aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/wacom_i2c.c
diff options
context:
space:
mode:
authorTatsunosuke Tobita <tobita.tatsunosuke@wacom.co.jp>2013-06-19 02:13:28 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-06-19 02:19:00 -0400
commit8855f30cd2b68012571932c7b01290c20be4508c (patch)
tree6a82c5944995f01d34b645f7a862b081d69f10cc /drivers/input/touchscreen/wacom_i2c.c
parent9eb521394ea9a50feaf8a9c70b689e4b86ff1b93 (diff)
Input: wacom_i2c - implement hovering capability
Although BTN_TOOL_PEN and BTN_TOOL_RUBBER functioned properly, the driver didn't have hover functionality, so it's been added. Also, "WACOM_RETRY_CNT" was not used, so it was removed. Signed-off-by: Tatsunosuke Tobita <tobita.tatsunosuke@wacom.co.jp> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/wacom_i2c.c')
-rw-r--r--drivers/input/touchscreen/wacom_i2c.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c
index bf0d07620bac..7ccaa1b12b05 100644
--- a/drivers/input/touchscreen/wacom_i2c.c
+++ b/drivers/input/touchscreen/wacom_i2c.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Wacom Penabled Driver for I2C 2 * Wacom Penabled Driver for I2C
3 * 3 *
4 * Copyright (c) 2011 Tatsunosuke Tobita, Wacom. 4 * Copyright (c) 2011 - 2013 Tatsunosuke Tobita, Wacom.
5 * <tobita.tatsunosuke@wacom.co.jp> 5 * <tobita.tatsunosuke@wacom.co.jp>
6 * 6 *
7 * This program is free software; you can redistribute it 7 * This program is free software; you can redistribute it
@@ -27,7 +27,6 @@
27#define WACOM_CMD_THROW0 0x05 27#define WACOM_CMD_THROW0 0x05
28#define WACOM_CMD_THROW1 0x00 28#define WACOM_CMD_THROW1 0x00
29#define WACOM_QUERY_SIZE 19 29#define WACOM_QUERY_SIZE 19
30#define WACOM_RETRY_CNT 100
31 30
32struct wacom_features { 31struct wacom_features {
33 int x_max; 32 int x_max;
@@ -40,6 +39,8 @@ struct wacom_i2c {
40 struct i2c_client *client; 39 struct i2c_client *client;
41 struct input_dev *input; 40 struct input_dev *input;
42 u8 data[WACOM_QUERY_SIZE]; 41 u8 data[WACOM_QUERY_SIZE];
42 bool prox;
43 int tool;
43}; 44};
44 45
45static int wacom_query_device(struct i2c_client *client, 46static int wacom_query_device(struct i2c_client *client,
@@ -112,9 +113,14 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id)
112 y = le16_to_cpup((__le16 *)&data[6]); 113 y = le16_to_cpup((__le16 *)&data[6]);
113 pressure = le16_to_cpup((__le16 *)&data[8]); 114 pressure = le16_to_cpup((__le16 *)&data[8]);
114 115
116 if (!wac_i2c->prox)
117 wac_i2c->tool = (data[3] & 0x0c) ?
118 BTN_TOOL_RUBBER : BTN_TOOL_PEN;
119
120 wac_i2c->prox = data[3] & 0x20;
121
115 input_report_key(input, BTN_TOUCH, tsw || ers); 122 input_report_key(input, BTN_TOUCH, tsw || ers);
116 input_report_key(input, BTN_TOOL_PEN, tsw); 123 input_report_key(input, wac_i2c->tool, wac_i2c->prox);
117 input_report_key(input, BTN_TOOL_RUBBER, ers);
118 input_report_key(input, BTN_STYLUS, f1); 124 input_report_key(input, BTN_STYLUS, f1);
119 input_report_key(input, BTN_STYLUS2, f2); 125 input_report_key(input, BTN_STYLUS2, f2);
120 input_report_abs(input, ABS_X, x); 126 input_report_abs(input, ABS_X, x);