Skip to contentSkip to conversation

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

PATCH In review Richard Fitzgerald 2 participants 2 messages Nov 27

Subsystems (3)
lore
Share & tools
lore

Richard Fitzgerald

author maintainer
#0 lore raw

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

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.

---
 sound/soc/codecs/cs35l56.c | 72 +++++++++++---------------------------
 1 file changed, 20 insertions(+), 52 deletions(-)
sound/soc/codecs/cs35l56.c +20 -52
index 439063084d4b..0ea8c69d93fc 100644
@@ -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),
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 1 line · Richard Fitzgerald

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