linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/sun4i: tcon: Prepare and enable TCON channel 0 clock at init
@ 2019-01-31 13:25 Paul Kocialkowski
  2019-02-01 13:12 ` Maxime Ripard
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Kocialkowski @ 2019-01-31 13:25 UTC (permalink / raw)
  To: dri-devel, linux-arm-kernel, linux-kernel, linux-sunxi
  Cc: Maxime Ripard, David Airlie, Chen-Yu Tsai, Maxime Ripard,
	Paul Kocialkowski

When initializing clocks, a reference to the TCON channel 0 clock is
obtained. However, the clock is never prepared and enabled later.
Switching from simplefb to DRM actually disables the clock (that was
usually configured by U-Boot) because of that.

On the V3s, this results in a hang when writing to some mixer registers
when switching over to DRM from simplefb.

Fix this by preparing and enabling the clock when initializing other
clocks. Waiting for sun4i_tcon_channel_enable to enable the clock is
apparently too late and results in the same mixer register access hang.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index e987615c16f1..b31f5d95cadb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -371,6 +371,7 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 		dev_err(dev, "Couldn't get the TCON channel 0 clock\n");
 		return PTR_ERR(tcon->sclk0);
 	}
+	clk_prepare_enable(tcon->sclk0);
 
 	if (tcon->quirks->has_channel_1) {
 		tcon->sclk1 = devm_clk_get(dev, "tcon-ch1");
@@ -385,6 +386,7 @@ static int sun4i_tcon_init_clocks(struct device *dev,
 
 static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon)
 {
+	clk_disable_unprepare(tcon->sclk0);
 	clk_disable_unprepare(tcon->clk);
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/sun4i: tcon: Prepare and enable TCON channel 0 clock at init
  2019-01-31 13:25 [PATCH] drm/sun4i: tcon: Prepare and enable TCON channel 0 clock at init Paul Kocialkowski
@ 2019-02-01 13:12 ` Maxime Ripard
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2019-02-01 13:12 UTC (permalink / raw)
  To: Paul Kocialkowski
  Cc: dri-devel, linux-arm-kernel, linux-kernel, linux-sunxi,
	David Airlie, Chen-Yu Tsai

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

On Thu, Jan 31, 2019 at 02:25:50PM +0100, Paul Kocialkowski wrote:
> When initializing clocks, a reference to the TCON channel 0 clock is
> obtained. However, the clock is never prepared and enabled later.
> Switching from simplefb to DRM actually disables the clock (that was
> usually configured by U-Boot) because of that.
> 
> On the V3s, this results in a hang when writing to some mixer registers
> when switching over to DRM from simplefb.
> 
> Fix this by preparing and enabling the clock when initializing other
> clocks. Waiting for sun4i_tcon_channel_enable to enable the clock is
> apparently too late and results in the same mixer register access hang.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Applied, thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-01 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 13:25 [PATCH] drm/sun4i: tcon: Prepare and enable TCON channel 0 clock at init Paul Kocialkowski
2019-02-01 13:12 ` Maxime Ripard

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).