Skip to contentSkip to conversation

ASoC: cs35l56: Set correct upper volume limit

PATCH In review Richard Fitzgerald 2 participants 4 messages Jul 3, 2024

Subsystems (3)
lore
Share & tools
lore

Richard Fitzgerald

author maintainer
#0 lore raw

cover ASoC: cs35l56: Set correct upper volume limit

These two commits set the upper limit of the Speaker Volume control to +12dB instead of +100dB.

This should have been a simple 1-line change to the #define in the header file, but only the HDA cs35l56 driver is using this define. The ASoC cs35l56 driver was using hardcoded numbers instead of the header defines.

So the first commit changes the ASoC driver to use the #defined constants. The second commit corrects the value of the constant.

Richard Fitzgerald (2):
ASoC: cs35l56: Use header defines for Speaker Volume control
definition
ASoC: cs35l56: Limit Speaker Volume to +12dB maximum

 include/sound/cs35l56.h    | 2 +-
 sound/soc/codecs/cs35l56.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/2 ASoC: cs35l56: Use header defines for Speaker Volume control definition

The "Speaker Volume" control was being defined using four hardcoded magic numbers. There are #defines in the cs35l56.h header for these numbers, so change the code to use the defined constants.

---
 sound/soc/codecs/cs35l56.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l56.c +5 -1
index 7cac9812f5b5..84c34f5b1a51 100644
@@ -71,7 +71,11 @@ static const struct snd_kcontrol_new cs35l56_controls[] = {
 		       cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
 	SOC_SINGLE_S_EXT_TLV("Speaker Volume",
 			     CS35L56_MAIN_RENDER_USER_VOLUME,
-			     6, -400, 400, 9, 0,
+			     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),
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 2/2 ASoC: cs35l56: Limit Speaker Volume to +12dB maximum

In reply to Richard Fitzgerald

Change CS35L56_MAIN_RENDER_USER_VOLUME_MAX to 48, to limit the maximum value of the Speaker Volume control to +12dB. The minimum value is unchanged so that the default 0dB has the same integer control value.

The original maximum of 400 (+100dB) was the largest value that can be mathematically handled by the DSP. The actual maximum amplification is +12dB.

---
 include/sound/cs35l56.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/cs35l56.h +1 -1
index 642ef690ebc2..a6aa112e5741 100644
@@ -207,7 +207,7 @@
 
 /* CS35L56_MAIN_RENDER_USER_VOLUME */
 #define CS35L56_MAIN_RENDER_USER_VOLUME_MIN		-400
-#define CS35L56_MAIN_RENDER_USER_VOLUME_MAX		400
+#define CS35L56_MAIN_RENDER_USER_VOLUME_MAX		48
 #define CS35L56_MAIN_RENDER_USER_VOLUME_MASK		0x0000FFC0
 #define CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT		6
 #define CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT		9
Signature · 1 line
2.39.2
maintainer
#3 lore raw
In reply to Richard Fitzgerald
Quoted 9 lines · Richard Fitzgerald

These two commits set the upper limit of the Speaker Volume control to +12dB instead of +100dB.

This should have been a simple 1-line change to the #define in the header file, but only the HDA cs35l56 driver is using this define. The ASoC cs35l56 driver was using hardcoded numbers instead of the header defines.

[...]

Applied to

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

Thanks!

[1/2] ASoC: cs35l56: Use header defines for Speaker Volume control definition

      commit: c66995ae403073212f5ba60d2079003866c6e130
[2/2] ASoC: cs35l56: Limit Speaker Volume to +12dB maximum
      commit: 244389bd42870640c4b5ef672a360da329b579ed

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