diff mbox series

[v4,04/10] Input: wacom_i2c - Add touchscren properties

Message ID 20210326015229.141-4-alistair@alistair23.me
State New
Headers show
Series [v4,01/10] dt-bindings: Add Wacom to vendor bindings | expand

Commit Message

Alistair March 26, 2021, 1:52 a.m. UTC
Connect touchscreen properties to the wacom_i2c.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
v4:
 - Add touchscreen_report_pos() as well

 drivers/input/touchscreen/wacom_i2c.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Dmitry Torokhov March 29, 2021, 7:08 p.m. UTC | #1
On Thu, Mar 25, 2021 at 09:52:24PM -0400, Alistair Francis wrote:
> Connect touchscreen properties to the wacom_i2c.

> 

> Signed-off-by: Alistair Francis <alistair@alistair23.me>

> ---

> v4:

>  - Add touchscreen_report_pos() as well

> 

>  drivers/input/touchscreen/wacom_i2c.c | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c

> index eada68770671..ee1829dd35f4 100644

> --- a/drivers/input/touchscreen/wacom_i2c.c

> +++ b/drivers/input/touchscreen/wacom_i2c.c

> @@ -11,6 +11,7 @@

>  #include <linux/i2c.h>

>  #include <linux/slab.h>

>  #include <linux/irq.h>

> +#include <linux/input/touchscreen.h>

>  #include <linux/interrupt.h>

>  #include <linux/of.h>

>  #include <asm/unaligned.h>

> @@ -33,6 +34,7 @@ struct wacom_features {

>  struct wacom_i2c {

>  	struct i2c_client *client;

>  	struct input_dev *input;

> +	struct touchscreen_properties props;

>  	u8 data[WACOM_QUERY_SIZE];

>  	bool prox;

>  	int tool;

> @@ -188,6 +190,9 @@ static int wacom_i2c_probe(struct i2c_client *client,

>  	__set_bit(BTN_STYLUS2, input->keybit);

>  	__set_bit(BTN_TOUCH, input->keybit);

>  

> +	touchscreen_parse_properties(input, true, &wac_i2c->props);

> +	touchscreen_report_pos(input, &wac_i2c->props, features.x_max,

> +			       features.y_max, true);


??? This goes into wacom_i2c_irq() where it previously used
input_report_abs() for X and Y so that transformations (swap, mirrot)
requested via device properties are applied to the coordinates.

Thanks.

-- 
Dmitry
Alistair Francis March 30, 2021, midnight UTC | #2
On Mon, Mar 29, 2021 at 3:08 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>

> On Thu, Mar 25, 2021 at 09:52:24PM -0400, Alistair Francis wrote:

> > Connect touchscreen properties to the wacom_i2c.

> >

> > Signed-off-by: Alistair Francis <alistair@alistair23.me>

> > ---

> > v4:

> >  - Add touchscreen_report_pos() as well

> >

> >  drivers/input/touchscreen/wacom_i2c.c | 5 +++++

> >  1 file changed, 5 insertions(+)

> >

> > diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c

> > index eada68770671..ee1829dd35f4 100644

> > --- a/drivers/input/touchscreen/wacom_i2c.c

> > +++ b/drivers/input/touchscreen/wacom_i2c.c

> > @@ -11,6 +11,7 @@

> >  #include <linux/i2c.h>

> >  #include <linux/slab.h>

> >  #include <linux/irq.h>

> > +#include <linux/input/touchscreen.h>

> >  #include <linux/interrupt.h>

> >  #include <linux/of.h>

> >  #include <asm/unaligned.h>

> > @@ -33,6 +34,7 @@ struct wacom_features {

> >  struct wacom_i2c {

> >       struct i2c_client *client;

> >       struct input_dev *input;

> > +     struct touchscreen_properties props;

> >       u8 data[WACOM_QUERY_SIZE];

> >       bool prox;

> >       int tool;

> > @@ -188,6 +190,9 @@ static int wacom_i2c_probe(struct i2c_client *client,

> >       __set_bit(BTN_STYLUS2, input->keybit);

> >       __set_bit(BTN_TOUCH, input->keybit);

> >

> > +     touchscreen_parse_properties(input, true, &wac_i2c->props);

> > +     touchscreen_report_pos(input, &wac_i2c->props, features.x_max,

> > +                            features.y_max, true);

>

> ??? This goes into wacom_i2c_irq() where it previously used

> input_report_abs() for X and Y so that transformations (swap, mirrot)

> requested via device properties are applied to the coordinates.


Ah sorry. I misunderstood what touchscreen_report_pos() does (and
didn't read it).

Looking at the actual code it seems that I need to remove

input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_X, x);

from wacom_i2c_irq() and add touchscreen_report_pos() to wacom_i2c_irq() instead

I'll do that in the next version.

Alistair

>

> Thanks.

>

> --

> Dmitry
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c
index eada68770671..ee1829dd35f4 100644
--- a/drivers/input/touchscreen/wacom_i2c.c
+++ b/drivers/input/touchscreen/wacom_i2c.c
@@ -11,6 +11,7 @@ 
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/irq.h>
+#include <linux/input/touchscreen.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
 #include <asm/unaligned.h>
@@ -33,6 +34,7 @@  struct wacom_features {
 struct wacom_i2c {
 	struct i2c_client *client;
 	struct input_dev *input;
+	struct touchscreen_properties props;
 	u8 data[WACOM_QUERY_SIZE];
 	bool prox;
 	int tool;
@@ -188,6 +190,9 @@  static int wacom_i2c_probe(struct i2c_client *client,
 	__set_bit(BTN_STYLUS2, input->keybit);
 	__set_bit(BTN_TOUCH, input->keybit);
 
+	touchscreen_parse_properties(input, true, &wac_i2c->props);
+	touchscreen_report_pos(input, &wac_i2c->props, features.x_max,
+			       features.y_max, true);
 	input_set_abs_params(input, ABS_X, 0, features.x_max, 0, 0);
 	input_set_abs_params(input, ABS_Y, 0, features.y_max, 0, 0);
 	input_set_abs_params(input, ABS_PRESSURE,