[PATCH] ALSA: intel8x0: keep AC97 PCM descriptors for ICH4 capture
From: raoxu
Date: Wed Nov 04 2026 - 03:28:34 EST
From: Xu Rao <raoxu@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxx>
---
sound/pci/intel8x0.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 339024182a26..75db97501c72 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2291,7 +2291,8 @@ static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
i = ARRAY_SIZE(ac97_pcm_defs);
if (chip->device_type != DEVICE_INTEL_ICH4)
i -= 2; /* do not allocate PCM2IN and MIC2 */
- if (chip->spdif_idx < 0)
+ /* ICH4 PCM2IN and MIC2 still need entries 4 and 5. */
+ if (chip->spdif_idx < 0 && chip->device_type != DEVICE_INTEL_ICH4)
i--; /* do not allocate S/PDIF */
err = snd_ac97_pcm_assign(pbus, i, ac97_pcm_defs);
if (err < 0)
--
2.50.1