From: Alistair Francis <hidden> Date: 2021-03-26 01:53:47
Allow the wacom-i2c device to be exposed via device tree.
Signed-off-by: Alistair Francis <redacted>
---
v4:
- Avoid unused variable warning by not using of_match_ptr()
drivers/input/touchscreen/wacom_i2c.c | 8 ++++++++
1 file changed, 8 insertions(+)
From: Alistair Francis <hidden> Date: 2021-03-26 01:53:47
Add support for a VDD regulator. This allows the kernel to prove the
Wacom-I2C device on the rM2.
Signed-off-by: Alistair Francis <redacted>
---
v4:
- Don't double allocate wac_i2c
drivers/input/touchscreen/wacom_i2c.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
From: Alistair Francis <hidden> Date: 2021-03-26 01:53:47
This is based on the out of tree rM2 driver.
Signed-off-by: Alistair Francis <redacted>
---
drivers/input/touchscreen/wacom_i2c.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
From: Alistair Francis <hidden> Date: 2021-03-26 01:53:47
Enable the Wacom I2C in the imx defconfig as it is used by the
reMarkable2 tablet.
Signed-off-by: Alistair Francis <redacted>
---
arch/arm/configs/imx_v6_v7_defconfig | 1 +
1 file changed, 1 insertion(+)
@@ -175,6 +176,8 @@ static int wacom_i2c_open(struct input_dev *dev)structwacom_i2c*wac_i2c=input_get_drvdata(dev);structi2c_client*client=wac_i2c->client;+reset_control_reset(wac_i2c->rstc);+enable_irq(client->irq);return0;
@@ -193,6 +196,7 @@ static int wacom_i2c_probe(struct i2c_client *client,{structwacom_i2c*wac_i2c;structinput_dev*input;+structreset_control*rstc;structwacom_featuresfeatures={0};interror;
@@ -201,6 +205,12 @@ static int wacom_i2c_probe(struct i2c_client *client,return-EIO;}+rstc=devm_reset_control_get_optional_exclusive(&client->dev,NULL);+if(IS_ERR(rstc)){+dev_err(&client->dev,"Failed to get reset control before init\n");+returnPTR_ERR(rstc);+}+error=wacom_query_device(client,&features);if(error)returnerror;
@@ -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
Hi Alistair,
On Thu, Mar 25, 2021 at 09:52:23PM -0400, Alistair Francis wrote:
quoted hunk
Allow the wacom-i2c device to be exposed via device tree.
Signed-off-by: Alistair Francis <redacted>
---
v4:
- Avoid unused variable warning by not using of_match_ptr()
drivers/input/touchscreen/wacom_i2c.c | 8 ++++++++
1 file changed, 8 insertions(+)
No, "generic" is not something we want in device tree binding. What is
the version of the controller used in your device? Put it instead of
"generic". Or if you know the earliest model with this protocol then it
can be used.
On Thu, Mar 25, 2021 at 09:52:25PM -0400, Alistair Francis wrote:
quoted hunk
This is based on the out of tree rM2 driver.
Signed-off-by: Alistair Francis <redacted>
---
drivers/input/touchscreen/wacom_i2c.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
@@ -175,6 +176,8 @@ static int wacom_i2c_open(struct input_dev *dev)structwacom_i2c*wac_i2c=input_get_drvdata(dev);structi2c_client*client=wac_i2c->client;+reset_control_reset(wac_i2c->rstc);
Why does this device need to be reset on every open compared to doing it
in probe?
quoted hunk
+
enable_irq(client->irq);
return 0;
@@ -193,6 +196,7 @@ static int wacom_i2c_probe(struct i2c_client *client, { struct wacom_i2c *wac_i2c; struct input_dev *input;+ struct reset_control *rstc; struct wacom_features features = { 0 }; int error;
@@ -201,6 +205,12 @@ static int wacom_i2c_probe(struct i2c_client *client, return -EIO; }+ rstc = devm_reset_control_get_optional_exclusive(&client->dev, NULL);+ if (IS_ERR(rstc)) {+ dev_err(&client->dev, "Failed to get reset control before init\n");+ return PTR_ERR(rstc);+ }
I think majority users will have this controller reset line connected to
a GPIO. I briefly looked into reset controller code and I do not see it
supporting this case. How is this device connected on your board?
quoted hunk
+
error = wacom_query_device(client, &features);
if (error)
return error;
@@ -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
@@ -175,6 +176,8 @@ static int wacom_i2c_open(struct input_dev *dev)structwacom_i2c*wac_i2c=input_get_drvdata(dev);structi2c_client*client=wac_i2c->client;+reset_control_reset(wac_i2c->rstc);
Why does this device need to be reset on every open compared to doing it
in probe?
quoted
+
enable_irq(client->irq);
return 0;
@@ -193,6 +196,7 @@ static int wacom_i2c_probe(struct i2c_client *client, { struct wacom_i2c *wac_i2c; struct input_dev *input;+ struct reset_control *rstc; struct wacom_features features = { 0 }; int error;
@@ -201,6 +205,12 @@ static int wacom_i2c_probe(struct i2c_client *client, return -EIO; }+ rstc = devm_reset_control_get_optional_exclusive(&client->dev, NULL);+ if (IS_ERR(rstc)) {+ dev_err(&client->dev, "Failed to get reset control before init\n");+ return PTR_ERR(rstc);+ }
I think majority users will have this controller reset line connected to
a GPIO. I briefly looked into reset controller code and I do not see it
supporting this case. How is this device connected on your board?
That's a good question. I am going to drop this patch as I'm not
convinced it's required.
Alistair
quoted
+
error = wacom_query_device(client, &features);
if (error)
return error;