summarylogtreecommitdiffstats
path: root/0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch
diff options
context:
space:
mode:
authorgraysky2022-09-07 16:19:26 -0400
committergraysky2022-09-07 16:19:26 -0400
commit01eceb25e1f246cc3260fd2312789677be73e6f1 (patch)
treec92a79316c5b2269f88b1b93e3bfaf7082e9b828 /0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch
parent365f0a84130208b1ec98d842f1e48ff660842d21 (diff)
downloadaur-01eceb25e1f246cc3260fd2312789677be73e6f1.tar.gz
Update to 5.19.8rc1-1
Diffstat (limited to '0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch')
-rw-r--r--0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch b/0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch
new file mode 100644
index 000000000000..260ead1edb61
--- /dev/null
+++ b/0005-soundwire-intel-use-pm_runtime_resume-on-component-p.patch
@@ -0,0 +1,82 @@
+From 82b1098e107303aefec21455a84c0e8120ea42e3 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Tue, 21 Jun 2022 17:56:40 -0500
+Subject: [PATCH 5/6] soundwire: intel: use pm_runtime_resume() on component
+ probe
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+During the card registration, transactions on the SoundWire bus can be
+initiated. If the ALSA card is registered after the bus suspends,
+timeouts can be seen while reading/writing codec registers. This is
+extremely easy to reproduce in driver bind/unbind tests.
+
+In an initial experiment, the ASoC soc-component.c code was modified
+to initiate a pm_runtime resume on a component probe. The results
+showed this was too invasive. Instead this patch suggests resuming the
+SoundWire component only.
+
+Because of the parent-child hierarchy enforced by the pm_runtime
+framework, it can be argued that the codec component probe should be
+enough to resume all necessary devices, and indeed the same resume
+will be applied to SoundWire codecs used on Intel platforms.
+
+Calling pm_runtime_resume() on both the Intel and codec sides has the
+benefit of resuming the bus without assuming any order during the card
+registration. The first component on a dailink to be probed will
+resume the bus. In addition, if a codec driver did not implement this
+transition, the Intel component would still resume the bus and avoid
+timeouts on card registration.
+
+BugLink: https://github.com/thesofproject/linux/issues/3651
+Reviewed-by: Rander Wang <rander.wang@intel.com>
+Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20220621225641.221170-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+---
+ drivers/soundwire/intel.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
+index 505c5ef061e3..95ce292994cc 100644
+--- a/drivers/soundwire/intel.c
++++ b/drivers/soundwire/intel.c
+@@ -1043,6 +1043,23 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
+ return ret;
+ }
+
++static int intel_component_probe(struct snd_soc_component *component)
++{
++ int ret;
++
++ /*
++ * make sure the device is pm_runtime_active before initiating
++ * bus transactions during the card registration.
++ * We use pm_runtime_resume() here, without taking a reference
++ * and releasing it immediately.
++ */
++ ret = pm_runtime_resume(component->dev);
++ if (ret < 0 && ret != -EACCES)
++ return ret;
++
++ return 0;
++}
++
+ static int intel_component_dais_suspend(struct snd_soc_component *component)
+ {
+ struct snd_soc_dai *dai;
+@@ -1098,6 +1115,7 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
+
+ static const struct snd_soc_component_driver dai_component = {
+ .name = "soundwire",
++ .probe = intel_component_probe,
+ .suspend = intel_component_dais_suspend
+ };
+
+--
+2.37.3
+