[PATCH v2 4/6] Input: cyttsp5 - properly initialize the device as a pm wakeup device

Maximilian Weigand posted 6 patches 2 years, 7 months ago
There is a newer version of this series
[PATCH v2 4/6] Input: cyttsp5 - properly initialize the device as a pm wakeup device
Posted by Maximilian Weigand 2 years, 7 months ago
When used as a wakeup source the driver should be properly registered
with the pm system using device_init_wakeup.

Signed-off-by: Maximilian Weigand <mweigand@mweigand.net>
Reviewed-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/input/touchscreen/cyttsp5.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
index 55abf568bdf6..f701125357f0 100644
--- a/drivers/input/touchscreen/cyttsp5.c
+++ b/drivers/input/touchscreen/cyttsp5.c
@@ -830,6 +830,9 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
 		return error;
 	}
 
+	if (device_property_read_bool(dev, "wakeup-source"))
+		device_init_wakeup(dev, true);
+
 	error = cyttsp5_startup(ts);
 	if (error) {
 		dev_err(ts->dev, "Fail initial startup r=%d\n", error);
-- 
2.39.2
Re: [PATCH v2 4/6] Input: cyttsp5 - properly initialize the device as a pm wakeup device
Posted by Dmitry Torokhov 2 years, 7 months ago
Hi Maximilian,

On Mon, May 01, 2023 at 01:30:08PM +0200, Maximilian Weigand wrote:
> When used as a wakeup source the driver should be properly registered
> with the pm system using device_init_wakeup.

This is an I2C device and I2C core already handles setting up a device
as a wakeup source, this patch is not needed as far as I can tell.

> 
> Signed-off-by: Maximilian Weigand <mweigand@mweigand.net>
> Reviewed-by: Alistair Francis <alistair@alistair23.me>
> ---
>  drivers/input/touchscreen/cyttsp5.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
> index 55abf568bdf6..f701125357f0 100644
> --- a/drivers/input/touchscreen/cyttsp5.c
> +++ b/drivers/input/touchscreen/cyttsp5.c
> @@ -830,6 +830,9 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
>  		return error;
>  	}
>  
> +	if (device_property_read_bool(dev, "wakeup-source"))
> +		device_init_wakeup(dev, true);
> +
>  	error = cyttsp5_startup(ts);
>  	if (error) {
>  		dev_err(ts->dev, "Fail initial startup r=%d\n", error);
> -- 
> 2.39.2
> 

Thanks.

-- 
Dmitry