Commit 28ac2933 authored by Yufeng Shen's avatar Yufeng Shen Committed by Dmitry Torokhov

Input: atmel_mxt_ts - report pressure information from the driver

Atmel mxt1386 touch controller has the touch pressure information so
let's report it to the user space.

[dtor@mail.ru: added ABS_RESSURE reporting for ST emulation.]
Signed-off-by: default avatarYufeng Shen <miletus@chromium.org>
Acked-by: default avatarWanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-by: default avatarHenrik Rydberg <rydberg@euromail.se>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent c331eb58
...@@ -244,6 +244,7 @@ struct mxt_finger { ...@@ -244,6 +244,7 @@ struct mxt_finger {
int x; int x;
int y; int y;
int area; int area;
int pressure;
}; };
/* Each client has this additional data */ /* Each client has this additional data */
...@@ -536,6 +537,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id) ...@@ -536,6 +537,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
finger[id].x); finger[id].x);
input_report_abs(input_dev, ABS_MT_POSITION_Y, input_report_abs(input_dev, ABS_MT_POSITION_Y,
finger[id].y); finger[id].y);
input_report_abs(input_dev, ABS_MT_PRESSURE,
finger[id].pressure);
} else { } else {
finger[id].status = 0; finger[id].status = 0;
} }
...@@ -546,6 +549,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id) ...@@ -546,6 +549,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
if (status != MXT_RELEASE) { if (status != MXT_RELEASE) {
input_report_abs(input_dev, ABS_X, finger[single_id].x); input_report_abs(input_dev, ABS_X, finger[single_id].x);
input_report_abs(input_dev, ABS_Y, finger[single_id].y); input_report_abs(input_dev, ABS_Y, finger[single_id].y);
input_report_abs(input_dev,
ABS_PRESSURE, finger[single_id].pressure);
} }
input_sync(input_dev); input_sync(input_dev);
...@@ -560,6 +565,7 @@ static void mxt_input_touchevent(struct mxt_data *data, ...@@ -560,6 +565,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
int x; int x;
int y; int y;
int area; int area;
int pressure;
/* Check the touch is present on the screen */ /* Check the touch is present on the screen */
if (!(status & MXT_DETECT)) { if (!(status & MXT_DETECT)) {
...@@ -584,6 +590,7 @@ static void mxt_input_touchevent(struct mxt_data *data, ...@@ -584,6 +590,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
y = y >> 2; y = y >> 2;
area = message->message[4]; area = message->message[4];
pressure = message->message[5];
dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
status & MXT_MOVE ? "moved" : "pressed", status & MXT_MOVE ? "moved" : "pressed",
...@@ -594,6 +601,7 @@ static void mxt_input_touchevent(struct mxt_data *data, ...@@ -594,6 +601,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
finger[id].x = x; finger[id].x = x;
finger[id].y = y; finger[id].y = y;
finger[id].area = area; finger[id].area = area;
finger[id].pressure = pressure;
mxt_input_report(data, id); mxt_input_report(data, id);
} }
...@@ -1116,6 +1124,8 @@ static int __devinit mxt_probe(struct i2c_client *client, ...@@ -1116,6 +1124,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
0, data->max_x, 0, 0); 0, data->max_x, 0, 0);
input_set_abs_params(input_dev, ABS_Y, input_set_abs_params(input_dev, ABS_Y,
0, data->max_y, 0, 0); 0, data->max_y, 0, 0);
input_set_abs_params(input_dev, ABS_PRESSURE,
0, 255, 0, 0);
/* For multi touch */ /* For multi touch */
input_mt_init_slots(input_dev, MXT_MAX_FINGER); input_mt_init_slots(input_dev, MXT_MAX_FINGER);
...@@ -1125,6 +1135,8 @@ static int __devinit mxt_probe(struct i2c_client *client, ...@@ -1125,6 +1135,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
0, data->max_x, 0, 0); 0, data->max_x, 0, 0);
input_set_abs_params(input_dev, ABS_MT_POSITION_Y, input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
0, data->max_y, 0, 0); 0, data->max_y, 0, 0);
input_set_abs_params(input_dev, ABS_MT_PRESSURE,
0, 255, 0, 0);
input_set_drvdata(input_dev, data); input_set_drvdata(input_dev, data);
i2c_set_clientdata(client, data); i2c_set_clientdata(client, data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment