diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-01-08 10:02:55 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-02-01 22:26:08 -0500 |
commit | 50ebec09f1a79df27afeceb14a3059944f327e1d (patch) | |
tree | 4d368a7c03f4e08bc6a0368385bacceffced6931 /drivers/misc | |
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')
-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 e18f1e18781f..91bda316a51c 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -22,7 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define TPACPI_VERSION "0.18" | 24 | #define TPACPI_VERSION "0.18" |
25 | #define TPACPI_SYSFS_VERSION 0x020101 | 25 | #define TPACPI_SYSFS_VERSION 0x020200 |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Changelog: | 28 | * Changelog: |
@@ -1643,7 +1643,7 @@ static struct device_attribute dev_attr_hotkey_poll_freq = | |||
1643 | 1643 | ||
1644 | #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ | 1644 | #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ |
1645 | 1645 | ||
1646 | /* sysfs hotkey radio_sw ----------------------------------------------- */ | 1646 | /* sysfs hotkey radio_sw (pollable) ------------------------------------ */ |
1647 | static ssize_t hotkey_radio_sw_show(struct device *dev, | 1647 | static ssize_t hotkey_radio_sw_show(struct device *dev, |
1648 | struct device_attribute *attr, | 1648 | struct device_attribute *attr, |
1649 | char *buf) | 1649 | char *buf) |
@@ -1659,6 +1659,13 @@ static ssize_t hotkey_radio_sw_show(struct device *dev, | |||
1659 | static struct device_attribute dev_attr_hotkey_radio_sw = | 1659 | static struct device_attribute dev_attr_hotkey_radio_sw = |
1660 | __ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL); | 1660 | __ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL); |
1661 | 1661 | ||
1662 | static void hotkey_radio_sw_notify_change(void) | ||
1663 | { | ||
1664 | if (tp_features.hotkey_wlsw) | ||
1665 | sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, | ||
1666 | "hotkey_radio_sw"); | ||
1667 | } | ||
1668 | |||
1662 | /* sysfs hotkey report_mode -------------------------------------------- */ | 1669 | /* sysfs hotkey report_mode -------------------------------------------- */ |
1663 | static ssize_t hotkey_report_mode_show(struct device *dev, | 1670 | static ssize_t hotkey_report_mode_show(struct device *dev, |
1664 | struct device_attribute *attr, | 1671 | struct device_attribute *attr, |
@@ -1671,7 +1678,7 @@ static ssize_t hotkey_report_mode_show(struct device *dev, | |||
1671 | static struct device_attribute dev_attr_hotkey_report_mode = | 1678 | static struct device_attribute dev_attr_hotkey_report_mode = |
1672 | __ATTR(hotkey_report_mode, S_IRUGO, hotkey_report_mode_show, NULL); | 1679 | __ATTR(hotkey_report_mode, S_IRUGO, hotkey_report_mode_show, NULL); |
1673 | 1680 | ||
1674 | /* sysfs wakeup reason ------------------------------------------------- */ | 1681 | /* sysfs wakeup reason (pollable) -------------------------------------- */ |
1675 | static ssize_t hotkey_wakeup_reason_show(struct device *dev, | 1682 | static ssize_t hotkey_wakeup_reason_show(struct device *dev, |
1676 | struct device_attribute *attr, | 1683 | struct device_attribute *attr, |
1677 | char *buf) | 1684 | char *buf) |
@@ -1682,7 +1689,14 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev, | |||
1682 | static struct device_attribute dev_attr_hotkey_wakeup_reason = | 1689 | static struct device_attribute dev_attr_hotkey_wakeup_reason = |
1683 | __ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL); | 1690 | __ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL); |
1684 | 1691 | ||
1685 | /* sysfs wakeup hotunplug_complete ------------------------------------- */ | 1692 | void hotkey_wakeup_reason_notify_change(void) |
1693 | { | ||
1694 | if (tp_features.hotkey_mask) | ||
1695 | sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, | ||
1696 | "wakeup_reason"); | ||
1697 | } | ||
1698 | |||
1699 | /* sysfs wakeup hotunplug_complete (pollable) -------------------------- */ | ||
1686 | static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev, | 1700 | static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev, |
1687 | struct device_attribute *attr, | 1701 | struct device_attribute *attr, |
1688 | char *buf) | 1702 | char *buf) |
@@ -1694,6 +1708,13 @@ static struct device_attribute dev_attr_hotkey_wakeup_hotunplug_complete = | |||
1694 | __ATTR(wakeup_hotunplug_complete, S_IRUGO, | 1708 | __ATTR(wakeup_hotunplug_complete, S_IRUGO, |
1695 | hotkey_wakeup_hotunplug_complete_show, NULL); | 1709 | hotkey_wakeup_hotunplug_complete_show, NULL); |
1696 | 1710 | ||
1711 | void hotkey_wakeup_hotunplug_complete_notify_change(void) | ||
1712 | { | ||
1713 | if (tp_features.hotkey_mask) | ||
1714 | sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, | ||
1715 | "wakeup_hotunplug_complete"); | ||
1716 | } | ||
1717 | |||
1697 | /* --------------------------------------------------------------------- */ | 1718 | /* --------------------------------------------------------------------- */ |
1698 | 1719 | ||
1699 | static struct attribute *hotkey_attributes[] __initdata = { | 1720 | static struct attribute *hotkey_attributes[] __initdata = { |
@@ -2106,6 +2127,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2106 | printk(TPACPI_INFO | 2127 | printk(TPACPI_INFO |
2107 | "woke up due to a hot-unplug " | 2128 | "woke up due to a hot-unplug " |
2108 | "request...\n"); | 2129 | "request...\n"); |
2130 | hotkey_wakeup_reason_notify_change(); | ||
2109 | } | 2131 | } |
2110 | break; | 2132 | break; |
2111 | case 3: | 2133 | case 3: |
@@ -2114,6 +2136,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2114 | hotkey_autosleep_ack = 1; | 2136 | hotkey_autosleep_ack = 1; |
2115 | printk(TPACPI_INFO | 2137 | printk(TPACPI_INFO |
2116 | "bay ejected\n"); | 2138 | "bay ejected\n"); |
2139 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
2117 | } else { | 2140 | } else { |
2118 | unk_ev = 1; | 2141 | unk_ev = 1; |
2119 | } | 2142 | } |
@@ -2124,6 +2147,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2124 | hotkey_autosleep_ack = 1; | 2147 | hotkey_autosleep_ack = 1; |
2125 | printk(TPACPI_INFO | 2148 | printk(TPACPI_INFO |
2126 | "undocked\n"); | 2149 | "undocked\n"); |
2150 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
2127 | } else { | 2151 | } else { |
2128 | unk_ev = 1; | 2152 | unk_ev = 1; |
2129 | } | 2153 | } |
@@ -2150,6 +2174,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2150 | /* 0x7000-0x7FFF: misc */ | 2174 | /* 0x7000-0x7FFF: misc */ |
2151 | if (tp_features.hotkey_wlsw && hkey == 0x7000) { | 2175 | if (tp_features.hotkey_wlsw && hkey == 0x7000) { |
2152 | tpacpi_input_send_radiosw(); | 2176 | tpacpi_input_send_radiosw(); |
2177 | hotkey_radio_sw_notify_change(); | ||
2153 | send_acpi_ev = 0; | 2178 | send_acpi_ev = 0; |
2154 | break; | 2179 | break; |
2155 | } | 2180 | } |
@@ -2193,6 +2218,9 @@ static void hotkey_resume(void) | |||
2193 | "error while trying to read hot key mask " | 2218 | "error while trying to read hot key mask " |
2194 | "from firmware\n"); | 2219 | "from firmware\n"); |
2195 | tpacpi_input_send_radiosw(); | 2220 | tpacpi_input_send_radiosw(); |
2221 | hotkey_radio_sw_notify_change(); | ||
2222 | hotkey_wakeup_reason_notify_change(); | ||
2223 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
2196 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL | 2224 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL |
2197 | hotkey_poll_setup_safe(0); | 2225 | hotkey_poll_setup_safe(0); |
2198 | #endif | 2226 | #endif |