Skip to contentSkip to conversation

fix IRQ / GPEs restore on wake

PATCH In review Karol Kozimor 2 participants 3 messages Apr 17, 2004 – Apr 18, 2004 2 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix IRQ / GPEs restore on wake

Hi,
This patch (originally by Alexander Malysh) reorders the IRQ / GPEs restore on wake-up from S1/S3. Without this patch no ACPI interrupts are received after S1 / S3 and in consequence, ACPI-driven hotkeys stop working. This affects certain (probably all) ASUS laptops as well as possibly other machines depending on those features. The patch addresses bug #2321 directly and #1409 partly. It was prepared against 2.6.5-mm6.

Can somebody comment on that?
Best regards,

Signature · 9 lines
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/[email protected]


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

A message that is not in the archive (sent off-list or not yet received): 20040417215139.GA17862-DETuoxkZsSqrDJvtcaxF/[email protected]

#2 lore raw

Thus wrote Karol Kozimor:

Quoted 1 line

Can somebody comment on that?

Either the patch got eaten or I forgot to attach it, here it is:

Signature · 74 lines
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/[email protected]

--- a/drivers/acpi/hardware/hwsleep.c	2004-04-17 22:57:11.000000000 +0200
+++ b/drivers/acpi/hardware/hwsleep.c	2004-04-17 23:12:08.000000000 +0200
@@ -512,6 +512,16 @@ acpi_leave_sleep_state (
 
 	acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
 
+	/*
+	 * Restore the GPEs:
+	 * 1) Disable all wakeup GPEs
+	 * 2) Enable all runtime GPEs
+	 */
+	status = acpi_hw_restore_gpes_on_wake ();
+	if (ACPI_FAILURE (status)) {
+		ACPI_REPORT_ERROR(("Could not enable non wakeup GPEs, %s\n", acpi_format_exception (status)));
+	}
+
 	/* Setup parameter object */
 
 	arg_list.count = 1;
@@ -538,16 +548,6 @@ acpi_leave_sleep_state (
 	}
 	/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
 
-	/*
-	 * Restore the GPEs:
-	 * 1) Disable all wakeup GPEs
-	 * 2) Enable all runtime GPEs
-	 */
-	status = acpi_hw_restore_gpes_on_wake ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
-	}
-
 	/* Enable power button */
 
 	acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
--- a/drivers/acpi/sleep/main.c	2004-04-17 22:55:12.000000000 +0200
+++ b/drivers/acpi/sleep/main.c	2004-04-17 23:09:45.000000000 +0200
@@ -107,7 +107,6 @@ static int acpi_pm_enter(u32 state)
 	default:
 		return -EINVAL;
 	}
-	local_irq_restore(flags);
 	printk(KERN_DEBUG "Back to C!\n");
 
 	/* restore processor state
@@ -118,6 +117,8 @@ static int acpi_pm_enter(u32 state)
 	if (state > PM_SUSPEND_STANDBY)
 		acpi_restore_state_mem();
 
+	acpi_leave_sleep_state(state);
+	local_irq_restore(flags);
 
 	return ACPI_SUCCESS(status) ? 0 : -EFAULT;
 }
@@ -133,8 +134,6 @@ static int acpi_pm_enter(u32 state)
 
 static int acpi_pm_finish(u32 state)
 {
-	acpi_leave_sleep_state(state);
-
 	/* reset firmware waking vector */
 	acpi_set_firmware_waking_vector((acpi_physical_address) 0);
 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

A message that is not in the archive (sent off-list or not yet received): 20040417215139.GA17862-DETuoxkZsSqrDJvtcaxF/[email protected]

#4 lore raw
drivers/acpi/hardware/hwsleep.c +10 -10
@@ -512,6 +512,16 @@ acpi_leave_sleep_state (
 
 	acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
 
+	/*
+	 * Restore the GPEs:
+	 * 1) Disable all wakeup GPEs
+	 * 2) Enable all runtime GPEs
+	 */
+	status = acpi_hw_restore_gpes_on_wake ();
+	if (ACPI_FAILURE (status)) {
+		ACPI_REPORT_ERROR(("Could not enable non wakeup GPEs, %s\n", acpi_format_exception (status)));
+	}
+
 	/* Setup parameter object */
 
 	arg_list.count = 1;
@@ -538,16 +548,6 @@ acpi_leave_sleep_state (
 	}
 	/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
 
-	/*
-	 * Restore the GPEs:
-	 * 1) Disable all wakeup GPEs
-	 * 2) Enable all runtime GPEs
-	 */
-	status = acpi_hw_restore_gpes_on_wake ();
-	if (ACPI_FAILURE (status)) {
-		return_ACPI_STATUS (status);
-	}
-
 	/* Enable power button */
 
 

acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,

drivers/acpi/sleep/main.c +2 -3
@@ -107,7 +107,6 @@ static int acpi_pm_enter(u32 state)
 	default:
 		return -EINVAL;
 	}
-	local_irq_restore(flags);
 	printk(KERN_DEBUG "Back to C!\n");
 
 	/* restore processor state
@@ -118,6 +117,8 @@ static int acpi_pm_enter(u32 state)
 	if (state > PM_SUSPEND_STANDBY)
 		acpi_restore_state_mem();
 
+	acpi_leave_sleep_state(state);
+	local_irq_restore(flags);
 
 	return ACPI_SUCCESS(status) ? 0 : -EFAULT;
 }
@@ -133,8 +134,6 @@ static int acpi_pm_enter(u32 state)
 
 static int acpi_pm_finish(u32 state)
 {
-	acpi_leave_sleep_state(state);
-
 	/* reset firmware waking vector */
 	acpi_set_firmware_waking_vector((acpi_physical_address) 0);
 

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click