From: Jason Gerecke <killertofu@gmail.com>
Date: Sat, 19 Apr 2014 20:51:41 +0000 (-0700)
Subject: Input: wacom - handle 1024 pressure levels in wacom_tpc_pen
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=38a1807badd26d413e8f2b0393a0c5bfdf9e912b;p=linux.git

Input: wacom - handle 1024 pressure levels in wacom_tpc_pen

Some tablet PC sensors (e.g. the 0xEC found in the Thinkpad Yoga) report
more than 256 pressure levels and will experience wraparound unless the
full range is read.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Aaron Skomra <Aaron.Skomra@wacom.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 99710e9fdd6a8..4822c57a3756f 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1087,7 +1087,7 @@ static int wacom_tpc_pen(struct wacom_wac *wacom)
 		input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
 		input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
 		input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
-		input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]);
+		input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x03) << 8) | data[6]);
 		input_report_key(input, BTN_TOUCH, data[1] & 0x05);
 		input_report_key(input, wacom->tool[0], prox);
 		return 1;