From: Cezary Rojewski <cezary.rojewski@intel.com>
To: "Amadeusz Sławiński" <amade@asmblr.net>
Cc: <broonie@kernel.org>, <linux-sound@vger.kernel.org>,
<tiwai@suse.com>, <perex@perex.cz>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] ASoC: Intel: avs: Unprepare a stream when recovery occurs
Date: Fri, 16 Oct 2026 09:51:45 +0200 [thread overview]
Message-ID: <8c3e7800-798c-428e-92a4-25ef01a724e6@intel.com> (raw)
In-Reply-To: <20261015212502.6280c705@milkyway>
On 10/15/2026 9:25 PM, Amadeusz Sławiński wrote:
> On Thu, 15 Oct 2026 21:02:38 +0200
> Cezary Rojewski <cezary.rojewski@intel.com> wrote:
>
>> Recovery on alsa-lib side is handled with either:
>> 1) snd_pcm_prepare(state=XRUN)
>> 2) snd_pcm_drop/drain() -> snd_pcm_prepare(state=SETUP)
>>
>> before starting the PCM anew. Relying solely on state=XRUN leaves 2)
>> unaccounted for. sound/core/pcm_native.c ensures correctness of the
>> state machine so plain state!=PREPARED check suffices.
>>
>> This is the BE equivalent of job done previously for FE side only with
>> commit cfca1637bc2b ("ASoC: Intel: avs: Unprepare a stream when XRUN
>> occurs") and its follow up titled: ("ASoC: Intel: avs: Reset the stream
>> unless it is already prepared").
>>
>> Link: https://lore.kernel.org/linux-sound/20261010103753.16969-1-stiraspo@gmail.com/T/
>> Fixes: d070002a20fc ("ASoC: Intel: avs: HDA PCM BE operations")
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>> sound/soc/intel/avs/pcm.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
>> index 3cf455e8b879..a0a0d645ea33 100644
>> --- a/sound/soc/intel/avs/pcm.c
>> +++ b/sound/soc/intel/avs/pcm.c
>> @@ -461,6 +461,8 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
>> link_stream = data->link_stream;
>> p = &be->dpcm[substream->stream].hw_params;
>>
>> + if (substream->runtime->state != SNDRV_PCM_STATE_PREPARED)
>> + link_stream->link_prepared = false;
>> if (link_stream->link_prepared)
>> return 0;
>>
>
> It's bit late, so I can be wrong, but if you are going to execute whole
> function in most cases anyway, is link_prepared even needed? Why not just:
> if (substream->runtime->state == SNDRV_PCM_STATE_PREPARED)
> return 0;
> and remove link_prepared entirely?
I do agree that something is amiss here. As mentioned during a parallel
review [1] with these checks added, I doubt ->prepared and
->link_prepared are needed.
All of these is a separate investigation though and I've decided to go
with what has been touched, at least for now.
[1]:
https://lore.kernel.org/linux-sound/179182811090.390394.9718829794059346472.b4-ty@b4/T/#m72e50a5e55c45570926a88ebd260343e11847eaa
next prev parent reply other threads:[~2026-10-16 7:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 19:02 [PATCH 0/3] ASoC: Intel: avs: Fix for recovery procedure and new size-checks Cezary Rojewski
2026-10-15 19:02 ` [PATCH 1/3] ASoC: Intel: avs: Unprepare a stream when recovery occurs Cezary Rojewski
2026-10-15 19:25 ` Amadeusz Sławiński
2026-10-16 7:51 ` Cezary Rojewski [this message]
2026-10-15 19:02 ` [PATCH 2/3] ASoC: Intel: avs: Verify sizes of configs coming from topology Cezary Rojewski
2026-10-15 19:02 ` [PATCH 3/3] ASoC: Intel: avs: Prevent module info underflow Cezary Rojewski
2026-10-15 19:14 ` [PATCH 0/3] ASoC: Intel: avs: Fix for recovery procedure and new size-checks 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=8c3e7800-798c-428e-92a4-25ef01a724e6@intel.com \
--to=cezary.rojewski@intel.com \
--cc=amade@asmblr.net \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--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
all inboxes | Powered by JetHome®