[PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

Subsystems: atmel maxtouch driver, input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE5503d

6 messages, 4 authors, 2011-08-16 · open the first message on its own page

[PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

From: Yufeng Shen <hidden>
Date: 2011-08-15 15:03:04

Atmel mxt1386 touch controller has the touch pressure information but
the current driver atmel_mxt_ts does not expose it to the user space.
This patch makes the driver report the touch pressure information to
user space.

ChangeLog:
v2: fixed indentation as commented by Wanlong Gao
v3: added signed-off-by

Change-Id: Ie0e4683a3cd5ec79222f7682b0ddc24f909af543
Signed-off-by: Yufeng Shen <redacted>
---
 drivers/input/touchscreen/atmel_mxt_ts.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index ae00604..9bdf4e0 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -244,6 +244,7 @@ struct mxt_finger {
 	int x;
 	int y;
 	int area;
+	int pressure;
 };
 
 /* Each client has this additional data */
@@ -536,6 +537,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
 					finger[id].x);
 			input_report_abs(input_dev, ABS_MT_POSITION_Y,
 					finger[id].y);
+			input_report_abs(input_dev, ABS_MT_PRESSURE,
+					finger[id].pressure);
 		} else {
 			finger[id].status = 0;
 		}
@@ -560,6 +563,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 	int x;
 	int y;
 	int area;
+	int pressure;
 
 	/* Check the touch is present on the screen */
 	if (!(status & MXT_DETECT)) {
@@ -584,6 +588,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 		y = y >> 2;
 
 	area = message->message[4];
+	pressure = message->message[5];
 
 	dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
 		status & MXT_MOVE ? "moved" : "pressed",
@@ -594,6 +599,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 	finger[id].x = x;
 	finger[id].y = y;
 	finger[id].area = area;
+	finger[id].pressure = pressure;
 
 	mxt_input_report(data, id);
 }
@@ -1125,6 +1131,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
 			     0, data->max_x, 0, 0);
 	input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
 			     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);
 	i2c_set_clientdata(client, data);
-- 
1.7.3.1

Re: [PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

From: Wanlong Gao <hidden>
Date: 2011-08-16 00:23:47

On 08/15/2011 11:02 PM, Yufeng Shen wrote:
Atmel mxt1386 touch controller has the touch pressure information but
the current driver atmel_mxt_ts does not expose it to the user space.
This patch makes the driver report the touch pressure information to
user space.

ChangeLog:
v2: fixed indentation as commented by Wanlong Gao
v3: added signed-off-by

Change-Id: Ie0e4683a3cd5ec79222f7682b0ddc24f909af543
Signed-off-by: Yufeng Shen<redacted>
Acked-by: Wanlong Gao <redacted>
quoted hunk
---
  drivers/input/touchscreen/atmel_mxt_ts.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index ae00604..9bdf4e0 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -244,6 +244,7 @@ struct mxt_finger {
  	int x;
  	int y;
  	int area;
+	int pressure;
  };

  /* Each client has this additional data */
@@ -536,6 +537,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
  					finger[id].x);
  			input_report_abs(input_dev, ABS_MT_POSITION_Y,
  					finger[id].y);
+			input_report_abs(input_dev, ABS_MT_PRESSURE,
+					finger[id].pressure);
  		} else {
  			finger[id].status = 0;
  		}
@@ -560,6 +563,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
  	int x;
  	int y;
  	int area;
+	int pressure;

  	/* Check the touch is present on the screen */
  	if (!(status&  MXT_DETECT)) {
@@ -584,6 +588,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
  		y = y>>  2;

  	area = message->message[4];
+	pressure = message->message[5];

  	dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
  		status&  MXT_MOVE ? "moved" : "pressed",
@@ -594,6 +599,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
  	finger[id].x = x;
  	finger[id].y = y;
  	finger[id].area = area;
+	finger[id].pressure = pressure;

  	mxt_input_report(data, id);
  }
@@ -1125,6 +1131,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
  			     0, data->max_x, 0, 0);
  	input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
  			     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);
  	i2c_set_clientdata(client, data);

-- 
Thanks
Wanlong Gao

