Skip to content

Commit 5e5a8b5

Browse files
njhollinghurstpelwell
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 03314cd commit 5e5a8b5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/clk/clk-rp1.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,9 +1083,11 @@ static void rp1_clock_choose_div_and_prate(struct clk_hw *hw,
10831083
/*
10841084
* Prevent overclocks - if all parent choices result in
10851085
* a downstream clock in excess of the maximum, then the
1086-
* call to set the clock will fail.
1086+
* call to set the clock will fail. But due to round-to-
1087+
* nearest in the PLL core (which has 24 fractional bits),
1088+
* it's expedient to tolerate a tiny error (1Hz/33MHz).
10871089
*/
1088-
if (tmp > data->max_freq)
1090+
if (tmp > data->max_freq + (data->max_freq >> 25))
10891091
*calc_rate = 0;
10901092
else
10911093
*calc_rate = tmp;
@@ -1738,7 +1740,7 @@ static struct rp1_clk_desc clk_audio_in_desc = REGISTER_CLK(
17381740

17391741
static const struct clk_parent_data clk_audio_out_parents[] = {
17401742
{ .index = -1 },
1741-
{ .index = -1 },
1743+
{ .hw = &pll_audio_sec_desc.hw },
17421744
{ .hw = &pll_video_sec_desc.hw },
17431745
{ .index = 0 },
17441746
};

0 commit comments

Comments
 (0)