summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorGary King <gking@nvidia.com>2010-09-10 18:43:14 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:35:51 -0800
commit122b85eda2b19c6c24e90086fe932e538d5f27ad (patch)
treeb05e4f5d69935de9546c2921800078de4f0dce7f /drivers/input/touchscreen
parent746c57df441a468bf4dfb0eb339621684d625012 (diff)
touchscreen: panjit: use multi-touch reporting interface
Change-Id: I2bcad8cd07725e36598545168f33b87b9f217c11 Signed-off-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/panjit_i2c.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/input/touchscreen/panjit_i2c.c b/drivers/input/touchscreen/panjit_i2c.c
index 6d82cec45ed9..16df9313a10f 100644
--- a/drivers/input/touchscreen/panjit_i2c.c
+++ b/drivers/input/touchscreen/panjit_i2c.c
@@ -45,10 +45,7 @@ struct pj_data {
};
struct pj_event {
- __be16 x0;
- __be16 y0;
- __be16 x1;
- __be16 y1;
+ __be16 coord[2][2];
__u8 fingers;
__u8 gesture;
};
@@ -74,9 +71,7 @@ static irqreturn_t pj_irq(int irq, void *dev_id)
struct pj_data *touch = dev_id;
struct i2c_client *client = touch->client;
union pj_buff event;
- unsigned short x, y;
- int offs;
- int ret;
+ int ret, i;
ret = i2c_smbus_read_i2c_block_data(client, X1_H,
sizeof(event.buff), event.buff);
@@ -97,23 +92,14 @@ static irqreturn_t pj_irq(int irq, void *dev_id)
if (!event.data.fingers || (event.data.fingers > 2))
goto out;
- offs = (event.data.fingers == 2) ? ABS_HAT0X : ABS_X;
-
- x = __be16_to_cpu(event.data.x0);
- y = __be16_to_cpu(event.data.y0);
-
- dev_dbg(&client->dev, "f[0] x=%u, y=%u\n", x, y);
- input_report_abs(touch->input_dev, offs, x);
- input_report_abs(touch->input_dev, offs + 1, y);
-
- if (event.data.fingers == 1)
- goto out;
-
- x = __be16_to_cpu(event.data.x1);
- y = __be16_to_cpu(event.data.y1);
- dev_dbg(&client->dev, "f[1] x=%u, y=%u\n", x, y);
- input_report_abs(touch->input_dev, ABS_HAT1X, x);
- input_report_abs(touch->input_dev, ABS_HAT1Y, y);
+ for (i = 0; i < event.data.fingers; i++) {
+ input_report_abs(touch->input_dev, ABS_MT_POSITION_X,
+ __be16_to_cpu(event.data.coord[i][0]));
+ input_report_abs(touch->input_dev, ABS_MT_POSITION_Y,
+ __be16_to_cpu(event.data.coord[i][1]));
+ input_report_abs(touch->input_dev, ABS_MT_TRACKING_ID, i + 1);
+ input_mt_sync(touch->input_dev);
+ }
out:
input_sync(touch->input_dev);
@@ -203,6 +189,7 @@ static int pj_probe(struct i2c_client *client,
input_set_abs_params(touch->input_dev, ABS_MT_POSITION_X, 0, 4095, 0, 0);
input_set_abs_params(touch->input_dev, ABS_MT_POSITION_Y, 0, 4095, 0, 0);
+ input_set_abs_params(touch->input_dev, ABS_MT_TRACKING_ID, 0, 2, 1, 0);
ret = input_register_device(touch->input_dev);
if (ret) {