ARM: dts: imx6qdl-sabre*: fix Egalax touchscreen properties
Subsystems (4)
Dmitry Torokhov
maintainerPATCH 1/4 ARM: dts: imx6qdl-sabre*: fix Egalax touchscreen properties
This patch fixes interrupt trigger (should be level low as that is what the driver is always using), the GPIO that is the interrupt source that is also used to wake up chip by driving the line low.
The proper polarity is be needed for converting the driver to gpiod API.
--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +2 -2
@@ -451,8 +451,8 @@ touchscreen@4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_egalax_int>; interrupt-parent = <&gpio2>; - interrupts = <28 IRQ_TYPE_EDGE_FALLING>; - wakeup-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; + interrupts = <28 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; }; };
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +4 -4
@@ -311,8 +311,8 @@ touchscreen@4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2_egalax_int>; interrupt-parent = <&gpio6>; - interrupts = <8 IRQ_TYPE_EDGE_FALLING>; - wakeup-gpios = <&gpio6 8 GPIO_ACTIVE_HIGH>; + interrupts = <8 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio6 8 GPIO_ACTIVE_LOW>; }; ov5640: camera@3c {
@@ -450,8 +450,8 @@ egalax_ts@4 { compatible = "eeti,egalax_ts"; reg = <0x04>; interrupt-parent = <&gpio6>; - interrupts = <7 2>; - wakeup-gpios = <&gpio6 7 0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_LOW>; }; magnetometer@e {
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
Dmitry Torokhov
maintainerPATCH 3/4 Input: egalax_ts - switch to using gpiod API
This updates the driver to gpiod API, and removes yet another use of of_get_named_gpio().
--- drivers/input/touchscreen/egalax_ts.c | 42 +++++++++++---------------- 1 file changed, 17 insertions(+), 25 deletions(-)
drivers/input/touchscreen/egalax_ts.c +17 -25
@@ -14,17 +14,17 @@- auto idle mode support */ +#include <linux/err.h> #include <linux/module.h> #include <linux/i2c.h> #include <linux/interrupt.h> #include <linux/input.h> #include <linux/irq.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/bitops.h> #include <linux/input/mt.h> -#include <linux/of_gpio.h> /* * Mouse Mode: some panel may configure the controller to mouse mode,
@@ -119,32 +119,26 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)/* wake up controller by an falling edge of interrupt gpio. */ static int egalax_wake_up_device (struct i2c_client *client) { -struct device_node *np = client->dev.of_node; -int gpio; +struct gpio_desc *gpio;int ret; -if (!np) -return -ENODEV ; - - gpio =of_get_named_gpio (np,"wakeup-gpios" ,0 ); -if (!gpio_is_valid (gpio)) -return -ENODEV ; - - ret =gpio_request (gpio,"egalax_irq" ); -if (ret <0 ) { -dev_err (&client->dev, -"request gpio failed, cannot wake up controller: %d\n" , - ret); +/* wake up controller via an falling edge on IRQ gpio. */ + gpio =gpiod_get (&client->dev,"wakeup" ,GPIOD_OUT_HIGH ); + ret =PTR_ERR_OR_ZERO (gpio); +if (ret) { +if (ret != -EPROBE_DEFER ) +dev_err (&client->dev, +"failed to request wakeup gpio, cannot wake up controller: %d\n" , + ret);return ret; } -/* wake up controller via an falling edge on IRQ gpio. */ -gpio_direction_output (gpio,0 ); -gpio_set_value (gpio,1 ); +/* release the line */ +gpiod_set_value_cansleep (gpio,0 ); -/* controller should be waken up, return irq. */ -gpio_direction_input (gpio); -gpio_free (gpio); +/* controller should be woken up, return irq. */ +gpiod_direction_input (gpio); +gpiod_put (gpio);return 0 ; }
@@ -185,10 +179,8 @@ static int egalax_ts_probe(struct i2c_client *client,/* controller may be in sleep, wake it up. */ error =egalax_wake_up_device (client); -if (error) { -dev_err (&client->dev,"Failed to wake up the controller\n" ); +if (error)return error; - } error =egalax_firmware_version (client);if (error <0 ) {
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
Dmitry Torokhov
maintainerPATCH 2/4 dt-binding: input: egalax-ts: fix GPIO and IRQ in example
In reply to Dmitry TorokhovThe driver is using level triggered interrupt (low) which is backed by and active low GPIO that can be used to wake the controller by driving it low. Let's annotate it properly in the example.
--- .../devicetree/bindings/input/touchscreen/egalax-ts.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt +2 -2
@@ -13,6 +13,6 @@ Example: compatible = "eeti,egalax_ts"; reg = <0x04>; interrupt-parent = <&gpio1>; - interrupts = <9 2>; - wakeup-gpios = <&gpio1 9 0>; + interrupts = <9 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; };
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
Dmitry Torokhov
maintainerPATCH 4/4 Input: egalax_ts - do not hardcode interrupt trigger
In reply to Dmitry TorokhovStop hard-coding interrupt trigger, instead rely on the platform code to do the right thing, according to DT or ACPI data.
--- drivers/input/touchscreen/egalax_ts.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/input/touchscreen/egalax_ts.c +3 -4
@@ -203,10 +203,9 @@ static int egalax_ts_probe(struct i2c_client *client, ABS_MT_POSITION_Y, 0, EGALAX_MAX_Y, 0, 0);input_mt_init_slots (input_dev,MAX_SUPPORT_POINTS ,0 ); - error =devm_request_threaded_irq (&client->dev, client->irq,NULL , - egalax_ts_interrupt, -IRQF_TRIGGER_LOW |IRQF_ONESHOT , -"egalax_ts" , ts); + error =devm_request_threaded_irq (&client->dev, client->irq, +NULL , egalax_ts_interrupt, +IRQF_ONESHOT ,"egalax_ts" , ts);if (error <0 ) {dev_err (&client->dev,"Failed to register interrupt\n" );return error;
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
Re: [PATCH 2/4] dt-binding: input: egalax-ts: fix GPIO and IRQ in example
In reply to Dmitry TorokhovQuoted 5 lines · Dmitry Torokhov
The driver is using level triggered interrupt (low) which is backed by and active low GPIO that can be used to wake the controller by driving it low. Let's annotate it properly in the example.
Signed-off-by Dmitry Torokhov <[email protected]>
Best regards,
Krzysztof
Quoted 7 lines · Dmitry Torokhov
This patch fixes interrupt trigger (should be level low as that is what the driver is always using), the GPIO that is the interrupt source that is also used to wake up chip by driving the line low.
The proper polarity is be needed for converting the driver to gpiod API.
Signed-off-by Dmitry Torokhov <[email protected]>
Looks good to me. Let me know if you want me to pick it up. Otherwise,
Shawn
Quoted 49 lines
--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +2
-2@@ -451,8 +451,8 @@ touchscreen@4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_egalax_int>; interrupt-parent = <&gpio2>; - interrupts = <28 IRQ_TYPE_EDGE_FALLING>; - wakeup-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; + interrupts = <28 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; }; };arch/arm/boot/dts/imx6qdl-sabresd.dtsi +4
-4@@ -311,8 +311,8 @@ touchscreen@4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2_egalax_int>; interrupt-parent = <&gpio6>; - interrupts = <8 IRQ_TYPE_EDGE_FALLING>; - wakeup-gpios = <&gpio6 8 GPIO_ACTIVE_HIGH>; + interrupts = <8 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio6 8 GPIO_ACTIVE_LOW>; }; ov5640: camera@3c {@@ -450,8 +450,8 @@ egalax_ts@4 { compatible = "eeti,egalax_ts"; reg = <0x04>; interrupt-parent = <&gpio6>; - interrupts = <7 2>; - wakeup-gpios = <&gpio6 7 0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_LOW>; }; magnetometer@e {Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
Dmitry Torokhov
maintainerQuoted 5 lines · Shawn Guo
Quoted 4 lines · Dmitry Torokhov
This patch fixes interrupt trigger (should be level low as that is what the driver is always using), the GPIO that is the interrupt source that is also used to wake up chip by driving the line low.
Quoted 7 lines
Quoted 3 lines
The proper polarity is be needed for converting the driver to gpiod API.
Signed-off-by Dmitry Torokhov <[email protected]>Looks good to me. Let me know if you want me to pick it up. Otherwise,
Acked-by Shawn Guo <[email protected]>
Thank you, I merged it with the other 3 patches through my tree.
Signature · 6 lines
Dmitry _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel