All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raul Rangel <rrangel@chromium.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	linux-input <linux-input@vger.kernel.org>,
	Tim Van Patten <timvp@google.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"jingle.wu" <jingle.wu@emc.com.tw>,
	Hans de Goede <hdegoede@redhat.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Len Brown <lenb@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle
Date: Wed, 28 Sep 2022 15:10:40 -0600	[thread overview]
Message-ID: <CAHQZ30BZ5jnTY4DQD5mxpnLcLxn5Oo=izB1+f06JOqXU5VGz_A@mail.gmail.com> (raw)
In-Reply-To: <CAJZ5v0g57mF-4ZC2ajL5+JE+q9y=fW1G-OXR8tuOk4TYxHPWtQ@mail.gmail.com>

On Sat, Sep 24, 2022 at 11:00 AM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Wed, Sep 21, 2022 at 5:52 PM Raul E Rangel <rrangel@chromium.org> wrote:
> >
> > This change adds support for ACPI devices that use ExclusiveAndWake or
> > SharedAndWake in their _CRS GpioInt definition (instead of using _PRW),
> > and also provide power resources. Previously the ACPI subsystem had no
> > idea if the device had a wake capable interrupt armed. This resulted
> > in the ACPI device PM system placing the device into D3Cold, and thus
> > cutting power to the device. With this change we will now query the
> > _S0W method to figure out the appropriate wake capable D-state.
> >
> > Signed-off-by: Raul E Rangel <rrangel@chromium.org>
> > ---
> >
> > Changes in v5:
> > - Go back to using adev->wakeup.flags.valid to keep the diff cleaner
> > - Fix a typo in comment
> >
> >  drivers/acpi/device_pm.c | 19 +++++++++++++++++--
> >  1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
> > index 9dce1245689ca2..3111fc426e04fd 100644
> > --- a/drivers/acpi/device_pm.c
> > +++ b/drivers/acpi/device_pm.c

> > @@ -681,8 +681,23 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
> >                 d_min = ret;
> >                 wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid
> >                         && adev->wakeup.sleep_state >= target_state;
Just an FYI, I didn't update the code that handles the target state >
S0. I need to get a
device that has S3 capabilities and the correct firmware to test this.
I figure I can do
that as a different patch when I have time to test with an S3 device.

> > -       } else {
> > -               wakeup = adev->wakeup.flags.valid;
> > +       } else if (adev->wakeup.flags.valid) {
> > +               /* ACPI GPE specified in _PRW. */
> > +               wakeup = true;

>
> I would retain the "else" clause as it was and just add a new "else
> if" one before it.
>
Done

> > +       } else if (device_may_wakeup(dev) && dev->power.wakeirq) {
> > +               /*
> > +                * The ACPI subsystem doesn't manage the wake bit for IRQs
> > +                * defined with ExclusiveAndWake and SharedAndWake. Instead we
> > +                * expect them to be managed via the PM subsystem. Drivers
> > +                * should call dev_pm_set_wake_irq to register an IRQ as a wake
> > +                * source.
> > +                *
> > +                * If a device has a wake IRQ attached we need to check the
> > +                * _S0W method to get the correct wake D-state. Otherwise we
> > +                * end up putting the device into D3Cold which will more than
> > +                * likely disable wake functionality.
> > +                */
> > +               wakeup = true;
> >         }
> >
> >         /*
> > --

I'll send out v6 soon unless anyone else has any comments.

  reply	other threads:[~2022-09-28 21:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 15:51 [PATCH v5 00/13] acpi: i2c: Use SharedAndWake and ExclusiveAndWake to enable wake irq Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 01/13] HID: i2c-hid: Use PM subsystem to manage " Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 02/13] Input: elan_i2c - " Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 03/13] Input: elants_i2c " Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 04/13] Input: raydium_ts_i2c " Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 05/13] gpiolib: acpi: Add wake_capable variants of acpi_dev_gpio_irq_get Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 06/13] ACPI: resources: Add wake_capable parameter to acpi_dev_irq_flags Raul E Rangel
2022-09-21 15:51 ` [PATCH v5 07/13] i2c: acpi: Use ACPI wake capability bit to set wake_irq Raul E Rangel
2022-09-21 20:10   ` Wolfram Sang
2022-09-21 15:52 ` [PATCH v5 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle Raul E Rangel
2022-09-24 17:00   ` Rafael J. Wysocki
2022-09-28 21:10     ` Raul Rangel [this message]
2022-09-29 10:06       ` Rafael J. Wysocki
2022-09-21 15:52 ` [PATCH v5 09/13] HID: i2c-hid: acpi: Stop setting wakeup_capable Raul E Rangel
2022-09-21 15:52 ` [PATCH v5 10/13] HID: i2c-hid: Don't set wake_capable and wake_irq Raul E Rangel
2022-09-21 15:52 ` [PATCH v5 11/13] Input: elan_i2c - " Raul E Rangel
2022-09-21 15:52 ` [PATCH v5 12/13] Input: elants_i2c " Raul E Rangel
2022-09-21 15:52 ` [PATCH v5 13/13] Input: raydium_ts_i2c " Raul E Rangel
2022-09-21 22:54 ` [PATCH v5 00/13] acpi: i2c: Use SharedAndWake and ExclusiveAndWake to enable wake irq Dmitry Torokhov
2022-09-22 10:15 ` Andy Shevchenko
2022-09-23 15:37   ` Raul Rangel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHQZ30BZ5jnTY4DQD5mxpnLcLxn5Oo=izB1+f06JOqXU5VGz_A@mail.gmail.com' \
    --to=rrangel@chromium.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jingle.wu@emc.com.tw \
    --cc=lenb@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=timvp@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.