* [PATCH v1 0/2] ACPI: PM: Refine acpi_dev_pm_attach() and stop special-casing buttons @ 2026-01-10 11:55 Rafael J. Wysocki 2026-01-10 11:57 ` [PATCH v1 1/2] ACPI: PM: Let acpi_dev_pm_attach() skip devices without ACPI PM Rafael J. Wysocki 2026-01-10 11:58 ` [PATCH v1 2/2] ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons Rafael J. Wysocki 0 siblings, 2 replies; 4+ messages in thread From: Rafael J. Wysocki @ 2026-01-10 11:55 UTC (permalink / raw) To: Linux ACPI; +Cc: LKML, Linux PM, Todd Brandt, Xi Pardee Hi All, The first patch causes acpi_dev_pm_attach() to skip devices whose ACPI companions cannot do ACPI PM or wakeup and the second one (which is a fix) causes device ACPI PM enumeration to stop treating buttons in a special way (which is not necessary and becomes harmful after the conversion of the button driver to a platform one). Thanks! ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/2] ACPI: PM: Let acpi_dev_pm_attach() skip devices without ACPI PM 2026-01-10 11:55 [PATCH v1 0/2] ACPI: PM: Refine acpi_dev_pm_attach() and stop special-casing buttons Rafael J. Wysocki @ 2026-01-10 11:57 ` Rafael J. Wysocki 2026-01-10 11:58 ` [PATCH v1 2/2] ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons Rafael J. Wysocki 1 sibling, 0 replies; 4+ messages in thread From: Rafael J. Wysocki @ 2026-01-10 11:57 UTC (permalink / raw) To: Linux ACPI; +Cc: LKML, Linux PM, Todd Brandt, Xi Pardee From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> It is pointless to attach the generic ACPI PM domain to devices whose ACPI companions don't support ACPI power management and don't have a wakeup GPE, so update acpi_dev_pm_attach() to skip such devices. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/device_pm.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -1457,6 +1457,15 @@ int acpi_dev_pm_attach(struct device *de return 0; /* + * Skip devices whose ACPI companions don't support power management and + * don't have a wakeup GPE. + */ + if (!acpi_device_power_manageable(adev) && !acpi_device_can_wakeup(adev)) { + dev_dbg(dev, "No ACPI power management or wakeup GPE\n"); + return 0; + } + + /* * Only attach the power domain to the first device if the * companion is shared by multiple. This is to prevent doing power * management twice. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons 2026-01-10 11:55 [PATCH v1 0/2] ACPI: PM: Refine acpi_dev_pm_attach() and stop special-casing buttons Rafael J. Wysocki 2026-01-10 11:57 ` [PATCH v1 1/2] ACPI: PM: Let acpi_dev_pm_attach() skip devices without ACPI PM Rafael J. Wysocki @ 2026-01-10 11:58 ` Rafael J. Wysocki 2026-01-13 2:51 ` Xi Pardee 1 sibling, 1 reply; 4+ messages in thread From: Rafael J. Wysocki @ 2026-01-10 11:58 UTC (permalink / raw) To: Linux ACPI; +Cc: LKML, Linux PM, Todd Brandt, Xi Pardee From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> After starting to use platform devices for representing buttons enumerated via ACPI, acpi_mark_gpe_for_wake() is insufficient for preparing their GPEs to wake up the system from sleep because it does not change the "dispatch type" of the given GPE to ACPI_GPE_DISPATCH_NOTIFY. Subsequently, this causes acpi_enable_gpe() in __acpi_device_wakeup_enable() to fail and system suspend transitions to be aborted. Address this by updating acpi_wakeup_gpe_init() to use acpi_setup_gpe_for_wake() for buttons like for any other devices. This allows acpi_setup_gpe_for_wake() to be simplified further because buttons are not a special case in it any more, so do that as well. Fixes: 52d864019636 ("ACPI: button: Convert the driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/scan.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -999,15 +999,11 @@ static int acpi_bus_extract_wakeup_devic return err; } -/* Do not use a button for S5 wakeup */ -#define ACPI_AVOID_WAKE_FROM_S5 BIT(0) - static bool acpi_wakeup_gpe_init(struct acpi_device *device) { static const struct acpi_device_id button_device_ids[] = { - {"PNP0C0C", 0}, /* Power button */ - {"PNP0C0D", ACPI_AVOID_WAKE_FROM_S5}, /* Lid */ - {"PNP0C0E", ACPI_AVOID_WAKE_FROM_S5}, /* Sleep button */ + {"PNP0C0D", 0}, /* Lid */ + {"PNP0C0E", 0}, /* Sleep button */ {"", 0}, }; struct acpi_device_wakeup *wakeup = &device->wakeup; @@ -1016,15 +1012,9 @@ static bool acpi_wakeup_gpe_init(struct wakeup->flags.notifier_present = 0; - /* Power button, Lid switch always enable wakeup */ match = acpi_match_acpi_device(button_device_ids, device); - if (match) { - if ((match->driver_data & ACPI_AVOID_WAKE_FROM_S5) && - wakeup->sleep_state == ACPI_STATE_S5) - wakeup->sleep_state = ACPI_STATE_S4; - acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number); - return true; - } + if (match && wakeup->sleep_state == ACPI_STATE_S5) + wakeup->sleep_state = ACPI_STATE_S4; status = acpi_setup_gpe_for_wake(device->handle, wakeup->gpe_device, wakeup->gpe_number); ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 2/2] ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons 2026-01-10 11:58 ` [PATCH v1 2/2] ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons Rafael J. Wysocki @ 2026-01-13 2:51 ` Xi Pardee 0 siblings, 0 replies; 4+ messages in thread From: Xi Pardee @ 2026-01-13 2:51 UTC (permalink / raw) To: Rafael J. Wysocki, Linux ACPI; +Cc: LKML, Linux PM, Todd Brandt This patch fixes the suspend failing regression caused by a recent ACPI changes in intelnext kernel. I tested this patch on Panther Lake platform and it can suspend and resume successfully with this patch. Tested-by: Xi Pardee <xi.pardee@linux.intel.com> On 1/10/2026 3:58 AM, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > After starting to use platform devices for representing buttons > enumerated via ACPI, acpi_mark_gpe_for_wake() is insufficient for > preparing their GPEs to wake up the system from sleep because it > does not change the "dispatch type" of the given GPE to > ACPI_GPE_DISPATCH_NOTIFY. Subsequently, this causes acpi_enable_gpe() > in __acpi_device_wakeup_enable() to fail and system suspend transitions > to be aborted. > > Address this by updating acpi_wakeup_gpe_init() to use > acpi_setup_gpe_for_wake() for buttons like for any other devices. > > This allows acpi_setup_gpe_for_wake() to be simplified further because > buttons are not a special case in it any more, so do that as well. > > Fixes: 52d864019636 ("ACPI: button: Convert the driver to a platform one") > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > drivers/acpi/scan.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > --- a/drivers/acpi/scan.c > +++ b/drivers/acpi/scan.c > @@ -999,15 +999,11 @@ static int acpi_bus_extract_wakeup_devic > return err; > } > > -/* Do not use a button for S5 wakeup */ > -#define ACPI_AVOID_WAKE_FROM_S5 BIT(0) > - > static bool acpi_wakeup_gpe_init(struct acpi_device *device) > { > static const struct acpi_device_id button_device_ids[] = { > - {"PNP0C0C", 0}, /* Power button */ > - {"PNP0C0D", ACPI_AVOID_WAKE_FROM_S5}, /* Lid */ > - {"PNP0C0E", ACPI_AVOID_WAKE_FROM_S5}, /* Sleep button */ > + {"PNP0C0D", 0}, /* Lid */ > + {"PNP0C0E", 0}, /* Sleep button */ > {"", 0}, > }; > struct acpi_device_wakeup *wakeup = &device->wakeup; > @@ -1016,15 +1012,9 @@ static bool acpi_wakeup_gpe_init(struct > > wakeup->flags.notifier_present = 0; > > - /* Power button, Lid switch always enable wakeup */ > match = acpi_match_acpi_device(button_device_ids, device); > - if (match) { > - if ((match->driver_data & ACPI_AVOID_WAKE_FROM_S5) && > - wakeup->sleep_state == ACPI_STATE_S5) > - wakeup->sleep_state = ACPI_STATE_S4; > - acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number); > - return true; > - } > + if (match && wakeup->sleep_state == ACPI_STATE_S5) > + wakeup->sleep_state = ACPI_STATE_S4; > > status = acpi_setup_gpe_for_wake(device->handle, wakeup->gpe_device, > wakeup->gpe_number); > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-13 2:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-10 11:55 [PATCH v1 0/2] ACPI: PM: Refine acpi_dev_pm_attach() and stop special-casing buttons Rafael J. Wysocki 2026-01-10 11:57 ` [PATCH v1 1/2] ACPI: PM: Let acpi_dev_pm_attach() skip devices without ACPI PM Rafael J. Wysocki 2026-01-10 11:58 ` [PATCH v1 2/2] ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons Rafael J. Wysocki 2026-01-13 2:51 ` Xi Pardee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox