From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: pierre-louis.bossart@linux.intel.com,
Cezary Rojewski <cezary.rojewski@intel.com>,
andriy.shevchenko@linux.intel.com, lgirdwood@gmail.com,
tiwai@suse.com, hdegoede@redhat.com, vkoul@kernel.org,
broonie@kernel.org
Subject: [PATCH 1/2] ASoC: Intel: catpt: Wake up device before configuring SSP port
Date: Mon, 12 Oct 2020 12:32:20 +0200 [thread overview]
Message-ID: <20201012103221.30759-1-cezary.rojewski@intel.com> (raw)
catpt_dai_pcm_new() invoked during new PCM runtime creation configures
SSP by sending IPC to DSP firmware. For that to succeed device needs to
be up and running. While components default probing behavior -
snd_soc_catpt causing machine board module to load just after it - needs
no changes, machine board's module may be unloaded and re-loaded at a
different time e.g.: when catpt is already asleep.
Wake device explicitly in catpt_dai_pcm_new() to ensure communication is
established before sending any IPCs, enabling those advanced scenarios
in the process.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
In short, this allows for following scenario (which user usually do not
touch):
1. modprobe snd_soc_catpt // core driver
2. modprobe snd_soc_sst_broadwell // machine board driver
3. wait for snd_soc_catpt to suspend (~2s)
4. rmmod snd_soc_sst_broadwell
5. modprobe snd_soc_sst_broadwell
Without the 3. everything works just fine but let's be more flexible
here.
Right now, -110 (timeout) will occur as device will simply be asleep. To
allow for this advanced scenario, pm_runtime manipulation is required.
memcmp check is to prevent unnecessary operations from occurring.
sound/soc/intel/catpt/pcm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index f78018c857b8..ba653ebea7d1 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -667,7 +667,17 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm,
break;
}
+ /* see if this is a new configuration */
+ if (!memcmp(&cdev->devfmt[devfmt.iface], &devfmt, sizeof(devfmt)))
+ return 0;
+
+ pm_runtime_get_sync(cdev->dev);
+
ret = catpt_ipc_set_device_format(cdev, &devfmt);
+
+ pm_runtime_mark_last_busy(cdev->dev);
+ pm_runtime_put_autosuspend(cdev->dev);
+
if (ret)
return CATPT_IPC_ERROR(ret);
--
2.17.1
next reply other threads:[~2020-10-12 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 10:32 Cezary Rojewski [this message]
2020-10-12 10:32 ` [PATCH 2/2] ASoC: Intel: catpt: Relax clock selection conditions Cezary Rojewski
2020-10-14 19:31 ` [PATCH 1/2] ASoC: Intel: catpt: Wake up device before configuring SSP port 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=20201012103221.30759-1-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=hdegoede@redhat.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
--cc=vkoul@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).