From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@opensource.cirrus.com
Subject: [PATCH] ASoC: cs35l56: Volume/Mute/Posture controls don't need to wait for dsp_work
Date: Fri, 27 Nov 2026 09:46:17 +0000 [thread overview]
Message-ID: <20261127094617.1932934-1-rf@opensource.cirrus.com> (raw)
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
next reply other threads:[~2026-11-27 9:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 9:46 Richard Fitzgerald [this message]
2026-11-27 15:18 ` Mark Brown
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=20261127094617.1932934-1-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.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
all inboxes | Powered by JetHome®