diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-01-08 13:02:55 -0200 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-02-01 22:26:08 -0500 |
commit | 50ebec09f1a79df27afeceb14a3059944f327e1d (patch) | |
tree | 4d368a7c03f4e08bc6a0368385bacceffced6931 /drivers/misc/thinkpad_acpi.c | |
parent | 013c40e457ac573b29daa0e369c2ba6729c23557 (diff) |
ACPI: thinkpad-acpi: add poll() support to some sysfs attributes
Implement poll()/select() support through sysfs_notify() for some key
attributes which userspace might want to poll() or select() on.
In order to let userspace know poll()/select() support is available for an
attribute, the thinkpad-acpi sysfs interface version is also bumped up.
Further changes that add poll()/select() capabilities to any pre-existing
attributes will also increment the sysfs interface version.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index e18f1e18781..91bda316a51 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -22,7 +22,7 @@ */ #define TPACPI_VERSION "0.18" -#define TPACPI_SYSFS_VERSION 0x020101 +#define TPACPI_SYSFS_VERSION 0x020200 /* * Changelog: @@ -1643,7 +1643,7 @@ static struct device_attribute dev_attr_hotkey_poll_freq = #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ -/* sysfs hotkey radio_sw ----------------------------------------------- */ +/* sysfs hotkey radio_sw (pollable) ------------------------------------ */ static ssize_t hotkey_radio_sw_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -1659,6 +1659,13 @@ static ssize_t hotkey_radio_sw_show(struct device *dev, static struct device_attribute dev_attr_hotkey_radio_sw = __ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL); +static void hotkey_radio_sw_notify_change(void) +{ + if (tp_features.hotkey_wlsw) + sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, + "hotkey_radio_sw"); +} + /* sysfs hotkey report_mode -------------------------------------------- */ static ssize_t hotkey_report_mode_show(struct device *dev, struct device_attribute *attr, @@ -1671,7 +1678,7 @@ static ssize_t hotkey_report_mode_show(struct device *dev, static struct device_attribute dev_attr_hotkey_report_mode = __ATTR(hotkey_report_mode, S_IRUGO, hotkey_report_mode_show, NULL); -/* sysfs wakeup reason ------------------------------------------------- */ +/* sysfs wakeup reason (pollable) -------------------------------------- */ static ssize_t hotkey_wakeup_reason_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -1682,7 +1689,14 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev, static struct device_attribute dev_attr_hotkey_wakeup_reason = __ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL); -/* sysfs wakeup hotunplug_complete ------------------------------------- */ +void hotkey_wakeup_reason_notify_change(void) +{ + if (tp_features.hotkey_mask) + sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, + "wakeup_reason"); +} + +/* sysfs wakeup hotunplug_complete (pollable) -------------------------- */ static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -1694,6 +1708,13 @@ static struct device_attribute dev_attr_hotkey_wakeup_hotunplug_complete = __ATTR(wakeup_hotunplug_complete, S_IRUGO, hotkey_wakeup_hotunplug_complete_show, NULL); +void hotkey_wakeup_hotunplug_complete_notify_change(void) +{ + if (tp_features.hotkey_mask) + sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, + "wakeup_hotunplug_complete"); +} + /* --------------------------------------------------------------------- */ static struct attribute *hotkey_attributes[] __initdata = { @@ -2106,6 +2127,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) printk(TPACPI_INFO "woke up due to a hot-unplug " "request...\n"); + hotkey_wakeup_reason_notify_change(); } break; case 3: @@ -2114,6 +2136,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) hotkey_autosleep_ack = 1; printk(TPACPI_INFO "bay ejected\n"); + hotkey_wakeup_hotunplug_complete_notify_change(); } else { unk_ev = 1; } @@ -2124,6 +2147,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) hotkey_autosleep_ack = 1; printk(TPACPI_INFO "undocked\n"); + hotkey_wakeup_hotunplug_complete_notify_change(); } else { unk_ev = 1; } @@ -2150,6 +2174,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) /* 0x7000-0x7FFF: misc */ if (tp_features.hotkey_wlsw && hkey == 0x7000) { tpacpi_input_send_radiosw(); + hotkey_radio_sw_notify_change(); send_acpi_ev = 0; break; } @@ -2193,6 +2218,9 @@ static void hotkey_resume(void) "error while trying to read hot key mask " "from firmware\n"); tpacpi_input_send_radiosw(); + hotkey_radio_sw_notify_change(); + hotkey_wakeup_reason_notify_change(); + hotkey_wakeup_hotunplug_complete_notify_change(); #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL hotkey_poll_setup_safe(0); #endif |