* [PATCH] ALSA: ice1724: Fix blocking open for independent surround PCMs
@ 2026-05-18 14:32 Cássio Gabriel
2026-05-19 5:38 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Cássio Gabriel @ 2026-05-18 14:32 UTC (permalink / raw)
To: Takashi Iwai, Jaroslav Kysela
Cc: linux-sound, linux-kernel, Cássio Gabriel
The independent surround playback open path rejects a substream when the
matching PDMA channel is reserved by the multi-channel PDMA0 stream. It
currently returns -EBUSY for that case, although the driver has carried a
FIXME noting that blocking mode is not handled properly.
ALSA PCM open waits and retries only when the low-level open callback
returns -EAGAIN. Returning -EBUSY therefore makes blocking opens fail
immediately, the same as nonblocking opens.
Return -EAGAIN for the temporary PDMA0 reservation conflict. The PCM core
continues to report -EBUSY for O_NONBLOCK callers, while blocking callers
sleep and retry.
Also wake the independent surround PCM wait queue when hw_free releases a
PDMA reservation. The reservation can be released by the pro PCM, while
waiters are sleeping on the independent surround PCM, so waking the current
substream PCM is not sufficient for this cross-PCM reservation.
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
sound/pci/ice1712/ice1724.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 2e64f9c020e5..79d57938a1c8 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -730,13 +730,22 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
+ bool released = false;
int i;
- guard(mutex)(&ice->open_mutex);
- /* unmark surround channels */
- for (i = 0; i < 3; i++)
- if (ice->pcm_reserved[i] == substream)
+ scoped_guard(mutex, &ice->open_mutex) {
+ /* unmark surround channels */
+ for (i = 0; i < 3; i++) {
+ if (ice->pcm_reserved[i] != substream)
+ continue;
ice->pcm_reserved[i] = NULL;
+ released = true;
+ }
+ }
+
+ if (released && ice->pcm_ds)
+ wake_up(&ice->pcm_ds->open_wait);
+
return 0;
}
@@ -1364,7 +1373,7 @@ static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream)
scoped_guard(mutex, &ice->open_mutex) {
/* already used by PDMA0? */
if (ice->pcm_reserved[substream->number])
- return -EBUSY; /* FIXME: should handle blocking mode properly */
+ return -EAGAIN;
}
runtime->private_data = (void *)&vt1724_playback_dma_regs[substream->number];
ice->playback_con_substream_ds[substream->number] = substream;
---
base-commit: 910e9f1bc3bc96e6d067c405ba30d69c4feff46e
change-id: 20260428-ice1724-blocking-open-1b77c96e2329
Best regards,
--
Cássio Gabriel <cassiogabrielcontato@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: ice1724: Fix blocking open for independent surround PCMs
2026-05-18 14:32 [PATCH] ALSA: ice1724: Fix blocking open for independent surround PCMs Cássio Gabriel
@ 2026-05-19 5:38 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-05-19 5:38 UTC (permalink / raw)
To: Cássio Gabriel
Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel
On Mon, 18 May 2026 16:32:05 +0200,
Cássio Gabriel wrote:
>
> The independent surround playback open path rejects a substream when the
> matching PDMA channel is reserved by the multi-channel PDMA0 stream. It
> currently returns -EBUSY for that case, although the driver has carried a
> FIXME noting that blocking mode is not handled properly.
>
> ALSA PCM open waits and retries only when the low-level open callback
> returns -EAGAIN. Returning -EBUSY therefore makes blocking opens fail
> immediately, the same as nonblocking opens.
>
> Return -EAGAIN for the temporary PDMA0 reservation conflict. The PCM core
> continues to report -EBUSY for O_NONBLOCK callers, while blocking callers
> sleep and retry.
>
> Also wake the independent surround PCM wait queue when hw_free releases a
> PDMA reservation. The reservation can be released by the pro PCM, while
> waiters are sleeping on the independent surround PCM, so waking the current
> substream PCM is not sufficient for this cross-PCM reservation.
>
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Applied to for-next branch now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-19 5:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 14:32 [PATCH] ALSA: ice1724: Fix blocking open for independent surround PCMs Cássio Gabriel
2026-05-19 5:38 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.