Skip to content

Commit d05afb5

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: wm8940: Correct PLL rate rounding
Using a single value of 22500000 for both 48000Hz and 44100Hz audio will sometimes result in returning wrong dividers due to rounding. Update the code to use the actual value for both. Fixes: 294833f ("ASoC: wm8940: Rewrite code to set proper clocks") Reported-by: Ankur Tyagi <ankur.tyagi85@gmail.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Tested-by: Ankur Tyagi <ankur.tyagi85@gmail.com> Link: https://patch.msgid.link/20250821082639.1301453-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b320789 commit d05afb5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sound/soc/codecs/wm8940.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,12 @@ static int wm8940_update_clocks(struct snd_soc_dai *dai)
693693
f = wm8940_get_mclkdiv(priv->mclk, fs256, &mclkdiv);
694694
if (f != priv->mclk) {
695695
/* The PLL performs best around 90MHz */
696-
fpll = wm8940_get_mclkdiv(22500000, fs256, &mclkdiv);
696+
if (fs256 % 8000)
697+
f = 22579200;
698+
else
699+
f = 24576000;
700+
701+
fpll = wm8940_get_mclkdiv(f, fs256, &mclkdiv);
697702
}
698703

699704
wm8940_set_dai_pll(dai, 0, 0, priv->mclk, fpll);

0 commit comments

Comments
 (0)