difos/target/linux/bcm27xx/patches-6.12/950-0808-clk-rp1-Allow-audio-out-to-use-PLL_AUDIO_SEC-workaro.patch
Álvaro Fernández Rojas 8f9e91ad03 bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-05-21 11:32:18 +02:00

41 lines
1.6 KiB
Diff

From 198ae80fecb40a9a99c6d301277c794f5e07548b Mon Sep 17 00:00:00 2001
From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Date: Tue, 11 Feb 2025 13:47:27 +0000
Subject: [PATCH] clk: rp1: Allow audio out to use PLL_AUDIO_SEC; workaround
rounding error
Connect PLL_AUDIO_SEC to CLK_AUDIO_OUT, which had been commented out
to avoid interference with I2S: we expect them never to be enabled
at the same time. Work around a rounding error that occurs when the
desired rate is exactly the max but not exactly achievable by the PLL.
Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
---
drivers/clk/clk-rp1.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/drivers/clk/clk-rp1.c
+++ b/drivers/clk/clk-rp1.c
@@ -1326,9 +1326,11 @@ static void rp1_clock_choose_div_and_pra
/*
* Prevent overclocks - if all parent choices result in
* a downstream clock in excess of the maximum, then the
- * call to set the clock will fail.
+ * call to set the clock will fail. But due to round-to-
+ * nearest in the PLL core (which has 24 fractional bits),
+ * it's expedient to tolerate a tiny error (1Hz/33MHz).
*/
- if (tmp > clock->data->max_freq)
+ if (tmp > clock->data->max_freq + (clock->data->max_freq >> 25))
*calc_rate = 0;
else
*calc_rate = tmp;
@@ -2006,7 +2008,7 @@ static const struct rp1_clk_desc clk_des
[RP1_CLK_AUDIO_OUT] = REGISTER_CLK(
.name = "clk_audio_out",
.parents = {"", //"pll_audio",
- "", //"pll_audio_sec",
+ "pll_audio_sec",
"pll_video_sec",
"xosc",
"clksrc_gp0",