Skip to content

Commit a128ec3

Browse files
mkumardwebgeek1234
authored andcommitted
ALSA: hda: Clear RIRB status before reading WP
RIRB interrupt status getting cleared after the write pointer is read causes a race condition, where last response(s) into RIRB may remain unserviced by IRQ, eventually causing azx_rirb_get_response to fall back to polling mode. Clearing the RIRB interrupt status ahead of write pointer access ensures that this condition is avoided. Bug 2533543 Change-Id: Ib79ee9534cdb7a649af32c46f0c8d934c6c28861 Signed-off-by: Mohan Kumar <[email protected]> Signed-off-by: Viswanath L <[email protected]> Reviewed-on: https://git-master.nvidia.com/r/c/linux-4.9/+/2291384 Tested-by: mobile promotions <[email protected]> Reviewed-by: Sharad Gupta <[email protected]> Reviewed-by: mobile promotions <[email protected]> GVS: Gerrit_Virtual_Submit
1 parent 502018e commit a128ec3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sound/pci/hda/hda_controller.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,16 +1205,23 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
12051205
if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update))
12061206
active = true;
12071207

1208-
/* clear rirb int */
12091208
status = azx_readb(chip, RIRBSTS);
12101209
if (status & RIRB_INT_MASK) {
1210+
/*
1211+
* Clearing the interrupt status here ensures that no
1212+
* interrupt gets masked after the RIRB wp is read in
1213+
* snd_hdac_bus_update_rirb. This avoids a possible
1214+
* race condition where codec response in RIRB may
1215+
* remain unserviced by IRQ, eventually falling back
1216+
* to polling mode in azx_rirb_get_response.
1217+
*/
1218+
azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
12111219
active = true;
12121220
if (status & RIRB_INT_RESPONSE) {
12131221
if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND)
12141222
udelay(80);
12151223
snd_hdac_bus_update_rirb(bus);
12161224
}
1217-
azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
12181225
}
12191226
} while (active && ++repeat < 10);
12201227

0 commit comments

Comments
 (0)