[PATCH 1/3] devicetree/bindings: Initial commit of wacom,wacom-i2c

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, open firmware and flattened device tree bindings, the rest

STALE2025d

7 messages, 3 authors, 2021-01-21 · open the first message on its own page

[PATCH 1/3] devicetree/bindings: Initial commit of wacom,wacom-i2c

From: Alistair Francis <hidden>
Date: 2021-01-17 23:43:36

Signed-off-by: Alistair Francis <redacted>
---
 .../input/touchscreen/wacom,wacom-i2c.yaml    | 55 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
diff --git a/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml b/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
new file mode 100644
index 000000000000..6b0e0034f836
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/wacom,wacom-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Wacom I2C Controller
+
+maintainers:
+  - Alistair Francis <alistair@alistair23.me>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: wacom,wacom-i2c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  flip-tilt-x:
+  flip-tilt-y:
+  flip-pos-x:
+  flip-pos-y:
+  flip-distance:
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include "dt-bindings/interrupt-controller/irq.h"
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        digitiser@9 {
+                compatible = "wacom,wacom-i2c";
+                reg = <0x9>;
+                interrupt-parent = <&gpio1>;
+                interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+                flip-tilt-x;
+                flip-tilt-y;
+                flip-pos-x;
+                flip-pos-y;
+                flip-distance;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 041ae90b0d8f..5bca22f035a3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1202,6 +1202,8 @@ patternProperties:
     description: Vision Optical Technology Co., Ltd.
   "^vxt,.*":
     description: VXT Ltd
+  "^wacom,.*":
+    description: Wacom Co., Ltd
   "^wand,.*":
     description: Wandbord (Technexion)
   "^waveshare,.*":
-- 
2.29.2

[PATCH 2/3] input/touchscreen: Add device tree support to wacom_i2c

From: Alistair Francis <hidden>
Date: 2021-01-17 23:43:05

Allow the wacom-i2c device to be exposed via device tree.

Signed-off-by: Alistair Francis <redacted>
---
 drivers/input/touchscreen/wacom_i2c.c | 38 +++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c
index 1afc6bde2891..54af2934ba17 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
@@ -35,6 +36,13 @@ struct wacom_i2c {
 	u8 data[WACOM_QUERY_SIZE];
 	bool prox;
 	int tool;
+
+	bool flip_tilt_x;
+	bool flip_tilt_y;
+	bool flip_pos_x;
+	bool flip_pos_y;
+	bool flip_distance;
+	bool flip_pressure;
 };
 
 static int wacom_query_device(struct i2c_client *client,
@@ -144,6 +152,20 @@ static void wacom_i2c_close(struct input_dev *dev)
 	disable_irq(client->irq);
 }
 
+#ifdef CONFIG_OF
+static void wacom_of_read(struct wacom_i2c *wac_i2c)
+{
+	struct i2c_client *client = wac_i2c->client;
+
+	wac_i2c->flip_tilt_x = of_property_read_bool(client->dev.of_node, "flip-tilt-x");
+	wac_i2c->flip_tilt_y = of_property_read_bool(client->dev.of_node, "flip-tilt-y");
+	wac_i2c->flip_pos_x = of_property_read_bool(client->dev.of_node, "flip-pos-x");
+	wac_i2c->flip_pos_y = of_property_read_bool(client->dev.of_node, "flip-pos-y");
+	wac_i2c->flip_distance = of_property_read_bool(client->dev.of_node, "flip-distance");
+	wac_i2c->flip_pressure = of_property_read_bool(client->dev.of_node, "flip-pressure");
+}
+#endif
+
 static int wacom_i2c_probe(struct i2c_client *client,
 				     const struct i2c_device_id *id)
 {
@@ -214,6 +236,11 @@ static int wacom_i2c_probe(struct i2c_client *client,
 	}
 
 	i2c_set_clientdata(client, wac_i2c);
+
+#ifdef CONFIG_OF
+	wacom_of_read(wac_i2c);
+#endif
+
 	return 0;
 
 err_free_irq:
@@ -262,10 +289,21 @@ static const struct i2c_device_id wacom_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, wacom_i2c_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id wacom_i2c_of_match_table[] = {
+	{ .compatible = "wacom,wacom-i2c" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, wacom_i2c_of_match_table);
+#endif
+
 static struct i2c_driver wacom_i2c_driver = {
 	.driver	= {
 		.name	= "wacom_i2c",
 		.pm	= &wacom_i2c_pm,
+#ifdef CONFIG_OF
+		.of_match_table = of_match_ptr(wacom_i2c_of_match_table),
+#endif
 	},
 
 	.probe		= wacom_i2c_probe,
-- 
2.29.2

[PATCH 3/3] arch/arm: reMarkable2: Enable wacom_i2c

From: Alistair Francis <hidden>
Date: 2021-01-17 23:43:36

Enable the wacom_i2c touchscreen for the reMarkable2.

Signed-off-by: Alistair Francis <redacted>
---
 arch/arm/boot/dts/imx7d-remarkable2.dts | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
index fba55a0e028a..8052d884a5e5 100644
--- a/arch/arm/boot/dts/imx7d-remarkable2.dts
+++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
@@ -150,6 +150,30 @@ &dma_apbh {
 	status = "disabled";
 };
 
+&i2c1 {
+	clock-frequency = <400000>;
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&pinctrl_i2c1>;
+	pinctrl-1 = <&pinctrl_i2c1>;
+	status = "okay";
+
+	digitizer: wacom-i2c@9 {
+		pinctrl-names = "default", "sleep";
+		pinctrl-0 = <&pinctrl_wacom>;
+		pinctrl-1 = <&pinctrl_wacom>;
+		compatible = "wacom,wacom-i2c";
+		reg = <0x09>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <1 2>;
+		flip-tilt-x;
+		flip-tilt-y;
+		flip-pos-x;
+		flip-pos-y;
+		flip-distance;
+		vdd-supply = <&reg_digitizer>;
+	};
+};
+
 &sdma {
 	status = "okay";
 };
@@ -221,6 +245,16 @@ &wdog1 {
 };
 
 &iomuxc_lpsr {
+	pinctrl_wacom: wacomgrp {
+		fsl,pins = <
+			/*MX7D_PAD_LPSR_GPIO1_IO00__GPIO1_IO0	0x00000074 /* WACOM RESET */
+			MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1	0x00000034 /* WACOM INT */
+			MX7D_PAD_LPSR_GPIO1_IO04__GPIO1_IO4	0x00000074 /* PDCTB */
+			/*MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5	0x00000014 /* FWE */
+			/*MX7D_PAD_LPSR_GPIO1_IO06__GPIO1_IO6	0x00000014 /* WACOM PWR ENABLE */
+		>;
+	};
+
 	pinctrl_digitizer_reg: digitizerreggrp {
 		fsl,pins = <
 			/* DIGITIZER_PWR_EN */
@@ -236,6 +270,13 @@ MX7D_PAD_SAI1_RX_SYNC__GPIO6_IO16	0x59
 		>;
 	};
 
+	pinctrl_i2c1: i2c1grp {
+		fsl,pins = <
+			MX7D_PAD_I2C1_SDA__I2C1_SDA		0x4000007f
+			MX7D_PAD_I2C1_SCL__I2C1_SCL		0x4000007f
+		>;
+	};
+
 	pinctrl_uart1: uart1grp {
 		fsl,pins = <
 			MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX	0x79
-- 
2.29.2

Re: [PATCH 1/3] devicetree/bindings: Initial commit of wacom,wacom-i2c

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2021-01-20 02:16:52

Hi Alistair,

On Sat, Jan 16, 2021 at 08:24:26PM -0800, Alistair Francis wrote:
quoted hunk
Signed-off-by: Alistair Francis <redacted>
---
 .../input/touchscreen/wacom,wacom-i2c.yaml    | 55 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
diff --git a/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml b/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
new file mode 100644
index 000000000000..6b0e0034f836
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/wacom,wacom-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Wacom I2C Controller
+
+maintainers:
+  - Alistair Francis <alistair@alistair23.me>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: wacom,wacom-i2c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  flip-tilt-x:
+  flip-tilt-y:
Does the device support tilt? The driver does not, at least at the
moment. Also, does it make sense to flip tilt but not position?
+  flip-pos-x:
+  flip-pos-y:
This needs to use standard touchscreen properties. See
Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
+  flip-distance:
I am having trouble understanding when this one would be useful.
quoted hunk
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include "dt-bindings/interrupt-controller/irq.h"
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        digitiser@9 {
+                compatible = "wacom,wacom-i2c";
+                reg = <0x9>;
+                interrupt-parent = <&gpio1>;
+                interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+                flip-tilt-x;
+                flip-tilt-y;
+                flip-pos-x;
+                flip-pos-y;
+                flip-distance;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 041ae90b0d8f..5bca22f035a3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1202,6 +1202,8 @@ patternProperties:
     description: Vision Optical Technology Co., Ltd.
   "^vxt,.*":
     description: VXT Ltd
+  "^wacom,.*":
+    description: Wacom Co., Ltd
   "^wand,.*":
     description: Wandbord (Technexion)
   "^waveshare,.*":
-- 
2.29.2
Thanks.

-- 
Dmitry

Re: [PATCH 2/3] input/touchscreen: Add device tree support to wacom_i2c

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2021-01-20 02:19:14

On Sat, Jan 16, 2021 at 08:24:27PM -0800, Alistair Francis wrote:
Allow the wacom-i2c device to be exposed via device tree.
The patch seems incomplete. I see we are reading and storing properties,
but we are not using them whatsoever, so I do not see the reason to have
this in this form.

Thanks.

-- 
Dmitry

Re: [PATCH 1/3] devicetree/bindings: Initial commit of wacom,wacom-i2c

From: Alistair Francis <hidden>
Date: 2021-01-20 06:18:51

On Tue, Jan 19, 2021 at 6:15 PM Dmitry Torokhov
[off-list ref] wrote:
Hi Alistair,

On Sat, Jan 16, 2021 at 08:24:26PM -0800, Alistair Francis wrote:
quoted
Signed-off-by: Alistair Francis <redacted>
---
 .../input/touchscreen/wacom,wacom-i2c.yaml    | 55 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
diff --git a/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml b/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
new file mode 100644
index 000000000000..6b0e0034f836
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/wacom,wacom-i2c.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/wacom,wacom-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Wacom I2C Controller
+
+maintainers:
+  - Alistair Francis <alistair@alistair23.me>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: wacom,wacom-i2c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  flip-tilt-x:
+  flip-tilt-y:
Does the device support tilt? The driver does not, at least at the
moment. Also, does it make sense to flip tilt but not position?
quoted
+  flip-pos-x:
+  flip-pos-y:
This needs to use standard touchscreen properties. See
Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
quoted
+  flip-distance:
I am having trouble understanding when this one would be useful.
Thanks for the review. These came from the original out of tree DT. I
have removed them, I'm planning on using the standard touchscreen ones
you pointed out if they are required.

Alistair
quoted
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include "dt-bindings/interrupt-controller/irq.h"
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        digitiser@9 {
+                compatible = "wacom,wacom-i2c";
+                reg = <0x9>;
+                interrupt-parent = <&gpio1>;
+                interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+                flip-tilt-x;
+                flip-tilt-y;
+                flip-pos-x;
+                flip-pos-y;
+                flip-distance;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 041ae90b0d8f..5bca22f035a3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1202,6 +1202,8 @@ patternProperties:
     description: Vision Optical Technology Co., Ltd.
   "^vxt,.*":
     description: VXT Ltd
+  "^wacom,.*":
+    description: Wacom Co., Ltd
   "^wand,.*":
     description: Wandbord (Technexion)
   "^waveshare,.*":
--
2.29.2
Thanks.

--
Dmitry

Re: [PATCH 2/3] input/touchscreen: Add device tree support to wacom_i2c

From: Alistair Francis <hidden>
Date: 2021-01-21 06:52:44

On Tue, Jan 19, 2021 at 6:17 PM Dmitry Torokhov
[off-list ref] wrote:
On Sat, Jan 16, 2021 at 08:24:27PM -0800, Alistair Francis wrote:
quoted
Allow the wacom-i2c device to be exposed via device tree.
The patch seems incomplete. I see we are reading and storing properties,
but we are not using them whatsoever, so I do not see the reason to have
this in this form.
Good point. I am trying to split up the work, but I guess here I split
it up a little too much. I'm sending a v2 that should fix this.

Alistair
Thanks.

--
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help