[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200122060419.GD110084@dtor-ws>
Date: Tue, 21 Jan 2020 22:04:19 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Samuel Holland <samuel@...lland.org>, Chen-Yu Tsai <wens@...e.org>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v2 1/2] Input: axp20x-pek - Respect userspace wakeup
configuration
On Wed, Jan 15, 2020 at 11:50:08AM +0100, Hans de Goede wrote:
> Hi,
>
> On 15-01-2020 06:12, Samuel Holland wrote:
> > Unlike most other power button drivers, this driver unconditionally
> > enables its wakeup IRQ. It should be using device_may_wakeup() to
> > respect the userspace configuration of wakeup sources.
> >
> > Because the AXP20x MFD device uses regmap-irq, the AXP20x PEK IRQs are
> > nested off of regmap-irq's threaded interrupt handler. The device core
> > ignores such interrupts, so to actually disable wakeup, we must
> > explicitly disable all non-wakeup interrupts during suspend.
> >
> > Signed-off-by: Samuel Holland <samuel@...lland.org>
>
> Patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Applied, thank you.
>
> Regards,
>
> Hans
>
>
>
> > ---
> > drivers/input/misc/axp20x-pek.c | 37 ++++++++++++++++++++++++++++++++-
> > 1 file changed, 36 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> > index 17c1cca74498..0ace3fe3d7dc 100644
> > --- a/drivers/input/misc/axp20x-pek.c
> > +++ b/drivers/input/misc/axp20x-pek.c
> > @@ -280,7 +280,7 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
> > }
> > if (axp20x_pek->axp20x->variant == AXP288_ID)
> > - enable_irq_wake(axp20x_pek->irq_dbr);
> > + device_init_wakeup(&pdev->dev, true);
> > return 0;
> > }
> > @@ -352,6 +352,40 @@ static int axp20x_pek_probe(struct platform_device *pdev)
> > return 0;
> > }
> > +static int __maybe_unused axp20x_pek_suspend(struct device *dev)
> > +{
> > + struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> > +
> > + /*
> > + * As nested threaded IRQs are not automatically disabled during
> > + * suspend, we must explicitly disable non-wakeup IRQs.
> > + */
> > + if (device_may_wakeup(dev)) {
> > + enable_irq_wake(axp20x_pek->irq_dbf);
> > + enable_irq_wake(axp20x_pek->irq_dbr);
> > + } else {
> > + disable_irq(axp20x_pek->irq_dbf);
> > + disable_irq(axp20x_pek->irq_dbr);
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +static int __maybe_unused axp20x_pek_resume(struct device *dev)
> > +{
> > + struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> > +
> > + if (device_may_wakeup(dev)) {
> > + disable_irq_wake(axp20x_pek->irq_dbf);
> > + disable_irq_wake(axp20x_pek->irq_dbr);
> > + } else {
> > + enable_irq(axp20x_pek->irq_dbf);
> > + enable_irq(axp20x_pek->irq_dbr);
> > + }
> > +
> > + return 0;
> > +}
> > +
> > static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev)
> > {
> > struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> > @@ -371,6 +405,7 @@ static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev)
> > }
> > static const struct dev_pm_ops axp20x_pek_pm_ops = {
> > + SET_SYSTEM_SLEEP_PM_OPS(axp20x_pek_suspend, axp20x_pek_resume)
> > #ifdef CONFIG_PM_SLEEP
> > .resume_noirq = axp20x_pek_resume_noirq,
> > #endif
> >
>
--
Dmitry
Powered by blists - more mailing lists