summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2023-07-31 18:57:21 +0200
committerTakashi Iwai <tiwai@suse.de>2023-08-01 08:30:06 +0200
commite5bac77b67082e59f7aceea08a30b5dc66138643 (patch)
treeb9ac25491784e7d4fc2ae396c5a6a7ee7b8171e1
parentALSA: hda/cs35l56: Call cs_dsp_power_down() before reloading firmware (diff)
downloadlinux-e5bac77b67082e59f7aceea08a30b5dc66138643.tar.xz
linux-e5bac77b67082e59f7aceea08a30b5dc66138643.zip
ALSA: hda/cs35l56: Always power-up and start cs_dsp
Always call cs_dsp_power_up() and cs_dsp_run() in cs35l56_hda_fw_load() even if there aren't any firmware files to download. Also, if there aren't any firmware files to download there is no need to do cs35l56_firmware_shutdown() and cs35l56_system_reset(). If there aren't any firmware files there's no need to write anything to the CS35L56 registers to make it work - it will already be running the ROM firmware. So it's not strictly necessary to start cs_dsp. But it's perfectly ok to call cs_dsp_power_up() and cs_dsp_run() without downloading any firmware. This avoids having to support a state where audio is playing but cs_dsp is not running. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230731165726.7940-5-rf@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/cs35l56_hda.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c
index b6b8cb21da75..2870f82bfa45 100644
--- a/sound/pci/hda/cs35l56_hda.c
+++ b/sound/pci/hda/cs35l56_hda.c
@@ -536,10 +536,6 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
cs35l56_hda_request_firmware_files(cs35l56, &wmfw_firmware, &wmfw_filename,
&coeff_firmware, &coeff_filename);
- /* Nothing to do - no firmware files were found to download */
- if (!wmfw_filename && !coeff_filename)
- return 0;
-
mutex_lock(&cs35l56->base.irq_lock);
pm_runtime_get_sync(cs35l56->base.dev);
@@ -549,7 +545,7 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
* shutdown the firmware to apply them and can use the lower cost
* reinit sequence instead.
*/
- if (!cs35l56->base.secured) {
+ if (!cs35l56->base.secured && (wmfw_firmware || coeff_firmware)) {
ret = cs35l56_firmware_shutdown(&cs35l56->base);
if (ret)
goto err;
@@ -572,8 +568,8 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT);
if (ret)
goto err;
- } else {
- /* Reset the device and wait for it to boot */
+ } else if (wmfw_firmware || coeff_firmware) {
+ /* If we downloaded firmware, reset the device and wait for it to boot */
cs35l56_system_reset(&cs35l56->base, false);
regcache_mark_dirty(cs35l56->base.regmap);
ret = cs35l56_wait_for_firmware_boot(&cs35l56->base);