aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Binding <sbinding@opensource.cirrus.com>2022-06-30 01:23:35 +0100
committerTakashi Iwai <tiwai@suse.de>2022-07-15 16:23:47 +0200
commit622f21994506e1dac7b8e4e362c8951426e032c5 (patch)
tree3031da8143aa7f6bb04c5f04b7c45773f384b726
parentALSA: hda: cs35l41: Support Firmware switching and reloading (diff)
downloadlinux-dev-622f21994506e1dac7b8e4e362c8951426e032c5.tar.xz
linux-dev-622f21994506e1dac7b8e4e362c8951426e032c5.zip
ALSA: hda: cs35l41: Add module parameter to control firmware load
By default, the driver will automatically load DSP firmware for the amps, if available. Adding this option allows the autoload to be optional, which allows for different configurations. 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-15-vitalyr@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/cs35l41_hda.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index 4252c0ac69b7..28798d5c1cf1 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -8,6 +8,7 @@
#include <linux/acpi.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <sound/hda_codec.h>
#include <sound/soc.h>
#include <linux/pm_runtime.h>
@@ -32,6 +33,11 @@
#define CAL_DSP_CTL_TYPE 5
#define CAL_DSP_CTL_ALG 205
+static bool firmware_autostart = 1;
+module_param(firmware_autostart, bool, 0444);
+MODULE_PARM_DESC(firmware_autostart, "Allow automatic firmware download on boot"
+ "(0=Disable, 1=Enable) (default=1); ");
+
static const struct reg_sequence cs35l41_hda_config[] = {
{ CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3072000Hz, BCLK Input, PLL_REFCLK_EN = 1
{ CS35L41_DSP_CLK_CTRL, 0x00000003 }, // DSP CLK EN
@@ -843,11 +849,16 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
cs35l41->firmware_type = HDA_CS_DSP_FW_SPK_PROT;
- cs35l41->request_fw_load = true;
- mutex_lock(&cs35l41->fw_mutex);
- if (cs35l41_smart_amp(cs35l41) < 0)
- dev_warn(cs35l41->dev, "Cannot Run Firmware, reverting to dsp bypass...\n");
- mutex_unlock(&cs35l41->fw_mutex);
+ if (firmware_autostart) {
+ dev_dbg(cs35l41->dev, "Firmware Autostart.\n");
+ cs35l41->request_fw_load = true;
+ mutex_lock(&cs35l41->fw_mutex);
+ if (cs35l41_smart_amp(cs35l41) < 0)
+ dev_warn(cs35l41->dev, "Cannot Run Firmware, reverting to dsp bypass...\n");
+ mutex_unlock(&cs35l41->fw_mutex);
+ } else {
+ dev_dbg(cs35l41->dev, "Firmware Autostart is disabled.\n");
+ }
ret = cs35l41_create_controls(cs35l41);