Skip to contentSkip to conversation

input: touchscreen: edt-ft5x06: make wakeup source behavior configurable

PATCH Superseded Daniel Mack 2 participants 7 messages May 16, 2018 – May 17, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover input: touchscreen: edt-ft5x06: make wakeup source behavior configurable

Hi,

I have a platform that features an edt-ft5x06 touch panel and that doesn't want to wake on touch screen activity.

Here's a trivial series of patches that make the edt-ft5x06 driver only act as wakeup source when requested through device properties or DTS.

The third patch changes the default in two DTS files that use this driver.

I guess the first two patches should go through the input tree, while the third can be picked by the IMX people. There are no compile-time dependencies, so the order doesn't matter.

Thanks,
Daniel

Daniel Mack (3):
input: touchscreen: edt-ft5x06: make wakeup source behavior
configurable
input: touchscreen: edt-ft5x06: assert reset during suspend
ARM: dts: imx28/imx53: enable edt-ft5x06 wakeup source

 .../devicetree/bindings/input/touchscreen/edt-ft5x06.txt         | 3 +++
 arch/arm/boot/dts/imx28-tx28.dts                                 | 1 +
 arch/arm/boot/dts/imx53-tx53-x03x.dts                            | 1 +
 drivers/input/touchscreen/edt-ft5x06.c                           | 9 ++++++++-
 4 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/3 input: touchscreen: edt-ft5x06: make wakeup source behavior configurable

Allow configuring the device as wakeup source through device properties, as not all platforms want to wake up on touch screen activity.

Note that by default, the device will now no longer be a wakeup source.

---
 Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt | 3 +++
 drivers/input/touchscreen/edt-ft5x06.c                             | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt +3 -0
index 025cf8c9324a..83f792d4d88c 100644
@@ -52,6 +52,8 @@ Optional properties:
  - touchscreen-inverted-y  : See touchscreen.txt
  - touchscreen-swapped-x-y : See touchscreen.txt
 
+ - wakeup-source: touchscreen acts as wakeup source
+
 Example:
 	polytouch: edt-ft5x06 at 38 {
 		compatible = "edt,edt-ft5406", "edt,edt-ft5x06";
@@ -62,4 +64,5 @@ Example:
 		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
 		reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 		wake-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+		wakeup-source;
 	};
drivers/input/touchscreen/edt-ft5x06.c +2 -1
index 5bf63f76ddda..955f085627fa 100644
@@ -1007,7 +1007,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		goto err_remove_attrs;
 
 	edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
-	device_init_wakeup(&client->dev, 1);
+	device_init_wakeup(&client->dev,
+			    device_property_read_bool(dev, "wakeup-source"));
 
 	dev_dbg(&client->dev,
 		"EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
Signature · 1 line
2.14.3
maintainer
#2 lore raw

PATCH 1/3 input: touchscreen: edt-ft5x06: make wakeup source behavior configurable

Hi Daniel,

Quoted 35 lines · Daniel Mack

Allow configuring the device as wakeup source through device properties, as not all platforms want to wake up on touch screen activity.

Note that by default, the device will now no longer be a wakeup source.

---
 Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt | 3 +++
 drivers/input/touchscreen/edt-ft5x06.c                             | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt +3 -0
index 025cf8c9324a..83f792d4d88c 100644
@@ -52,6 +52,8 @@ Optional properties:
  - touchscreen-inverted-y  : See touchscreen.txt
  - touchscreen-swapped-x-y : See touchscreen.txt
 
+ - wakeup-source: touchscreen acts as wakeup source
+
 Example:
 	polytouch: edt-ft5x06 at 38 {
 		compatible = "edt,edt-ft5406", "edt,edt-ft5x06";
@@ -62,4 +64,5 @@ Example:
 		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
 		reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 		wake-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+		wakeup-source;
 	};
drivers/input/touchscreen/edt-ft5x06.c +0 -0
index 5bf63f76ddda..955f085627fa 100644

drivers/input/touchscreen/edt-ft5x06.c static int edt_ft5x06_ts_probe(struct i2c_client *client, · line 1011

Quoted 6 lines
drivers/input/touchscreen/edt-ft5x06.c +2 -1
@@ -1007,7 +1007,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		goto err_remove_attrs;
 
 	edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
-	device_init_wakeup(&client->dev, 1);
+	device_init_wakeup(&client->dev,
+			    device_property_read_bool(dev, "wakeup-source"));

I think we should actually drop device_init_wakeup() call. I2C core already handles "wakeup-source" property (for OF). The static board files can instantiate clients with I2C_CLIENT_WAKE, so that's handled too, and I think ACPI has its own notion of annotating wakeup sources.

Quoted 6 lines
drivers/input/touchscreen/edt-ft5x06.c +0 -0
 	dev_dbg(&client->dev,
 		"EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
Signature · 1 line
2.14.3

Thanks.

Signature · 1 line
Dmitry
#3 lore raw

PATCH 1/3 input: touchscreen: edt-ft5x06: make wakeup source behavior configurable

Hi Dmitry,

Quoted 7 lines · Dmitry Torokhov
Quoted 7 lines
drivers/input/touchscreen/edt-ft5x06.c +0 -0
index 5bf63f76ddda..955f085627fa 100644
@@ -1007,7 +1007,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
  		goto err_remove_attrs;
 
Quoted 9 lines

drivers/input/touchscreen/edt-ft5x06.c static int edt_ft5x06_ts_probe(struct i2c_client *client, · line 1011

Quoted 4 lines
drivers/input/touchscreen/edt-ft5x06.c +2 -1
  	edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
-	device_init_wakeup(&client->dev, 1);
+	device_init_wakeup(&client->dev,
+			    device_property_read_bool(dev, "wakeup-source"));

I think we should actually drop device_init_wakeup() call. I2C core already handles "wakeup-source" property (for OF). The static board files can instantiate clients with I2C_CLIENT_WAKE, so that's handled too, and I think ACPI has its own notion of annotating wakeup sources.

Ah, right! Thanks, will respin :)

Daniel

#4 lore raw

PATCH 2/3 input: touchscreen: edt-ft5x06: assert reset during suspend

In reply to Daniel Mack

If the device is not configured as wakeup source, it can be put in reset during suspend to save some power.

---
 drivers/input/touchscreen/edt-ft5x06.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/input/touchscreen/edt-ft5x06.c +6 -0
index 955f085627fa..c34a0b23f90a 100644
@@ -1036,9 +1036,12 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	if (device_may_wakeup(dev))
 		enable_irq_wake(client->irq);
+	else if (tsdata->reset_gpio)
+		gpiod_set_value_cansleep(tsdata->reset_gpio, 1);
 
 	return 0;
 }
@@ -1046,9 +1049,12 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(client->irq);
+	else if (tsdata->reset_gpio)
+		gpiod_set_value_cansleep(tsdata->reset_gpio, 0);
 
 	return 0;
 }
Signature · 1 line
2.14.3
maintainer
#5 lore raw

PATCH 2/3 input: touchscreen: edt-ft5x06: assert reset during suspend

Quoted 26 lines · Daniel Mack

If the device is not configured as wakeup source, it can be put in reset during suspend to save some power.

---
 drivers/input/touchscreen/edt-ft5x06.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/input/touchscreen/edt-ft5x06.c +3 -0
index 955f085627fa..c34a0b23f90a 100644
@@ -1036,9 +1036,12 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	if (device_may_wakeup(dev))
 		enable_irq_wake(client->irq);
+	else if (tsdata->reset_gpio)
+		gpiod_set_value_cansleep(tsdata->reset_gpio, 1);
 
 	return 0;
 }

drivers/input/touchscreen/edt-ft5x06.c static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) · line 1057

Quoted 9 lines
drivers/input/touchscreen/edt-ft5x06.c +3 -0
@@ -1046,9 +1049,12 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(client->irq);
+	else if (tsdata->reset_gpio)
+		gpiod_set_value_cansleep(tsdata->reset_gpio, 0);

I think you need msleep() here as the chip needs a bit to get out of reset before it is ready. FWIW we have 300 ms delay in probe().

Thanks.

Signature · 1 line
Dmitry
#6 lore raw

PATCH 3/3 ARM: dts: imx28/imx53: enable edt-ft5x06 wakeup source

In reply to Daniel Mack

The touchscreen driver no longer configures the device as wakeup source by default. A "wakeup-source" property is needed.

To avoid regressions, this patch changes the DTS files for the only two users of this driver that didn't have this property yet.

---
 arch/arm/boot/dts/imx28-tx28.dts      | 1 +
 arch/arm/boot/dts/imx53-tx53-x03x.dts | 1 +
 2 files changed, 2 insertions(+)
arch/arm/boot/dts/imx28-tx28.dts +1 -0
index 0ebbc83852d0..094a39a67ec8 100644
@@ -328,6 +328,7 @@
 		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
 		reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 		wake-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+		wakeup-source;
 	};
 
 	touchscreen: tsc2007 at 48 {
arch/arm/boot/dts/imx53-tx53-x03x.dts +1 -0
index 0ecb43d88522..dbf0d73dc7b9 100644
@@ -220,6 +220,7 @@
 		interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
 		reset-gpios = <&gpio2 22 GPIO_ACTIVE_LOW>;
 		wake-gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
+		wakeup-source;
 	};
 
 	touchscreen: tsc2007 at 48 {
Signature · 1 line
2.14.3