Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi-ng: sun6i-a31: Fix LCD CH0 and IEP clock mux widths
@ 2026-11-20 15:37 Herman verschooten
  0 siblings, 0 replies; only message in thread
From: Herman verschooten @ 2026-11-20 15:37 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stephen Boyd
  Cc: Jernej Skrabec, Samuel Holland, Brian Masney, Jerome Brunet,
	linux-clk, linux-arm-kernel, linux-sunxi, linux-kernel,
	Herman verschooten

The source select fields of the LCD0/LCD1 CH0 clocks and the IEP DRC0,
DRC1, DEU0 and DEU1 clocks are 3 bits wide (bits 26:24), like those of
the BE, FE and MP clocks, but they are described as 2 bits wide. The LCD
CH0 clocks have 5 possible parents and the IEP clocks 6 (the same
de_parents as BE/FE/MP), so pll-mipi, pll9 and pll10 can never be
selected. Worse, if the bootloader left bit 26 set, Linux keeps it when
it reparents these clocks, and the register ends up selecting a
different or reserved source.

This happens on a Modecom FreeTab 8014 tablet, whose vendor bootloader
shows its boot logo on the LVDS panel and leaves bit 26 set in both the
LCD0 CH0 and the IEP DRC0 clock registers. Linux reparents them to
pll-video0-2x and pll-periph-2x by writing only bits 25:24, leaving both
registers at the reserved value 0b110: the TCON gets no clock and never
raises a vblank interrupt (drm_atomic_helper_wait_for_vblanks() times
out, the panel stays dark), and once the TCON clock is fixed by hand,
the unclocked DRC0 makes the panel show a flat colour instead of the
picture. When the same kernel is started over FEL, where these registers
start at zero, the display works.

Describe these muxes as 3 bits wide.

Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks")
Assisted-by: claude-opus-5-5
Signed-off-by: Herman verschooten <Herman@octarion.eu>
---
 drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
index bab65cf..0884dc5 100644
--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
+++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
@@ -551,9 +551,9 @@ static const char * const lcd_ch0_parents[] = { "pll-video0", "pll-video1",
 						"pll-video0-2x",
 						"pll-video1-2x", "pll-mipi" };
 static SUNXI_CCU_MUX_WITH_GATE(lcd0_ch0_clk, "lcd0-ch0", lcd_ch0_parents,
-			       0x118, 24, 2, BIT(31), CLK_SET_RATE_PARENT);
+			       0x118, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
 static SUNXI_CCU_MUX_WITH_GATE(lcd1_ch0_clk, "lcd1-ch0", lcd_ch0_parents,
-			       0x11c, 24, 2, BIT(31), CLK_SET_RATE_PARENT);
+			       0x11c, 24, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const lcd_ch1_parents[] = { "pll-video0", "pll-video1",
 						"pll-video0-2x",
@@ -645,13 +645,13 @@ static SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_dphy_clk, "mipi-csi-dphy",
 				 BIT(15), 0);
 
 static SUNXI_CCU_M_WITH_MUX_GATE(iep_drc0_clk, "iep-drc0", de_parents,
-				 0x180, 0, 3, 24, 2, BIT(31), 0);
+				 0x180, 0, 3, 24, 3, BIT(31), 0);
 static SUNXI_CCU_M_WITH_MUX_GATE(iep_drc1_clk, "iep-drc1", de_parents,
-				 0x184, 0, 3, 24, 2, BIT(31), 0);
+				 0x184, 0, 3, 24, 3, BIT(31), 0);
 static SUNXI_CCU_M_WITH_MUX_GATE(iep_deu0_clk, "iep-deu0", de_parents,
-				 0x188, 0, 3, 24, 2, BIT(31), 0);
+				 0x188, 0, 3, 24, 3, BIT(31), 0);
 static SUNXI_CCU_M_WITH_MUX_GATE(iep_deu1_clk, "iep-deu1", de_parents,
-				 0x18c, 0, 3, 24, 2, BIT(31), 0);
+				 0x18c, 0, 3, 24, 3, BIT(31), 0);
 
 static const char * const gpu_parents[] = { "pll-gpu", "pll-periph-2x",
 					    "pll-video0", "pll-video1",
-- 
2.56.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-20 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 15:37 [PATCH] clk: sunxi-ng: sun6i-a31: Fix LCD CH0 and IEP clock mux widths Herman verschooten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox