[PATCH] add powerbutton and lid platform devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jordan,

This allows configuration of powerbutton/lid events... Are the 
gpio_gpio_{clear,set} calls correct for enabling/disabling LID
events?

What else do we want to support?

--- olpc-pm.c.orig	2007-07-08 17:09:07.000000000 -0400
+++ olpc-pm.c	2007-07-08 18:07:03.000000000 -0400
@@ -54,6 +54,18 @@
 
 static int gpio_wake_events = 0;
 static int ebook_state = -1;
+static u16 olpc_wakeup_mask = 0;
+
+struct platform_device olpc_powerbutton_dev = {
+	.name = "powerbutton",
+	.id = 0,
+};
+
+struct platform_device olpc_lid_dev = {
+	.name = "lid",
+	.id = 0,
+};
+
 
 static void __init init_ebook_state(void)
 {
@@ -250,6 +262,16 @@
 	/* Save the MFGPT MSRs */
 	rdmsrl(MFGPT_IRQ_MSR, mfgpt_irq_msr);
 	rdmsrl(MFGPT_NR_MSR, mfgpt_nr_msr);
+
+	if (device_may_wakeup(&olpc_powerbutton_dev.dev))
+		olpc_wakeup_mask |= CS5536_PM_PWRBTN;
+	else
+		olpc_wakeup_mask &= ~(CS5536_PM_PWRBTN);
+
+	if (device_may_wakeup(&olpc_lid_dev.dev))
+		geode_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
+	else
+		geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE);
 }
 
 static int olpc_pm_enter(suspend_state_t pm_state)
@@ -275,8 +297,6 @@
 	return 0;
 }
 
-static u16 olpc_wakeup_mask = CS5536_PM_PWRBTN;
-
 int asmlinkage olpc_do_sleep(u8 sleep_state)
 {
 	void *pgd_addr = __va(read_cr3());
@@ -596,15 +616,20 @@
 	.resource = rtc_platform_resource,
 };
 
-static int __init olpc_rtc_init(void)
+static int __init olpc_platform_init(void)
 {
 	(void)platform_device_register(&olpc_rtc_device);
-
 	device_init_wakeup(&olpc_rtc_device.dev, 1);
 
+	(void)platform_device_register(&olpc_powerbutton_dev);
+	device_init_wakeup(&olpc_powerbutton_dev.dev, 1);
+
+	(void)platform_device_register(&olpc_lid_dev);
+	device_init_wakeup(&olpc_lid_dev.dev, 1);
+
 	return 0;
 }
-arch_initcall(olpc_rtc_init);
+arch_initcall(olpc_platform_init);
 #endif /* CONFIG_RTC_DRV_CMOS */
 
 static void olpc_pm_exit(void)
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux