mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Raul E Rangel <rrangel@chromium.org>,
	linux-kernel@vger.kernel.org,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: mario.limonciello@amd.com, linux-input@vger.kernel.org,
	dianders@chromium.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Jiri Kosina <jikos@kernel.org>
Subject: Re: [PATCH 1/3] HID: i2c-hid-acpi: Remove explicit device_set_wakeup_capable
Date: Tue, 21 Dec 2021 19:49:38 +0100	[thread overview]
Message-ID: <7d4f20da-f18b-eccf-19c4-ea7c15492634@redhat.com> (raw)
In-Reply-To: <20211220163823.1.Ie20ca47a26d3ea68124d8197b67bb1344c67f650@changeid>

Hi,

On 12/21/21 00:43, Raul E Rangel wrote:
> The ACPI subsystem is responsible for managing the power and wake
> sources for an ACPI device. By explicitly calling
> device_set_wakeup_capable, we are circumvent the ACPI subsystem and
> setting wake capabilities on the device when it doesn't support it.
> 
> Take the following example:
> * We have an ACPI HID device that has `_PR0` and `_PR3`. It doesn't have
> `_PRW` so that means the device can't wake the system.
> * The IRQ line is active level low for this device and is pulled up by the
> power resource defined in `_PR0`/`_PR3`.
> 
> Since the i2c-hid driver has set the device as wake capable, the wake
> pin gets enabled on suspend.

The IRQ pin should only have a enable_irq_wake() called on it if
something has actually requested the i2c-HID device to be a wakeup source,
the removed code claims the device is wakeup *capable*, but is also
explicitly calls device_set_wakeup_enable(dev, false), disabling wakeup.

And i2c-hid suspend does:

        if (device_may_wakeup(&client->dev)) {
                wake_status = enable_irq_wake(client->irq);

And device_may_wakeup() checks the wakeup *enabled* setting AFAIK.

I've added Rafael to the Cc since he knows all this a lot better then me.

I have the feeling that your userspace is perhaps poking the
wakeup settings in sysfs, triggering this issue.

> As part of suspend, ACPI will power down
> the device since it's not a wake source. When the device is powered
> down, the IRQ line will drop, and it will trigger a wake event.

To me that sounds like the device is not wakeup *capable* at all, so
its ACPI node should not set the ACPI_FADT_LOW_POWER_S0 flag at all.

Note I'm not certain about this at all, but at a first look this feels
like it is not the right fix for your problem.

Regards,

Hans


> 
> See the following debug log:
> [   42.335804] PM: Suspending system (s2idle)
> [   42.340186] amd_gpio AMD0030:00: RX: Setting wake for pin 89 to enable
> [   42.467736]     power-0416 __acpi_power_off      : Power resource [PR00] turned off
> [   42.467739] device_pm-0280 device_set_power      : Device [H05D] transitioned to D3cold
> [   42.475210] PM: pm_system_irq_wakeup: 11 triggered pinctrl_amd
> [   42.535293] PM: Wakeup unrelated to ACPI SCI
> [   42.535294] PM: resume from suspend-to-idle
> 
> Signed-off-by: Raul E Rangel <rrangel@chromium.org>
> ---
> 
>  drivers/hid/i2c-hid/i2c-hid-acpi.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-hid-acpi.c
> index a6f0257a26de..fc311a19a19d 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-acpi.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c
> @@ -105,11 +105,6 @@ static int i2c_hid_acpi_probe(struct i2c_client *client)
>  
>  	acpi_device_fix_up_power(adev);
>  
> -	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
> -		device_set_wakeup_capable(dev, true);
> -		device_set_wakeup_enable(dev, false);
> -	}
> -
>  	return i2c_hid_core_probe(client, &ihid_acpi->ops,
>  				  hid_descriptor_address);
>  }
> 


  reply	other threads:[~2021-12-21 18:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 23:43 [PATCH 0/3] Fix spurious wakes on ACPI platforms Raul E Rangel
2021-12-20 23:43 ` [PATCH 1/3] HID: i2c-hid-acpi: Remove explicit device_set_wakeup_capable Raul E Rangel
2021-12-21 18:49   ` Hans de Goede [this message]
2021-12-21 23:40     ` Raul Rangel
2021-12-23  8:41       ` Hans de Goede
2021-12-21 23:51     ` Raul Rangel
2021-12-20 23:43 ` [PATCH 2/3] Input: elan_i2c - Use PM subsystem to manage wake irq Raul E Rangel
2021-12-21  2:41   ` Dmitry Torokhov
2021-12-21 18:13     ` Raul Rangel
2021-12-23 14:42     ` Hans de Goede
2021-12-23 21:21       ` Dmitry Torokhov
2021-12-24 11:11         ` Hans de Goede
2021-12-25 13:51           ` Kai-Heng Feng
2022-01-31 12:41             ` Hans de Goede
2021-12-20 23:43 ` [PATCH 3/3] platform/chrome: cros_ec: Don't enable wake pin if ACPI managed Raul E 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=7d4f20da-f18b-eccf-19c4-ea7c15492634@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dianders@chromium.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=rjw@rjwysocki.net \
    --cc=rrangel@chromium.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

all inboxes | Powered by JetHome®