Re: [PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

From: Henrik Rydberg <hidden>
Date: 2011-08-16 05:26:21

On Mon, Aug 15, 2011 at 11:02:30AM -0400, Yufeng Shen wrote:
quoted hunk
Atmel mxt1386 touch controller has the touch pressure information but
the current driver atmel_mxt_ts does not expose it to the user space.
This patch makes the driver report the touch pressure information to
user space.

ChangeLog:
v2: fixed indentation as commented by Wanlong Gao
v3: added signed-off-by

Change-Id: Ie0e4683a3cd5ec79222f7682b0ddc24f909af543
Signed-off-by: Yufeng Shen <redacted>
---
 drivers/input/touchscreen/atmel_mxt_ts.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index ae00604..9bdf4e0 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -244,6 +244,7 @@ struct mxt_finger {
 	int x;
 	int y;
 	int area;
+	int pressure;
 };
 
 /* Each client has this additional data */
@@ -536,6 +537,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
 					finger[id].x);
 			input_report_abs(input_dev, ABS_MT_POSITION_Y,
 					finger[id].y);
+			input_report_abs(input_dev, ABS_MT_PRESSURE,
+					finger[id].pressure);
 		} else {
 			finger[id].status = 0;
 		}
@@ -560,6 +563,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 	int x;
 	int y;
 	int area;
+	int pressure;
 
 	/* Check the touch is present on the screen */
 	if (!(status & MXT_DETECT)) {
@@ -584,6 +588,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 		y = y >> 2;
 
 	area = message->message[4];
+	pressure = message->message[5];
 
 	dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
 		status & MXT_MOVE ? "moved" : "pressed",
@@ -594,6 +599,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 	finger[id].x = x;
 	finger[id].y = y;
 	finger[id].area = area;
+	finger[id].pressure = pressure;
 
 	mxt_input_report(data, id);
 }
@@ -1125,6 +1131,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
 			     0, data->max_x, 0, 0);
 	input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
 			     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);
 	i2c_set_clientdata(client, data);
-- 
1.7.3.1
    Acked-by: Henrik Rydberg [off-list ref]

Thanks,
Henrik

Re: [PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-08-16 07:20:50

On Tue, Aug 16, 2011 at 07:27:38AM +0200, Henrik Rydberg wrote:
On Mon, Aug 15, 2011 at 11:02:30AM -0400, Yufeng Shen wrote:
quoted
Atmel mxt1386 touch controller has the touch pressure information but
the current driver atmel_mxt_ts does not expose it to the user space.
This patch makes the driver report the touch pressure information to
user space.

ChangeLog:
v2: fixed indentation as commented by Wanlong Gao
v3: added signed-off-by
I think we should be reporting pressure for ST emulation as well. Does
the following version still work for you?

Thanks.

-- 
Dmitry

Input: atmel_mxt_ts - report pressure information from the driver

From: Yufeng Shen <redacted>

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: Yufeng Shen <redacted>
Acked-by: Wanlong Gao <redacted>
Acked-by: Henrik Rydberg <redacted>
Signed-off-by: Dmitry Torokhov <redacted>
---

 drivers/input/touchscreen/atmel_mxt_ts.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index c4f6b81..5bc2065 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -245,6 +245,7 @@ struct mxt_finger {
 	int x;
 	int y;
 	int area;
+	int pressure;
 };
 
 /* Each client has this additional data */
@@ -537,6 +538,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
 					finger[id].x);
 			input_report_abs(input_dev, ABS_MT_POSITION_Y,
 					finger[id].y);
+			input_report_abs(input_dev, ABS_MT_PRESSURE,
+					finger[id].pressure);
 		} else {
 			finger[id].status = 0;
 		}
@@ -547,6 +550,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
 	if (status != MXT_RELEASE) {
 		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_PRESSURE, finger[single_id].pressure);
 	}
 
 	input_sync(input_dev);
@@ -561,6 +566,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 	int x;
 	int y;
 	int area;
+	int pressure;
 
 	/* Check the touch is present on the screen */
 	if (!(status & MXT_DETECT)) {
@@ -585,6 +591,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 		y = y >> 2;
 
 	area = message->message[4];
+	pressure = message->message[5];
 
 	dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
 		status & MXT_MOVE ? "moved" : "pressed",
@@ -595,6 +602,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
 	finger[id].x = x;
 	finger[id].y = y;
 	finger[id].area = area;
+	finger[id].pressure = pressure;
 
 	mxt_input_report(data, id);
 }
