diff mbox series

[1/2] Input: atmel_mxt_ts: Convert bindings to YAML and extend

Message ID 20201028101711.696423-1-linus.walleij@linaro.org
State Superseded
Headers show
Series [1/2] Input: atmel_mxt_ts: Convert bindings to YAML and extend | expand

Commit Message

Linus Walleij Oct. 28, 2020, 10:17 a.m. UTC
This converts the Armel MXT touchscreen bindings to YAML
format and extends them with the following two properties:

- vdda-supply: the optional analog supply voltage
- vdd-supply: the optional digital supply voltage

I also explained about the reset-gpios property that this
better be flagged as active high (0) despite actually
being active low, because all current device trees and
drivers assume that this is the case and will actively
drive the line low to assert RESET.

Tested the schema with all in-tree users and they verify
fine.

Cc: Nick Dyer <nick@shmanahar.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 .../bindings/input/atmel,maxtouch.txt         | 41 ---------
 .../bindings/input/atmel,maxtouch.yaml        | 83 +++++++++++++++++++
 MAINTAINERS                                   |  2 +-
 3 files changed, 84 insertions(+), 42 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.txt
 create mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.yaml

Comments

Dmitry Torokhov Oct. 28, 2020, 6 p.m. UTC | #1
Hi Linus,

On Wed, Oct 28, 2020 at 11:17:10AM +0100, Linus Walleij wrote:
> This converts the Armel MXT touchscreen bindings to YAML
> format and extends them with the following two properties:
> 
> - vdda-supply: the optional analog supply voltage
> - vdd-supply: the optional digital supply voltage
> 
> I also explained about the reset-gpios property that this
> better be flagged as active high (0) despite actually
> being active low, because all current device trees and
> drivers assume that this is the case and will actively
> drive the line low to assert RESET.

I wonder if we should fix that in driver and in DTs instead of doing
this cludge...

Thanks.
Linus Walleij Oct. 29, 2020, 1:47 p.m. UTC | #2
On Wed, Oct 28, 2020 at 7:01 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Oct 28, 2020 at 11:17:10AM +0100, Linus Walleij wrote:

> > This converts the Armel MXT touchscreen bindings to YAML
> > format and extends them with the following two properties:
> >
> > - vdda-supply: the optional analog supply voltage
> > - vdd-supply: the optional digital supply voltage
> >
> > I also explained about the reset-gpios property that this
> > better be flagged as active high (0) despite actually
> > being active low, because all current device trees and
> > drivers assume that this is the case and will actively
> > drive the line low to assert RESET.
>
> I wonder if we should fix that in driver and in DTs instead of doing
> this cludge...

Unfortunately I think there are deployed systems with flashed-in
system descriptions depending on this bug in the system
description already.

I am not thinking about device trees now, but instead ACPI
chromebooks, that have their reset line flagged as whatever
ACPI or DT-to-ACPI use to indicate an active high line.
Despite being active low.

I could fix all the in-tree devicetrees and do it the natural way
(I have certainly done so before) and then add a quirk if used
with ACPI. But it's really risky. I'm afraid of regressions here.

Yours,
Linus Walleij
Dmitry Torokhov Oct. 29, 2020, 4:25 p.m. UTC | #3
On Thu, Oct 29, 2020 at 02:47:36PM +0100, Linus Walleij wrote:
> On Wed, Oct 28, 2020 at 7:01 PM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Wed, Oct 28, 2020 at 11:17:10AM +0100, Linus Walleij wrote:
> 
> > > This converts the Armel MXT touchscreen bindings to YAML
> > > format and extends them with the following two properties:
> > >
> > > - vdda-supply: the optional analog supply voltage
> > > - vdd-supply: the optional digital supply voltage
> > >
> > > I also explained about the reset-gpios property that this
> > > better be flagged as active high (0) despite actually
> > > being active low, because all current device trees and
> > > drivers assume that this is the case and will actively
> > > drive the line low to assert RESET.
> >
> > I wonder if we should fix that in driver and in DTs instead of doing
> > this cludge...
> 
> Unfortunately I think there are deployed systems with flashed-in
> system descriptions depending on this bug in the system
> description already.
> 
> I am not thinking about device trees now, but instead ACPI
> chromebooks, that have their reset line flagged as whatever
> ACPI or DT-to-ACPI use to indicate an active high line.
> Despite being active low.

