]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: Fix overflow bug in SOC_DOUBLE_R_SX_TLV
authorStuart Longland <redhatter@gentoo.org>
Fri, 18 Jun 2010 02:56:10 +0000 (12:56 +1000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 19 Jun 2010 01:33:44 +0000 (02:33 +0100)
commitbf43dca238b3744e1af56cf0ba437c9f9a5f8faf
tree04e684f6720e9fece574570208d196da9c09574e
parent82b967bf258fda31ed98c857067cb80f4bbfe9e2
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: Stuart Longland <redhatter@gentoo.org>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-core.c