* [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML
@ 2020-03-15 10:04 Paul Cercueil
2020-03-15 10:04 ` [PATCH 2/2] input: atmel_mxt_ts: Add support for optional regulator Paul Cercueil
2020-03-30 19:11 ` [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML Rob Herring
0 siblings, 2 replies; 3+ messages in thread
From: Paul Cercueil @ 2020-03-15 10:04 UTC (permalink / raw)
To: Nick Dyer, Dmitry Torokhov, Rob Herring, Mark Rutland
Cc: linux-input, devicetree, linux-arm-kernel, linux-kernel, Paul Cercueil
Update atmel,maxtouch.txt to YAML. The new 'vdd-supply' property was
added in the process.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
.../bindings/input/atmel,maxtouch.txt | 41 -----------
.../bindings/input/atmel,maxtouch.yaml | 68 +++++++++++++++++++
2 files changed, 68 insertions(+), 41 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.txt
create mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
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..1b138a9836bf
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
@@ -0,0 +1,68 @@
+# 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 DT bindings
+
+maintainers:
+ - Paul Cercueil <paul@crapouillou.net>
+
+properties:
+ compatible:
+ enum:
+ - atmel,maxtouch
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ vdd-supply:
+ description: Phandle to regulator providing power to the touchscreen
+
+ linux,gpio-keymap:
+ minItems: 1
+ maxItems: 8
+ 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.
+
+ reset-gpios:
+ description: GPIO specifier for the touchscreen's reset pin (active low)
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mxt224-touchscreen@4a {
+ compatible = "atmel,maxtouch";
+ reg = <0x4a>;
+
+ interrupt-parent = <&gpx0>;
+ interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
+
+ vdd-supply = <&tsp_reg>;
+ };
+ };
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] input: atmel_mxt_ts: Add support for optional regulator
2020-03-15 10:04 [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML Paul Cercueil
@ 2020-03-15 10:04 ` Paul Cercueil
2020-03-30 19:11 ` [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML Rob Herring
1 sibling, 0 replies; 3+ messages in thread
From: Paul Cercueil @ 2020-03-15 10:04 UTC (permalink / raw)
To: Nick Dyer, Dmitry Torokhov, Rob Herring, Mark Rutland
Cc: linux-input, devicetree, linux-arm-kernel, linux-kernel, Paul Cercueil
Add support for an optional "vdd" regulator, as some platforms require a
regulator to be enabled for the touchscreen to be enabled.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 25 +++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index ae60442efda0..b3511dad475a 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -22,6 +22,7 @@
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/property.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.h>
#include <asm/unaligned.h>
@@ -308,6 +309,7 @@ struct mxt_data {
struct t7_config t7_cfg;
struct mxt_dbg dbg;
struct gpio_desc *reset_gpio;
+ struct regulator *vdd;
/* Cached parameters from object table */
u16 T5_address;
@@ -3103,6 +3105,22 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
disable_irq(client->irq);
+ data->vdd = devm_regulator_get_optional(&client->dev, "vdd");
+ if (IS_ERR(data->vdd)) {
+ error = PTR_ERR(data->vdd);
+ dev_err(&client->dev, "Failed to get regulator: %d\n", error);
+ return error;
+ }
+
+ if (data->vdd) {
+ error = regulator_enable(data->vdd);
+ if (error) {
+ dev_err(&client->dev,
+ "Failed to enable regulator: %d\n", error);
+ return error;
+ }
+ }
+
if (data->reset_gpio) {
msleep(MXT_RESET_GPIO_TIME);
gpiod_set_value(data->reset_gpio, 1);
@@ -3111,7 +3129,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
error = mxt_initialize(data);
if (error)
- return error;
+ goto err_disable_regulator;
error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
if (error) {
@@ -3125,6 +3143,9 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
err_free_object:
mxt_free_input_device(data);
mxt_free_object_table(data);
+err_disable_regulator:
+ if (data->vdd)
+ regulator_disable(data->vdd);
return error;
}
@@ -3136,6 +3157,8 @@ static int mxt_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
mxt_free_input_device(data);
mxt_free_object_table(data);
+ if (data->vdd)
+ regulator_disable(data->vdd);
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML
2020-03-15 10:04 [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML Paul Cercueil
2020-03-15 10:04 ` [PATCH 2/2] input: atmel_mxt_ts: Add support for optional regulator Paul Cercueil
@ 2020-03-30 19:11 ` Rob Herring
1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2020-03-30 19:11 UTC (permalink / raw)
To: Paul Cercueil
Cc: Nick Dyer, Dmitry Torokhov, Mark Rutland, linux-input,
devicetree, linux-arm-kernel, linux-kernel
On Sun, Mar 15, 2020 at 11:04:15AM +0100, Paul Cercueil wrote:
> Update atmel,maxtouch.txt to YAML. The new 'vdd-supply' property was
> added in the process.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> .../bindings/input/atmel,maxtouch.txt | 41 -----------
> .../bindings/input/atmel,maxtouch.yaml | 68 +++++++++++++++++++
> 2 files changed, 68 insertions(+), 41 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.txt
> create mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
>
> 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..1b138a9836bf
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml
> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
Do you have rights to relicense?
> +%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 DT bindings
> +
> +maintainers:
> + - Paul Cercueil <paul@crapouillou.net>
> +
> +properties:
> + compatible:
> + enum:
> + - atmel,maxtouch
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + vdd-supply:
> + description: Phandle to regulator providing power to the touchscreen
> +
> + linux,gpio-keymap:
> + minItems: 1
> + maxItems: 8
Needs a type reference (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.
> +
> + reset-gpios:
> + description: GPIO specifier for the touchscreen's reset pin (active low)
maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> +
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + mxt224-touchscreen@4a {
touchscreen@4a
> + compatible = "atmel,maxtouch";
> + reg = <0x4a>;
> +
> + interrupt-parent = <&gpx0>;
> + interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
> +
> + vdd-supply = <&tsp_reg>;
> + };
> + };
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-30 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 10:04 [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML Paul Cercueil
2020-03-15 10:04 ` [PATCH 2/2] input: atmel_mxt_ts: Add support for optional regulator Paul Cercueil
2020-03-30 19:11 ` [PATCH 1/2] dt-bindings: input: Update atmel,maxtouch.txt to YAML Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).