All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: synaptics-rmi4 - Add I2C wakeup support
@ 2021-11-16 18:01 Loic Poulain
  2022-01-14 10:03 ` Loic Poulain
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2021-11-16 18:01 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, Loic Poulain

This adds wakeup capability to the I2C bus, and prevents regulator
shutdown when activated.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/input/rmi4/rmi_i2c.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index 50305fc..dc70ea0 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -273,6 +273,8 @@ static int rmi_i2c_probe(struct i2c_client *client,
 
 	dev_info(&client->dev, "registering I2C-connected sensor\n");
 
+	device_init_wakeup(&client->dev, true);
+
 	error = rmi_register_transport_device(&rmi_i2c->xport);
 	if (error) {
 		dev_err(&client->dev, "failed to register sensor: %d\n", error);
@@ -299,8 +301,10 @@ static int rmi_i2c_suspend(struct device *dev)
 	if (ret)
 		dev_warn(dev, "Failed to resume device: %d\n", ret);
 
-	regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies),
-			       rmi_i2c->supplies);
+	if (!device_may_wakeup(dev)) {
+		regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies),
+				       rmi_i2c->supplies);
+	}
 
 	return ret;
 }
@@ -311,12 +315,14 @@ static int rmi_i2c_resume(struct device *dev)
 	struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client);
 	int ret;
 
-	ret = regulator_bulk_enable(ARRAY_SIZE(rmi_i2c->supplies),
-				    rmi_i2c->supplies);
-	if (ret)
-		return ret;
+	if (!device_may_wakeup(dev)) {
+		ret = regulator_bulk_enable(ARRAY_SIZE(rmi_i2c->supplies),
+					    rmi_i2c->supplies);
+		if (ret)
+			return ret;
 
-	msleep(rmi_i2c->startup_delay);
+		msleep(rmi_i2c->startup_delay);
+	}
 
 	ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev, true);
 	if (ret)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: synaptics-rmi4 - Add I2C wakeup support
  2021-11-16 18:01 [PATCH] Input: synaptics-rmi4 - Add I2C wakeup support Loic Poulain
@ 2022-01-14 10:03 ` Loic Poulain
  0 siblings, 0 replies; 2+ messages in thread
From: Loic Poulain @ 2022-01-14 10:03 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input

Hi Dmitry,

On Tue, 16 Nov 2021 at 18:50, Loic Poulain <loic.poulain@linaro.org> wrote:
>
> This adds wakeup capability to the I2C bus, and prevents regulator
> shutdown when activated.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---

I Submitted a few changes for rmi4, still in new state. Should I
resend, is there anyone else I can include for review?

Thanks,
Loic

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-14  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 18:01 [PATCH] Input: synaptics-rmi4 - Add I2C wakeup support Loic Poulain
2022-01-14 10:03 ` Loic Poulain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.