]> www.infradead.org Git - users/willy/pagecache.git/commit
ASoC: ops: Consistently treat platform_max as control value
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 28 Feb 2025 15:14:56 +0000 (15:14 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 5 Mar 2025 17:25:25 +0000 (17:25 +0000)
commit0eba2a7e858907a746ba69cd002eb9eb4dbd7bf3
tree90a790819c504ca80712e19f52f89eeffa172619
parent927e6bec5cf3624665b0a2e9f64a1d32f3d22cdd
ASoC: ops: Consistently treat platform_max as control value

This reverts commit 9bdd10d57a88 ("ASoC: ops: Shift tested values in
snd_soc_put_volsw() by +min"), and makes some additional related
updates.

There are two ways the platform_max could be interpreted; the maximum
register value, or the maximum value the control can be set to. The
patch moved from treating the value as a control value to a register
one. When the patch was applied it was technically correct as
snd_soc_limit_volume() also used the register interpretation. However,
even then most of the other usages treated platform_max as a
control value, and snd_soc_limit_volume() has since been updated to
also do so in commit fb9ad24485087 ("ASoC: ops: add correct range
check for limiting volume"). That patch however, missed updating
snd_soc_put_volsw() back to the control interpretation, and fixing
snd_soc_info_volsw_range(). The control interpretation makes more
sense as limiting is typically done from the machine driver, so it is
appropriate to use the customer facing representation rather than the
internal codec representation. Update all the code to consistently use
this interpretation of platform_max.

Finally, also add some comments to the soc_mixer_control struct to
hopefully avoid further patches switching between the two approaches.

Fixes: fb9ad24485087 ("ASoC: ops: add correct range check for limiting volume")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250228151456.3703342-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-ops.c