ALSA: emu10k1: use mutex for E-MU FPGA access locking
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Sun, 28 Apr 2024 09:37:14 +0000 (11:37 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sun, 28 Apr 2024 09:58:12 +0000 (11:58 +0200)
commit2d3f4810886eb7c319cec41b6d725d2953bfa88a
treeff2074e6771efcb25dfd1ddccd690f9781de1c7e
parentf848337cd801c7106a4ec0d61765771dab2a5909
ALSA: emu10k1: use mutex for E-MU FPGA access locking

The FPGA access through the GPIO port does not interfere with other
sound processor register access, so there is no need to subject it to
emu_lock. And after moving all FPGA access out of the interrupt handler,
it does not need to be IRQ-safe, either.

What's more, attaching the dock causes a firmware upload, which takes
several seconds. We really don't want to disable IRQs for this long, and
even less also have someone else spin with IRQs disabled waiting for us.

Therefore, use a mutex for FPGA access locking.

This makes the code somewhat more noisy, as we need to wrap bigger
sections into the mutex, as it needs to enclose the spinlocks.

The latter has the "side effect" of fixing dock FPGA programming in a
corner case: a really badly timed mixer access right between entering
FPGA programming mode and uploading the netlist would mess up the
protocol.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-5-oswald.buddenhagen@gmx.de>
include/sound/emu10k1.h
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emumixer.c
sound/pci/emu10k1/emuproc.c
sound/pci/emu10k1/io.c