diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-25 22:39:46 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-25 22:39:46 +0100 |
commit | 0bbc367e21bfeea33230d893be4fa3a3ff9bcb48 (patch) | |
tree | 50fb335648a22ac519eddb772714ba64a3e6a7ec /drivers/input/touchscreen/ads7846.c | |
parent | USB: core: Codestyle fix in urb.c (diff) | |
parent | Linux 4.3-rc7 (diff) | |
download | linux-0bbc367e21bfeea33230d893be4fa3a3ff9bcb48.tar.xz linux-0bbc367e21bfeea33230d893be4fa3a3ff9bcb48.zip |
Merge 4.3-rc7 into usb-next
We want the USB and other fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 0f5f968592bd..04edc8f7122f 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -668,18 +668,22 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val) 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) |