summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs42l42-sdw.c
diff options
context:
space:
mode:
authorStefan Binding <sbinding@opensource.cirrus.com>2023-01-27 16:51:11 +0000
committerMark Brown <broonie@kernel.org>2023-01-31 12:10:52 +0000
commit16838bfbf6e70b7a3381ab302248bd18c085aba5 (patch)
treec02ea2761058f5fa13b59c60378c5f75d250a173 /sound/soc/codecs/cs42l42-sdw.c
parente0bd53a4d1d5afa7d3a3bf46e2f0ec7940f94710 (diff)
ASoC: cs42l42: Wait for debounce interval after resume
Since clock stop causes bus reset on Intel controllers, we need to wait for the debounce interval on resume, to ensure all the interrupt status registers are set correctly. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230127165111.3010960-9-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/cs42l42-sdw.c')
-rw-r--r--sound/soc/codecs/cs42l42-sdw.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c
index 0de370b40eaf..79023268d4c1 100644
--- a/sound/soc/codecs/cs42l42-sdw.c
+++ b/sound/soc/codecs/cs42l42-sdw.c
@@ -447,7 +447,9 @@ static int __maybe_unused cs42l42_sdw_handle_unattach(struct cs42l42_private *cs
static int __maybe_unused cs42l42_sdw_runtime_resume(struct device *dev)
{
+ static const unsigned int ts_dbnce_ms[] = { 0, 125, 250, 500, 750, 1000, 1250, 1500};
struct cs42l42_private *cs42l42 = dev_get_drvdata(dev);
+ unsigned int dbnce;
int ret;
dev_dbg(dev, "Runtime resume\n");
@@ -456,8 +458,14 @@ static int __maybe_unused cs42l42_sdw_runtime_resume(struct device *dev)
return 0;
ret = cs42l42_sdw_handle_unattach(cs42l42);
- if (ret < 0)
+ if (ret < 0) {
return ret;
+ } else if (ret > 0) {
+ dbnce = max(cs42l42->ts_dbnc_rise, cs42l42->ts_dbnc_fall);
+
+ if (dbnce > 0)
+ msleep(ts_dbnce_ms[dbnce]);
+ }
regcache_cache_only(cs42l42->regmap, false);