* ACPI LID wakeup device prevents shutdown on Toshiba laptop and other computers
@ 2011-07-28 15:47 Anisse Astier
2011-08-18 16:11 ` Anisse Astier
0 siblings, 1 reply; 2+ messages in thread
From: Anisse Astier @ 2011-07-28 15:47 UTC (permalink / raw)
To: linux-acpi, Len Brown
Hi,
(See reference: https://bugzilla.kernel.org/show_bug.cgi?id=35262 )
On Toshiba C670D-10C, and as reported on a desktop asus mainboard
computer, we cannot shutdown without the computer rebooting.
The fix for this is simple, just run:
echo " LID" > /proc/acpi/wakeup
before shutdown. Please see below for quick and dirty in-kernel
implementation.
Now I don't know why is that. Perhaps Windows disables (some) wakeup
devices at shutdown, therefore the OEM/BIOS vendor expected any OS to
behave this way in order to halt properly.
Or maybe there's another reason.
I'd like comments on the idea implemented on the patch below, and maybe
suggestions to do this in a better way.
Thanks,
Anisse
--
From: Anisse Astier <anisse@astier.eu>
Subject: [PATCH] ACPI / PM : Disable ACPI LID wakeup device at shutdown
This device might cause shutdown to be a reboot on some computers:
Toshiba C670D-10C laptop, Asus desktop mainboard.
Device will shutdown, then wakeup immediately afterwards, regardless of
the status of the LID.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=35262
---
drivers/acpi/sleep.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 6c94960..3859628 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -58,6 +58,30 @@ static struct notifier_block tts_notifier = {
.priority = 0,
};
+static void acpi_disable_obnoxious_wakeup_device(u32 sleep_state)
+{
+ struct list_head *node, *next;
+
+ list_for_each_safe(node, next, &acpi_wakeup_device_list) {
+ struct acpi_device *dev =
+ container_of(node, struct acpi_device, wakeup_list);
+
+ if (!dev->wakeup.flags.valid
+ || sleep_state > (u32) dev->wakeup.sleep_state
+ || !(device_may_wakeup(&dev->dev)
+ || dev->wakeup.prepare_count))
+ continue;
+ if (!strcmp(dev->pnp.bus_id, "LID")) {
+ acpi_set_gpe_wake_mask(dev->wakeup.gpe_device,
+ dev->wakeup.gpe_number,
+ ACPI_GPE_DISABLE);
+
+ if (device_may_wakeup(&dev->dev))
+ acpi_disable_wakeup_device_power(dev);
+ }
+ }
+}
+
static int acpi_sleep_prepare(u32 acpi_state)
{
#ifdef CONFIG_ACPI_SLEEP
@@ -75,6 +99,7 @@ static int acpi_sleep_prepare(u32 acpi_state)
printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
acpi_state);
acpi_enable_wakeup_devices(acpi_state);
+ acpi_disable_obnoxious_wakeup_device(acpi_state);
acpi_enter_sleep_state_prep(acpi_state);
return 0;
}
--
1.7.5.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: ACPI LID wakeup device prevents shutdown on Toshiba laptop and other computers
2011-07-28 15:47 ACPI LID wakeup device prevents shutdown on Toshiba laptop and other computers Anisse Astier
@ 2011-08-18 16:11 ` Anisse Astier
0 siblings, 0 replies; 2+ messages in thread
From: Anisse Astier @ 2011-08-18 16:11 UTC (permalink / raw)
To: Anisse Astier; +Cc: linux-acpi, Len Brown, Matthew Garrett
On Thu, 28 Jul 2011 17:47:59 +0200, Anisse Astier <anisse@astier.eu> wrote :
> Hi,
>
> (See reference: https://bugzilla.kernel.org/show_bug.cgi?id=35262 )
>
> On Toshiba C670D-10C, and as reported on a desktop asus mainboard
> computer, we cannot shutdown without the computer rebooting.
>
> The fix for this is simple, just run:
> echo " LID" > /proc/acpi/wakeup
> before shutdown. Please see below for quick and dirty in-kernel
> implementation.
>
> Now I don't know why is that. Perhaps Windows disables (some) wakeup
> devices at shutdown, therefore the OEM/BIOS vendor expected any OS to
> behave this way in order to halt properly.
> Or maybe there's another reason.
>
> I'd like comments on the idea implemented on the patch below, and maybe
> suggestions to do this in a better way.
No one has any objection ? Should I resend the patch as-is ? Make it a
quirk?
>
> Thanks,
>
> Anisse
>
> --
>
> From: Anisse Astier <anisse@astier.eu>
> Subject: [PATCH] ACPI / PM : Disable ACPI LID wakeup device at shutdown
>
> This device might cause shutdown to be a reboot on some computers:
> Toshiba C670D-10C laptop, Asus desktop mainboard.
> Device will shutdown, then wakeup immediately afterwards, regardless of
> the status of the LID.
>
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=35262
> ---
> drivers/acpi/sleep.c | 25 +++++++++++++++++++++++++
> 1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 6c94960..3859628 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -58,6 +58,30 @@ static struct notifier_block tts_notifier = {
> .priority = 0,
> };
>
> +static void acpi_disable_obnoxious_wakeup_device(u32 sleep_state)
> +{
> + struct list_head *node, *next;
> +
> + list_for_each_safe(node, next, &acpi_wakeup_device_list) {
> + struct acpi_device *dev =
> + container_of(node, struct acpi_device, wakeup_list);
> +
> + if (!dev->wakeup.flags.valid
> + || sleep_state > (u32) dev->wakeup.sleep_state
> + || !(device_may_wakeup(&dev->dev)
> + || dev->wakeup.prepare_count))
> + continue;
> + if (!strcmp(dev->pnp.bus_id, "LID")) {
> + acpi_set_gpe_wake_mask(dev->wakeup.gpe_device,
> + dev->wakeup.gpe_number,
> + ACPI_GPE_DISABLE);
> +
> + if (device_may_wakeup(&dev->dev))
> + acpi_disable_wakeup_device_power(dev);
> + }
> + }
> +}
> +
> static int acpi_sleep_prepare(u32 acpi_state)
> {
> #ifdef CONFIG_ACPI_SLEEP
> @@ -75,6 +99,7 @@ static int acpi_sleep_prepare(u32 acpi_state)
> printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
> acpi_state);
> acpi_enable_wakeup_devices(acpi_state);
> + acpi_disable_obnoxious_wakeup_device(acpi_state);
> acpi_enter_sleep_state_prep(acpi_state);
> return 0;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-18 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-28 15:47 ACPI LID wakeup device prevents shutdown on Toshiba laptop and other computers Anisse Astier
2011-08-18 16:11 ` Anisse Astier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox