Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: tiwai@suse.com
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: [PATCH] ALSA: hda: cs35l56: Volume/Posture controls don't need to wait for dsp_work
Date: Tue,  1 Dec 2026 11:16:00 +0000	[thread overview]
Message-ID: <20261201111600.458478-1-rf@opensource.cirrus.com> (raw)

Delete the calls to cs35l56_hda_wait_dsp_ready() in the get/put handlers
for the Volume and Posture controls. This wait isn't necessary now.

The original reason for the wait in the get/put handlers was that the
downloaded firmware can patch the registers to non-default values. To
avoid the regmap cache getting out-of-sync with the actual register
value, the ASoC driver fixed up the regmap content at the end of
firmware download. This meant that control get/put had to wait for
firmware download to complete. The HDA driver never had this fixup code
so never needed the wait.

Commit df4167d658d4 ("ASoC: cs35l56: Patch soft registers to defaults")
already removed this fix-up code in the ASoC driver, and instead used
the regmap patch to set volume and posture registers to a default of zero.
When HDA driver firmware download was moved to a workqueue in
commit 634f3b4e7dde ("ALSA: hda: cs35l56: Perform firmware download in the
background") the wait was added to the get/put handlers, copying the
behaviour of the ASoC driver. But this was unnecessary and the equivalent
wait has been removed from the ASoC driver.

When the amp is rebooted after a firmware download, cs35l56_system_reset()
puts the regmap in cache-only and this is only released after the amp has
rebooted. The regcache_sync() near the end of cs35l56_hda_fw_load() will
overwrite the volume and posture registers with the values from the regmap
patch and then write out any non-default cached values.

That means it is safe for the Volume and Posture controls to read/write
regmap any time.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 sound/hda/codecs/side-codecs/cs35l56_hda.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sound/hda/codecs/side-codecs/cs35l56_hda.c b/sound/hda/codecs/side-codecs/cs35l56_hda.c
index 5982eebae152..ba0872ec7c65 100644
--- a/sound/hda/codecs/side-codecs/cs35l56_hda.c
+++ b/sound/hda/codecs/side-codecs/cs35l56_hda.c
@@ -242,8 +242,6 @@ static int cs35l56_hda_posture_get(struct snd_kcontrol *kcontrol,
 	unsigned int pos;
 	int ret;
 
-	cs35l56_hda_wait_dsp_ready(cs35l56);
-
 	ret = regmap_read(cs35l56->base.regmap,
 			  cs35l56->base.fw_reg->posture_number, &pos);
 	if (ret)
@@ -266,8 +264,6 @@ static int cs35l56_hda_posture_put(struct snd_kcontrol *kcontrol,
 	    (pos > CS35L56_MAIN_POSTURE_MAX))
 		return -EINVAL;
 
-	cs35l56_hda_wait_dsp_ready(cs35l56);
-
 	ret = regmap_update_bits_check(cs35l56->base.regmap, cs35l56->base.fw_reg->posture_number,
 				       CS35L56_MAIN_POSTURE_MASK, pos, &changed);
 	if (ret)
@@ -309,8 +305,6 @@ static int cs35l56_hda_vol_get(struct snd_kcontrol *kcontrol,
 	int vol;
 	int ret;
 
-	cs35l56_hda_wait_dsp_ready(cs35l56);
-
 	ret = regmap_read(cs35l56->base.regmap, cs35l56->base.fw_reg->user_volume, &raw_vol);
 
 	if (ret)
@@ -343,8 +337,6 @@ static int cs35l56_hda_vol_put(struct snd_kcontrol *kcontrol,
 	raw_vol = (vol + CS35L56_MAIN_RENDER_USER_VOLUME_MIN) <<
 		  CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT;
 
-	cs35l56_hda_wait_dsp_ready(cs35l56);
-
 	ret = regmap_update_bits_check(cs35l56->base.regmap, cs35l56->base.fw_reg->user_volume,
 				       CS35L56_MAIN_RENDER_USER_VOLUME_MASK, raw_vol, &changed);
 	if (ret)
-- 
2.47.3


                 reply	other threads:[~2026-12-01 11:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261201111600.458478-1-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --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