diff mbox series

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

Message ID 20180516122829.23694-2-daniel@zonque.org
State Superseded, archived
Headers show
Series input: touchscreen: edt-ft5x06: make wakeup source behavior configurable | expand

Commit Message

Daniel Mack May 16, 2018, 12:28 p.m. UTC
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.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt | 3 +++
 drivers/input/touchscreen/edt-ft5x06.c                             | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov May 16, 2018, 5:03 p.m. UTC | #1
Hi Daniel,

On Wed, May 16, 2018 at 02:28:27PM +0200, Daniel Mack wrote:
> 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.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt | 3 +++
>  drivers/input/touchscreen/edt-ft5x06.c                             | 3 ++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
> index 025cf8c9324a..83f792d4d88c 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
> @@ -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@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;
>  	};
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index 5bf63f76ddda..955f085627fa 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -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.

>  
>  	dev_dbg(&client->dev,
>  		"EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
> -- 
> 2.14.3
> 

Thanks.
Daniel Mack May 17, 2018, 8:48 a.m. UTC | #2
Hi Dmitry,

On Wednesday, May 16, 2018 07:03 PM, Dmitry Torokhov wrote:
>> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
>> index 5bf63f76ddda..955f085627fa 100644
>> --- a/drivers/input/touchscreen/edt-ft5x06.c
>> +++ b/drivers/input/touchscreen/edt-ft5x06.c
>> @@ -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.

Ah, right! Thanks, will respin :)


Daniel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
index 025cf8c9324a..83f792d4d88c 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
@@ -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@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;
 	};
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 5bf63f76ddda..955f085627fa 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -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",