]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 May 2016 17:18:11 +0000 (19:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 May 2016 17:18:11 +0000 (19:18 +0200)
added patches:
input-ads7846-correct-the-value-got-from-spi.patch

queue-3.14/input-ads7846-correct-the-value-got-from-spi.patch [new file with mode: 0644]
queue-3.14/series

diff --git a/queue-3.14/input-ads7846-correct-the-value-got-from-spi.patch b/queue-3.14/input-ads7846-correct-the-value-got-from-spi.patch
new file mode 100644 (file)
index 0000000..2879624
--- /dev/null
@@ -0,0 +1,59 @@
+From 879f2fea8a5a748bcbf98d2cdce9139c045505d3 Mon Sep 17 00:00:00 2001
+From: Andrey Gelman <andrey.gelman@compulab.co.il>
+Date: Tue, 6 Oct 2015 15:43:43 -0700
+Subject: Input: ads7846 - correct the value got from SPI
+
+From: Andrey Gelman <andrey.gelman@compulab.co.il>
+
+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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/touchscreen/ads7846.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/input/touchscreen/ads7846.c
++++ b/drivers/input/touchscreen/ads7846.c
+@@ -668,18 +668,22 @@ static int ads7846_no_filter(void *ads,
+ static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m)
+ {
++      int value;
+       struct spi_transfer *t =
+               list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
+       if (ts->model == 7845) {
+-              return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3;
++              value = be16_to_cpup((__be16 *)&(((char *)t->rx_buf)[1]));
+       } else {
+               /*
+                * adjust:  on-wire is a must-ignore bit, a BE12 value, then
+                * padding; built from two 8 bit values written msb-first.
+                */
+-              return be16_to_cpup((__be16 *)t->rx_buf) >> 3;
++              value = be16_to_cpup((__be16 *)t->rx_buf);
+       }
++
++      /* enforce ADC output is 12 bits width */
++      return (value >> 3) & 0xfff;
+ }
+ static void ads7846_update_value(struct spi_message *m, int val)
index ea07da4759249826f53844756d0f8d06d5628dad..84ae03a985e268e5ff8aa2a9b85687c4aab0c884 100644 (file)
@@ -19,3 +19,4 @@ acpica-dispatcher-update-thread-id-for-recursive-method-calls.patch
 usb-serial-cp210x-add-id-for-link-ecu.patch
 usb-serial-cp210x-add-straizona-focusers-device-ids.patch
 iio-ak8975-fix-null-pointer-exception-on-early-interrupt.patch
+input-ads7846-correct-the-value-got-from-spi.patch