]> git.ipfire.org Git - thirdparty/linux.git/commit
ASoC: ops: fix snd_soc_get_volsw for sx controls
authorStefan Binding <sbinding@opensource.cirrus.com>
Tue, 16 Dec 2025 13:49:20 +0000 (13:49 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 18 Dec 2025 18:18:18 +0000 (18:18 +0000)
commit095d621141826a2841dae85b52c784c147ea99d3
tree1e5f2e253ea9e7e0fa33e8a2887b1f5127cb6e14
parentfa43ab13c59f4c047c479673792ed033ab567c65
ASoC: ops: fix snd_soc_get_volsw for sx controls

SX controls are currently broken, since the clamp introduced in
commit a0ce874cfaaa ("ASoC: ops: improve snd_soc_get_volsw") does not
handle SX controls, for example where the min value in the clamp is
greater than the max value in the clamp.

Add clamp parameter to prevent clamping in SX controls.
The nature of SX controls mean that it wraps around 0, with a variable
number of bits, therefore clamping the value becomes complicated and
prone to error.

Fixes 35 kunit tests for soc_ops_test_access.

Fixes: a0ce874cfaaa ("ASoC: ops: improve snd_soc_get_volsw")
Co-developed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20251216134938.788625-1-sbinding@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-ops.c