[PATCH] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work

From: Richard Fitzgerald

Date: Fri Nov 27 2026 - 04:49:15 EST


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@xxxxxxxxxxxxxxxxxxxxx>
---
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