[PATCH v2 1/2] Input: st1232 - remove enable/disable irq if device may wake up

From: Javier Carrasco
Date: Fri Sep 15 2023 - 09:47:46 EST


Disabling the interrupts unconditionally in the suspend callback leads
to a loss of the wakeup capability in suspend to idle (freeze) mode.

In commit 95dc58a9a02f ("Input: st1232 - rely on I2C core to configure
wakeup interrupt") redundancy was removed by letting the I2C core manage
the wake interrupt handling. On the other hand, the irq enabling/disabling
became unconditional.

Revert the general interrupt enabling/disabling to its previous state.

Fixes: 95dc58a9a02f ("Input: st1232 - rely on I2C core to configure wakeup interrupt")
Signed-off-by: Javier Carrasco <javier.carrasco@xxxxxxxxxxxxxx>
---
drivers/input/touchscreen/st1232.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index 6475084aee1b..d0ee90abc293 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -345,10 +345,10 @@ static int st1232_ts_suspend(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct st1232_ts_data *ts = i2c_get_clientdata(client);

- disable_irq(client->irq);
-
- if (!device_may_wakeup(&client->dev))
+ if (!device_may_wakeup(&client->dev)) {
+ disable_irq(client->irq);
st1232_ts_power(ts, false);
+ }

return 0;
}
@@ -358,10 +358,10 @@ static int st1232_ts_resume(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct st1232_ts_data *ts = i2c_get_clientdata(client);

- if (!device_may_wakeup(&client->dev))
+ if (!device_may_wakeup(&client->dev)) {
+ enable_irq(client->irq);
st1232_ts_power(ts, true);
-
- enable_irq(client->irq);
+ }

return 0;
}

--
2.39.2