Skip to contentSkip to conversation

Minor bug fixes for some older Wolfson devices

PATCH Superseded Charles Keepax 1 participant 4 messages Aug 21, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Minor bug fixes for some older Wolfson devices

Minor bug fixes for a couple of older devices reported by some users. Mostly this centers around the automatic PLL configuration getting the wrong values due to rounding.

Thanks,
Charles

Charles Keepax (3):
ASoC: wm8940: Correct PLL rate rounding
ASoC: wm8940: Correct typo in control name
ASoC: wm8974: Correct PLL rate rounding

 sound/soc/codecs/wm8940.c | 9 +++++++--
 sound/soc/codecs/wm8974.c | 8 ++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)
Signature · 1 line
2.47.2
#1 lore raw

PATCH 1/3 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 294833fc9eb4 ("ASoC: wm8940: Rewrite code to set proper clocks")
---
 sound/soc/codecs/wm8940.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/wm8940.c +6 -1
index 401ee20897b1b..46c16c9bc17a8 100644
@@ -693,7 +693,12 @@ static int wm8940_update_clocks(struct snd_soc_dai *dai)
 	f = wm8940_get_mclkdiv(priv->mclk, fs256, &mclkdiv);
 	if (f != priv->mclk) {
 		/* The PLL performs best around 90MHz */
-		fpll = wm8940_get_mclkdiv(22500000, fs256, &mclkdiv);
+		if (fs256 % 8000)
+			f = 22579200;
+		else
+			f = 24576000;
+
+		fpll = wm8940_get_mclkdiv(f, fs256, &mclkdiv);
 	}
 
 	wm8940_set_dai_pll(dai, 0, 0, priv->mclk, fpll);
Signature · 1 line
2.47.2
#2 lore raw

PATCH 2/3 ASoC: wm8940: Correct typo in control name

In reply to Charles Keepax
Fixes 0b5e92c5e020 ("ASoC WM8940 Driver")
---
 sound/soc/codecs/wm8940.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8940.c +1 -1
index 46c16c9bc17a8..94873ea630146 100644
@@ -220,7 +220,7 @@ static const struct snd_kcontrol_new wm8940_snd_controls[] = {
 	SOC_SINGLE_TLV("Digital Capture Volume", WM8940_ADCVOL,
 		       0, 255, 0, wm8940_adc_tlv),
 	SOC_ENUM("Mic Bias Level", wm8940_mic_bias_level_enum),
-	SOC_SINGLE_TLV("Capture Boost Volue", WM8940_ADCBOOST,
+	SOC_SINGLE_TLV("Capture Boost Volume", WM8940_ADCBOOST,
 		       8, 1, 0, wm8940_capture_boost_vol_tlv),
 	SOC_SINGLE_TLV("Speaker Playback Volume", WM8940_SPKVOL,
 		       0, 63, 0, wm8940_spk_vol_tlv),
Signature · 1 line
2.47.2
#3 lore raw

PATCH 3/3 ASoC: wm8974: Correct PLL rate rounding

In reply to Charles Keepax

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 51b2bb3f2568 ("ASoC: wm8974: configure pll and mclk divider automatically")
---
 sound/soc/codecs/wm8974.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8974.c +6 -2
index bdf437a5403fe..db16d893a2351 100644
@@ -419,10 +419,14 @@ static int wm8974_update_clocks(struct snd_soc_dai *dai)
 	fs256 = 256 * priv->fs;
 
 	f = wm8974_get_mclkdiv(priv->mclk, fs256, &mclkdiv);
-
 	if (f != priv->mclk) {
 		/* The PLL performs best around 90MHz */
-		fpll = wm8974_get_mclkdiv(22500000, fs256, &mclkdiv);
+		if (fs256 % 8000)
+			f = 22579200;
+		else
+			f = 24576000;
+
+		fpll = wm8974_get_mclkdiv(f, fs256, &mclkdiv);
 	}
 
 	wm8974_set_dai_pll(dai, 0, 0, priv->mclk, fpll);
Signature · 1 line
2.47.2