Skip to content
Commit 20630c7f authored by Stuart Longland's avatar Stuart Longland Committed by Mark Brown
Browse files

ASoC: Fix overflow bug in SOC_DOUBLE_R_SX_TLV



When SX_TLV widgets are read, if the gain is set to a value below 0dB,
the mixer control is erroniously read as being at maximum volume.

The value read out of the CODEC register is never sign-extended, and
when the minimum value is subtracted (read; added, since the minimum is
negative) the result is a number greater than the maximum allowed value
for the control, and hence it saturates.

Solution: Mask the result so that it "wraps around", emulating
sign-extension.

Signed-off-by: default avatarStuart Longland <redhatter@gentoo.org>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 43793207
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment