From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Raul E Rangel <rrangel@chromium.org>
Cc: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org,
hdegoede@redhat.com, mario.limonciello@amd.com, timvp@google.com,
rafael@kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Wolfram Sang <wsa@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] i2c: acpi: Use ACPI GPIO wake capability bit to set wake_irq
Date: Tue, 6 Sep 2022 18:00:37 -0700 [thread overview]
Message-ID: <YxftNQrRx3fwsobk@google.com> (raw)
In-Reply-To: <20220830171332.4.I8af4282adc72eb9f247adcd03676a43893a020a6@changeid>
On Tue, Aug 30, 2022 at 05:15:37PM -0600, Raul E Rangel wrote:
> Device tree already has a mechanism to pass the wake_irq. It does this
> by looking for the wakeup-source property and setting the
> I2C_CLIENT_WAKE flag. This CL adds the ACPI equivalent. It uses at the
> ACPI GpioInt wake flag to determine if the interrupt can be used to wake
> the system. Previously the i2c drivers had to make assumptions and
> blindly enable the wake IRQ. This can cause spurious wake events. e.g.,
> If there is a device with an Active Low interrupt and the device gets
> powered off while suspending, the interrupt line will go low since it's
> no longer powered and wake the system. For this reason we should respect
> the board designers wishes and honor the wake bit defined on the
> GpioInt.
>
> This change does not cover the ACPI Interrupt or IRQ resources.
>
> Signed-off-by: Raul E Rangel <rrangel@chromium.org>
> ---
>
> drivers/i2c/i2c-core-acpi.c | 8 ++++++--
> drivers/i2c/i2c-core-base.c | 17 +++++++++++------
> drivers/i2c/i2c-core.h | 4 ++--
> 3 files changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
> index c762a879c4cc6b..cfe82a6ba3ef28 100644
> --- a/drivers/i2c/i2c-core-acpi.c
> +++ b/drivers/i2c/i2c-core-acpi.c
> @@ -182,12 +182,13 @@ static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data)
> /**
> * i2c_acpi_get_irq - get device IRQ number from ACPI
> * @client: Pointer to the I2C client device
> + * @wake_capable: Set to 1 if the IRQ is wake capable
> *
> * Find the IRQ number used by a specific client device.
> *
> * Return: The IRQ number or an error code.
> */
> -int i2c_acpi_get_irq(struct i2c_client *client)
> +int i2c_acpi_get_irq(struct i2c_client *client, int *wake_capable)
> {
> struct acpi_device *adev = ACPI_COMPANION(&client->dev);
> struct list_head resource_list;
> @@ -196,6 +197,9 @@ int i2c_acpi_get_irq(struct i2c_client *client)
>
> INIT_LIST_HEAD(&resource_list);
>
> + if (wake_capable)
> + *wake_capable = 0;
> +
> ret = acpi_dev_get_resources(adev, &resource_list,
> i2c_acpi_add_resource, &irq);
You also need to handle "Interrupt(..., ...AndWake)" case here. I would
look into maybe defining
#define IORESOURCE_IRQ_WAKECAPABLE (1<<6)
in include/linux/ioport.h and plumbing it through from ACPI layer.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2022-09-07 1:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 23:15 [PATCH 0/8] acpi: i2c: Use SharedAndWake and ExclusiveAndWake to enable wake irq Raul E Rangel
2022-08-30 23:15 ` [PATCH 1/8] Input: elan_i2c - Use PM subsystem to manage " Raul E Rangel
2022-08-31 18:01 ` Rafael J. Wysocki
2022-08-31 18:13 ` Raul Rangel
2022-08-31 18:42 ` Rafael J. Wysocki
2022-09-01 6:57 ` Tony Lindgren
2022-08-31 19:12 ` Dmitry Torokhov
2022-08-31 19:16 ` Dmitry Torokhov
2022-09-01 2:17 ` Raul Rangel
2022-09-03 5:06 ` Dmitry Torokhov
2022-09-06 17:18 ` Raul Rangel
2022-09-06 18:40 ` Dmitry Torokhov
2022-08-30 23:15 ` [PATCH 2/8] HID: i2c-hid: " Raul E Rangel
2022-08-30 23:15 ` [PATCH 3/8] gpiolib: acpi: Add wake_capable parameter to acpi_dev_gpio_irq_get_by Raul E Rangel
2022-08-31 4:58 ` kernel test robot
2022-08-30 23:15 ` [PATCH 4/8] i2c: acpi: Use ACPI GPIO wake capability bit to set wake_irq Raul E Rangel
2022-09-07 1:00 ` Dmitry Torokhov [this message]
2022-09-07 2:00 ` Raul Rangel
2022-09-07 2:04 ` Dmitry Torokhov
2022-09-07 8:12 ` Hans de Goede
2022-09-08 14:40 ` Raul Rangel
2022-09-08 15:23 ` Rafael J. Wysocki
2022-09-09 18:47 ` Raul Rangel
2022-09-10 1:25 ` Dmitry Torokhov
2022-08-30 23:15 ` [PATCH 5/8] HID: i2c-hid: acpi: Stop setting wakeup_capable Raul E Rangel
2022-08-30 23:15 ` [PATCH 6/8] Input: elan_i2c - Don't set wake_irq when using ACPI Raul E Rangel
2022-08-30 23:15 ` [PATCH 7/8] HID: i2c-hid: " Raul E Rangel
2022-08-30 23:15 ` [PATCH 8/8] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle Raul E Rangel
2022-08-31 11:52 ` [PATCH 0/8] acpi: i2c: Use SharedAndWake and ExclusiveAndWake to enable wake irq Andy Shevchenko
2022-08-31 14:37 ` Raul Rangel
2022-08-31 15:18 ` Hans de Goede
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=YxftNQrRx3fwsobk@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@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=rrangel@chromium.org \
--cc=timvp@google.com \
--cc=wsa@kernel.org \
/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 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).