From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: kai.vehmanen@linux.intel.com, yung-chuan.liao@linux.intel.com,
lgirdwood@gmail.com, pierre-louis.bossart@linux.intel.com,
ranjani.sridharan@linux.intel.com, daniel.baluta@nxp.com
Subject: [PATCH 10/10] ASoC: SOF: Intel: hda: send DAI_CONFIG IPC during pause
Date: Thu, 25 Nov 2021 12:15:20 +0200 [thread overview]
Message-ID: <20211125101520.291581-11-kai.vehmanen@linux.intel.com> (raw)
In-Reply-To: <20211125101520.291581-1-kai.vehmanen@linux.intel.com>
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
For HDA DAI's the DMA must be paused after the RUN bit is cleared by the
host. So, send the DAI_CONFIG IPC with just the SOF_DAI_CONFIG_FLAGS_PAUSE
flag set to indicate this to the firmware.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
sound/soc/sof/intel/hda-dai.c | 42 ++++++++++++++++++++++++++++++-----
1 file changed, 37 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index bce5366cf913..8c1d7ddb00e2 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -287,6 +287,36 @@ static int hda_link_pcm_prepare(struct snd_pcm_substream *substream,
dai);
}
+static int hda_link_dai_config_pause_push_ipc(struct snd_soc_dapm_widget *w)
+{
+ struct snd_sof_widget *swidget = w->dobj.private;
+ struct snd_soc_component *component = swidget->scomp;
+ struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
+ struct sof_ipc_dai_config *config;
+ struct snd_sof_dai *sof_dai;
+ struct sof_ipc_reply reply;
+ int ret;
+
+ sof_dai = swidget->private;
+
+ if (!sof_dai || !sof_dai->dai_config) {
+ dev_err(sdev->dev, "No config for DAI %s\n", w->name);
+ return -EINVAL;
+ }
+
+ config = &sof_dai->dai_config[sof_dai->current_config];
+
+ /* set PAUSE command flag */
+ config->flags = FIELD_PREP(SOF_DAI_CONFIG_FLAGS_CMD_MASK, SOF_DAI_CONFIG_FLAGS_PAUSE);
+
+ ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size,
+ &reply, sizeof(reply));
+ if (ret < 0)
+ dev_err(sdev->dev, "DAI config for %s failed during pause push\n", w->name);
+
+ return ret;
+}
+
static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{
@@ -312,6 +342,9 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
hda_stream = hstream_to_sof_hda_stream(link_dev);
dev_dbg(dai->dev, "In %s cmd=%d\n", __func__, cmd);
+
+ w = snd_soc_dai_get_widget(dai, substream->stream);
+
switch (cmd) {
case SNDRV_PCM_TRIGGER_RESUME:
/* set up hw_params */
@@ -331,11 +364,6 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_STOP:
snd_hdac_ext_link_stream_clear(link_dev);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- w = dai->playback_widget;
- else
- w = dai->capture_widget;
-
/*
* free DAI widget during stop/suspend to keep widget use_count's balanced.
*/
@@ -352,6 +380,10 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
snd_hdac_ext_link_stream_clear(link_dev);
+
+ ret = hda_link_dai_config_pause_push_ipc(w);
+ if (ret < 0)
+ return ret;
break;
default:
return -EINVAL;
--
2.33.0
next prev parent reply other threads:[~2021-11-25 10:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 10:15 [PATCH 00/10] ASoC: SOF: Fixes for Intel HD-Audio DMA stopping Kai Vehmanen
2021-11-25 10:15 ` [PATCH 01/10] ASoC: SOF: Intel: hda: clear stream before freeing the DAI widget Kai Vehmanen
2021-11-25 10:15 ` [PATCH 02/10] ASoC: SOF: Intel: hda: Add a helper function for stream reset Kai Vehmanen
2021-11-25 10:15 ` [PATCH 03/10] ASoC: SOF: Intel: hda: reset stream before coupling host and link DMA's Kai Vehmanen
2021-11-25 10:15 ` [PATCH 04/10] ASoC: SOF: pcm: invoke platform hw_free for STOP/SUSPEND triggers Kai Vehmanen
2021-11-25 10:15 ` [PATCH 05/10] ASoC: SOF: call platform hw_free for paused streams during suspend Kai Vehmanen
2021-11-25 10:15 ` [PATCH 06/10] ASoC: SOF: Add a helper for freeing PCM stream Kai Vehmanen
2021-11-25 10:15 ` [PATCH 07/10] ASoC: SOF: pcm: move the check for prepared flag Kai Vehmanen
2021-11-25 10:15 ` [PATCH 08/10] ASoC: SOF: align the hw_free sequence with stop Kai Vehmanen
2021-11-25 10:15 ` [PATCH 09/10] ASoC: SOF: IPC: dai: Expand DAI_CONFIG IPC flags Kai Vehmanen
2021-11-25 10:15 ` Kai Vehmanen [this message]
2021-11-27 1:29 ` [PATCH 00/10] ASoC: SOF: Fixes for Intel HD-Audio DMA stopping 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=20211125101520.291581-11-kai.vehmanen@linux.intel.com \
--to=kai.vehmanen@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=yung-chuan.liao@linux.intel.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;
as well as URLs for NNTP newsgroup(s).