* [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls
@ 2022-11-25 16:23 Charles Keepax
2022-11-25 16:23 ` [PATCH 2/2] ASoC: cs42l51: Correct PGA Volume minimum value Charles Keepax
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Charles Keepax @ 2022-11-25 16:23 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, guille.rodriguez, patches, lgirdwood, david.rhodes,
james.schulman
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.
Fixes: e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
sound/soc/soc-ops.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 1970bda074d8a..55b009d3c6815 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -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,
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] ASoC: cs42l51: Correct PGA Volume minimum value 2022-11-25 16:23 [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Charles Keepax @ 2022-11-25 16:23 ` Charles Keepax 2022-11-25 16:29 ` [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Mark Brown 2022-11-25 21:28 ` Mark Brown 2 siblings, 0 replies; 6+ messages in thread From: Charles Keepax @ 2022-11-25 16:23 UTC (permalink / raw) To: broonie Cc: alsa-devel, guille.rodriguez, patches, lgirdwood, david.rhodes, james.schulman 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. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> --- sound/soc/codecs/cs42l51.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 51721edd8f53c..e88d9ff95cdfc 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -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), -- 2.30.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls 2022-11-25 16:23 [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Charles Keepax 2022-11-25 16:23 ` [PATCH 2/2] ASoC: cs42l51: Correct PGA Volume minimum value Charles Keepax @ 2022-11-25 16:29 ` Mark Brown 2022-11-25 16:35 ` Charles Keepax 2022-11-25 21:28 ` Mark Brown 2 siblings, 1 reply; 6+ messages in thread From: Mark Brown @ 2022-11-25 16:29 UTC (permalink / raw) To: Charles Keepax Cc: alsa-devel, guille.rodriguez, patches, lgirdwood, david.rhodes, james.schulman [-- Attachment #1: Type: text/plain, Size: 221 bytes --] On Fri, Nov 25, 2022 at 04:23:47PM +0000, Charles Keepax wrote: > Fixes: e9b397afabb8 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()") You probably mean 97eea946b93961fffd29448dcda7398d0d51c4b2. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls 2022-11-25 16:29 ` [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Mark Brown @ 2022-11-25 16:35 ` Charles Keepax 2022-11-25 16:39 ` Mark Brown 0 siblings, 1 reply; 6+ messages in thread From: Charles Keepax @ 2022-11-25 16:35 UTC (permalink / raw) To: Mark Brown Cc: alsa-devel, guille.rodriguez, patches, lgirdwood, david.rhodes, james.schulman On Fri, Nov 25, 2022 at 04:29:57PM +0000, Mark Brown wrote: > On Fri, Nov 25, 2022 at 04:23:47PM +0000, Charles Keepax wrote: > > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls 2022-11-25 16:35 ` Charles Keepax @ 2022-11-25 16:39 ` Mark Brown 0 siblings, 0 replies; 6+ messages in thread From: Mark Brown @ 2022-11-25 16:39 UTC (permalink / raw) To: Charles Keepax Cc: alsa-devel, guille.rodriguez, patches, lgirdwood, david.rhodes, james.schulman [-- Attachment #1: Type: text/plain, Size: 258 bytes --] On Fri, Nov 25, 2022 at 04:35:09PM +0000, Charles Keepax wrote: > On Fri, Nov 25, 2022 at 04:29:57PM +0000, Mark Brown wrote: > > You probably mean 97eea946b93961fffd29448dcda7398d0d51c4b2. > Sigh, sorry about that will send a new version. No, it's fine. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls 2022-11-25 16:23 [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Charles Keepax 2022-11-25 16:23 ` [PATCH 2/2] ASoC: cs42l51: Correct PGA Volume minimum value Charles Keepax 2022-11-25 16:29 ` [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Mark Brown @ 2022-11-25 21:28 ` Mark Brown 2 siblings, 0 replies; 6+ messages in thread From: Mark Brown @ 2022-11-25 21:28 UTC (permalink / raw) To: Charles Keepax Cc: alsa-devel, guille.rodriguez, patches, lgirdwood, james.schulman, david.rhodes On Fri, 25 Nov 2022 16:23:47 +0000, Charles Keepax wrote: > 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: 3d1bb6cc1a654c8693a85b1d262e610196edec8b 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-25 21:29 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-11-25 16:23 [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Charles Keepax 2022-11-25 16:23 ` [PATCH 2/2] ASoC: cs42l51: Correct PGA Volume minimum value Charles Keepax 2022-11-25 16:29 ` [PATCH 1/2] ASoC: ops: Correct bounds check for second channel on SX controls Mark Brown 2022-11-25 16:35 ` Charles Keepax 2022-11-25 16:39 ` Mark Brown 2022-11-25 21:28 ` Mark Brown
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.