ASoC: ops: Correct bounds check for second channel on SX controls
Subsystems (3)
PATCH 1/2 ASoC: ops: Correct bounds check for second channel on SX controls
Currently the check against the max value for the control is being applied after the value has had the minimum applied and been masked. But the max value simply indicates the number of volume levels on an SX control, and as such should just be applied on the raw value.
--- sound/soc/soc-ops.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/soc-ops.c +3 -4
@@ -464,16 +464,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, ret = err;if (snd_soc_volsw_is_stereo (mc)) { -unsigned int val2; - - val_mask = mask << rshift; - val2 = (ucontrol->value.integer.value[1 ] + min) & mask; +unsigned int val2 = ucontrol->value.integer.value[1 ];if (mc->platform_max && val2 > mc->platform_max)return -EINVAL ;if (val2 > max)return -EINVAL ; + val_mask = mask << rshift; + val2 = (val2 + min) & mask; val2 = val2 << rshift; err = snd_soc_component_update_bits(component, reg2, val_mask,
Signature · 1 line
2.30.2
PATCH 2/2 ASoC: cs42l51: Correct PGA Volume minimum value
The table in the datasheet actually shows the volume values in the wrong order, with the two -3dB values being reversed. This appears to have caused the lower of the two values to be used in the driver when the higher should have been, correct this mixup.
--- sound/soc/codecs/cs42l51.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs42l51.c +1 -1
@@ -143,7 +143,7 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = { 0, 0xA0, 96, adc_att_tlv),SOC_DOUBLE_R_SX_TLV ("PGA Volume" ,CS42L51_ALC_PGA_CTL ,CS42L51_ALC_PGB_CTL , -0 ,0x19 ,30 , pga_tlv), +0 ,0x1A ,30 , pga_tlv),SOC_SINGLE ("Playback Deemphasis Switch" ,CS42L51_DAC_CTL ,3 ,1 ,0 ),SOC_SINGLE ("Auto-Mute Switch" ,CS42L51_DAC_CTL ,2 ,1 ,0 ), SOC_SINGLE("Soft Ramp Switch", CS42L51_DAC_CTL, 1, 1, 0),
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 1 line · Charles Keepax
Fixes e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()")
You probably mean 97eea946b93961fffd29448dcda7398d0d51c4b2.
Quoted 5 lines · Mark Brown
Quoted 1 line · Charles Keepax
Fixes e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()")You probably mean
97eea946b93961fffd29448dcda7398d0d51c4b2.
Sigh, sorry about that will send a new version.
Thanks,
Charles
Mark Brown
maintainerQuoted 5 lines · Charles Keepax
Quoted 1 line · Mark Brown
You probably mean
97eea946b93961fffd29448dcda7398d0d51c4b2.Sigh, sorry about that will send a new version.
No, it's fine.
Mark Brown
maintainerQuoted 6 lines · Charles Keepax
Currently the check against the max value for the control is being applied after the value has had the minimum applied and been masked. But the max value simply indicates the number of volume levels on an SX control, and as such should just be applied on the raw value.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: ops: Correct bounds check for second channel on SX controls
commit: f33bcc506050f89433a52a3052054d4ebd37b1c1
[2/2] ASoC: cs42l51: Correct PGA Volume minimum value
commit: 3d1bb6cc1a654c8693a85b1d262e610196edec8bAll 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