Skip to content

Commit ca1170b

Browse files
Roman Beranekjernejsk
authored andcommitted
clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux
TCON0's source clock can be fed from either PLL_MIPI, or PLL_VIDEO0(2X), however MIPI DSI output only seems to work when PLL_MIPI is selected and thus the choice must be hardcoded in. Currently, this driver can't propagate rate change from N-K-M clocks (such as PLL_MIPI) upwards. This prevents PLL_VIDEO0 from participating in setting of the TCON0 data clock rate, limiting the precision with which a target pixel clock can be matched. For outputs with fixed TCON0 divider, that is DSI and LVDS, the dotclock can deviate up to 8% off target. Signed-off-by: Roman Beranek <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]> Acked-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jernej Skrabec <[email protected]>
1 parent ac9a786 commit ca1170b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/clk/sunxi-ng/ccu-sun50i-a64.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,18 @@ static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
528528
0x104, 0, 4, 24, 3, BIT(31),
529529
CLK_SET_RATE_PARENT);
530530

531+
/*
532+
* DSI output seems to work only when PLL_MIPI selected. Set it and prevent
533+
* the mux from reparenting.
534+
*/
535+
#define SUN50I_A64_TCON0_CLK_REG 0x118
536+
531537
static const char * const tcon0_parents[] = { "pll-mipi", "pll-video0-2x" };
532538
static const u8 tcon0_table[] = { 0, 2, };
533539
static SUNXI_CCU_MUX_TABLE_WITH_GATE(tcon0_clk, "tcon0", tcon0_parents,
534540
tcon0_table, 0x118, 24, 3, BIT(31),
535-
CLK_SET_RATE_PARENT);
541+
CLK_SET_RATE_PARENT |
542+
CLK_SET_RATE_NO_REPARENT);
536543

537544
static const char * const tcon1_parents[] = { "pll-video0", "pll-video1" };
538545
static const u8 tcon1_table[] = { 0, 2, };
@@ -953,6 +960,11 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev)
953960

954961
writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG);
955962

963+
/* Set PLL MIPI as parent for TCON0 */
964+
val = readl(reg + SUN50I_A64_TCON0_CLK_REG);
965+
val &= ~GENMASK(26, 24);
966+
writel(val | (0 << 24), reg + SUN50I_A64_TCON0_CLK_REG);
967+
956968
ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a64_ccu_desc);
957969
if (ret)
958970
return ret;

0 commit comments

Comments
 (0)