]> git.itanic.dy.fi Git - linux-stable/commit
Input: ads7846 - correct the value got from SPI
authorAndrey Gelman <andrey.gelman@compulab.co.il>
Tue, 6 Oct 2015 22:43:43 +0000 (15:43 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 12 Oct 2017 14:28:16 +0000 (15:28 +0100)
commit34fff37b6442a580a8b7e91aa93dd647c7d50dde
tree9a0e8a4a1f1eddd6033ff9ead0377e29f860fef5
parente854c4d34f99ea3e76856cdd809f1e405c00f266
Input: ads7846 - correct the value got from SPI

commit 879f2fea8a5a748bcbf98d2cdce9139c045505d3 upstream.

According to the touch controller spec, SPI return a 16 bit value, only 12
bits are valid, they are bit[14-3].

The value of MISO and MOSI can be configured when SPI is in idle mode.
Currently this touch driver assumes the SPI bus sets the MOSI and MISO in
low level when SPI bus is in idle mode. So the bit[15] of the value got
from SPI bus is always 0. But when SPI bus congfigures the MOSI and MISO in
high level during the SPI idle mode, the bit[15] of the value get from SPI
is always 1. If bit[15] is not masked, we may get the wrong value.

Mask the invalid bit to make sure the correct value gets returned.
Regardless of the SPI bus idle configuration.

Signed-off-by: Andrey Gelman <andrey.gelman@compulab.co.il>
Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/input/touchscreen/ads7846.c