Skip to content

Commit 398321d

Browse files
ossilatortiwai
authored andcommitted
ALSA: emu10k1: fix E-MU card dock presence monitoring
While there are two separate IRQ status bits for dock attach and detach, the hardware appears to mix them up more or less randomly, making them useless for tracking what actually happened. It is much safer to check the dock status separately and proceed based on that, as the old polling code did. Note that the code assumes that only the dock can be hot-plugged - if other option card bits changed, the logic would break. Fixes: fbb64ee ("ALSA: emu10k1: make E-MU dock monitoring interrupt-driven") Link: https://bugzilla.kernel.org/show_bug.cgi?id=218584 Signed-off-by: Oswald Buddenhagen <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Message-ID: <[email protected]>
1 parent f25f17d commit 398321d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

sound/pci/emu10k1/emu10k1_main.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,11 @@ static void emu1010_firmware_work(struct work_struct *work)
778778
msleep(10);
779779
/* Unmute all. Default is muted after a firmware load */
780780
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
781+
} else if (!(reg & EMU_HANA_OPTION_DOCK_ONLINE)) {
782+
/* Audio Dock removed */
783+
dev_info(emu->card->dev, "emu1010: Audio Dock detached\n");
784+
/* The hardware auto-mutes all, so we unmute again */
785+
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
781786
}
782787
}
783788

@@ -810,14 +815,12 @@ static void emu1010_interrupt(struct snd_emu10k1 *emu)
810815
u32 sts;
811816

812817
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &sts);
813-
if (sts & EMU_HANA_IRQ_DOCK_LOST) {
814-
/* Audio Dock removed */
815-
dev_info(emu->card->dev, "emu1010: Audio Dock detached\n");
816-
/* The hardware auto-mutes all, so we unmute again */
817-
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
818-
} else if (sts & EMU_HANA_IRQ_DOCK) {
818+
819+
// The distinction of the IRQ status bits is unreliable,
820+
// so we dispatch later based on option card status.
821+
if (sts & (EMU_HANA_IRQ_DOCK | EMU_HANA_IRQ_DOCK_LOST))
819822
schedule_work(&emu->emu1010.firmware_work);
820-
}
823+
821824
if (sts & EMU_HANA_IRQ_WCLK_CHANGED)
822825
schedule_work(&emu->emu1010.clock_work);
823826
}

0 commit comments

Comments
 (0)