Skip to contentSkip to conversation

clk: sunxi-ng: sun6i-a31: Fix LCD CH0 and IEP clock mux widths

PATCH New Herman verschooten 1 participant 1 message Nov 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: sunxi-ng: sun6i-a31: Fix LCD CH0 and IEP clock mux widths

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
---
 drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/sunxi-ng/ccu-sun6i-a31.c +6 -6
index bab65cf..0884dc5 100644
@@ -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",
Signature · 1 line
2.56.1