mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work
@ 2026-11-27  9:46 Richard Fitzgerald
  2026-11-27 15:18 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2026-11-27  9:46 UTC (permalink / raw)
  To: broonie; +Cc: linux-sound, linux-kernel, patches

Remove the special get/put handlers for the Volume/Mute/Posture controls.
These are not necessary now.

The original reason for the special 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 regmap content was fixed-up at the end of cs35l56_dsp_work(). This
meant that control get/put had to wait for cs35l56_dsp_work() to complete.

This is now unnecessary since commit df4167d658d4 ("ASoC: cs35l56: Patch
soft registers to defaults") removed this fix-up code, and instead used
the regmap patch to set volume/mute/posture registers to a default of
zero.

When the amp is rebooted after a firmware download,
cs35l56_system_reset() puts regmap in cache-only and this is only released
in cs35l56_init() after the amp has rebooted. The regcache_sync() in
cs35l56_init() will overwrite the volume/mute/posture registers with the
values from the regmap patch and then write out the content of the cache.

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

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 sound/soc/codecs/cs35l56.c | 72 +++++++++++---------------------------
 1 file changed, 20 insertions(+), 52 deletions(-)

diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 439063084d4b..0ea8c69d93fc 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -103,26 +103,6 @@ static void cs35l56_wait_dsp_ready(struct cs35l56_private *cs35l56)
 	flush_work(&cs35l56->dsp_work);
 }
 
-static int cs35l56_dspwait_get_volsw(struct snd_kcontrol *kcontrol,
-				     struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-	struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
-
-	cs35l56_wait_dsp_ready(cs35l56);
-	return snd_soc_get_volsw(kcontrol, ucontrol);
-}
-
-static int cs35l56_dspwait_put_volsw(struct snd_kcontrol *kcontrol,
-				     struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-	struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
-
-	cs35l56_wait_dsp_ready(cs35l56);
-	return snd_soc_put_volsw(kcontrol, ucontrol);
-}
-
 static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0);
 
 static SOC_ENUM_SINGLE_DECL(cs35l56_cal_set_status_enum, SND_SOC_NOPM, 0,
@@ -138,44 +118,32 @@ static int cs35l56_cal_set_status_ctl_get(struct snd_kcontrol *kcontrol,
 }
 
 static const struct snd_kcontrol_new cs35l56_controls[] = {
-	SOC_SINGLE_EXT("Speaker Switch",
-		       CS35L56_MAIN_RENDER_USER_MUTE, 0, 1, 1,
-		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
-	SOC_SINGLE_S_EXT_TLV("Speaker Volume",
-			     CS35L56_MAIN_RENDER_USER_VOLUME,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_MIN,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_MAX,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT,
-			     0,
-			     cs35l56_dspwait_get_volsw,
-			     cs35l56_dspwait_put_volsw,
-			     vol_tlv),
-	SOC_SINGLE_EXT("Posture Number", CS35L56_MAIN_POSTURE_NUMBER,
-		       0, 255, 0,
-		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
+	SOC_SINGLE("Speaker Switch", CS35L56_MAIN_RENDER_USER_MUTE, 0, 1, 1),
+	SOC_SINGLE_S_TLV("Speaker Volume",
+			 CS35L56_MAIN_RENDER_USER_VOLUME,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_MIN,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_MAX,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT,
+			 0,
+			 vol_tlv),
+	SOC_SINGLE("Posture Number", CS35L56_MAIN_POSTURE_NUMBER, 0, 255, 0),
 	SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
 			 cs35l56_cal_set_status_ctl_get, NULL,
 			 SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
 };
 
 static const struct snd_kcontrol_new cs35l63_controls[] = {
-	SOC_SINGLE_EXT("Speaker Switch",
-		       CS35L63_MAIN_RENDER_USER_MUTE, 0, 1, 1,
-		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
-	SOC_SINGLE_S_EXT_TLV("Speaker Volume",
-			     CS35L63_MAIN_RENDER_USER_VOLUME,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_MIN,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_MAX,
-			     CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT,
-			     0,
-			     cs35l56_dspwait_get_volsw,
-			     cs35l56_dspwait_put_volsw,
-			     vol_tlv),
-	SOC_SINGLE_EXT("Posture Number", CS35L63_MAIN_POSTURE_NUMBER,
-		       0, 255, 0,
-		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
+	SOC_SINGLE("Speaker Switch", CS35L63_MAIN_RENDER_USER_MUTE, 0, 1, 1),
+	SOC_SINGLE_S_TLV("Speaker Volume",
+			 CS35L63_MAIN_RENDER_USER_VOLUME,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_MIN,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_MAX,
+			 CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT,
+			 0,
+			 vol_tlv),
+	SOC_SINGLE("Posture Number", CS35L63_MAIN_POSTURE_NUMBER, 0, 255, 0),
 	SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
 			 cs35l56_cal_set_status_ctl_get, NULL,
 			 SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
-- 
2.47.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work
  2026-11-27  9:46 [PATCH] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work Richard Fitzgerald
@ 2026-11-27 15:18 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-11-27 15:18 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: linux-sound, linux-kernel, patches

On Fri, 27 Nov 2026 09:46:17 +0000, Richard Fitzgerald wrote:
> ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

[1/1] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work
      https://git.kernel.org/broonie/sound/c/fbf1f115ba41

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-27 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  9:46 [PATCH] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work Richard Fitzgerald
2026-11-27 15:18 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®