From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
pierre-louis.bossart@linux.intel.com, tiwai@suse.com,
hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com
Subject: [PATCH v4 5/9] ASoC: Intel: avs: Restart instead of resuming HDA capture streams
Date: Thu, 27 Oct 2022 14:46:58 +0200 [thread overview]
Message-ID: <20221027124702.1761002-6-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20221027124702.1761002-1-cezary.rojewski@intel.com>
Resuming of capture streams for HD-Audio is unsupported so remove the
relevant flag from the hardware params when assigning them during
avs_component_hda_open().
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/avs/pcm.c | 50 ++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 22 deletions(-)
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index db29496e16ab..660129508c08 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -1004,34 +1004,34 @@ static int avs_component_resume(struct snd_soc_component *component)
return avs_component_resume_prepare(component, false);
}
+static const struct snd_pcm_hardware avs_pcm_hardware = {
+ .info = SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_PAUSE |
+ SNDRV_PCM_INFO_RESUME |
+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE |
+ SNDRV_PCM_FMTBIT_S24_LE |
+ SNDRV_PCM_FMTBIT_S32_LE,
+ .buffer_bytes_max = AZX_MAX_BUF_SIZE,
+ .period_bytes_min = 128,
+ .period_bytes_max = AZX_MAX_BUF_SIZE / 2,
+ .periods_min = 2,
+ .periods_max = AZX_MAX_FRAG,
+ .fifo_size = 0,
+};
+
static int avs_component_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
- struct snd_pcm_hardware hwparams;
/* only FE DAI links are handled here */
if (rtd->dai_link->no_pcm)
return 0;
- hwparams.info = SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_MMAP_VALID |
- SNDRV_PCM_INFO_INTERLEAVED |
- SNDRV_PCM_INFO_PAUSE |
- SNDRV_PCM_INFO_RESUME |
- SNDRV_PCM_INFO_NO_PERIOD_WAKEUP;
-
- hwparams.formats = SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S24_LE |
- SNDRV_PCM_FMTBIT_S32_LE;
- hwparams.period_bytes_min = 128;
- hwparams.period_bytes_max = AZX_MAX_BUF_SIZE / 2;
- hwparams.periods_min = 2;
- hwparams.periods_max = AZX_MAX_FRAG;
- hwparams.buffer_bytes_max = AZX_MAX_BUF_SIZE;
- hwparams.fifo_size = 0;
-
- return snd_soc_set_runtime_hwparams(substream, &hwparams);
+ return snd_soc_set_runtime_hwparams(substream, &avs_pcm_hardware);
}
static unsigned int avs_hda_stream_dpib_read(struct hdac_ext_stream *stream)
@@ -1375,9 +1375,15 @@ static int avs_component_hda_open(struct snd_soc_component *component,
struct hdac_ext_stream *link_stream;
struct hda_codec *codec;
- /* only BE DAI links are handled here */
- if (!rtd->dai_link->no_pcm)
- return avs_component_open(component, substream);
+ if (!rtd->dai_link->no_pcm) {
+ struct snd_pcm_hardware hwparams = avs_pcm_hardware;
+
+ /* RESUME unsupported for de-coupled HD-Audio capture. */
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ hwparams.info &= ~SNDRV_PCM_INFO_RESUME;
+
+ return snd_soc_set_runtime_hwparams(substream, &hwparams);
+ }
codec = dev_to_hda_codec(asoc_rtd_to_codec(rtd, 0)->dev);
link_stream = snd_hdac_ext_stream_assign(&codec->bus->core, substream,
--
2.25.1
next prev parent reply other threads:[~2022-10-27 12:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 12:46 [PATCH v4 0/9] ASoC: Intel: avs: PCM power management Cezary Rojewski
2022-10-27 12:46 ` [PATCH v4 1/9] ASoC: Intel: avs: Split pcm pages freeing operation from hw_free() Cezary Rojewski
2022-10-27 12:46 ` [PATCH v4 2/9] ASoC: Intel: avs: Introduce PCM power management routines Cezary Rojewski
2022-10-27 12:46 ` [PATCH v4 3/9] ALSA: hda: Introduce snd_hdac_stream_wait_drsm() Cezary Rojewski
2022-10-27 13:31 ` Takashi Iwai
2022-10-27 12:46 ` [PATCH v4 4/9] ASoC: Intel: avs: Handle SUSPEND and RESUME triggers Cezary Rojewski
2022-10-27 12:46 ` Cezary Rojewski [this message]
2022-10-27 12:46 ` [PATCH v4 6/9] ASoC: Intel: avs: Count low power streams Cezary Rojewski
2022-10-27 12:47 ` [PATCH v4 7/9] ASoC: Intel: avs: Standby power-state support Cezary Rojewski
2022-10-27 12:47 ` [PATCH v4 8/9] ASoC: Intel: avs: Power and clock gating policy overriding Cezary Rojewski
2022-10-27 12:47 ` [PATCH v4 9/9] ASoC: Intel: avs: Enact power gating policy Cezary Rojewski
2022-10-28 16:40 ` [PATCH v4 0/9] ASoC: Intel: avs: PCM power management 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=20221027124702.1761002-6-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=hdegoede@redhat.com \
--cc=pierre-louis.bossart@linux.intel.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