]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: tas2764: Wait for ramp-down after shutdown
authorHector Martin <marcan@marcan.st>
Sat, 8 Feb 2025 01:03:25 +0000 (01:03 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 16 Feb 2025 23:51:27 +0000 (23:51 +0000)
When we shut down the amp, we need to wait for the built-in ramp-down
before we can remove the TDM clocks. There is no documented status
regiter to poll, so the best we can do is a delay. Datasheet says 5.9ms
for ramp-down and 1.5ms between shutdown and next startup, so let's do
6ms after mute and 2ms after shutdown. That gives us a cumulative 8ms
for ramp-down and guaratees the required minimum shutdown time.

Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20250208-asoc-tas2764-v1-2-dbab892a69b5@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tas2764.c

index 60d660a88fab19a700a7fd1ca524cfaf0fb52165..0b033ab51f7f503e05afd28c289ee35a9cca7540 100644 (file)
@@ -142,6 +142,8 @@ static int tas2764_codec_suspend(struct snd_soc_component *component)
        regcache_cache_only(tas2764->regmap, true);
        regcache_mark_dirty(tas2764->regmap);
 
+       usleep_range(6000, 7000);
+
        return 0;
 }
 
@@ -228,10 +230,16 @@ static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction)
                return ret;
 
        if (mute) {
+               /* Wait for ramp-down */
+               usleep_range(6000, 7000);
+
                tas2764->dac_powered = false;
                ret = tas2764_update_pwr_ctrl(tas2764);
                if (ret)
                        return ret;
+
+               /* Wait a bit after shutdown */
+               usleep_range(2000, 3000);
        }
 
        return 0;