[PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients

From: Stefan Binding
Date: Tue Jul 30 2024 - 10:40:11 EST


Add a kernel parameter to allow coefficients to be exposed as ALSA controls.

When the CS35L41 loads its firmware, it has a number of controls to
affect its behaviour. Currently, these controls are exposed as ALSA
Controls by default.

However, nothing in userspace currently uses them, and is unlikely to
do so in the future, therefore we don't need to create ASLA controls
for them.

These controls can be useful for debug, so we can add a kernel
parameter to re-enable them if necessary.

Disabling these controls would prevent userspace from trying to read
these controls when the CS35L41 is hibernating, which ordinarily
would result in an error message.

Also change the formatting of the other module parameter in
cs35l41_hda.c to match the new parameter.

Signed-off-by: Stefan Binding <sbinding@xxxxxxxxxxxxxxxxxxxxx>
---
sound/pci/hda/cs35l41_hda.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index 4b411ed8c3fe..43d49a69ca14 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -76,8 +76,13 @@ static const struct cirrus_amp_cal_controls cs35l41_calibration_controls = {

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); ");
+MODULE_PARM_DESC(firmware_autostart,
+ "Allow automatic firmware download on boot, (0=Disable, 1=Enable) (default=1)");
+
+static bool expose_dsp_controls;
+module_param(expose_dsp_controls, bool, 0444);
+MODULE_PARM_DESC(expose_dsp_controls,
+ "Expose DSP controls as ALSA controls on boot, (0=Disable, 1=Enable) (default=0)");

static const struct reg_sequence cs35l41_hda_config[] = {
{ CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3072000Hz, BCLK Input, PLL_REFCLK_EN = 1
@@ -603,7 +608,8 @@ static int cs35l41_init_dsp(struct cs35l41_hda *cs35l41)
if (ret)
goto err;

- cs35l41_add_controls(cs35l41);
+ if (expose_dsp_controls)
+ cs35l41_add_controls(cs35l41);

cs35l41_hda_apply_calibration(cs35l41);

--
2.43.0