diff mbox series

[v1,1/3] dt-bindings: input: atmel_mxt_ts: Document atmel,wakeup-method and wake-GPIO

Message ID 20201205053328.9535-2-digetx@gmail.com
State Superseded, archived
Headers show
Series Support wakeup methods of Atmel maXTouch controllers | expand

Checks

Context Check Description
robh/checkpatch success

Commit Message

Dmitry Osipenko Dec. 5, 2020, 5:33 a.m. UTC
Some Atmel touchscreen controllers have a WAKE line that needs to be
asserted low in order to wake up controller from a deep sleep. Document
the wakeup methods and the wake-GPIO properties.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 .../bindings/input/atmel,maxtouch.yaml        | 26 +++++++++++++++++++
 include/dt-bindings/input/atmel-maxtouch.h    | 10 +++++++
 2 files changed, 36 insertions(+)
 create mode 100644 include/dt-bindings/input/atmel-maxtouch.h

Comments

Linus Walleij Dec. 6, 2020, 3:13 p.m. UTC | #1
On Sat, Dec 5, 2020 at 6:34 AM Dmitry Osipenko <digetx@gmail.com> wrote:

> Some Atmel touchscreen controllers have a WAKE line that needs to be
> asserted low in order to wake up controller from a deep sleep. Document
> the wakeup methods and the wake-GPIO properties.
>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Looks really useful!

> +  atmel,wakeup-method:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: |
> +      The WAKE line is an active-low input that is used to wake up the touch
> +      controller from deep-sleep mode before communication with the controller
> +      could be started. This feature used to minimize current consumption
> +      when the controller is in deep sleep mode.
> +
> +      The WAKE pin can be connected in one of the following ways:
> +       1) left permanently low
> +       2) connected to the I2C-compatible SCL pin
> +       3) connected to a GPIO pin on the host
> +    enum:
> +      - 0 # ATMEL_MXT_WAKEUP_NONE
> +      - 1 # ATMEL_MXT_WAKEUP_I2C_SCL
> +      - 2 # ATMEL_MXT_WAKEUP_GPIO

So you can add:
minimum: 0
maximum: 2

I suppose?

With that:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Dmitry Osipenko Dec. 6, 2020, 7:41 p.m. UTC | #2
Hello Linus,

06.12.2020 18:13, Linus Walleij пишет:
> On Sat, Dec 5, 2020 at 6:34 AM Dmitry Osipenko <digetx@gmail.com> wrote:
> 
>> Some Atmel touchscreen controllers have a WAKE line that needs to be
>> asserted low in order to wake up controller from a deep sleep. Document
>> the wakeup methods and the wake-GPIO properties.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> 
> Looks really useful!
> 
>> +  atmel,wakeup-method:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: |
>> +      The WAKE line is an active-low input that is used to wake up the touch
>> +      controller from deep-sleep mode before communication with the controller
>> +      could be started. This feature used to minimize current consumption
>> +      when the controller is in deep sleep mode.
>> +
>> +      The WAKE pin can be connected in one of the following ways:
>> +       1) left permanently low
>> +       2) connected to the I2C-compatible SCL pin
>> +       3) connected to a GPIO pin on the host
>> +    enum:
>> +      - 0 # ATMEL_MXT_WAKEUP_NONE
>> +      - 1 # ATMEL_MXT_WAKEUP_I2C_SCL
>> +      - 2 # ATMEL_MXT_WAKEUP_GPIO
> 
> So you can add:
> minimum: 0
> maximum: 2
> 
> I suppose?

The min/max ranges aren't needed for the enums because the min/max are
already implied.

I skimmed through a few yamls that use enums, just to be sure, nobody
sets the min/max for a enum.

I noticed that some bindings use "default: value" for enums, perhaps it
will be good to set default=0 for this property, I'll improve it in v3.

> With that:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thank you for taking a look at the patch!
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
index 8c6418f76e94..7924a16dc248 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
@@ -39,6 +39,13 @@  properties:
       (active low). The line must be flagged with
       GPIO_ACTIVE_LOW.
 
+  wake-gpios:
+    maxItems: 1
+    description:
+      Optional GPIO specifier for the touchscreen's wake pin
+      (active low). The line must be flagged with
+      GPIO_ACTIVE_LOW.
+
   linux,gpio-keymap:
     $ref: /schemas/types.yaml#/definitions/uint32-array
     description: |
@@ -53,6 +60,23 @@  properties:
       or experiment to determine which bit corresponds to which input. Use
       KEY_RESERVED for unused padding values.
 
+  atmel,wakeup-method:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      The WAKE line is an active-low input that is used to wake up the touch
+      controller from deep-sleep mode before communication with the controller
+      could be started. This feature used to minimize current consumption
+      when the controller is in deep sleep mode.
+
+      The WAKE pin can be connected in one of the following ways:
+       1) left permanently low
+       2) connected to the I2C-compatible SCL pin
+       3) connected to a GPIO pin on the host
+    enum:
+      - 0 # ATMEL_MXT_WAKEUP_NONE
+      - 1 # ATMEL_MXT_WAKEUP_I2C_SCL
+      - 2 # ATMEL_MXT_WAKEUP_GPIO
+
 required:
   - compatible
   - reg
@@ -63,6 +87,7 @@  additionalProperties: false
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/input/atmel-maxtouch.h>
     #include <dt-bindings/gpio/gpio.h>
     i2c {
       #address-cells = <1>;
@@ -75,6 +100,7 @@  examples:
         reset-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
         vdda-supply = <&ab8500_ldo_aux2_reg>;
         vdd-supply = <&ab8500_ldo_aux5_reg>;
+        atmel,wakeup-method = <ATMEL_MXT_WAKEUP_I2C_SCL>;
       };
     };
 
diff --git a/include/dt-bindings/input/atmel-maxtouch.h b/include/dt-bindings/input/atmel-maxtouch.h
new file mode 100644
index 000000000000..7345ab32224d
--- /dev/null
+++ b/include/dt-bindings/input/atmel-maxtouch.h
@@ -0,0 +1,10 @@ 
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef _DT_BINDINGS_ATMEL_MAXTOUCH_H
+#define _DT_BINDINGS_ATMEL_MAXTOUCH_H
+
+#define ATMEL_MXT_WAKEUP_NONE		0
+#define ATMEL_MXT_WAKEUP_I2C_SCL	1
+#define ATMEL_MXT_WAKEUP_GPIO		2
+
+#endif /* _DT_BINDINGS_ATMEL_MAXTOUCH_H */