2019-11-12 22:40:59

by Michael Walle

[permalink] [raw]
Subject: [PATCH] ASoC: wm8904: fix regcache handling

The current code assumes that the power is turned off in
SND_SOC_BIAS_OFF. If there are no actual regulator the codec isn't
turned off and the registers are not reset to their default values but
the regcache is still marked as dirty. Thus a value might not be written
to the hardware if it is set to the default value. Do a software reset
before turning off the power to make sure the registers are always reset
to their default states.

Signed-off-by: Michael Walle <[email protected]>
---
sound/soc/codecs/wm8904.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 2a7d23a5daa8..7d7ea15d73e0 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1933,6 +1933,7 @@ static int wm8904_set_bias_level(struct snd_soc_component *component,
snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0,
WM8904_BIAS_ENA, 0);

+ snd_soc_component_write(component, WM8904_SW_RESET_AND_ID, 0);
regcache_cache_only(wm8904->regmap, true);
regcache_mark_dirty(wm8904->regmap);

--
2.20.1


2019-11-13 08:30:48

by Charles Keepax

[permalink] [raw]
Subject: Re: [PATCH] ASoC: wm8904: fix regcache handling

On Tue, Nov 12, 2019 at 11:36:29PM +0100, Michael Walle wrote:
> The current code assumes that the power is turned off in
> SND_SOC_BIAS_OFF. If there are no actual regulator the codec isn't
> turned off and the registers are not reset to their default values but
> the regcache is still marked as dirty. Thus a value might not be written
> to the hardware if it is set to the default value. Do a software reset
> before turning off the power to make sure the registers are always reset
> to their default states.
>
> Signed-off-by: Michael Walle <[email protected]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2019-11-15 12:26:59

by Mark Brown

[permalink] [raw]
Subject: Applied "ASoC: wm8904: fix regcache handling" to the asoc tree

The patch

ASoC: wm8904: fix regcache handling

has been applied to the asoc tree at

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

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

From e9149b8c00d25dbaef1aa174fc604bed207e576d Mon Sep 17 00:00:00 2001
From: Michael Walle <[email protected]>
Date: Tue, 12 Nov 2019 23:36:29 +0100
Subject: [PATCH] ASoC: wm8904: fix regcache handling

The current code assumes that the power is turned off in
SND_SOC_BIAS_OFF. If there are no actual regulator the codec isn't
turned off and the registers are not reset to their default values but
the regcache is still marked as dirty. Thus a value might not be written
to the hardware if it is set to the default value. Do a software reset
before turning off the power to make sure the registers are always reset
to their default states.

Signed-off-by: Michael Walle <[email protected]>
Acked-by: Charles Keepax <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
---
sound/soc/codecs/wm8904.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index bcb3c9d5abf0..9e8c564f6e9c 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1917,6 +1917,7 @@ static int wm8904_set_bias_level(struct snd_soc_component *component,
snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0,
WM8904_BIAS_ENA, 0);

+ snd_soc_component_write(component, WM8904_SW_RESET_AND_ID, 0);
regcache_cache_only(wm8904->regmap, true);
regcache_mark_dirty(wm8904->regmap);

--
2.20.1