* [PATCH 1/2] ACPI / Wakeup: Enable button GPEs unconditionally during initialization
2011-02-06 13:18 [PATCH 0/2] ACPI / PM: Fix suspend regression related to button GPEs Rafael J. Wysocki
@ 2011-02-06 13:20 ` Rafael J. Wysocki
2011-02-06 14:24 ` [Updated][PATCH " Rafael J. Wysocki
2011-02-06 13:21 ` [PATCH 2/2] ACPI / Button: Avoid disabling wakeup unnecessarily on remove Rafael J. Wysocki
1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-02-06 13:20 UTC (permalink / raw)
To: Len Brown
Cc: ACPI Devel Mailing List, LKML, Linux PM mailing list,
Matthew Garrett, Ferenc Wágner
From: Rafael J. Wysocki <rjw@sisk.pl>
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
Reported-and-tested-by: Ferenc Wágner <wferi@niif.hu>
Cc: stable@kernel.org
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/acpi/button.c | 13 -------------
drivers/acpi/wakeup.c | 6 +++++-
2 files changed, 5 insertions(+), 14 deletions(-)
Index: linux-2.6/drivers/acpi/wakeup.c
===================================================================
--- linux-2.6.orig/drivers/acpi/wakeup.c
+++ linux-2.6/drivers/acpi/wakeup.c
@@ -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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] ACPI / Button: Avoid disabling wakeup unnecessarily on remove
2011-02-06 13:18 [PATCH 0/2] ACPI / PM: Fix suspend regression related to button GPEs Rafael J. Wysocki
2011-02-06 13:20 ` [PATCH 1/2] ACPI / Wakeup: Enable button GPEs unconditionally during initialization Rafael J. Wysocki
@ 2011-02-06 13:21 ` Rafael J. Wysocki
1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-02-06 13:21 UTC (permalink / raw)
To: Len Brown
Cc: ACPI Devel Mailing List, LKML, Linux PM mailing list,
Matthew Garrett, Ferenc Wágner
From: Rafael J. Wysocki <rjw@sisk.pl>
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.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/acpi/button.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/acpi/button.c
===================================================================
--- linux-2.6.orig/drivers/acpi/button.c
+++ linux-2.6/drivers/acpi/button.c
@@ -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 acp
if (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);
^ permalink raw reply [flat|nested] 4+ messages in thread