OSDN Git Service

ASoC: rt1015: re-calibrate again when resuming
authorTzung-Bi Shih <tzungbi@google.com>
Fri, 25 Dec 2020 03:08:45 +0000 (11:08 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 5 Jan 2021 14:34:17 +0000 (14:34 +0000)
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@google.com>
Link: https://lore.kernel.org/r/20201225030845.4138497-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt1015.c

index bf452cc..145724a 100644 (file)
@@ -1035,7 +1035,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);
 
@@ -1093,6 +1092,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