linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi-ng: v3s: fix incorrect postdivider on pll-audio
@ 2021-05-13 13:13 Tobias Schramm
  2021-05-24 11:57 ` Maxime Ripard
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Schramm @ 2021-05-13 13:13 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai
  Cc: Jernej Skrabec, Michael Turquette, Stephen Boyd, linux-clk,
	linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

Commit 46060be6d840 ("clk: sunxi-ng: v3s: use sigma-delta modulation for audio-pll")
changed the audio pll on the Allwinner V3s and V3 SoCs to use
sigma-delta modulation. In the process the declaration of fixed postdivider
providing "pll-audio" was adjusted to provide the desired clock rates from
the now sigma-delta modulated pll.
However, while the divider used for calculations by the clock framework
was adjusted the actual divider programmed into the hardware in
sun8i_v3_v3s_ccu_init was left at "divide by four". This broke the
"pll-audio" clock, now only providing quater the expected clock rate.
It would in general be desirable to program the postdivider for
"pll-audio" to four, such that a broader range of frequencies were
available on the pll outputs. But the clock for the integrated codec
"ac-dig" does not feature a mux that allows to select from all pll outputs
as it is just a simple clock gate connected to "pll-audio". Thus we need
to set the postdivider to one to be able to provide the 22.5792MHz and
24.576MHz rates required by the internal sun4i codec.

This patches fixes the incorrect clock rate by forcing the postdivider to
one in sun8i_v3_v3s_ccu_init.

Fixes: 46060be6d840 ("clk: sunxi-ng: v3s: use sigma-delta modulation for audio-pll")
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
 drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
index a774942cb153..f49724a22540 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
@@ -817,10 +817,10 @@ static void __init sun8i_v3_v3s_ccu_init(struct device_node *node,
 		return;
 	}
 
-	/* Force the PLL-Audio-1x divider to 4 */
+	/* Force the PLL-Audio-1x divider to 1 */
 	val = readl(reg + SUN8I_V3S_PLL_AUDIO_REG);
 	val &= ~GENMASK(19, 16);
-	writel(val | (3 << 16), reg + SUN8I_V3S_PLL_AUDIO_REG);
+	writel(val, reg + SUN8I_V3S_PLL_AUDIO_REG);
 
 	sunxi_ccu_probe(node, reg, ccu_desc);
 }
-- 
2.30.1


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

* Re: [PATCH] clk: sunxi-ng: v3s: fix incorrect postdivider on pll-audio
  2021-05-13 13:13 [PATCH] clk: sunxi-ng: v3s: fix incorrect postdivider on pll-audio Tobias Schramm
@ 2021-05-24 11:57 ` Maxime Ripard
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2021-05-24 11:57 UTC (permalink / raw)
  To: Tobias Schramm
  Cc: Chen-Yu Tsai, Jernej Skrabec, Michael Turquette, Stephen Boyd,
	linux-clk, linux-arm-kernel, linux-sunxi, linux-kernel

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

On Thu, May 13, 2021 at 03:13:15PM +0200, Tobias Schramm wrote:
> Commit 46060be6d840 ("clk: sunxi-ng: v3s: use sigma-delta modulation for audio-pll")
> changed the audio pll on the Allwinner V3s and V3 SoCs to use
> sigma-delta modulation. In the process the declaration of fixed postdivider
> providing "pll-audio" was adjusted to provide the desired clock rates from
> the now sigma-delta modulated pll.
> However, while the divider used for calculations by the clock framework
> was adjusted the actual divider programmed into the hardware in
> sun8i_v3_v3s_ccu_init was left at "divide by four". This broke the
> "pll-audio" clock, now only providing quater the expected clock rate.
> It would in general be desirable to program the postdivider for
> "pll-audio" to four, such that a broader range of frequencies were
> available on the pll outputs. But the clock for the integrated codec
> "ac-dig" does not feature a mux that allows to select from all pll outputs
> as it is just a simple clock gate connected to "pll-audio". Thus we need
> to set the postdivider to one to be able to provide the 22.5792MHz and
> 24.576MHz rates required by the internal sun4i codec.
> 
> This patches fixes the incorrect clock rate by forcing the postdivider to
> one in sun8i_v3_v3s_ccu_init.
> 
> Fixes: 46060be6d840 ("clk: sunxi-ng: v3s: use sigma-delta modulation for audio-pll")
> Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>

Applied, thanks
Maxime

[-- 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:[~2021-05-24 11:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 13:13 [PATCH] clk: sunxi-ng: v3s: fix incorrect postdivider on pll-audio Tobias Schramm
2021-05-24 11:57 ` 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).