ACPI / PM: Fix suspend regression related to button GPEs
PATCH 1/2 ACPI / Wakeup: Enable button GPEs unconditionally during initialization
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Commit 9630bdd (ACPI: Use GPE reference counting to support shared GPEs) introduced a suspend regression where boxes resume immediately after being suspended due to the lid or sleep button wakeup status not being cleared properly. This happens if the GPEs corresponding to those devices are not enabled all the time, which apparently is expected by some BIOSes.
To fix this problem, enable button and lid GPEs unconditionally during initialization and keep them enabled all the time, regardless of whether or not the ACPI button driver is used.
References: https://bugzilla.kernel.org/show_bug.cgi?id=27372
--- drivers/acpi/button.c | 13 ------------- drivers/acpi/wakeup.c | 6 +++++- 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/acpi/wakeup.c +5 -1
@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void)struct acpi_device *dev =container_of (node, struct acpi_device, wakeup_list); -if (device_can_wakeup (&dev->dev)) +if (device_can_wakeup (&dev->dev)) { +/* Button GPEs are supposed to be always enabled. */ +acpi_enable_gpe (dev->wakeup.gpe_device, + dev->wakeup.gpe_number);device_set_wakeup_enable (&dev->dev, true); + } }mutex_unlock (&acpi_device_lock);return 0 ;
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
PATCH 2/2 ACPI / Button: Avoid disabling wakeup unnecessarily on remove
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
If a button device had already been enabled to wake up the system from sleep states before the button driver saw it, the driver shouldn't disable the device's wakeup capability when being detached from the device.
--- drivers/acpi/button.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/button.c +7 -2
@@ -98,6 +98,7 @@ struct acpi_button {struct input_dev *input;char phys[32 ];/* for input device */ unsigned long pushed; +bool wakeup_enabled; };static const struct file_operations acpi_button_info_fops = {
@@ -430,7 +431,10 @@ static int acpi_button_add(struct acpi_d/* Button's GPE is run-wake GPE */ acpi_enable_gpe (device->wakeup.gpe_device, device->wakeup.gpe_number); -device_set_wakeup_enable (&device->dev, true); +if (!device_may_wakeup (&device->dev)) { +device_set_wakeup_enable (&device->dev, true); + button->wakeup_enabled = true; + } } printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
@@ -452,7 +456,8 @@ static int acpi_button_remove(struct acpif (device->wakeup.flags.valid) {acpi_disable_gpe (device->wakeup.gpe_device, device->wakeup.gpe_number); -device_set_wakeup_enable (&device->dev, false); +if (button->wakeup_enabled) +device_set_wakeup_enable (&device->dev, false); }acpi_button_remove_fs (device);
PATCH 2/2 ACPI / Button: Avoid disabling wakeup unnecessarily on remove
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
If a button device had already been enabled to wake up the system from sleep states before the button driver saw it, the driver shouldn't disable the device's wakeup capability when being detached from the device.
--- drivers/acpi/button.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/button.c +7 -2
@@ -98,6 +98,7 @@ struct acpi_button {struct input_dev *input;char phys[32 ];/* for input device */ unsigned long pushed; +bool wakeup_enabled; };static const struct file_operations acpi_button_info_fops = {
@@ -430,7 +431,10 @@ static int acpi_button_add(struct acpi_d/* Button's GPE is run-wake GPE */ acpi_enable_gpe (device->wakeup.gpe_device, device->wakeup.gpe_number); -device_set_wakeup_enable (&device->dev, true); +if (!device_may_wakeup (&device->dev)) { +device_set_wakeup_enable (&device->dev, true); + button->wakeup_enabled = true; + } } printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
@@ -452,7 +456,8 @@ static int acpi_button_remove(struct acpif (device->wakeup.flags.valid) {acpi_disable_gpe (device->wakeup.gpe_device, device->wakeup.gpe_number); -device_set_wakeup_enable (&device->dev, false); +if (button->wakeup_enabled) +device_set_wakeup_enable (&device->dev, false); }acpi_button_remove_fs (device);
cover ACPI / PM: Fix suspend regression related to button GPEs
Hi,
The first of the following patches fixes the suspend regression tracked in
References: https://bugzilla.kernel.org/show_bug.cgi?id=27372
and the second one corrects a small ugliness in the button driver.
Please apply!
Thanks,
Rafael
PATCH 1/2 ACPI / Wakeup: Enable button GPEs unconditionally during initialization
From: Rafael J. Wysocki <[email protected]>
Commit 9630bdd (ACPI: Use GPE reference counting to support shared GPEs) introduced a suspend regression where boxes resume immediately after being suspended due to the lid or sleep button wakeup status not being cleared properly. This happens if the GPEs corresponding to those devices are not enabled all the time, which apparently is expected by some BIOSes.
To fix this problem, enable button and lid GPEs unconditionally during initialization and keep them enabled all the time, regardless of whether or not the ACPI button driver is used.
References: https://bugzilla.kernel.org/show_bug.cgi?id=27372
--- drivers/acpi/button.c | 13 ------------- drivers/acpi/wakeup.c | 6 +++++- 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/acpi/wakeup.c +5 -1
@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void)struct acpi_device *dev =container_of (node, struct acpi_device, wakeup_list); -if (device_can_wakeup (&dev->dev)) +if (device_can_wakeup (&dev->dev)) { +/* Button GPEs are supposed to be always enabled. */ +acpi_enable_gpe (dev->wakeup.gpe_device, + dev->wakeup.gpe_number);device_set_wakeup_enable (&dev->dev, true); + } }mutex_unlock (&acpi_device_lock);return 0 ;
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/2 ACPI / Wakeup: Enable button GPEs unconditionally during initialization
From: Rafael J. Wysocki <[email protected]>
Subject: ACPI / Wakeup: Enable button GPEs unconditionally during initialization
Commit 9630bdd (ACPI: Use GPE reference counting to support shared GPEs) introduced a suspend regression where boxes resume immediately after being suspended due to the lid or sleep button wakeup status not being cleared properly. This happens if the GPEs corresponding to those devices are not enabled all the time, which apparently is expected by some BIOSes.
To fix this problem, enable button and lid GPEs unconditionally during initialization and keep them enabled all the time, regardless of whether or not the ACPI button driver is used.
References: https://bugzilla.kernel.org/show_bug.cgi?id=27372
---
Hi,
This time with the correct diffstat.
Thanks,
Rafael
--- drivers/acpi/wakeup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/acpi/wakeup.c +5 -1
@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void)struct acpi_device *dev =container_of (node, struct acpi_device, wakeup_list); -if (device_can_wakeup (&dev->dev)) +if (device_can_wakeup (&dev->dev)) { +/* Button GPEs are supposed to be always enabled. */ +acpi_enable_gpe (dev->wakeup.gpe_device, + dev->wakeup.gpe_number);device_set_wakeup_enable (&dev->dev, true); + } }mutex_unlock (&acpi_device_lock);return 0 ;
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
PATCH 1/2 ACPI / Wakeup: Enable button GPEs unconditionally during initialization
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Subject: ACPI / Wakeup: Enable button GPEs unconditionally during initialization
Commit 9630bdd (ACPI: Use GPE reference counting to support shared GPEs) introduced a suspend regression where boxes resume immediately after being suspended due to the lid or sleep button wakeup status not being cleared properly. This happens if the GPEs corresponding to those devices are not enabled all the time, which apparently is expected by some BIOSes.
To fix this problem, enable button and lid GPEs unconditionally during initialization and keep them enabled all the time, regardless of whether or not the ACPI button driver is used.
References: https://bugzilla.kernel.org/show_bug.cgi?id=27372
---
Hi,
This time with the correct diffstat.
Thanks,
Rafael
--- drivers/acpi/wakeup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/acpi/wakeup.c +5 -1
@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void)struct acpi_device *dev =container_of (node, struct acpi_device, wakeup_list); -if (device_can_wakeup (&dev->dev)) +if (device_can_wakeup (&dev->dev)) { +/* Button GPEs are supposed to be always enabled. */ +acpi_enable_gpe (dev->wakeup.gpe_device, + dev->wakeup.gpe_number);device_set_wakeup_enable (&dev->dev, true); + } }mutex_unlock (&acpi_device_lock);return 0 ;
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html