Skip to contentSkip to conversation

ASoC: wm8904: Enable FLL when switching an active SYSCLK to FLL

PATCH In review Stefano Radaelli 3 participants 3 messages Nov 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: wm8904: Enable FLL when switching an active SYSCLK to FLL

From: Stefano Radaelli <[email protected]>

When switching SYSCLK from MCLK to FLL, DAPM may keep SYSCLK powered and skip the PRE_PMU event that normally enables the FLL. This leaves SYSCLK sourced from a disabled FLL and can cause playback to fail.

Enable FLL_OSC_ENA and FLL_ENA before selecting FLL as the SYSCLK source when WM8904_CLK_SYS_ENA is already set.

On VAR-SOM-MX8X, playing audio at 48 kHz followed immediately by 8 kHz reproduced an I/O error when switching from MCLK to FLL. With this change, playback succeeds.

---
 sound/soc/codecs/wm8904.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
sound/soc/codecs/wm8904.c +14 -0
index 96d2e54a2c6a..efa108544927 100644
@@ -338,6 +338,20 @@ static int wm8904_configure_clocking(struct snd_soc_component *component)
 		dev_dbg(component->dev, "Using %dHz FLL clock\n",
 			wm8904->fll_fout);
 
+		/* The SYSCLK may already be on; if source changes to FLL, ensure
+		 * FLL is enabled before selecting it as SYSCLK source.
+		 */
+		if (clock2 & WM8904_CLK_SYS_ENA) {
+			snd_soc_component_update_bits(component,
+						      WM8904_FLL_CONTROL_1,
+						      WM8904_FLL_OSC_ENA,
+						      WM8904_FLL_OSC_ENA);
+			snd_soc_component_update_bits(component,
+						      WM8904_FLL_CONTROL_1,
+						      WM8904_FLL_ENA,
+						      WM8904_FLL_ENA);
+		}
+
 		clock2 |= WM8904_SYSCLK_SRC;
 		rate = wm8904->fll_fout;
 		break;
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Stefano Radaelli

From: Stefano Radaelli <[email protected]>

When switching SYSCLK from MCLK to FLL, DAPM may keep SYSCLK powered and skip the PRE_PMU event that normally enables the FLL. This leaves SYSCLK sourced from a disabled FLL and can cause playback to fail.

Enable FLL_OSC_ENA and FLL_ENA before selecting FLL as the SYSCLK source when WM8904_CLK_SYS_ENA is already set.

Quoted 8 lines

On VAR-SOM-MX8X, playing audio at 48 kHz followed immediately by 8 kHz reproduced an I/O error when switching from MCLK to FLL. With this change, playback succeeds.

---

Thanks,
Charles

maintainer
#2 lore raw
In reply to Stefano Radaelli
Quoted 1 line · Stefano Radaelli

ASoC: wm8904: Enable FLL when switching an active SYSCLK to FLL

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4

Thanks!

[1/1] ASoC: wm8904: Enable FLL when switching an active SYSCLK to FLL

      https://git.kernel.org/broonie/sound/c/b3f452ff1778

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark