diff options
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 8c088687e95..3cf37bb55e9 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -733,6 +733,13 @@ static u32 hotkey_reserved_mask = 0x00778000; | |||
733 | 733 | ||
734 | static struct attribute_set *hotkey_dev_attributes; | 734 | static struct attribute_set *hotkey_dev_attributes; |
735 | 735 | ||
736 | static int hotkey_get_wlsw(int *status) | ||
737 | { | ||
738 | if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) | ||
739 | return -EIO; | ||
740 | return 0; | ||
741 | } | ||
742 | |||
736 | /* sysfs hotkey enable ------------------------------------------------- */ | 743 | /* sysfs hotkey enable ------------------------------------------------- */ |
737 | static ssize_t hotkey_enable_show(struct device *dev, | 744 | static ssize_t hotkey_enable_show(struct device *dev, |
738 | struct device_attribute *attr, | 745 | struct device_attribute *attr, |
@@ -853,6 +860,22 @@ static struct device_attribute dev_attr_hotkey_recommended_mask = | |||
853 | __ATTR(hotkey_recommended_mask, S_IRUGO, | 860 | __ATTR(hotkey_recommended_mask, S_IRUGO, |
854 | hotkey_recommended_mask_show, NULL); | 861 | hotkey_recommended_mask_show, NULL); |
855 | 862 | ||
863 | /* sysfs hotkey radio_sw ----------------------------------------------- */ | ||
864 | static ssize_t hotkey_radio_sw_show(struct device *dev, | ||
865 | struct device_attribute *attr, | ||
866 | char *buf) | ||
867 | { | ||
868 | int res, s; | ||
869 | res = hotkey_get_wlsw(&s); | ||
870 | if (res < 0) | ||
871 | return res; | ||
872 | |||
873 | return snprintf(buf, PAGE_SIZE, "%d\n", !!s); | ||
874 | } | ||
875 | |||
876 | static struct device_attribute dev_attr_hotkey_radio_sw = | ||
877 | __ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL); | ||
878 | |||
856 | /* --------------------------------------------------------------------- */ | 879 | /* --------------------------------------------------------------------- */ |
857 | 880 | ||
858 | static struct attribute *hotkey_mask_attributes[] = { | 881 | static struct attribute *hotkey_mask_attributes[] = { |
@@ -866,6 +889,7 @@ static struct attribute *hotkey_mask_attributes[] = { | |||
866 | static int __init hotkey_init(struct ibm_init_struct *iibm) | 889 | static int __init hotkey_init(struct ibm_init_struct *iibm) |
867 | { | 890 | { |
868 | int res; | 891 | int res; |
892 | int status; | ||
869 | 893 | ||
870 | vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n"); | 894 | vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n"); |
871 | 895 | ||
@@ -879,7 +903,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
879 | str_supported(tp_features.hotkey)); | 903 | str_supported(tp_features.hotkey)); |
880 | 904 | ||
881 | if (tp_features.hotkey) { | 905 | if (tp_features.hotkey) { |
882 | hotkey_dev_attributes = create_attr_set(6, NULL); | 906 | hotkey_dev_attributes = create_attr_set(7, NULL); |
883 | if (!hotkey_dev_attributes) | 907 | if (!hotkey_dev_attributes) |
884 | return -ENOMEM; | 908 | return -ENOMEM; |
885 | res = add_to_attr_set(hotkey_dev_attributes, | 909 | res = add_to_attr_set(hotkey_dev_attributes, |
@@ -908,11 +932,21 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
908 | hotkey_mask_attributes, | 932 | hotkey_mask_attributes, |
909 | ARRAY_SIZE(hotkey_mask_attributes)); | 933 | ARRAY_SIZE(hotkey_mask_attributes)); |
910 | } | 934 | } |
935 | |||
936 | /* Not all thinkpads have a hardware radio switch */ | ||
937 | if (!res && acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { | ||
938 | tp_features.hotkey_wlsw = 1; | ||
939 | printk(IBM_INFO | ||
940 | "radio switch found; radios are %s\n", | ||
941 | enabled(status, 0)); | ||
942 | res = add_to_attr_set(hotkey_dev_attributes, | ||
943 | &dev_attr_hotkey_radio_sw.attr); | ||
944 | } | ||
945 | |||
911 | if (!res) | 946 | if (!res) |
912 | res = register_attr_set_with_sysfs( | 947 | res = register_attr_set_with_sysfs( |
913 | hotkey_dev_attributes, | 948 | hotkey_dev_attributes, |
914 | &tpacpi_pdev->dev.kobj); | 949 | &tpacpi_pdev->dev.kobj); |
915 | |||
916 | if (res) | 950 | if (res) |
917 | return res; | 951 | return res; |
918 | } | 952 | } |