summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorAlejandro Gonzalez <alex.gonzalez@digi.com>2010-06-16 11:32:18 +0200
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-06-23 11:24:48 +0200
commit057b9b859cee72a4e70658ae6e28a1ad1f37bad5 (patch)
tree5f4fb8072203c0e8e01af8c42d58a4650b1f51e9 /drivers/base
parente7708a44045df4a7b590f45745d6d8b30c41ef7d (diff)
GPIO: Make suspend to RAM with GPIO wake up source work
Because the BSP implements GPIOs as system devices, but the sysfs uses the device model, this is an ugly way of supporting this functionality without moving the GPIO subsystem to the device model. Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/sysfs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 596aeecfdffe..0b3e0b7eb7fa 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -6,6 +6,10 @@
#include <linux/string.h>
#include "power.h"
+#include <asm/mach-types.h>
+#include <linux/interrupt.h>
+#include <mach/gpio.h>
+
/*
* wakeup - Report/change current wakeup option for device
*
@@ -72,6 +76,19 @@ wake_store(struct device * dev, struct device_attribute *attr,
device_set_wakeup_enable(dev, 0);
else
return -EINVAL;
+
+ if ( machine_is_ccwmx51js() || machine_is_ccmx51js() ) {
+ char *name = NULL;
+ char *ep;
+ unsigned int gpio;
+
+ /* Check whether this is a GPIO and if so configure it as wake up source */
+ if( (name = strstr(dev->kobj.name , "gpio")) ) {
+ gpio = simple_strtol(name+strlen("gpio"), &ep, 0);
+ set_irq_wake(gpio_to_irq(gpio),1);
+ }
+ }
+
return n;
}