mbox series

[v1,0/3] Support wakeup methods of Atmel maXTouch controllers

Message ID 20201205053328.9535-1-digetx@gmail.com
Headers show
Series Support wakeup methods of Atmel maXTouch controllers | expand

Message

Dmitry Osipenko Dec. 5, 2020, 5:33 a.m. UTC
Some Atmel maXTouch controllers, like mXT1386 and mXT3432S1 for example,
have a WAKE line that needs to be asserted in order to wake controller
from a deep sleep, otherwise it will be unusable. This series implements
support for the wakeup methods in accordance to the mXT1386 datasheet [1],
see page 29 (chapter "5.8 WAKE Line").

The mXT1386 is a widely used controller found on many older Android tablet
devices. Touchscreen on Acer A500 tablet now works properly after this
series.

This patchset is a continuation of the work originally started by
Jiada Wang [2].

[1] https://ww1.microchip.com/downloads/en/DeviceDoc/mXT1386_1vx_Datasheet_LX.pdf
[2] https://patchwork.kernel.org/project/linux-input/list/?series=357875

Dmitry Osipenko (3):
  dt-bindings: input: atmel_mxt_ts: Document atmel,wakeup-method and
    wake-GPIO
  Input: atmel_mxt_ts - support wakeup methods
  ARM: tegra: acer-a500: Add atmel,wakeup-method property

 .../bindings/input/atmel,maxtouch.yaml        | 26 +++++++++
 .../boot/dts/tegra20-acer-a500-picasso.dts    |  3 +
 drivers/input/touchscreen/atmel_mxt_ts.c      | 55 +++++++++++++++++++
 include/dt-bindings/input/atmel-maxtouch.h    | 10 ++++
 4 files changed, 94 insertions(+)
 create mode 100644 include/dt-bindings/input/atmel-maxtouch.h

Comments

Dmitry Osipenko Dec. 5, 2020, 5:41 a.m. UTC | #1
05.12.2020 08:33, Dmitry Osipenko пишет:
> +	/* Request the WAKE line as asserted so controller won't sleep */
> +	data->wake_gpio = devm_gpiod_get_optional(&client->dev,
> +						  "wake", GPIOD_OUT_HIGH);
> +	if (IS_ERR(data->reset_gpio)) {
> +		error = PTR_ERR(data->reset_gpio);

Woops, I missed this copy-paste error. Will send v2 shortly.
Linus Walleij Dec. 6, 2020, 3:13 p.m. UTC | #2
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 | #3
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!