iio/adc: ingenic: Fix AUX/VBAT readings when touchscreen is used
authorPaul Cercueil <paul@crapouillou.net>
Tue, 3 Nov 2020 20:12:38 +0000 (20:12 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 8 Nov 2020 15:36:48 +0000 (15:36 +0000)
commit6d6aa2907d59ddd3c0ebb2b93e1ddc84e474485b
tree0704d6d9ae2e454a6a5a67111f67c0aade1cc486
parentc91ebcc578e09783cfa4d85c1b437790f140f29a
iio/adc: ingenic: Fix AUX/VBAT readings when touchscreen is used

When the command feature of the ADC is used, it is possible to program
the ADC, and specify at each step what input should be processed, and in
comparison to what reference.

This broke the AUX and battery readings when the touchscreen was
enabled, most likely because the CMD feature would change the VREF all
the time.

Now, when AUX or battery are read, we temporarily disable the CMD
feature, which means that we won't get touchscreen readings in that time
frame. But it now gives correct values for AUX / battery, and the
touchscreen isn't disabled for long enough to be an actual issue.

Fixes: b96952f498db ("IIO: Ingenic JZ47xx: Add touchscreen mode.")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Artur Rojek <contact@artur-rojek.eu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201103201238.161083-1-paul@crapouillou.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ingenic-adc.c