Re: [PATCH 1/2] Input: atmel_mxt_ts: Add wake-up support
flat view
From: Loic Poulain <hidden>
Date: 2021-06-24 07:47:26
Hi Dmitry, On Thu, 24 Jun 2021 at 02:41, Dmitry Torokhov [off-list ref] wrote:
Hi Loic, On Wed, Jun 23, 2021 at 03:56:36PM +0200, Loic Poulain wrote:quoted
Add capability for the touchscreen to wakeup the host on touch event. Signed-off-by: Loic Poulain <redacted> --- drivers/input/touchscreen/atmel_mxt_ts.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 05de92c..807f449 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c@@ -3223,6 +3223,8 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + device_set_wakeup_capable(&client->dev, true);We do not want to make the touch controller be wakeup source unconditionally. I2C core recognized "wakeup-source" in device tree, other platforms may employ different techniques setting I2C_CLIENT_WAKE when registering I2C devices to mark them as wakeup capable/enabled.
Contrary to device_init_wakeup(), used in some other input drivers, device_set_wakeup_capable() does not enable the device as a wakeup source but just sets it as wakeup capable, and it's up to the user or distro policy to enable it as a wakeup source or not. It's a quite common way to do, and it does not change the behavior of this driver. The I2C_CLIENT_WAKE forces enabling wakeup source, which is maybe not what we want by default for a touchscreen. remote-wakeup enabling is a device configuration not a hardware property. Thoughts? I should probably also add dev_pm_set_wake_irq() for auto-enabling wake on suspend instead of doing it manually. Regards, Loic