Skip to content

Commit 9202e2a

Browse files
njhollinghurstpopcornmix
authored andcommitted
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 <[email protected]>
1 parent 6c35f29 commit 9202e2a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/clk/clk-rp1.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1326,9 +1326,11 @@ static void rp1_clock_choose_div_and_prate(struct clk_hw *hw,
13261326
/*
13271327
* Prevent overclocks - if all parent choices result in
13281328
* a downstream clock in excess of the maximum, then the
1329-
* call to set the clock will fail.
1329+
* call to set the clock will fail. But due to round-to-
1330+
* nearest in the PLL core (which has 24 fractional bits),
1331+
* it's expedient to tolerate a tiny error (1Hz/33MHz).
13301332
*/
1331-
if (tmp > clock->data->max_freq)
1333+
if (tmp > clock->data->max_freq + (clock->data->max_freq >> 25))
13321334
*calc_rate = 0;
13331335
else
13341336
*calc_rate = tmp;
@@ -2006,7 +2008,7 @@ static const struct rp1_clk_desc clk_desc_array[] = {
20062008
[RP1_CLK_AUDIO_OUT] = REGISTER_CLK(
20072009
.name = "clk_audio_out",
20082010
.parents = {"", //"pll_audio",
2009-
"", //"pll_audio_sec",
2011+
"pll_audio_sec",
20102012
"pll_video_sec",
20112013
"xosc",
20122014
"clksrc_gp0",

0 commit comments

Comments
 (0)