Skip to content

Commit 34e1b1b

Browse files
simontrimmertiwai
authored andcommitted
ALSA: hda: cs35l56: Stop creating ALSA controls for firmware coefficients
A number of laptops have gone to market with old firmware versions that export controls that have since been hidden, but we can't just install a newer firmware because the firmware for each product is customized and qualified by the OEM. The issue is that alsactl save and restore has no idea what controls are good to persist which can lead to misconfiguration. There is no reason that the UCM or user should need to interact with any of the ALSA controls for the firmware coefficients so they can be removed entirely, this also simplifies the driver. Signed-off-by: Simon Trimmer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent de9c2c6 commit 34e1b1b

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

sound/pci/hda/cs35l56_hda.c

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -559,18 +559,6 @@ static void cs35l56_hda_release_firmware_files(const struct firmware *wmfw_firmw
559559
kfree(coeff_filename);
560560
}
561561

562-
static void cs35l56_hda_create_dsp_controls_work(struct work_struct *work)
563-
{
564-
struct cs35l56_hda *cs35l56 = container_of(work, struct cs35l56_hda, control_work);
565-
struct hda_cs_dsp_ctl_info info;
566-
567-
info.device_name = cs35l56->amp_name;
568-
info.fw_type = HDA_CS_DSP_FW_MISC;
569-
info.card = cs35l56->codec->card;
570-
571-
hda_cs_dsp_add_controls(&cs35l56->cs_dsp, &info);
572-
}
573-
574562
static void cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56)
575563
{
576564
int ret;
@@ -595,26 +583,15 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
595583
char *wmfw_filename = NULL;
596584
unsigned int preloaded_fw_ver;
597585
bool firmware_missing;
598-
bool add_dsp_controls_required = false;
599586
int ret;
600587

601-
/*
602-
* control_work must be flushed before proceeding, but we can't do that
603-
* here as it would create a deadlock on controls_rwsem so it must be
604-
* performed before queuing dsp_work.
605-
*/
606-
WARN_ON_ONCE(work_busy(&cs35l56->control_work));
607-
608588
/*
609589
* Prepare for a new DSP power-up. If the DSP has had firmware
610590
* downloaded previously then it needs to be powered down so that it
611-
* can be updated and if hadn't been patched before then the controls
612-
* will need to be added once firmware download succeeds.
591+
* can be updated.
613592
*/
614593
if (cs35l56->base.fw_patched)
615594
cs_dsp_power_down(&cs35l56->cs_dsp);
616-
else
617-
add_dsp_controls_required = true;
618595

619596
cs35l56->base.fw_patched = false;
620597

@@ -698,15 +675,6 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
698675
CS35L56_FIRMWARE_MISSING);
699676
cs35l56->base.fw_patched = true;
700677

701-
/*
702-
* Adding controls is deferred to prevent a lock inversion - ALSA takes
703-
* the controls_rwsem when adding a control, the get() / put()
704-
* functions of a control are called holding controls_rwsem and those
705-
* that depend on running firmware wait for dsp_work() to complete.
706-
*/
707-
if (add_dsp_controls_required)
708-
queue_work(system_long_wq, &cs35l56->control_work);
709-
710678
ret = cs_dsp_run(&cs35l56->cs_dsp);
711679
if (ret)
712680
dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret);
@@ -753,7 +721,6 @@ static int cs35l56_hda_bind(struct device *dev, struct device *master, void *mas
753721
strscpy(comp->name, dev_name(dev), sizeof(comp->name));
754722
comp->playback_hook = cs35l56_hda_playback_hook;
755723

756-
flush_work(&cs35l56->control_work);
757724
queue_work(system_long_wq, &cs35l56->dsp_work);
758725

759726
cs35l56_hda_create_controls(cs35l56);
@@ -775,7 +742,6 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
775742
struct hda_component *comp;
776743

777744
cancel_work_sync(&cs35l56->dsp_work);
778-
cancel_work_sync(&cs35l56->control_work);
779745

780746
cs35l56_hda_remove_controls(cs35l56);
781747

@@ -806,7 +772,6 @@ static int cs35l56_hda_system_suspend(struct device *dev)
806772
struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
807773

808774
cs35l56_hda_wait_dsp_ready(cs35l56);
809-
flush_work(&cs35l56->control_work);
810775

811776
if (cs35l56->playing)
812777
cs35l56_hda_pause(cs35l56);
@@ -1026,7 +991,6 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id)
1026991
dev_set_drvdata(cs35l56->base.dev, cs35l56);
1027992

1028993
INIT_WORK(&cs35l56->dsp_work, cs35l56_hda_dsp_work);
1029-
INIT_WORK(&cs35l56->control_work, cs35l56_hda_create_dsp_controls_work);
1030994

1031995
ret = cs35l56_hda_read_acpi(cs35l56, hid, id);
1032996
if (ret)

sound/pci/hda/cs35l56_hda.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ struct cs35l56_hda {
2323
struct cs35l56_base base;
2424
struct hda_codec *codec;
2525
struct work_struct dsp_work;
26-
struct work_struct control_work;
2726

2827
int index;
2928
const char *system_name;

0 commit comments

Comments
 (0)