[PATCH] ASoC: rt1015: re-calibrate again when resuming

Tzung-Bi Shih tzungbi at google.com
Fri Dec 25 04:08:45 CET 2020


Assuming the calibration state gets lost after system suspend.
Re-calibrates again when resuming.

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 at google.com>
---
The idea is inspired from previous discussion:
https://mailman.alsa-project.org/pipermail/alsa-devel/2020-December/178229.html

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

v1 attempt:
https://mailman.alsa-project.org/pipermail/alsa-devel/2020-December/178614.html

 sound/soc/codecs/rt1015.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c
index 4a9e2eaebe30..3b06eaddccaf 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);
 
@@ -1113,6 +1112,10 @@ static int rt1015_resume(struct snd_soc_component *component)
 
 	regcache_cache_only(rt1015->regmap, false);
 	regcache_sync(rt1015->regmap);
+
+	if (rt1015->cali_done)
+		rt1015_calibrate(rt1015);
+
 	return 0;
 }
 #else
-- 
2.29.2.729.g45daf8777d-goog



More information about the Alsa-devel mailing list