diff mbox series

[v4,01/10] dt-bindings: Add Wacom to vendor bindings

Message ID 20210326015229.141-1-alistair@alistair23.me
State Superseded
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
Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

Comments

Dmitry Torokhov March 29, 2021, 7:11 p.m. UTC | #1
Hi Alistair,

On Thu, Mar 25, 2021 at 09:52:23PM -0400, Alistair Francis wrote:
> Allow the wacom-i2c device to be exposed via device tree.

> 

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

> ---

> v4:

>  - Avoid unused variable warning by not using of_match_ptr()

> 

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

>  1 file changed, 8 insertions(+)

> 

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

> index 1afc6bde2891..eada68770671 100644

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

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

> @@ -12,6 +12,7 @@

>  #include <linux/slab.h>

>  #include <linux/irq.h>

>  #include <linux/interrupt.h>

> +#include <linux/of.h>

>  #include <asm/unaligned.h>

>  

>  #define WACOM_CMD_QUERY0	0x04

> @@ -262,10 +263,17 @@ static const struct i2c_device_id wacom_i2c_id[] = {

>  };

>  MODULE_DEVICE_TABLE(i2c, wacom_i2c_id);

>  

> +static const struct of_device_id wacom_i2c_of_match_table[] = {

> +	{ .compatible = "wacom,generic" },


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.

> +	{}

> +};

> +MODULE_DEVICE_TABLE(of, wacom_i2c_of_match_table);

> +

>  static struct i2c_driver wacom_i2c_driver = {

>  	.driver	= {

>  		.name	= "wacom_i2c",

>  		.pm	= &wacom_i2c_pm,

> +		.of_match_table = wacom_i2c_of_match_table,

>  	},

>  

>  	.probe		= wacom_i2c_probe,

> -- 

> 2.31.0

> 


Thanks.

-- 
Dmitry
Dmitry Torokhov March 29, 2021, 7:12 p.m. UTC | #2
On Thu, Mar 25, 2021 at 09:52:25PM -0400, Alistair Francis wrote:
> This is based on the out of tree rM2 driver.

> 

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

> ---

>  drivers/input/touchscreen/wacom_i2c.c | 25 +++++++++++++++++++++++--

>  1 file changed, 23 insertions(+), 2 deletions(-)

> 

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

> index ee1829dd35f4..3b4bc514dc3f 100644

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

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

> @@ -22,12 +22,16 @@

>  #define WACOM_CMD_QUERY3	0x02

>  #define WACOM_CMD_THROW0	0x05

>  #define WACOM_CMD_THROW1	0x00

> -#define WACOM_QUERY_SIZE	19

> +#define WACOM_QUERY_SIZE	22

>  

>  struct wacom_features {

>  	int x_max;

>  	int y_max;

>  	int pressure_max;

> +	int distance_max;

> +	int distance_physical_max;

> +	int tilt_x_max;

> +	int tilt_y_max;

>  	char fw_version;

>  };

>  

> @@ -79,6 +83,10 @@ static int wacom_query_device(struct i2c_client *client,

>  	features->y_max = get_unaligned_le16(&data[5]);

>  	features->pressure_max = get_unaligned_le16(&data[11]);

>  	features->fw_version = get_unaligned_le16(&data[13]);

> +	features->distance_max = data[15];

> +	features->distance_physical_max = data[16];

> +	features->tilt_x_max = get_unaligned_le16(&data[17]);

> +	features->tilt_y_max = get_unaligned_le16(&data[19]);


Do other models also support distance and tilt? If not, this needs to be
made conditional.

Thanks.


-- 
Dmitry
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index a8e1e8d2ef20..996f4de2fff5 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1216,6 +1216,8 @@  patternProperties:
     description: Vision Optical Technology Co., Ltd.
   "^vxt,.*":
     description: VXT Ltd
+  "^wacom,.*":
+    description: Wacom Co., Ltd
   "^wand,.*":
     description: Wandbord (Technexion)
   "^waveshare,.*":