All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Karlman <jonas@kwiboo.se>
To: Kishon Vijay Abraham I <kishon@ti.com>, Heiko Stuebner <heiko@sntech.de>
Cc: Jonas Karlman <jonas@kwiboo.se>, Vinod Koul <vkoul@kernel.org>,
	Zheng Yang <zhengyang@rock-chips.com>,
	Algea Cao <algea.cao@rock-chips.com>,
	Huicong Xu <xhc@rock-chips.com>,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 6/6] phy/rockchip: inno-hdmi: Support more pre-pll configuration
Date: Tue, 22 Sep 2020 20:59:42 +0000 (UTC)	[thread overview]
Message-ID: <20200922205933.5540-7-jonas@kwiboo.se> (raw)
In-Reply-To: <20200922205933.5540-1-jonas@kwiboo.se>

From: Algea Cao <algea.cao@rock-chips.com>

Adding the following freq cfg in 8-bit and 10-bit color depth:

{
  40000000,  65000000,  71000000,  83500000, 85750000,
  88750000, 108000000, 119000000, 162000000
}

New freq has been validated by quantumdata 980.

For some freq which can't be got by only using integer freq div,
frac freq div is needed, Such as 88.75Mhz 10-bit. But The actual
freq is different from the target freq, We must try to narrow
the gap between them. RK322X only support integer freq div.

The VCO of pre-PLL must be more than 2Ghz, otherwise PLL may be
unlocked.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Acked-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 74 ++++++++++++-------
 1 file changed, 49 insertions(+), 25 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
index 3719309ad0d0..bb8bdf5e3301 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
@@ -291,32 +291,56 @@ struct inno_hdmi_phy_drv_data {
 	const struct phy_config		*phy_cfg_table;
 };
 
