diff options
-rw-r--r-- | Documentation/laptops/acer-wmi.txt | 28 | ||||
-rw-r--r-- | drivers/misc/acer-wmi.c | 101 |
2 files changed, 25 insertions, 104 deletions
diff --git a/Documentation/laptops/acer-wmi.txt b/Documentation/laptops/acer-wmi.txt index 69b5dd4e5a59..2b3a6b5260bf 100644 --- a/Documentation/laptops/acer-wmi.txt +++ b/Documentation/laptops/acer-wmi.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Acer Laptop WMI Extras Driver | 1 | Acer Laptop WMI Extras Driver |
2 | http://code.google.com/p/aceracpi | 2 | http://code.google.com/p/aceracpi |
3 | Version 0.1 | 3 | Version 0.2 |
4 | 9th February 2008 | 4 | 18th August 2008 |
5 | 5 | ||
6 | Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> | 6 | Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> |
7 | 7 | ||
@@ -87,17 +87,7 @@ acer-wmi come with built-in wireless. However, should you feel so inclined to | |||
87 | ever wish to remove the card, or swap it out at some point, please get in touch | 87 | ever wish to remove the card, or swap it out at some point, please get in touch |
88 | with me, as we may well be able to gain some data on wireless card detection. | 88 | with me, as we may well be able to gain some data on wireless card detection. |
89 | 89 | ||
90 | To read the status of the wireless radio (0=off, 1=on): | 90 | The wireless radio is exposed through rfkill. |
91 | cat /sys/devices/platform/acer-wmi/wireless | ||
92 | |||
93 | To enable the wireless radio: | ||
94 | echo 1 > /sys/devices/platform/acer-wmi/wireless | ||
95 | |||
96 | To disable the wireless radio: | ||
97 | echo 0 > /sys/devices/platform/acer-wmi/wireless | ||
98 | |||
99 | To set the state of the wireless radio when loading acer-wmi, pass: | ||
100 | wireless=X (where X is 0 or 1) | ||
101 | 91 | ||
102 | Bluetooth | 92 | Bluetooth |
103 | ********* | 93 | ********* |
@@ -117,17 +107,7 @@ For the adventurously minded - if you want to buy an internal bluetooth | |||
117 | module off the internet that is compatible with your laptop and fit it, then | 107 | module off the internet that is compatible with your laptop and fit it, then |
118 | it will work just fine with acer-wmi. | 108 | it will work just fine with acer-wmi. |
119 | 109 | ||
120 | To read the status of the bluetooth module (0=off, 1=on): | 110 | Bluetooth is exposed through rfkill. |
121 | cat /sys/devices/platform/acer-wmi/wireless | ||
122 | |||
123 | To enable the bluetooth module: | ||
124 | echo 1 > /sys/devices/platform/acer-wmi/bluetooth | ||
125 | |||
126 | To disable the bluetooth module: | ||
127 | echo 0 > /sys/devices/platform/acer-wmi/bluetooth | ||
128 | |||
129 | To set the state of the bluetooth module when loading acer-wmi, pass: | ||
130 | bluetooth=X (where X is 0 or 1) | ||
131 | 111 | ||
132 | 3G | 112 | 3G |
133 | ** | 113 | ** |
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index e3e11e88747e..8708d3193788 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
@@ -125,21 +125,15 @@ enum interface_flags { | |||
125 | 125 | ||
126 | static int max_brightness = 0xF; | 126 | static int max_brightness = 0xF; |
127 | 127 | ||
128 | static int wireless = -1; | ||
129 | static int bluetooth = -1; | ||
130 | static int mailled = -1; | 128 | static int mailled = -1; |
131 | static int brightness = -1; | 129 | static int brightness = -1; |
132 | static int threeg = -1; | 130 | static int threeg = -1; |
133 | static int force_series; | 131 | static int force_series; |
134 | 132 | ||
135 | module_param(mailled, int, 0444); | 133 | module_param(mailled, int, 0444); |
136 | module_param(wireless, int, 0444); | ||
137 | module_param(bluetooth, int, 0444); | ||
138 | module_param(brightness, int, 0444); | 134 | module_param(brightness, int, 0444); |
139 | module_param(threeg, int, 0444); | 135 | module_param(threeg, int, 0444); |
140 | module_param(force_series, int, 0444); | 136 | module_param(force_series, int, 0444); |
141 | MODULE_PARM_DESC(wireless, "Set initial state of Wireless hardware"); | ||
142 | MODULE_PARM_DESC(bluetooth, "Set initial state of Bluetooth hardware"); | ||
143 | MODULE_PARM_DESC(mailled, "Set initial state of Mail LED"); | 137 | MODULE_PARM_DESC(mailled, "Set initial state of Mail LED"); |
144 | MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness"); | 138 | MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness"); |
145 | MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware"); | 139 | MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware"); |
@@ -147,8 +141,6 @@ MODULE_PARM_DESC(force_series, "Force a different laptop series"); | |||
147 | 141 | ||
148 | struct acer_data { | 142 | struct acer_data { |
149 | int mailled; | 143 | int mailled; |
150 | int wireless; | ||
151 | int bluetooth; | ||
152 | int threeg; | 144 | int threeg; |
153 | int brightness; | 145 | int brightness; |
154 | }; | 146 | }; |
@@ -851,8 +843,6 @@ static void __init acer_commandline_init(void) | |||
851 | * capability isn't available on the given interface | 843 | * capability isn't available on the given interface |
852 | */ | 844 | */ |
853 | set_u32(mailled, ACER_CAP_MAILLED); | 845 | set_u32(mailled, ACER_CAP_MAILLED); |
854 | set_u32(wireless, ACER_CAP_WIRELESS); | ||
855 | set_u32(bluetooth, ACER_CAP_BLUETOOTH); | ||
856 | set_u32(threeg, ACER_CAP_THREEG); | 846 | set_u32(threeg, ACER_CAP_THREEG); |
857 | set_u32(brightness, ACER_CAP_BRIGHTNESS); | 847 | set_u32(brightness, ACER_CAP_BRIGHTNESS); |
858 | } | 848 | } |
@@ -1057,40 +1047,30 @@ static void acer_rfkill_exit(void) | |||
1057 | } | 1047 | } |
1058 | 1048 | ||
1059 | /* | 1049 | /* |
1060 | * Read/ write bool sysfs macro | 1050 | * sysfs interface |
1061 | */ | 1051 | */ |
1062 | #define show_set_bool(value, cap) \ | 1052 | static ssize_t show_bool_threeg(struct device *dev, |
1063 | static ssize_t \ | 1053 | struct device_attribute *attr, char *buf) |
1064 | show_bool_##value(struct device *dev, struct device_attribute *attr, \ | 1054 | { |
1065 | char *buf) \ | ||
1066 | { \ | ||
1067 | u32 result; \ | 1055 | u32 result; \ |
1068 | acpi_status status = get_u32(&result, cap); \ | 1056 | acpi_status status = get_u32(&result, ACER_CAP_THREEG); |
1069 | if (ACPI_SUCCESS(status)) \ | 1057 | if (ACPI_SUCCESS(status)) |
1070 | return sprintf(buf, "%u\n", result); \ | 1058 | return sprintf(buf, "%u\n", result); |
1071 | return sprintf(buf, "Read error\n"); \ | 1059 | return sprintf(buf, "Read error\n"); |
1072 | } \ | 1060 | } |
1073 | \ | 1061 | |
1074 | static ssize_t \ | 1062 | static ssize_t set_bool_threeg(struct device *dev, |
1075 | set_bool_##value(struct device *dev, struct device_attribute *attr, \ | 1063 | struct device_attribute *attr, const char *buf, size_t count) |
1076 | const char *buf, size_t count) \ | 1064 | { |
1077 | { \ | 1065 | u32 tmp = simple_strtoul(buf, NULL, 10); |
1078 | u32 tmp = simple_strtoul(buf, NULL, 10); \ | 1066 | acpi_status status = set_u32(tmp, ACER_CAP_THREEG); |
1079 | acpi_status status = set_u32(tmp, cap); \ | 1067 | if (ACPI_FAILURE(status)) |
1080 | if (ACPI_FAILURE(status)) \ | 1068 | return -EINVAL; |
1081 | return -EINVAL; \ | 1069 | return count; |
1082 | return count; \ | 1070 | } |
1083 | } \ | 1071 | static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg, |
1084 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \ | 1072 | set_bool_threeg); |
1085 | show_bool_##value, set_bool_##value); | ||
1086 | |||
1087 | show_set_bool(wireless, ACER_CAP_WIRELESS); | ||
1088 | show_set_bool(bluetooth, ACER_CAP_BLUETOOTH); | ||
1089 | show_set_bool(threeg, ACER_CAP_THREEG); | ||
1090 | 1073 | ||
1091 | /* | ||
1092 | * Read interface sysfs macro | ||
1093 | */ | ||
1094 | static ssize_t show_interface(struct device *dev, struct device_attribute *attr, | 1074 | static ssize_t show_interface(struct device *dev, struct device_attribute *attr, |
1095 | char *buf) | 1075 | char *buf) |
1096 | { | 1076 | { |
@@ -1180,16 +1160,6 @@ pm_message_t state) | |||
1180 | if (!data) | 1160 | if (!data) |
1181 | return -ENOMEM; | 1161 | return -ENOMEM; |
1182 | 1162 | ||
1183 | if (has_cap(ACER_CAP_WIRELESS)) { | ||
1184 | get_u32(&value, ACER_CAP_WIRELESS); | ||
1185 | data->wireless = value; | ||
1186 | } | ||
1187 | |||
1188 | if (has_cap(ACER_CAP_BLUETOOTH)) { | ||
1189 | get_u32(&value, ACER_CAP_BLUETOOTH); | ||
1190 | data->bluetooth = value; | ||
1191 | } | ||
1192 | |||
1193 | if (has_cap(ACER_CAP_MAILLED)) { | 1163 | if (has_cap(ACER_CAP_MAILLED)) { |
1194 | get_u32(&value, ACER_CAP_MAILLED); | 1164 | get_u32(&value, ACER_CAP_MAILLED); |
1195 | data->mailled = value; | 1165 | data->mailled = value; |
@@ -1210,15 +1180,6 @@ static int acer_platform_resume(struct platform_device *device) | |||
1210 | if (!data) | 1180 | if (!data) |
1211 | return -ENOMEM; | 1181 | return -ENOMEM; |
1212 | 1182 | ||
1213 | if (has_cap(ACER_CAP_WIRELESS)) | ||
1214 | set_u32(data->wireless, ACER_CAP_WIRELESS); | ||
1215 | |||
1216 | if (has_cap(ACER_CAP_BLUETOOTH)) | ||
1217 | set_u32(data->bluetooth, ACER_CAP_BLUETOOTH); | ||
1218 | |||
1219 | if (has_cap(ACER_CAP_THREEG)) | ||
1220 | set_u32(data->threeg, ACER_CAP_THREEG); | ||
1221 | |||
1222 | if (has_cap(ACER_CAP_MAILLED)) | 1183 | if (has_cap(ACER_CAP_MAILLED)) |
1223 | set_u32(data->mailled, ACER_CAP_MAILLED); | 1184 | set_u32(data->mailled, ACER_CAP_MAILLED); |
1224 | 1185 | ||
@@ -1243,12 +1204,6 @@ static struct platform_device *acer_platform_device; | |||
1243 | 1204 | ||
1244 | static int remove_sysfs(struct platform_device *device) | 1205 | static int remove_sysfs(struct platform_device *device) |
1245 | { | 1206 | { |
1246 | if (has_cap(ACER_CAP_WIRELESS)) | ||
1247 | device_remove_file(&device->dev, &dev_attr_wireless); | ||
1248 | |||
1249 | if (has_cap(ACER_CAP_BLUETOOTH)) | ||
1250 | device_remove_file(&device->dev, &dev_attr_bluetooth); | ||
1251 | |||
1252 | if (has_cap(ACER_CAP_THREEG)) | 1207 | if (has_cap(ACER_CAP_THREEG)) |
1253 | device_remove_file(&device->dev, &dev_attr_threeg); | 1208 | device_remove_file(&device->dev, &dev_attr_threeg); |
1254 | 1209 | ||
@@ -1261,20 +1216,6 @@ static int create_sysfs(void) | |||
1261 | { | 1216 | { |
1262 | int retval = -ENOMEM; | 1217 | int retval = -ENOMEM; |
1263 | 1218 | ||
1264 | if (has_cap(ACER_CAP_WIRELESS)) { | ||
1265 | retval = device_create_file(&acer_platform_device->dev, | ||
1266 | &dev_attr_wireless); | ||
1267 | if (retval) | ||
1268 | goto error_sysfs; | ||
1269 | } | ||
1270 | |||
1271 | if (has_cap(ACER_CAP_BLUETOOTH)) { | ||
1272 | retval = device_create_file(&acer_platform_device->dev, | ||
1273 | &dev_attr_bluetooth); | ||
1274 | if (retval) | ||
1275 | goto error_sysfs; | ||
1276 | } | ||
1277 | |||
1278 | if (has_cap(ACER_CAP_THREEG)) { | 1219 | if (has_cap(ACER_CAP_THREEG)) { |
1279 | retval = device_create_file(&acer_platform_device->dev, | 1220 | retval = device_create_file(&acer_platform_device->dev, |
1280 | &dev_attr_threeg); | 1221 | &dev_attr_threeg); |