From: broonie@kernel.org
To: "Shenghao Ding" <shenghao-ding@ti.com>,
"Kevin Lu" <kevin-lu@ti.com>, "Baojun Xu" <baojun.xu@ti.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>, "Dan Murphy" <dmurphy@ti.com>,
"Hector Martin" <marcan@marcan.st>,
"Martin Povišer" <povik+lin@cutebit.org>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: [PATCH 2/4] ASoC: tas2764: Wait for ramp-down after shutdown
Date: Sat, 08 Feb 2025 01:03:25 +0000 [thread overview]
Message-ID: <20250208-asoc-tas2764-v1-2-dbab892a69b5@kernel.org> (raw)
In-Reply-To: <20250208-asoc-tas2764-v1-0-dbab892a69b5@kernel.org>
From: Hector Martin <marcan@marcan.st>
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>
---
sound/soc/codecs/tas2764.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c
index 60d660a88fab..0b033ab51f7f 100644
--- a/sound/soc/codecs/tas2764.c
+++ b/sound/soc/codecs/tas2764.c
@@ -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;
--
2.39.5
next prev parent reply other threads:[~2025-02-08 1:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 1:03 [PATCH 0/4] ASoC: tas2764: Random patches from the Asahi Linux tree broonie
2025-02-08 1:03 ` [PATCH 1/4] ASoC: tas2764: Power up/down amp on mute ops broonie
2025-02-08 1:03 ` broonie [this message]
2025-02-08 1:03 ` [PATCH 3/4] ASoC: tas2764: Mark SW_RESET as volatile broonie
2025-02-08 1:03 ` [PATCH 4/4] ASoC: tas2764: Add reg defaults for TAS2764_INT_CLK_CFG broonie
2025-02-17 14:32 ` [PATCH 0/4] ASoC: tas2764: Random patches from the Asahi Linux tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250208-asoc-tas2764-v1-2-dbab892a69b5@kernel.org \
--to=broonie@kernel.org \
--cc=baojun.xu@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=kevin-lu@ti.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=perex@perex.cz \
--cc=povik+lin@cutebit.org \
--cc=shenghao-ding@ti.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®