aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/thinkpad-acpi.txt6
-rw-r--r--drivers/misc/thinkpad_acpi.c38
-rw-r--r--drivers/misc/thinkpad_acpi.h1
3 files changed, 43 insertions, 2 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 142a14fa1d91..fe26e50a2b15 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -227,6 +227,12 @@ sysfs notes:
227 supported hot keys, except those which are handled by 227 supported hot keys, except those which are handled by
228 the firmware. Echo it to hotkey_mask above, to use. 228 the firmware. Echo it to hotkey_mask above, to use.
229 229
230 hotkey_radio_sw:
231 if the ThinkPad has a hardware radio switch, this
232 attribute will read 0 if the switch is in the "radios
233 disabled" postition, and 1 if the switch is in the
234 "radios enabled" position.
235
230 236
231Bluetooth 237Bluetooth
232--------- 238---------
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 8c088687e954..3cf37bb55e9a 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
734static struct attribute_set *hotkey_dev_attributes; 734static struct attribute_set *hotkey_dev_attributes;
735 735
736static 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 ------------------------------------------------- */
737static ssize_t hotkey_enable_show(struct device *dev, 744static 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 ----------------------------------------------- */
864static 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
876static 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
858static struct attribute *hotkey_mask_attributes[] = { 881static struct attribute *hotkey_mask_attributes[] = {
@@ -866,6 +889,7 @@ static struct attribute *hotkey_mask_attributes[] = {
866static int __init hotkey_init(struct ibm_init_struct *iibm) 889static 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 }
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index e1a64f0aada9..78ea4c88d560 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -228,6 +228,7 @@ static struct {
228 u16 bluetooth:1; 228 u16 bluetooth:1;
229 u16 hotkey:1; 229 u16 hotkey:1;
230 u16 hotkey_mask:1; 230 u16 hotkey_mask:1;
231 u16 hotkey_wlsw:1;
231 u16 light:1; 232 u16 light:1;
232 u16 light_status:1; 233 u16 light_status:1;
233 u16 wan:1; 234 u16 wan:1;