linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: ili210x:  Enable suspend/resume functions
@ 2020-09-18 14:33 Adam Ford
  2020-11-04 16:15 ` Adam Ford
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Ford @ 2020-09-18 14:33 UTC (permalink / raw)
  To: linux-input; +Cc: aford, Adam Ford, Dmitry Torokhov, linux-kernel

Some people may wish to wake their system from sleep, so this
patch enables a suspend and resume function which enables
and disables IRQ wake functions.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 199cf3daec10..9b1a61447054 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -474,6 +474,28 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 	return 0;
 }
 
+static int __maybe_unused ili210x_i2c_suspend(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+
+	if (device_may_wakeup(&client->dev))
+		enable_irq_wake(client->irq);
+
+	return 0;
+}
+
+static int __maybe_unused ili210x_i2c_resume(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+
+	if (device_may_wakeup(&client->dev))
+		disable_irq_wake(client->irq);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(ili210x_i2c_pm, ili210x_i2c_suspend, ili210x_i2c_resume);
+
 static const struct i2c_device_id ili210x_i2c_id[] = {
 	{ "ili210x", (long)&ili210x_chip },
 	{ "ili2117", (long)&ili211x_chip },
@@ -495,6 +517,7 @@ MODULE_DEVICE_TABLE(of, ili210x_dt_ids);
 static struct i2c_driver ili210x_ts_driver = {
 	.driver = {
 		.name = "ili210x_i2c",
+		.pm = &ili210x_i2c_pm,
 		.of_match_table = ili210x_dt_ids,
 	},
 	.id_table = ili210x_i2c_id,
-- 
2.25.1


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

* Re: [PATCH] Input: ili210x: Enable suspend/resume functions
  2020-09-18 14:33 [PATCH] Input: ili210x: Enable suspend/resume functions Adam Ford
@ 2020-11-04 16:15 ` Adam Ford
  2020-11-04 16:22   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Ford @ 2020-11-04 16:15 UTC (permalink / raw)
  To: linux-input; +Cc: Adam Ford-BE, Dmitry Torokhov, Linux Kernel Mailing List

On Fri, Sep 18, 2020 at 9:34 AM Adam Ford <aford173@gmail.com> wrote:
>
> Some people may wish to wake their system from sleep, so this
> patch enables a suspend and resume function which enables
> and disables IRQ wake functions.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>

Gentle ping.  Any feedback on this?

>
> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> index 199cf3daec10..9b1a61447054 100644
> --- a/drivers/input/touchscreen/ili210x.c
> +++ b/drivers/input/touchscreen/ili210x.c
> @@ -474,6 +474,28 @@ static int ili210x_i2c_probe(struct i2c_client *client,
>         return 0;
>  }
>
> +static int __maybe_unused ili210x_i2c_suspend(struct device *dev)
> +{
> +       struct i2c_client *client = to_i2c_client(dev);
> +
> +       if (device_may_wakeup(&client->dev))
> +               enable_irq_wake(client->irq);
> +
> +       return 0;
> +}
> +
> +static int __maybe_unused ili210x_i2c_resume(struct device *dev)
> +{
> +       struct i2c_client *client = to_i2c_client(dev);
> +
> +       if (device_may_wakeup(&client->dev))
> +               disable_irq_wake(client->irq);
> +
> +       return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(ili210x_i2c_pm, ili210x_i2c_suspend, ili210x_i2c_resume);
> +
>  static const struct i2c_device_id ili210x_i2c_id[] = {
>         { "ili210x", (long)&ili210x_chip },
>         { "ili2117", (long)&ili211x_chip },
> @@ -495,6 +517,7 @@ MODULE_DEVICE_TABLE(of, ili210x_dt_ids);
>  static struct i2c_driver ili210x_ts_driver = {
>         .driver = {
>                 .name = "ili210x_i2c",
> +               .pm = &ili210x_i2c_pm,
>                 .of_match_table = ili210x_dt_ids,
>         },
>         .id_table = ili210x_i2c_id,
> --
> 2.25.1
>

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

* Re: [PATCH] Input: ili210x: Enable suspend/resume functions
  2020-11-04 16:15 ` Adam Ford
@ 2020-11-04 16:22   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-11-04 16:22 UTC (permalink / raw)
  To: Adam Ford; +Cc: linux-input, Adam Ford-BE, Linux Kernel Mailing List

Hi Adam,

On Wed, Nov 04, 2020 at 10:15:47AM -0600, Adam Ford wrote:
> On Fri, Sep 18, 2020 at 9:34 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > Some people may wish to wake their system from sleep, so this
> > patch enables a suspend and resume function which enables
> > and disables IRQ wake functions.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> Gentle ping.  Any feedback on this?

Ah, sorry. This should not be needed as for I2C devices that are
configured as wakeup sources I2C core takes care of declaring interrupt
line as wake IRQ and should configure it accordingly during the system
state transitions.

See drivers/i2c/i2c-core-base.c - calls to
dev_pm_set_[dedicated_]wake_irq() in i2c_device_probe().

> 
> >
> > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> > index 199cf3daec10..9b1a61447054 100644
> > --- a/drivers/input/touchscreen/ili210x.c
> > +++ b/drivers/input/touchscreen/ili210x.c
> > @@ -474,6 +474,28 @@ static int ili210x_i2c_probe(struct i2c_client *client,
> >         return 0;
> >  }
> >
> > +static int __maybe_unused ili210x_i2c_suspend(struct device *dev)
> > +{
> > +       struct i2c_client *client = to_i2c_client(dev);
> > +
> > +       if (device_may_wakeup(&client->dev))
> > +               enable_irq_wake(client->irq);
> > +
> > +       return 0;
> > +}
> > +
> > +static int __maybe_unused ili210x_i2c_resume(struct device *dev)
> > +{
> > +       struct i2c_client *client = to_i2c_client(dev);
> > +
> > +       if (device_may_wakeup(&client->dev))
> > +               disable_irq_wake(client->irq);
> > +
> > +       return 0;
> > +}
> > +
> > +static SIMPLE_DEV_PM_OPS(ili210x_i2c_pm, ili210x_i2c_suspend, ili210x_i2c_resume);
> > +
> >  static const struct i2c_device_id ili210x_i2c_id[] = {
> >         { "ili210x", (long)&ili210x_chip },
> >         { "ili2117", (long)&ili211x_chip },
> > @@ -495,6 +517,7 @@ MODULE_DEVICE_TABLE(of, ili210x_dt_ids);
> >  static struct i2c_driver ili210x_ts_driver = {
> >         .driver = {
> >                 .name = "ili210x_i2c",
> > +               .pm = &ili210x_i2c_pm,
> >                 .of_match_table = ili210x_dt_ids,
> >         },
> >         .id_table = ili210x_i2c_id,
> > --
> > 2.25.1
> >

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2020-11-04 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-18 14:33 [PATCH] Input: ili210x: Enable suspend/resume functions Adam Ford
2020-11-04 16:15 ` Adam Ford
2020-11-04 16:22   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).