linux-rockchip.lists.infradead.org archive mirror
 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: Algea Cao <algea.cao@rock-chips.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	Vinod Koul <vkoul@kernel.org>, Huicong Xu <xhc@rock-chips.com>,
	linux-arm-kernel@lists.infradead.org,
	Zheng Yang <zhengyang@rock-chips.com>
Subject: [PATCH v3 5/6] phy/rockchip: inno-hdmi: force set_rate on power_on
Date: Sat, 10 Oct 2020 15:32:20 +0000 (UTC)	[thread overview]
Message-ID: <20201010153214.19722-6-jonas@kwiboo.se> (raw)
In-Reply-To: <20201010153214.19722-1-jonas@kwiboo.se>

From: Huicong Xu <xhc@rock-chips.com>

Regular 8-bit and Deep Color video formats mainly differ in TMDS rate and
not in pixel clock rate.
When the hdmiphy clock is configured with the same pixel clock rate using
clk_set_rate() the clock framework do not signal the hdmi phy driver
to set_rate when switching between 8-bit and Deep Color.
This result in pre/post pll not being re-configured when switching between
regular 8-bit and Deep Color video formats.

Fix this by calling set_rate in power_on to force pre pll re-configuration.

Signed-off-by: Huicong Xu <xhc@rock-chips.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
index 3a59a6da0440..3719309ad0d0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
@@ -245,6 +245,7 @@ struct inno_hdmi_phy {
 	struct clk_hw hw;
 	struct clk *phyclk;
 	unsigned long pixclock;
+	unsigned long tmdsclock;
 };
 
 struct pre_pll_config {
@@ -485,6 +486,8 @@ static int inno_hdmi_phy_power_on(struct phy *phy)
 
 	dev_dbg(inno->dev, "Inno HDMI PHY Power On\n");
 
+	inno->plat_data->clk_ops->set_rate(&inno->hw, inno->pixclock, 24000000);
+
 	ret = clk_prepare_enable(inno->phyclk);
 	if (ret)
 		return ret;
@@ -509,6 +512,8 @@ static int inno_hdmi_phy_power_off(struct phy *phy)
 
 	clk_disable_unprepare(inno->phyclk);
 
+	inno->tmdsclock = 0;
+
 	dev_dbg(inno->dev, "Inno HDMI PHY Power Off\n");
 
 	return 0;
@@ -628,6 +633,9 @@ static int inno_hdmi_phy_rk3228_clk_set_rate(struct clk_hw *hw,
 	dev_dbg(inno->dev, "%s rate %lu tmdsclk %lu\n",
 		__func__, rate, tmdsclock);
 
+	if (inno->pixclock == rate && inno->tmdsclock == tmdsclock)
+		return 0;
+
 	cfg = inno_hdmi_phy_get_pre_pll_cfg(inno, rate);
 	if (IS_ERR(cfg))
 		return PTR_ERR(cfg);
@@ -670,6 +678,7 @@ static int inno_hdmi_phy_rk3228_clk_set_rate(struct clk_hw *hw,
 	}
 
 	inno->pixclock = rate;
+	inno->tmdsclock = tmdsclock;
 
 	return 0;
 }
@@ -781,6 +790,9 @@ static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw,
 	dev_dbg(inno->dev, "%s rate %lu tmdsclk %lu\n",
 		__func__, rate, tmdsclock);
 
+	if (inno->pixclock == rate && inno->tmdsclock == tmdsclock)
+		return 0;
+
 	cfg = inno_hdmi_phy_get_pre_pll_cfg(inno, rate);
 	if (IS_ERR(cfg))
 		return PTR_ERR(cfg);
@@ -820,6 +832,7 @@ static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw,
 	}
 
 	inno->pixclock = rate;
+	inno->tmdsclock = tmdsclock;
 
 	return 0;
 }
-- 
2.17.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

      parent reply	other threads:[~2020-10-10 15:32 UTC|newest]

Thread overview: 26+ 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 ` [PATCH v2 01/14] phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328 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 ` [PATCH v2 02/14] phy/rockchip: inno-hdmi: round fractal pixclock in " 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 ` [PATCH v2 06/14] drm/rockchip: dw-hdmi: allow high tmds bit rates 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 ` [PATCH v2 08/14] clk: rockchip: set parent rate for DCLK_VOP clock on rk3228 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 ` [PATCH v2 10/14] arm64: dts: rockchip: add vpll clock to hdmi node on rk3328 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 ` [PATCH v2 09/14] arm64: dts: rockchip: increase vop clock rate on rk3328 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 ` [PATCH v2 13/14] drm/rockchip: dw-hdmi: remove unused plat_data " Jonas Karlman
2020-01-08 21:07 ` [PATCH v2 14/14] phy/rockchip: inno-hdmi: Support more pre-pll configuration Jonas Karlman
2020-07-07 19:53   ` Johan Jonker
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
     [not found]   ` <b159ee28-213e-35d2-6d09-516abc3358bb-l0cyMroinI0@public.gmane.org>
2020-01-10 16:56     ` Jonas Karlman
2020-10-10 15:32 ` [PATCH v3 0/6] " 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   ` [PATCH v3 2/6] phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate 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   ` [PATCH v3 3/6] phy/rockchip: inno-hdmi: remove unused no_c from rk3328 recalc_rate 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 [this message]

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=20201010153214.19722-6-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).