The only ARM Chromebook that exposed reset line to the kernel was RK3288
Asus Chromebook "Minnie". DTS specifies correct polarity (active low),
but uses different binding (atmel,reset-gpios) from the driver found
upstream (I have never reconciled Atmel driver we ship with Chromebooks
with the upstream one). DT there is also part of the kernel, not flashed
separately.

x86 Chromebooks do not export reset line or regulators to the kernel but
rather handle power up/down sequence in firmware (either at boot or
exposing ACPI power control methods that kernel invokes form ACPI power
domain code).

> 
> I could fix all the in-tree devicetrees and do it the natural way
> (I have certainly done so before) and then add a quirk if used
> with ACPI. But it's really risky. I'm afraid of regressions here.

Unless there are unofficial firmwares that rework power handling on some
x86 Chromebooks and we want to support them I'd rather we did not quirk.

Thanks.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
deleted file mode 100644
index c88919480d37..000000000000
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ /dev/null
@@ -1,41 +0,0 @@ 
-Atmel maXTouch touchscreen/touchpad
-
-Required properties:
-- compatible:
-    atmel,maxtouch
-
-    The following compatibles have been used in various products but are
-    deprecated:
-	atmel,qt602240_ts
-	atmel,atmel_mxt_ts
-	atmel,atmel_mxt_tp
-	atmel,mXT224
-
-- reg: The I2C address of the device
-
-- interrupts: The sink for the touchpad's IRQ output
-    See ../interrupt-controller/interrupts.txt
-
-Optional properties for main touchpad device:
-
-- linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages
-    on GPIO bit changes. An array of up to 8 entries can be provided
-    indicating the Linux keycode mapped to each bit of the status byte,
-    starting at the LSB. Linux keycodes are defined in
-    <dt-bindings/input/input.h>.
-
-    Note: the numbering of the GPIOs and the bit they start at varies between
-    maXTouch devices. You must either refer to the documentation, or
-    experiment to determine which bit corresponds to which input. Use
-    KEY_RESERVED for unused padding values.
-
-- reset-gpios: GPIO specifier for the touchscreen's reset pin (active low)
-
-Example:
-
-	touch@4b {
-		compatible = "atmel,maxtouch";
-		reg = <0x4b>;
-		interrupt-parent = <&gpio>;
-		interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_LEVEL_LOW>;
-	};
diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
new file mode 100644
index 000000000000..6173562f328a
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
@@ -0,0 +1,83 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/atmel,maxtouch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel maXTouch touchscreen/touchpad
+
+maintainers:
+  - Nick Dyer <nick@shmanahar.org>
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  Atmel maXTouch touchscreen or touchpads such as the mXT244
+  and similar devices.
+
+properties:
+  compatible:
+    const: atmel,maxtouch
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vdda-supply:
+    description:
+      Optional regulator for the AVDD analog voltage.
+
+  vdd-supply:
+    description:
+      Optional regulator for the VDD digital voltage.
+
+  reset-gpios:
+    maxItems: 1
+    description:
+      Optional GPIO specifier for the touchscreen's reset pin
+      (active low). The operating system should actively drive
+      the line low to assert reset, so the line must NOT be
+      flagged with GPIO_ACTIVE_LOW, it should (counterintuitively)
+      be set to GPIO_ACTIVE_HIGH.
+
+  linux,gpio-keymap:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    description: |
+      When enabled, the SPT_GPIOPWN_T19 object sends messages
+      on GPIO bit changes. An array of up to 8 entries can be provided
+      indicating the Linux keycode mapped to each bit of the status byte,
+      starting at the LSB. Linux keycodes are defined in
+      <dt-bindings/input/input.h>.
+
+      Note: the numbering of the GPIOs and the bit they start at varies
+      between maXTouch devices. You must either refer to the documentation,
+      or experiment to determine which bit corresponds to which input. Use
+      KEY_RESERVED for unused padding values.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      touchscreen@4a {
+        compatible = "atmel,maxtouch";
+        reg = <0x4a>;
+        interrupt-parent = <&gpio>;
+        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
+        reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
+        vdda-supply = <&ab8500_ldo_aux2_reg>;
+        vdd-supply = <&ab8500_ldo_aux5_reg>;
+      };
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index e73636b75f29..b4b46fcb82db 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2966,7 +2966,7 @@  ATMEL MAXTOUCH DRIVER
 M:	Nick Dyer <nick@shmanahar.org>
 S:	Maintained
 T:	git git://github.com/ndyer/linux.git
-F:	Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+F:	Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
 F:	drivers/input/touchscreen/atmel_mxt_ts.c
 
 ATMEL WIRELESS DRIVER