From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <tiwai@suse.com>
Cc: <perex@perex.cz>, <alsa-devel@alsa-project.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: [PATCH 4/9] ALSA: hda/cs35l56: Always power-up and start cs_dsp
Date: Mon, 31 Jul 2023 17:57:21 +0100 [thread overview]
Message-ID: <20230731165726.7940-5-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20230731165726.7940-1-rf@opensource.cirrus.com>
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>
---
sound/pci/hda/cs35l56_hda.c | 10 +++-------
1 file 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);
--
2.30.2
next prev parent reply other threads:[~2023-07-31 17:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 16:57 [PATCH 0/9] ALSA: hda/cs35l56: Various bugfixes Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 1/9] ALSA: hda/cs35l56: Complete firmware reboot before calling cs_dsp_run() Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 2/9] ALSA: hda/cs35l56: Do not mark cache dirty after REINIT Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 3/9] ALSA: hda/cs35l56: Call cs_dsp_power_down() before reloading firmware Richard Fitzgerald
2023-07-31 16:57 ` Richard Fitzgerald [this message]
2023-07-31 16:57 ` [PATCH 5/9] ALSA: hda/cs35l56: Call cs_dsp_power_down() before calling cs_dsp_remove() Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 6/9] ALSA: hda/cs35l56: cs_dsp_power_down() on cs35l56_hda_fw_load() error path Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 7/9] ALSA: hda/cs35l56: Do not download firmware over existing RAM firmware Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 8/9] ALSA: hda/cs35l56: Fail if .bin not found and firmware not patched Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 9/9] ALSA: hda/cs35l56: Reject I2C alias addresses Richard Fitzgerald
2023-08-01 6:30 ` [PATCH 0/9] ALSA: hda/cs35l56: Various bugfixes Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230731165726.7940-5-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).