diff options
Diffstat (limited to 'arch/x86/kernel/olpc-pm.c')
-rw-r--r-- | arch/x86/kernel/olpc-pm.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/x86/kernel/olpc-pm.c b/arch/x86/kernel/olpc-pm.c index acedefbba498..4c758f7e6e02 100644 --- a/arch/x86/kernel/olpc-pm.c +++ b/arch/x86/kernel/olpc-pm.c @@ -373,6 +373,15 @@ void olpc_fixup_wakeup(void) /* tell the wireless module to restart USB communication */ olpc_ec_cmd(0x24, NULL, 0, NULL, 0); } + + /* + * Re-enable all LID events + */ + if (olpc_board_at_least(olpc_board(0xb2))) { + 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); + } } int olpc_fixup_sleep(void) @@ -711,6 +720,9 @@ static struct attribute_group olpc_attrs = { static ssize_t wackup_event_show(struct kobject *s, struct kobj_attribute *attr, char *buf); static ssize_t wackup_event_store(struct kobject *s, struct kobj_attribute *attr, const char *buf, size_t n); +static ssize_t wackup_all_show(struct kobject *s, struct kobj_attribute *attr, char *buf); +static ssize_t wackup_all_store(struct kobject *s, struct kobj_attribute *attr, const char *buf, size_t n); + static struct kobj_attribute wackup_event_attr[] = { __ATTR(ps2event, 0600, wackup_event_show, wackup_event_store), __ATTR(battery_state, 0600, wackup_event_show, wackup_event_store), @@ -719,6 +731,7 @@ static struct kobj_attribute wackup_event_attr[] = { __ATTR(ebook_mode_change, 0600, wackup_event_show, wackup_event_store), __ATTR(wlan, 0600, wackup_event_show, wackup_event_store), __ATTR(ac_power, 0600, wackup_event_show, wackup_event_store), + __ATTR(all, 0600, wackup_all_show, wackup_all_store) }; static DEFINE_RWLOCK(wackup_event_lock); @@ -758,6 +771,43 @@ static ssize_t wackup_event_store(struct kobject *s, struct kobj_attribute *attr return n; } +static ssize_t wackup_all_show(struct kobject *s, struct kobj_attribute *attr, char *buf) +{ + u8 data; + + read_lock(&wackup_event_lock); + olpc_ec_cmd(EC_READ_SCI_MASK, NULL, 0, &data, 1); + read_unlock(&wackup_event_lock); + + if (data == 0xff) + return sprintf(buf, "1\n"); + else + return sprintf(buf, "0\n"); +} + +static ssize_t wackup_all_store(struct kobject *s, struct kobj_attribute *attr, const char *buf, size_t n) +{ + unsigned enabled; + u8 data; + unsigned char shift = attr - wackup_event_attr; + + if (sscanf(buf, "%d\n", &enabled) != 1) + return -EINVAL; + + if (enabled == 1) + data = 0xff; + else if (!enabled) + data = 0; + else + return -EINVAL; + + write_lock(&wackup_event_lock); + olpc_ec_cmd(EC_WRITE_SCI_MASK, &data, 1, NULL, 0); + write_unlock(&wackup_event_lock); + + return n; +} + static struct attribute * olpc_wackup_event_attributes[] = { &wackup_event_attr[0].attr, &wackup_event_attr[1].attr, @@ -766,6 +816,7 @@ static struct attribute * olpc_wackup_event_attributes[] = { &wackup_event_attr[4].attr, &wackup_event_attr[5].attr, &wackup_event_attr[6].attr, + &wackup_event_attr[7].attr, NULL }; |