ASoC: wm8904: fix regcache handling
diff mbox series

Message ID 20191112223629.21867-1-michael@walle.cc
State Accepted
Commit e9149b8c00d25dbaef1aa174fc604bed207e576d
Headers show
Series
  • ASoC: wm8904: fix regcache handling
Related show

Commit Message

Michael Walle Nov. 12, 2019, 10:36 p.m. UTC
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 <michael@walle.cc>
---
 sound/soc/codecs/wm8904.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Charles Keepax Nov. 13, 2019, 8:25 a.m. UTC | #1
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 <michael@walle.cc>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

Patch
diff mbox series

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);