Skip to contentSkip to conversation

clk: sunxi-ng: h6: Keep both parents running while switching VP9 clock

PATCH Applied Jernej Skrabec 2 participants 2 messages Nov 10 – Nov 15

Subsystems (2)
lore
Share & tools
lore

Jernej Skrabec

author maintainer
#0 lore raw

PATCH 1/1 clk: sunxi-ng: h6: Keep both parents running while switching VP9 clock

The VP9 clock mux only switches while both parents are running. Its reset default parent is pll-ve, which is off at boot. When the Hantro driver sets the clock rate to 300 MHz, the clock gets reparented to pll-periph0-2x, but the mux doesn't actually switch until pll-ve is enabled for the video engine. Until then, the VP9 decoder has no clock and every frame times out.

Set CLK_OPS_PARENT_ENABLE, so both parents are enabled during the switch.

Fixes 524353ea480b ("clk: sunxi-ng: add support for the Allwinner H6 CCU")
---
 drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-h6.c +6 -1
index 7fccda96d444..a10f0502c5c1 100644
@@ -336,12 +336,17 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(emce_clk, "emce", ce_parents, 0x6b0,
 static SUNXI_CCU_GATE(bus_emce_clk, "bus-emce", "psi-ahb1-ahb2",
 		      0x6bc, BIT(0), 0);
 
+/*
+ * The mux only switches while both parents run. pll-ve is off at boot, so
+ * moving the clock away from it would otherwise leave the VP9 decoder
+ * without a clock until pll-ve gets enabled for the video engine.
+ */
 static const char * const vp9_parents[] = { "pll-ve", "pll-periph0-2x" };
 static SUNXI_CCU_M_WITH_MUX_GATE(vp9_clk, "vp9", vp9_parents, 0x6c0,
 				       0, 3,	/* M */
 				       24, 1,	/* mux */
 				       BIT(31),	/* gate */
-				       0);
+				       CLK_OPS_PARENT_ENABLE);
 
 static SUNXI_CCU_GATE(bus_vp9_clk, "bus-vp9", "psi-ahb1-ahb2",
 		      0x6cc, BIT(0), 0);
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Jernej Skrabec

The VP9 clock mux only switches while both parents are running. Its reset default parent is pll-ve, which is off at boot. When the Hantro driver sets the clock rate to 300 MHz, the clock gets reparented to pll-periph0-2x, but the mux doesn't actually switch until pll-ve is enabled for the video engine. Until then, the VP9 decoder has no clock and every frame times out.

[...]

Applied to sunxi/clk-for-7.5 in sunxi, thanks!

[1/1] clk: sunxi-ng: h6: Keep both parents running while switching VP9 clock

      https://git.kernel.org/sunxi/linux/c/b6844de23cd2

Best regards,

Signature · 1 line
Chen-Yu Tsai <[email protected]>