mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: intel8x0: keep AC97 PCM descriptors for ICH4 capture
@ 2026-11-05  1:46 raoxu
  2026-11-05  7:50 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: raoxu @ 2026-11-05  1:46 UTC (permalink / raw)
  To: perex
  Cc: tiwai, luiz.von.dentz, pmenzel, pengpeng, brgl, u.kleine-koenig,
	linux-sound, linux-kernel, raoxu

From: Xu Rao <raoxu@uniontech.com>

When S/PDIF uses the AC-link, spdif_idx is negative and the AC97
PCM assignment drops its last descriptor.  On ICH4 this leaves five
entries, but PCM2IN and MIC2 still use entries four and five.
Opening MIC2 then reads beyond the allocated descriptor array.

Keep all six descriptors on ICH4 so the capture stream indices stay
valid.  The S/PDIF descriptor occupies its fixed position but does
not create a separate hardware PCM when S/PDIF uses the AC-link.
Other controller types retain their existing descriptor counts.

Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
Changes in v2:
- Group the S/PDIF descriptor count adjustment with the non-ICH4 case,
  as suggested by Takashi Iwai.

 sound/pci/intel8x0.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 339024182a26..69fe42747750 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2289,10 +2289,11 @@ static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
 		pbus->isdin = 1;
 	/* find the available PCM streams */
 	i = ARRAY_SIZE(ac97_pcm_defs);
-	if (chip->device_type != DEVICE_INTEL_ICH4)
+	if (chip->device_type != DEVICE_INTEL_ICH4) {
 		i -= 2;		/* do not allocate PCM2IN and MIC2 */
-	if (chip->spdif_idx < 0)
-		i--;		/* do not allocate S/PDIF */
+		if (chip->spdif_idx < 0)
+			i--;		/* do not allocate S/PDIF */
+	}
 	err = snd_ac97_pcm_assign(pbus, i, ac97_pcm_defs);
 	if (err < 0)
 		goto __err;
--
2.50.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ALSA: intel8x0: keep AC97 PCM descriptors for ICH4 capture
  2026-11-05  1:46 [PATCH v2] ALSA: intel8x0: keep AC97 PCM descriptors for ICH4 capture raoxu
@ 2026-11-05  7:50 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-11-05  7:50 UTC (permalink / raw)
  To: raoxu
  Cc: perex, tiwai, luiz.von.dentz, pmenzel, pengpeng, brgl,
	u.kleine-koenig, linux-sound, linux-kernel

On Thu, 05 Nov 2026 02:46:42 +0100,
raoxu wrote:
> 
> From: Xu Rao <raoxu@uniontech.com>
> 
> When S/PDIF uses the AC-link, spdif_idx is negative and the AC97
> PCM assignment drops its last descriptor.  On ICH4 this leaves five
> entries, but PCM2IN and MIC2 still use entries four and five.
> Opening MIC2 then reads beyond the allocated descriptor array.
> 
> Keep all six descriptors on ICH4 so the capture stream indices stay
> valid.  The S/PDIF descriptor occupies its fixed position but does
> not create a separate hardware PCM when S/PDIF uses the AC-link.
> Other controller types retain their existing descriptor counts.
> 
> Signed-off-by: Xu Rao <raoxu@uniontech.com>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-05  7:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05  1:46 [PATCH v2] ALSA: intel8x0: keep AC97 PCM descriptors for ICH4 capture raoxu
2026-11-05  7:50 ` Takashi Iwai

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®