ALSA: hda: cs35l41: Support Firmware switching and reloading
authorStefan Binding <sbinding@opensource.cirrus.com>
Thu, 30 Jun 2022 00:23:34 +0000 (01:23 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 15 Jul 2022 14:23:29 +0000 (16:23 +0200)
commit47ceabd99a28399f8971f4ca0a37ebc0a21dd2a8
tree04241a4307bdcb1358839b3347ac83cef9b34a6e
parent4fa58b1d7ec714581bfb1d12370746d29518cd3a
ALSA: hda: cs35l41: Support Firmware switching and reloading

This is required to support CS35L41 calibration.

By default, speaker protection firmware will be loaded, if
available. However, different firmware is required to run
the calibration sequence, so it is necessary to add support
to be able to unload, switch and reload firmware.

This patch adds 2 ALSA Controls for each amp:
"DSP1 Firmware Load"
"DSP1 Firmware Type"

"DSP1 Firmware Load" can be used to unload and
load the firmware.
"DSP1 Firmware Type"  can be used to switch the
target firmware to be loaded by "DSP1 Firmware Load"

Since loading firmware can add new ALSA controls, it is
necessary to ensure the firmware loading is run asynchronously
from the ALSA control itself to prevent deadlocks.

Note: When switching between firmwares, an ALSA control is
only added if it has not previously existed. If it had existed
previously, it will be re-enabled instead.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220630002335.366545-14-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/cs35l41_hda.c
sound/pci/hda/cs35l41_hda.h