@@ -1130,6 +1138,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
 			     0, data->max_x, 0, 0);
 	input_set_abs_params(input_dev, ABS_Y,
 			     0, data->max_y, 0, 0);
+	input_set_abs_params(input_dev, ABS_PRESSURE,
+			     0, 255, 0, 0);
 
 	/* For multi touch */
 	input_mt_init_slots(input_dev, MXT_MAX_FINGER);
@@ -1139,6 +1149,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
 			     0, data->max_x, 0, 0);
 	input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
 			     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);
 	i2c_set_clientdata(client, data);

Re: [PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

From: Yufeng Shen <hidden>
Date: 2011-08-16 18:17:53

Re-sent from proper email account and sorry for the spam.

-----------------------------------------------------------------------------------------------------------------------

Tested that adding  ABS_PRESSURE to ST works properly.
Do you want me to submit a new patch or is this good enough for you to merge ?
Thanks.

On Tue, Aug 16, 2011 at 3:20 AM, Dmitry Torokhov
[off-list ref] wrote:
quoted hunk
On Tue, Aug 16, 2011 at 07:27:38AM +0200, Henrik Rydberg wrote:
quoted
On Mon, Aug 15, 2011 at 11:02:30AM -0400, Yufeng Shen wrote:
quoted
Atmel mxt1386 touch controller has the touch pressure information but
the current driver atmel_mxt_ts does not expose it to the user space.
This patch makes the driver report the touch pressure information to
user space.

ChangeLog:
v2: fixed indentation as commented by Wanlong Gao
v3: added signed-off-by
I think we should be reporting pressure for ST emulation as well. Does
the following version still work for you?

Thanks.

--
Dmitry

Input: atmel_mxt_ts - report pressure information from the driver

From: Yufeng Shen <redacted>

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: Yufeng Shen <redacted>
Acked-by: Wanlong Gao <redacted>
Acked-by: Henrik Rydberg <redacted>
Signed-off-by: Dmitry Torokhov <redacted>
---

 drivers/input/touchscreen/atmel_mxt_ts.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index c4f6b81..5bc2065 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -245,6 +245,7 @@ struct mxt_finger {
       int x;
       int y;
       int area;
+       int pressure;
 };

 /* Each client has this additional data */
@@ -537,6 +538,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
                                       finger[id].x);
                       input_report_abs(input_dev, ABS_MT_POSITION_Y,
                                       finger[id].y);
+                       input_report_abs(input_dev, ABS_MT_PRESSURE,
+                                       finger[id].pressure);
               } else {
                       finger[id].status = 0;
               }
@@ -547,6 +550,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id)
       if (status != MXT_RELEASE) {
               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_PRESSURE, finger[single_id].pressure);
       }

       input_sync(input_dev);
@@ -561,6 +566,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
       int x;
       int y;
       int area;
+       int pressure;

       /* Check the touch is present on the screen */
       if (!(status & MXT_DETECT)) {
@@ -585,6 +591,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
               y = y >> 2;

       area = message->message[4];
+       pressure = message->message[5];

       dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id,
               status & MXT_MOVE ? "moved" : "pressed",
@@ -595,6 +602,7 @@ static void mxt_input_touchevent(struct mxt_data *data,
       finger[id].x = x;
       finger[id].y = y;
       finger[id].area = area;
+       finger[id].pressure = pressure;

       mxt_input_report(data, id);
 }
@@ -1130,6 +1138,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
                            0, data->max_x, 0, 0);
       input_set_abs_params(input_dev, ABS_Y,
                            0, data->max_y, 0, 0);
+       input_set_abs_params(input_dev, ABS_PRESSURE,
+                            0, 255, 0, 0);

       /* For multi touch */
       input_mt_init_slots(input_dev, MXT_MAX_FINGER);
@@ -1139,6 +1149,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
                            0, data->max_x, 0, 0);
       input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
                            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);
       i2c_set_clientdata(client, data);
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3] Input: atmel_mxt_ts - Report pressure information from the driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-08-16 18:28:07

On Tue, Aug 16, 2011 at 02:17:49PM -0400, Yufeng Shen wrote:
Re-sent from proper email account and sorry for the spam.

-----------------------------------------------------------------------------------------------------------------------

Tested that adding  ABS_PRESSURE to ST works properly.
Do you want me to submit a new patch or is this good enough for you to merge ?
Thanks.
No, there is no need to resend.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help