* [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization
@ 2019-05-14 20:43 Jernej Skrabec
2019-05-14 20:43 ` [PATCH 1/2] drm/sun4i: Fix sun8i HDMI PHY clock initialization Jernej Skrabec
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jernej Skrabec @ 2019-05-14 20:43 UTC (permalink / raw)
To: maxime.ripard, wens
Cc: airlied, linux-kernel, dri-devel, linux-sunxi, daniel,
linux-arm-kernel
I received a report that 4K resolution doesn't work if U-Boot video
driver is disabled. It turns out that HDMI PHY clock driver was
initialized prematurely, before reset line was deasserted and clocks
enabled. U-Boot video driver masked the issue because it set pixel
clock correctly.
In the process of researching the bug, I also found out that few bits
in HDMI PHY registers were not set correctly. While there is no
noticeable change (4K resolution works with both settings), I've
added fix anyway, to be conformant with vendor documentation.
Please check it out.
Best regards,
Jernej
Jernej Skrabec (2):
drm/sun4i: Fix sun8i HDMI PHY clock initialization
drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 29 ++++++++++++++------------
1 file changed, 16 insertions(+), 13 deletions(-)
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] drm/sun4i: Fix sun8i HDMI PHY clock initialization
2019-05-14 20:43 [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Jernej Skrabec
@ 2019-05-14 20:43 ` Jernej Skrabec
2019-05-14 20:43 ` [PATCH 2/2] drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz Jernej Skrabec
2019-05-16 8:31 ` [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Maxime Ripard
2 siblings, 0 replies; 4+ messages in thread
From: Jernej Skrabec @ 2019-05-14 20:43 UTC (permalink / raw)
To: maxime.ripard, wens
Cc: airlied, linux-kernel, dri-devel, linux-sunxi, stable, daniel,
linux-arm-kernel
Current code initializes HDMI PHY clock driver before reset line is
deasserted and clocks enabled. Because of that, initial readout of
clock divider is incorrect (0 instead of 2). This causes any clock
rate with divider 1 (register value 0) to be set incorrectly.
Fix this by moving initialization of HDMI PHY clock driver after reset
line is deasserted and clocks enabled.
Cc: stable@vger.kernel.org # 4.17+
Fixes: 4f86e81748fe ("drm/sun4i: Add support for H3 HDMI PHY variant")
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index 66ea3a902e36..afc6d4a9c20b 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -672,22 +672,13 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
goto err_put_clk_pll0;
}
}
-
- ret = sun8i_phy_clk_create(phy, dev,
- phy->variant->has_second_pll);
- if (ret) {
- dev_err(dev, "Couldn't create the PHY clock\n");
- goto err_put_clk_pll1;
- }
-
- clk_prepare_enable(phy->clk_phy);
}
phy->rst_phy = of_reset_control_get_shared(node, "phy");
if (IS_ERR(phy->rst_phy)) {
dev_err(dev, "Could not get phy reset control\n");
ret = PTR_ERR(phy->rst_phy);
- goto err_disable_clk_phy;
+ goto err_put_clk_pll1;
}
ret = reset_control_deassert(phy->rst_phy);
@@ -708,18 +699,29 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
goto err_disable_clk_bus;
}
+ if (phy->variant->has_phy_clk) {
+ ret = sun8i_phy_clk_create(phy, dev,
+ phy->variant->has_second_pll);
+ if (ret) {
+ dev_err(dev, "Couldn't create the PHY clock\n");
+ goto err_disable_clk_mod;
+ }
+
+ clk_prepare_enable(phy->clk_phy);
+ }
+
hdmi->phy = phy;
return 0;
+err_disable_clk_mod:
+ clk_disable_unprepare(phy->clk_mod);
err_disable_clk_bus:
clk_disable_unprepare(phy->clk_bus);
err_deassert_rst_phy:
reset_control_assert(phy->rst_phy);
err_put_rst_phy:
reset_control_put(phy->rst_phy);
-err_disable_clk_phy:
- clk_disable_unprepare(phy->clk_phy);
err_put_clk_pll1:
clk_put(phy->clk_pll1);
err_put_clk_pll0:
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz
2019-05-14 20:43 [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Jernej Skrabec
2019-05-14 20:43 ` [PATCH 1/2] drm/sun4i: Fix sun8i HDMI PHY clock initialization Jernej Skrabec
@ 2019-05-14 20:43 ` Jernej Skrabec
2019-05-16 8:31 ` [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Maxime Ripard
2 siblings, 0 replies; 4+ messages in thread
From: Jernej Skrabec @ 2019-05-14 20:43 UTC (permalink / raw)
To: maxime.ripard, wens
Cc: airlied, linux-kernel, dri-devel, linux-sunxi, stable, daniel,
linux-arm-kernel
Vendor provided documentation says that EMP bits should be set to 3 for
pixel clocks greater than 148.5 MHz.
Fix that.
Cc: stable@vger.kernel.org # 4.17+
Fixes: 4f86e81748fe ("drm/sun4i: Add support for H3 HDMI PHY variant")
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index afc6d4a9c20b..43643ad31730 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -293,7 +293,8 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi,
SUN8I_HDMI_PHY_ANA_CFG2_REG_BIGSW |
SUN8I_HDMI_PHY_ANA_CFG2_REG_SLV(4);
ana_cfg3_init |= SUN8I_HDMI_PHY_ANA_CFG3_REG_AMPCK(9) |
- SUN8I_HDMI_PHY_ANA_CFG3_REG_AMP(13);
+ SUN8I_HDMI_PHY_ANA_CFG3_REG_AMP(13) |
+ SUN8I_HDMI_PHY_ANA_CFG3_REG_EMP(3);
}
regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG,
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization
2019-05-14 20:43 [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Jernej Skrabec
2019-05-14 20:43 ` [PATCH 1/2] drm/sun4i: Fix sun8i HDMI PHY clock initialization Jernej Skrabec
2019-05-14 20:43 ` [PATCH 2/2] drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz Jernej Skrabec
@ 2019-05-16 8:31 ` Maxime Ripard
2 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2019-05-16 8:31 UTC (permalink / raw)
To: Jernej Skrabec
Cc: airlied, linux-sunxi, linux-kernel, dri-devel, wens, daniel,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 745 bytes --]
On Tue, May 14, 2019 at 10:43:35PM +0200, Jernej Skrabec wrote:
> I received a report that 4K resolution doesn't work if U-Boot video
> driver is disabled. It turns out that HDMI PHY clock driver was
> initialized prematurely, before reset line was deasserted and clocks
> enabled. U-Boot video driver masked the issue because it set pixel
> clock correctly.
>
> In the process of researching the bug, I also found out that few bits
> in HDMI PHY registers were not set correctly. While there is no
> noticeable change (4K resolution works with both settings), I've
> added fix anyway, to be conformant with vendor documentation.
Applied both, thanks
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-16 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-14 20:43 [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Jernej Skrabec
2019-05-14 20:43 ` [PATCH 1/2] drm/sun4i: Fix sun8i HDMI PHY clock initialization Jernej Skrabec
2019-05-14 20:43 ` [PATCH 2/2] drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz Jernej Skrabec
2019-05-16 8:31 ` [PATCH 0/2] drm/sun4i: Fix sun8i HDMI PHY initialization Maxime Ripard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox