diff mbox series

ASoC: rt1015: reset cali_done when suspending

Message ID 20201224101034.3018244-1-tzungbi@google.com
State New
Headers show
Series ASoC: rt1015: reset cali_done when suspending | expand

Commit Message

Tzung-Bi Shih Dec. 24, 2020, 10:10 a.m. UTC
Assuming the calibration state gets lost after system suspend.  Resets
cali_done when suspending.

The rt1015_priv is alloced by kzalloc.  No need to initialize cali_done
to 0 in component probe callback.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
The idea inspired from previous discussion:
(https://mailman.alsa-project.org/pipermail/alsa-devel/2020-December/178229.html)

The device could lose the calibration state after suspend/resume.  It
is better to reset the flag and get chance to calibrate again.

The patch applies after the series:
https://mailman.alsa-project.org/pipermail/alsa-devel/2020-December/178608.html

 sound/soc/codecs/rt1015.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tzung-Bi Shih Dec. 25, 2020, 3:11 a.m. UTC | #1
On Thu, Dec 24, 2020 at 6:10 PM Tzung-Bi Shih <tzungbi@google.com> wrote:
>
> Assuming the calibration state gets lost after system suspend.  Resets
> cali_done when suspending.

I guess re-calibrate again when resuming is better (to not depend on
userspace needs to set mixer controls again):
https://mailman.alsa-project.org/pipermail/alsa-devel/2020-December/178623.html
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c
index 4a9e2eaebe30..2dcb7b0fba60 100644
--- a/sound/soc/codecs/rt1015.c
+++ b/sound/soc/codecs/rt1015.c
@@ -1055,7 +1055,6 @@  static int rt1015_probe(struct snd_soc_component *component)
 
 	rt1015->component = component;
 	rt1015->bclk_ratio = 0;
-	rt1015->cali_done = 0;
 
 	INIT_DELAYED_WORK(&rt1015->flush_work, rt1015_flush_work);
 
@@ -1103,6 +1102,7 @@  static int rt1015_suspend(struct snd_soc_component *component)
 
 	regcache_cache_only(rt1015->regmap, true);
 	regcache_mark_dirty(rt1015->regmap);
+	rt1015->cali_done = 0;
 
 	return 0;
 }