#7536 NORM 8.2.0 (: Lid open should wake from suspend, but lid close shouldn't.
Zarro Boogs per Child
bugtracker at laptop.org
Fri Jul 25 13:06:17 EDT 2008
#7536: Lid open should wake from suspend, but lid close shouldn't.
----------------------------+-----------------------------------------------
Reporter: cjb | Owner: dsaxena
Type: defect | Status: assigned
Priority: normal | Milestone: 8.2.0 (was Update.2)
Component: not assigned | Version: not specified
Resolution: | Keywords:
Next_action: never set | Verified: 0
Blockedby: | Blocking:
----------------------------+-----------------------------------------------
Comment(by dsaxena):
Patch for sanity checking
{{{
diff --git a/arch/x86/kernel/olpc-pm.c b/arch/x86/kernel/olpc-pm.c
index 5ce1226..1764891 100644
--- a/arch/x86/kernel/olpc-pm.c
+++ b/arch/x86/kernel/olpc-pm.c
@@ -236,39 +236,27 @@ static int olpc_pm_interrupt(int irq, void *id)
}
if (gpe & GPIO_WAKEUP_LID) {
+ olpc_lid_flag = geode_gpio_isset(OLPC_GPIO_LID,
GPIO_READ_BACK);
+
/* Disable events */
geode_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
-
- /* Clear the edge */
-
- if (olpc_lid_flag)
- geode_gpio_clear(OLPC_GPIO_LID,
GPIO_NEGATIVE_EDGE_EN);
- else
- geode_gpio_clear(OLPC_GPIO_LID,
GPIO_POSITIVE_EDGE_EN);
- /* Clear the status too */
geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_STS);
geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_STS);
- /* The line is high when the LID is open, but SW_LID
- * should be high when the LID is closed, so we pass the
old
- * value of olpc_lid_flag
- */
+ if (olpc_lid_flag)
+ printk(KERN_WARNING "LID OPEN\n");
+ else
+ printk(KERN_WARNING "LID CLOSED\n");
- input_report_switch(lid_inputdev, SW_LID, olpc_lid_flag);
+ input_report_switch(lid_inputdev, SW_LID, !olpc_lid_flag);
input_sync(lid_inputdev);
if (!wackup_source)
wackup_source = "lid";
- /* Swap the status */
- olpc_lid_flag = !olpc_lid_flag;
-
- if (olpc_lid_flag)
- geode_gpio_set(OLPC_GPIO_LID,
GPIO_NEGATIVE_EDGE_EN);
- else
- geode_gpio_set(OLPC_GPIO_LID,
GPIO_POSITIVE_EDGE_EN);
-
- /* re-enable the event */
+ /* Re-enable both events */
+ geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN);
+ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN);
geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
}
@@ -415,7 +403,12 @@ int olpc_fixup_sleep(void)
else
olpc_wakeup_mask &= ~(CS5536_PM_PWRBTN);
+ /*
+ * We only want to wakeup on lid open, not on lid close
+ */
if (device_may_wakeup(&olpc_lid_dev.dev)) {
+ geode_gpio_clear(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN);
+ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN);
geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
gpio_wake_events |= GPIO_WAKEUP_LID;
} else {
@@ -896,12 +889,9 @@ static int __init olpc_pm_init(void)
/* Get the current value of the GPIO, and set up the edges
*/
olpc_lid_flag = geode_gpio_isset(OLPC_GPIO_LID,
GPIO_READ_BACK);
- /* Watch for the opposite edge */
-
- if (olpc_lid_flag)
- geode_gpio_set(OLPC_GPIO_LID,
GPIO_NEGATIVE_EDGE_EN);
- else
- geode_gpio_set(OLPC_GPIO_LID,
GPIO_POSITIVE_EDGE_EN);
+ /* Watch for both edges at startup */
+ geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN);
+ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN);
/* Enable the event */
geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
}}}
--
Ticket URL: <http://dev.laptop.org/ticket/7536#comment:5>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list