+/*
+ * If only using integer freq div can't get frequency we want, frac
+ * freq div is needed. For example, pclk 88.75 Mhz and tmdsclk
+ * 110.9375 Mhz must use frac div 0xF00000. The actual frequency is different
+ * from the target frequency. Such as the tmds clock 110.9375 Mhz,
+ * the actual tmds clock we get is 110.93719 Mhz. It is important
+ * to note that RK322X platforms do not support frac div.
+ */
 static const struct pre_pll_config pre_pll_cfg_table[] = {
-	{ 27000000,  27000000, 1,  90, 3, 2, 2, 10, 3, 3, 4, 0, 0},
-	{ 27000000,  33750000, 1,  90, 1, 3, 3, 10, 3, 3, 4, 0, 0},
-	{ 40000000,  40000000, 1,  80, 2, 2, 2, 12, 2, 2, 2, 0, 0},
-	{ 59341000,  59341000, 1,  98, 3, 1, 2,  1, 3, 3, 4, 0, 0xE6AE6B},
-	{ 59400000,  59400000, 1,  99, 3, 1, 1,  1, 3, 3, 4, 0, 0},
-	{ 59341000,  74176250, 1,  98, 0, 3, 3,  1, 3, 3, 4, 0, 0xE6AE6B},
-	{ 59400000,  74250000, 1,  99, 1, 2, 2,  1, 3, 3, 4, 0, 0},
-	{ 74176000,  74176000, 1,  98, 1, 2, 2,  1, 2, 3, 4, 0, 0xE6AE6B},
-	{ 74250000,  74250000, 1,  99, 1, 2, 2,  1, 2, 3, 4, 0, 0},
-	{ 74176000,  92720000, 4, 494, 1, 2, 2,  1, 3, 3, 4, 0, 0x816817},
-	{ 74250000,  92812500, 4, 495, 1, 2, 2,  1, 3, 3, 4, 0, 0},
-	{148352000, 148352000, 1,  98, 1, 1, 1,  1, 2, 2, 2, 0, 0xE6AE6B},
-	{148500000, 148500000, 1,  99, 1, 1, 1,  1, 2, 2, 2, 0, 0},
-	{148352000, 185440000, 4, 494, 0, 2, 2,  1, 3, 2, 2, 0, 0x816817},
-	{148500000, 185625000, 4, 495, 0, 2, 2,  1, 3, 2, 2, 0, 0},
-	{296703000, 296703000, 1,  98, 0, 1, 1,  1, 0, 2, 2, 0, 0xE6AE6B},
-	{297000000, 297000000, 1,  99, 0, 1, 1,  1, 0, 2, 2, 0, 0},
-	{296703000, 370878750, 4, 494, 1, 2, 0,  1, 3, 1, 1, 0, 0x816817},
-	{297000000, 371250000, 4, 495, 1, 2, 0,  1, 3, 1, 1, 0, 0},
-	{593407000, 296703500, 1,  98, 0, 1, 1,  1, 0, 2, 1, 0, 0xE6AE6B},
-	{594000000, 297000000, 1,  99, 0, 1, 1,  1, 0, 2, 1, 0, 0},
-	{593407000, 370879375, 4, 494, 1, 2, 0,  1, 3, 1, 1, 1, 0x816817},
-	{594000000, 371250000, 4, 495, 1, 2, 0,  1, 3, 1, 1, 1, 0},
-	{593407000, 593407000, 1,  98, 0, 2, 0,  1, 0, 1, 1, 0, 0xE6AE6B},
-	{594000000, 594000000, 1,  99, 0, 2, 0,  1, 0, 1, 1, 0, 0},
+	{ 27000000,  27000000, 1,  90, 3, 2, 2, 10, 3, 3,  4, 0, 0},
+	{ 27000000,  33750000, 1,  90, 1, 3, 3, 10, 3, 3,  4, 0, 0},
+	{ 40000000,  40000000, 1,  80, 2, 2, 2, 12, 2, 2,  2, 0, 0},
+	{ 40000000,  50000000, 1, 100, 2, 2, 2,  1, 0, 0, 15, 0, 0},
+	{ 59341000,  59341000, 1,  98, 3, 1, 2,  1, 3, 3,  4, 0, 0xE6AE6B},
+	{ 59400000,  59400000, 1,  99, 3, 1, 1,  1, 3, 3,  4, 0, 0},
+	{ 59341000,  74176250, 1,  98, 0, 3, 3,  1, 3, 3,  4, 0, 0xE6AE6B},
+	{ 59400000,  74250000, 1,  99, 1, 2, 2,  1, 3, 3,  4, 0, 0},
+	{ 65000000,  65000000, 1, 130, 2, 2, 2,  1, 0, 0, 12, 0, 0},
+	{ 65000000,  81250000, 3, 325, 0, 3, 3,  1, 0, 0, 10, 0, 0},
+	{ 71000000,  71000000, 3, 284, 0, 3, 3,  1, 0, 0,  8, 0, 0},
+	{ 71000000,  88750000, 3, 355, 0, 3, 3,  1, 0, 0, 10, 0, 0},
+	{ 74176000,  74176000, 1,  98, 1, 2, 2,  1, 2, 3,  4, 0, 0xE6AE6B},
+	{ 74250000,  74250000, 1,  99, 1, 2, 2,  1, 2, 3,  4, 0, 0},
+	{ 74176000,  92720000, 4, 494, 1, 2, 2,  1, 3, 3,  4, 0, 0x816817},
+	{ 74250000,  92812500, 4, 495, 1, 2, 2,  1, 3, 3,  4, 0, 0},
+	{ 83500000,  83500000, 2, 167, 2, 1, 1,  1, 0, 0,  6, 0, 0},
+	{ 83500000, 104375000, 1, 104, 2, 1, 1,  1, 1, 0,  5, 0, 0x600000},
+	{ 85750000,  85750000, 3, 343, 0, 3, 3,  1, 0, 0,  8, 0, 0},
+	{ 88750000,  88750000, 3, 355, 0, 3, 3,  1, 0, 0,  8, 0, 0},
+	{ 88750000, 110937500, 1, 110, 2, 1, 1,  1, 1, 0,  5, 0, 0xF00000},
+	{108000000, 108000000, 1,  90, 3, 0, 0,  1, 0, 0,  5, 0, 0},
+	{108000000, 135000000, 1,  90, 0, 2, 2,  1, 0, 0,  5, 0, 0},
+	{119000000, 119000000, 1, 119, 2, 1, 1,  1, 0, 0,  6, 0, 0},
+	{119000000, 148750000, 1,  99, 0, 2, 2,  1, 0, 0,  5, 0, 0x2AAAAA},
+	{148352000, 148352000, 1,  98, 1, 1, 1,  1, 2, 2,  2, 0, 0xE6AE6B},
+	{148500000, 148500000, 1,  99, 1, 1, 1,  1, 2, 2,  2, 0, 0},
+	{148352000, 185440000, 4, 494, 0, 2, 2,  1, 3, 2,  2, 0, 0x816817},
+	{148500000, 185625000, 4, 495, 0, 2, 2,  1, 3, 2,  2, 0, 0},
+	{162000000, 162000000, 1, 108, 0, 2, 2,  1, 0, 0,  4, 0, 0},
+	{162000000, 202500000, 1, 135, 0, 2, 2,  1, 0, 0,  5, 0, 0},
+	{296703000, 296703000, 1,  98, 0, 1, 1,  1, 0, 2,  2, 0, 0xE6AE6B},
+	{297000000, 297000000, 1,  99, 0, 1, 1,  1, 0, 2,  2, 0, 0},
+	{296703000, 370878750, 4, 494, 1, 2, 0,  1, 3, 1,  1, 0, 0x816817},
+	{297000000, 371250000, 4, 495, 1, 2, 0,  1, 3, 1,  1, 0, 0},
+	{593407000, 296703500, 1,  98, 0, 1, 1,  1, 0, 2,  1, 0, 0xE6AE6B},
+	{594000000, 297000000, 1,  99, 0, 1, 1,  1, 0, 2,  1, 0, 0},
+	{593407000, 370879375, 4, 494, 1, 2, 0,  1, 3, 1,  1, 1, 0x816817},
+	{594000000, 371250000, 4, 495, 1, 2, 0,  1, 3, 1,  1, 1, 0},
+	{593407000, 593407000, 1,  98, 0, 2, 0,  1, 0, 1,  1, 0, 0xE6AE6B},
+	{594000000, 594000000, 1,  99, 0, 2, 0,  1, 0, 1,  1, 0, 0},
 	{ /* sentinel */ }
 };
 
-- 
2.17.1


  parent reply	other threads:[~2020-09-22 21:04 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 21:07 [PATCH v2 00/14] Support more HDMI modes on RK3228/RK3328 Jonas Karlman
2020-01-08 21:07 ` Jonas Karlman
2020-01-08 21:07 ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 01/14] phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 03/14] phy/rockchip: inno-hdmi: remove unused no_c from rk3328 recalc_rate Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 02/14] phy/rockchip: inno-hdmi: round fractal pixclock in " Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 04/14] phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 06/14] drm/rockchip: dw-hdmi: allow high tmds bit rates Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 05/14] phy/rockchip: inno-hdmi: force set_rate on power_on Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 08/14] clk: rockchip: set parent rate for DCLK_VOP clock on rk3228 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 07/14] drm/rockchip: dw-hdmi: require valid vpll clock rate on rk3228/rk3328 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 10/14] arm64: dts: rockchip: add vpll clock to hdmi node on rk3328 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 11/14] ARM: dts: rockchip: add vpll clock to hdmi node on rk3228 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 09/14] arm64: dts: rockchip: increase vop clock rate on rk3328 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 12/14] drm/rockchip: dw-hdmi: limit tmds to 340mhz on rk3228/rk3328 Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 13/14] drm/rockchip: dw-hdmi: remove unused plat_data " Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 14/14] phy/rockchip: inno-hdmi: Support more pre-pll configuration Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-01-08 21:07   ` Jonas Karlman
2020-07-07 19:53   ` Johan Jonker
2020-07-07 19:53     ` Johan Jonker
2020-07-07 19:53     ` Johan Jonker
2020-07-07 21:05     ` Jonas Karlman
2020-07-07 21:05       ` Jonas Karlman
2020-07-07 21:05       ` Jonas Karlman
2020-01-10 11:01 ` [PATCH v2 00/14] Support more HDMI modes on RK3228/RK3328 Kishon Vijay Abraham I
2020-01-10 11:01   ` Kishon Vijay Abraham I
2020-01-10 11:01   ` Kishon Vijay Abraham I
2020-01-10 11:01   ` Kishon Vijay Abraham I
2020-01-10 16:56   ` Jonas Karlman
2020-01-10 16:56     ` Jonas Karlman
2020-01-10 16:56     ` Jonas Karlman
2020-01-10 16:56     ` Jonas Karlman
2020-09-22 20:59 ` [PATCH v3 0/6] " Jonas Karlman
2020-09-22 20:59   ` [PATCH v3 1/6] phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328 Jonas Karlman
2020-09-22 20:59   ` [PATCH v3 2/6] phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate Jonas Karlman
2020-09-22 20:59   ` [PATCH v3 3/6] phy/rockchip: inno-hdmi: remove unused no_c from " Jonas Karlman
2020-09-22 20:59   ` [PATCH v3 4/6] phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write Jonas Karlman
2020-09-22 20:59   ` Jonas Karlman [this message]
2020-09-22 20:59   ` [PATCH v3 5/6] phy/rockchip: inno-hdmi: force set_rate on power_on Jonas Karlman
2020-10-10 15:32 ` [PATCH v3 0/6] Support more HDMI modes on RK3228/RK3328 Jonas Karlman
2020-10-10 15:32   ` Jonas Karlman
2020-10-10 15:32   ` Jonas Karlman
2020-10-10 15:32   ` [PATCH v3 1/6] phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328 Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32   ` [PATCH v3 2/6] phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32   ` [PATCH v3 4/6] phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32   ` [PATCH v3 3/6] phy/rockchip: inno-hdmi: remove unused no_c from rk3328 recalc_rate Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32   ` [PATCH v3 6/6] phy/rockchip: inno-hdmi: Support more pre-pll configuration Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32   ` [PATCH v3 5/6] phy/rockchip: inno-hdmi: force set_rate on power_on Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman
2020-10-10 15:32     ` Jonas Karlman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922205933.5540-7-jonas@kwiboo.se \
    --to=jonas@kwiboo.se \
    --cc=algea.cao@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=vkoul@kernel.org \
    --cc=xhc@rock-chips.com \
    --cc=zhengyang@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.