diff options
-rw-r--r-- | Documentation/thinkpad-acpi.txt | 13 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 37 |
2 files changed, 49 insertions, 1 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index 2f30db0e0db5..142a14fa1d91 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/thinkpad-acpi.txt | |||
@@ -214,6 +214,19 @@ sysfs notes: | |||
214 | key (see above). Returns the current status of the hot | 214 | key (see above). Returns the current status of the hot |
215 | keys mask, and allows one to modify it. | 215 | keys mask, and allows one to modify it. |
216 | 216 | ||
217 | hotkey_all_mask: | ||
218 | bit mask that should enable event reporting for all | ||
219 | supported hot keys, when echoed to hotkey_mask above. | ||
220 | Unless you know which events need to be handled | ||
221 | passively (because the firmware *will* handle them | ||
222 | anyway), do *not* use hotkey_all_mask. Use | ||
223 | hotkey_recommended_mask, instead. You have been warned. | ||
224 | |||
225 | hotkey_recommended_mask: | ||
226 | bit mask that should enable event reporting for all | ||
227 | supported hot keys, except those which are handled by | ||
228 | the firmware. Echo it to hotkey_mask above, to use. | ||
229 | |||
217 | 230 | ||
218 | Bluetooth | 231 | Bluetooth |
219 | --------- | 232 | --------- |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 450b1e5cd681..8c088687e954 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -728,6 +728,8 @@ static struct ibm_struct thinkpad_acpi_driver_data = { | |||
728 | 728 | ||
729 | static int hotkey_orig_status; | 729 | static int hotkey_orig_status; |
730 | static u32 hotkey_orig_mask; | 730 | static u32 hotkey_orig_mask; |
731 | static u32 hotkey_all_mask; | ||
732 | static u32 hotkey_reserved_mask = 0x00778000; | ||
731 | 733 | ||
732 | static struct attribute_set *hotkey_dev_attributes; | 734 | static struct attribute_set *hotkey_dev_attributes; |
733 | 735 | ||
@@ -827,12 +829,38 @@ static ssize_t hotkey_bios_mask_show(struct device *dev, | |||
827 | static struct device_attribute dev_attr_hotkey_bios_mask = | 829 | static struct device_attribute dev_attr_hotkey_bios_mask = |
828 | __ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL); | 830 | __ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL); |
829 | 831 | ||
832 | /* sysfs hotkey all_mask ----------------------------------------------- */ | ||
833 | static ssize_t hotkey_all_mask_show(struct device *dev, | ||
834 | struct device_attribute *attr, | ||
835 | char *buf) | ||
836 | { | ||
837 | return snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_all_mask); | ||
838 | } | ||
839 | |||
840 | static struct device_attribute dev_attr_hotkey_all_mask = | ||
841 | __ATTR(hotkey_all_mask, S_IRUGO, hotkey_all_mask_show, NULL); | ||
842 | |||
843 | /* sysfs hotkey recommended_mask --------------------------------------- */ | ||
844 | static ssize_t hotkey_recommended_mask_show(struct device *dev, | ||
845 | struct device_attribute *attr, | ||
846 | char *buf) | ||
847 | { | ||
848 | return snprintf(buf, PAGE_SIZE, "0x%08x\n", | ||
849 | hotkey_all_mask & ~hotkey_reserved_mask); | ||
850 | } | ||
851 | |||
852 | static struct device_attribute dev_attr_hotkey_recommended_mask = | ||
853 | __ATTR(hotkey_recommended_mask, S_IRUGO, | ||
854 | hotkey_recommended_mask_show, NULL); | ||
855 | |||
830 | /* --------------------------------------------------------------------- */ | 856 | /* --------------------------------------------------------------------- */ |
831 | 857 | ||
832 | static struct attribute *hotkey_mask_attributes[] = { | 858 | static struct attribute *hotkey_mask_attributes[] = { |
833 | &dev_attr_hotkey_mask.attr, | 859 | &dev_attr_hotkey_mask.attr, |
834 | &dev_attr_hotkey_bios_enabled.attr, | 860 | &dev_attr_hotkey_bios_enabled.attr, |
835 | &dev_attr_hotkey_bios_mask.attr, | 861 | &dev_attr_hotkey_bios_mask.attr, |
862 | &dev_attr_hotkey_all_mask.attr, | ||
863 | &dev_attr_hotkey_recommended_mask.attr, | ||
836 | }; | 864 | }; |
837 | 865 | ||
838 | static int __init hotkey_init(struct ibm_init_struct *iibm) | 866 | static int __init hotkey_init(struct ibm_init_struct *iibm) |
@@ -851,7 +879,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
851 | str_supported(tp_features.hotkey)); | 879 | str_supported(tp_features.hotkey)); |
852 | 880 | ||
853 | if (tp_features.hotkey) { | 881 | if (tp_features.hotkey) { |
854 | hotkey_dev_attributes = create_attr_set(4, NULL); | 882 | hotkey_dev_attributes = create_attr_set(6, NULL); |
855 | if (!hotkey_dev_attributes) | 883 | if (!hotkey_dev_attributes) |
856 | return -ENOMEM; | 884 | return -ENOMEM; |
857 | res = add_to_attr_set(hotkey_dev_attributes, | 885 | res = add_to_attr_set(hotkey_dev_attributes, |
@@ -867,6 +895,13 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
867 | vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", | 895 | vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", |
868 | str_supported(tp_features.hotkey_mask)); | 896 | str_supported(tp_features.hotkey_mask)); |
869 | 897 | ||
898 | if (tp_features.hotkey_mask) { | ||
899 | /* MHKA available in A31, R40, R40e, T4x, X31, and later */ | ||
900 | if (!acpi_evalf(hkey_handle, &hotkey_all_mask, | ||
901 | "MHKA", "qd")) | ||
902 | hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */ | ||
903 | } | ||
904 | |||
870 | res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask); | 905 | res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask); |
871 | if (!res && tp_features.hotkey_mask) { | 906 | if (!res && tp_features.hotkey_mask) { |
872 | res = add_many_to_attr_set(hotkey_dev_attributes, | 907 | res = add_many_to_attr_set(hotkey_dev_attributes, |