]>
Commit | Line | Data |
---|---|---|
85091b71 CC |
1 | /* |
2 | * asus-laptop.c - Asus Laptop Support | |
3 | * | |
4 | * | |
5 | * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor | |
8ec555c2 | 6 | * Copyright (C) 2006-2007 Corentin Chary |
85091b71 CC |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | * | |
22 | * | |
23 | * The development page for this driver is located at | |
24 | * http://sourceforge.net/projects/acpi4asus/ | |
25 | * | |
26 | * Credits: | |
27 | * Pontus Fuchs - Helper functions, cleanup | |
28 | * Johann Wiesner - Small compile fixes | |
29 | * John Belmonte - ACPI code for Toshiba laptop was a good starting point. | |
30 | * Eric Burghard - LED display support for W1N | |
31 | * Josh Green - Light Sens support | |
32 | * Thomas Tuttle - His first patch for led support was very helpfull | |
e539c2f6 | 33 | * Sam Lin - GPS support |
85091b71 CC |
34 | */ |
35 | ||
2fcc23da CC |
36 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
37 | ||
85091b71 CC |
38 | #include <linux/kernel.h> |
39 | #include <linux/module.h> | |
40 | #include <linux/init.h> | |
41 | #include <linux/types.h> | |
42 | #include <linux/err.h> | |
43 | #include <linux/proc_fs.h> | |
6b7091e7 CC |
44 | #include <linux/backlight.h> |
45 | #include <linux/fb.h> | |
be18cdab | 46 | #include <linux/leds.h> |
85091b71 CC |
47 | #include <linux/platform_device.h> |
48 | #include <acpi/acpi_drivers.h> | |
49 | #include <acpi/acpi_bus.h> | |
50 | #include <asm/uaccess.h> | |
034ce90a | 51 | #include <linux/input.h> |
85091b71 | 52 | |
f3985327 | 53 | #define ASUS_LAPTOP_VERSION "0.42" |
85091b71 CC |
54 | |
55 | #define ASUS_HOTK_NAME "Asus Laptop Support" | |
56 | #define ASUS_HOTK_CLASS "hotkey" | |
57 | #define ASUS_HOTK_DEVICE_NAME "Hotkey" | |
2fcc23da | 58 | #define ASUS_HOTK_FILE KBUILD_MODNAME |
85091b71 CC |
59 | #define ASUS_HOTK_PREFIX "\\_SB.ATKD." |
60 | ||
2fcc23da | 61 | |
6b7091e7 CC |
62 | /* |
63 | * Some events we use, same for all Asus | |
64 | */ | |
65 | #define ATKD_BR_UP 0x10 | |
66 | #define ATKD_BR_DOWN 0x20 | |
67 | #define ATKD_LCD_ON 0x33 | |
68 | #define ATKD_LCD_OFF 0x34 | |
69 | ||
4564de17 CC |
70 | /* |
71 | * Known bits returned by \_SB.ATKD.HWRS | |
72 | */ | |
73 | #define WL_HWRS 0x80 | |
74 | #define BT_HWRS 0x100 | |
75 | ||
be18cdab CC |
76 | /* |
77 | * Flags for hotk status | |
4564de17 | 78 | * WL_ON and BT_ON are also used for wireless_status() |
be18cdab | 79 | */ |
4564de17 CC |
80 | #define WL_ON 0x01 //internal Wifi |
81 | #define BT_ON 0x02 //internal Bluetooth | |
be18cdab CC |
82 | #define MLED_ON 0x04 //mail LED |
83 | #define TLED_ON 0x08 //touchpad LED | |
8def05fa LB |
84 | #define RLED_ON 0x10 //Record LED |
85 | #define PLED_ON 0x20 //Phone LED | |
fdd8d080 CC |
86 | #define GLED_ON 0x40 //Gaming LED |
87 | #define LCD_ON 0x80 //LCD backlight | |
f3985327 | 88 | #define GPS_ON 0x100 //GPS |
b7d3fbc2 | 89 | #define KEY_ON 0x200 //Keyboard backlight |
be18cdab | 90 | |
85091b71 CC |
91 | #define ASUS_LOG ASUS_HOTK_FILE ": " |
92 | #define ASUS_ERR KERN_ERR ASUS_LOG | |
93 | #define ASUS_WARNING KERN_WARNING ASUS_LOG | |
94 | #define ASUS_NOTICE KERN_NOTICE ASUS_LOG | |
95 | #define ASUS_INFO KERN_INFO ASUS_LOG | |
96 | #define ASUS_DEBUG KERN_DEBUG ASUS_LOG | |
97 | ||
98 | MODULE_AUTHOR("Julien Lerouge, Karol Kozimor, Corentin Chary"); | |
99 | MODULE_DESCRIPTION(ASUS_HOTK_NAME); | |
100 | MODULE_LICENSE("GPL"); | |
101 | ||
185e5af9 CC |
102 | /* WAPF defines the behavior of the Fn+Fx wlan key |
103 | * The significance of values is yet to be found, but | |
104 | * most of the time: | |
105 | * 0x0 will do nothing | |
106 | * 0x1 will allow to control the device with Fn+Fx key. | |
107 | * 0x4 will send an ACPI event (0x88) while pressing the Fn+Fx key | |
108 | * 0x5 like 0x1 or 0x4 | |
109 | * So, if something doesn't work as you want, just try other values =) | |
110 | */ | |
111 | static uint wapf = 1; | |
112 | module_param(wapf, uint, 0644); | |
113 | MODULE_PARM_DESC(wapf, "WAPF value"); | |
114 | ||
85091b71 CC |
115 | #define ASUS_HANDLE(object, paths...) \ |
116 | static acpi_handle object##_handle = NULL; \ | |
117 | static char *object##_paths[] = { paths } | |
118 | ||
be18cdab CC |
119 | /* LED */ |
120 | ASUS_HANDLE(mled_set, ASUS_HOTK_PREFIX "MLED"); | |
121 | ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED"); | |
8def05fa LB |
122 | ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */ |
123 | ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */ | |
fdd8d080 | 124 | ASUS_HANDLE(gled_set, ASUS_HOTK_PREFIX "GLED"); /* G1, G2 (probably) */ |
be18cdab | 125 | |
722ad971 CC |
126 | /* LEDD */ |
127 | ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM"); | |
128 | ||
4564de17 CC |
129 | /* Bluetooth and WLAN |
130 | * WLED and BLED are not handled like other XLED, because in some dsdt | |
131 | * they also control the WLAN/Bluetooth device. | |
132 | */ | |
133 | ASUS_HANDLE(wl_switch, ASUS_HOTK_PREFIX "WLED"); | |
134 | ASUS_HANDLE(bt_switch, ASUS_HOTK_PREFIX "BLED"); | |
8def05fa | 135 | ASUS_HANDLE(wireless_status, ASUS_HOTK_PREFIX "RSTS"); /* All new models */ |
4564de17 | 136 | |
6b7091e7 CC |
137 | /* Brightness */ |
138 | ASUS_HANDLE(brightness_set, ASUS_HOTK_PREFIX "SPLV"); | |
139 | ASUS_HANDLE(brightness_get, ASUS_HOTK_PREFIX "GPLV"); | |
140 | ||
141 | /* Backlight */ | |
8def05fa LB |
142 | ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ |
143 | "\\_SB.PCI0.ISA.EC0._Q10", /* A1x */ | |
144 | "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */ | |
145 | "\\_SB.PCI0.PX40.EC0.Q10", /* M1A */ | |
146 | "\\_SB.PCI0.LPCB.EC0._Q10", /* P30 */ | |
4d0b856e | 147 | "\\_SB.PCI0.LPCB.EC0._Q0E", /* P30/P35 */ |
8def05fa LB |
148 | "\\_SB.PCI0.PX40.Q10", /* S1x */ |
149 | "\\Q10"); /* A2x, L2D, L3D, M2E */ | |
6b7091e7 | 150 | |
78127b4a CC |
151 | /* Display */ |
152 | ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP"); | |
8def05fa LB |
153 | ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G |
154 | M6A M6V VX-1 V6J V6V W3Z */ | |
155 | "\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V | |
f3985327 | 156 | S5A M5A z33A W1Jc W2V G1 */ |
8def05fa LB |
157 | "\\_SB.PCI0.P0P3.VGA.GETD", /* A6V A6Q */ |
158 | "\\_SB.PCI0.P0PA.VGA.GETD", /* A6T, A6M */ | |
159 | "\\_SB.PCI0.PCI1.VGAC.NMAP", /* L3C */ | |
160 | "\\_SB.PCI0.VGA.GETD", /* Z96F */ | |
161 | "\\ACTD", /* A2D */ | |
162 | "\\ADVG", /* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ | |
163 | "\\DNXT", /* P30 */ | |
164 | "\\INFB", /* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ | |
165 | "\\SSTE"); /* A3F A6F A3N A3L M6N W3N W6A */ | |
166 | ||
167 | ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */ | |
168 | ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */ | |
8b857353 | 169 | |
e539c2f6 CC |
170 | /* GPS */ |
171 | /* R2H use different handle for GPS on/off */ | |
f3985327 CC |
172 | ASUS_HANDLE(gps_on, ASUS_HOTK_PREFIX "SDON"); /* R2H */ |
173 | ASUS_HANDLE(gps_off, ASUS_HOTK_PREFIX "SDOF"); /* R2H */ | |
e539c2f6 CC |
174 | ASUS_HANDLE(gps_status, ASUS_HOTK_PREFIX "GPST"); |
175 | ||
b7d3fbc2 CC |
176 | /* Keyboard light */ |
177 | ASUS_HANDLE(kled_set, ASUS_HOTK_PREFIX "SLKB"); | |
178 | ASUS_HANDLE(kled_get, ASUS_HOTK_PREFIX "GLKB"); | |
179 | ||
85091b71 CC |
180 | /* |
181 | * This is the main structure, we can use it to store anything interesting | |
182 | * about the hotk device | |
183 | */ | |
184 | struct asus_hotk { | |
8def05fa | 185 | char *name; //laptop name |
85091b71 CC |
186 | struct acpi_device *device; //the device we are in |
187 | acpi_handle handle; //the handle of the hotk device | |
188 | char status; //status of the hotk, for LEDs, ... | |
722ad971 | 189 | u32 ledd_status; //status of the LED display |
8def05fa LB |
190 | u8 light_level; //light sensor level |
191 | u8 light_switch; //light sensor switch value | |
85091b71 | 192 | u16 event_count[128]; //count for each event TODO make this better |
034ce90a CC |
193 | struct input_dev *inputdev; |
194 | u16 *keycode_map; | |
85091b71 CC |
195 | }; |
196 | ||
197 | /* | |
198 | * This header is made available to allow proper configuration given model, | |
199 | * revision number , ... this info cannot go in struct asus_hotk because it is | |
200 | * available before the hotk | |
201 | */ | |
202 | static struct acpi_table_header *asus_info; | |
203 | ||
204 | /* The actual device the driver binds to */ | |
205 | static struct asus_hotk *hotk; | |
206 | ||
207 | /* | |
208 | * The hotkey driver declaration | |
209 | */ | |
1ba90e3a TR |
210 | static const struct acpi_device_id asus_device_ids[] = { |
211 | {"ATK0100", 0}, | |
212 | {"", 0}, | |
213 | }; | |
214 | MODULE_DEVICE_TABLE(acpi, asus_device_ids); | |
215 | ||
85091b71 CC |
216 | static int asus_hotk_add(struct acpi_device *device); |
217 | static int asus_hotk_remove(struct acpi_device *device, int type); | |
586ed160 BH |
218 | static void asus_hotk_notify(struct acpi_device *device, u32 event); |
219 | ||
85091b71 CC |
220 | static struct acpi_driver asus_hotk_driver = { |
221 | .name = ASUS_HOTK_NAME, | |
222 | .class = ASUS_HOTK_CLASS, | |
1ba90e3a | 223 | .ids = asus_device_ids, |
586ed160 | 224 | .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, |
85091b71 CC |
225 | .ops = { |
226 | .add = asus_hotk_add, | |
227 | .remove = asus_hotk_remove, | |
586ed160 | 228 | .notify = asus_hotk_notify, |
85091b71 CC |
229 | }, |
230 | }; | |
231 | ||
6b7091e7 CC |
232 | /* The backlight device /sys/class/backlight */ |
233 | static struct backlight_device *asus_backlight_device; | |
234 | ||
235 | /* | |
236 | * The backlight class declaration | |
237 | */ | |
238 | static int read_brightness(struct backlight_device *bd); | |
239 | static int update_bl_status(struct backlight_device *bd); | |
599a52d1 | 240 | static struct backlight_ops asusbl_ops = { |
8def05fa LB |
241 | .get_brightness = read_brightness, |
242 | .update_status = update_bl_status, | |
6b7091e7 CC |
243 | }; |
244 | ||
be18cdab CC |
245 | /* These functions actually update the LED's, and are called from a |
246 | * workqueue. By doing this as separate work rather than when the LED | |
247 | * subsystem asks, we avoid messing with the Asus ACPI stuff during a | |
248 | * potentially bad time, such as a timer interrupt. */ | |
249 | static struct workqueue_struct *led_workqueue; | |
250 | ||
977c328d | 251 | #define ASUS_LED(object, ledname, max) \ |
be18cdab CC |
252 | static void object##_led_set(struct led_classdev *led_cdev, \ |
253 | enum led_brightness value); \ | |
abfa57e1 CC |
254 | static enum led_brightness object##_led_get( \ |
255 | struct led_classdev *led_cdev); \ | |
be18cdab CC |
256 | static void object##_led_update(struct work_struct *ignored); \ |
257 | static int object##_led_wk; \ | |
f110ef58 | 258 | static DECLARE_WORK(object##_led_work, object##_led_update); \ |
be18cdab | 259 | static struct led_classdev object##_led = { \ |
6c152bee | 260 | .name = "asus::" ledname, \ |
be18cdab | 261 | .brightness_set = object##_led_set, \ |
abfa57e1 | 262 | .brightness_get = object##_led_get, \ |
977c328d | 263 | .max_brightness = max \ |
be18cdab CC |
264 | } |
265 | ||
977c328d CC |
266 | ASUS_LED(mled, "mail", 1); |
267 | ASUS_LED(tled, "touchpad", 1); | |
268 | ASUS_LED(rled, "record", 1); | |
269 | ASUS_LED(pled, "phone", 1); | |
270 | ASUS_LED(gled, "gaming", 1); | |
b7d3fbc2 | 271 | ASUS_LED(kled, "kbd_backlight", 3); |
be18cdab | 272 | |
034ce90a CC |
273 | struct key_entry { |
274 | char type; | |
275 | u8 code; | |
276 | u16 keycode; | |
277 | }; | |
278 | ||
279 | enum { KE_KEY, KE_END }; | |
280 | ||
281 | static struct key_entry asus_keymap[] = { | |
282 | {KE_KEY, 0x30, KEY_VOLUMEUP}, | |
283 | {KE_KEY, 0x31, KEY_VOLUMEDOWN}, | |
284 | {KE_KEY, 0x32, KEY_MUTE}, | |
285 | {KE_KEY, 0x33, KEY_SWITCHVIDEOMODE}, | |
286 | {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE}, | |
287 | {KE_KEY, 0x40, KEY_PREVIOUSSONG}, | |
288 | {KE_KEY, 0x41, KEY_NEXTSONG}, | |
309f5fbd | 289 | {KE_KEY, 0x43, KEY_STOPCD}, |
034ce90a | 290 | {KE_KEY, 0x45, KEY_PLAYPAUSE}, |
4644d0e5 | 291 | {KE_KEY, 0x4c, KEY_MEDIA}, |
034ce90a CC |
292 | {KE_KEY, 0x50, KEY_EMAIL}, |
293 | {KE_KEY, 0x51, KEY_WWW}, | |
0aa20f7d | 294 | {KE_KEY, 0x55, KEY_CALC}, |
309f5fbd | 295 | {KE_KEY, 0x5C, KEY_SCREENLOCK}, /* Screenlock */ |
034ce90a | 296 | {KE_KEY, 0x5D, KEY_WLAN}, |
f641375b CC |
297 | {KE_KEY, 0x5E, KEY_WLAN}, |
298 | {KE_KEY, 0x5F, KEY_WLAN}, | |
299 | {KE_KEY, 0x60, KEY_SWITCHVIDEOMODE}, | |
034ce90a CC |
300 | {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE}, |
301 | {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */ | |
302 | {KE_KEY, 0x82, KEY_CAMERA}, | |
309f5fbd | 303 | {KE_KEY, 0x8A, KEY_PROG1}, |
034ce90a CC |
304 | {KE_KEY, 0x95, KEY_MEDIA}, |
305 | {KE_KEY, 0x99, KEY_PHONE}, | |
dc795260 CC |
306 | {KE_KEY, 0xc4, KEY_KBDILLUMUP}, |
307 | {KE_KEY, 0xc5, KEY_KBDILLUMDOWN}, | |
034ce90a CC |
308 | {KE_END, 0}, |
309 | }; | |
310 | ||
85091b71 CC |
311 | /* |
312 | * This function evaluates an ACPI method, given an int as parameter, the | |
313 | * method is searched within the scope of the handle, can be NULL. The output | |
314 | * of the method is written is output, which can also be NULL | |
315 | * | |
f8d1c94b | 316 | * returns 0 if write is successful, -1 else. |
85091b71 CC |
317 | */ |
318 | static int write_acpi_int(acpi_handle handle, const char *method, int val, | |
319 | struct acpi_buffer *output) | |
320 | { | |
321 | struct acpi_object_list params; //list of input parameters (an int here) | |
322 | union acpi_object in_obj; //the only param we use | |
323 | acpi_status status; | |
324 | ||
f8d1c94b CC |
325 | if (!handle) |
326 | return 0; | |
327 | ||
85091b71 CC |
328 | params.count = 1; |
329 | params.pointer = &in_obj; | |
330 | in_obj.type = ACPI_TYPE_INTEGER; | |
331 | in_obj.integer.value = val; | |
332 | ||
333 | status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); | |
f8d1c94b CC |
334 | if (status == AE_OK) |
335 | return 0; | |
336 | else | |
337 | return -1; | |
85091b71 CC |
338 | } |
339 | ||
8def05fa LB |
340 | static int read_wireless_status(int mask) |
341 | { | |
27663c58 | 342 | unsigned long long status; |
9a816850 | 343 | acpi_status rv = AE_OK; |
4564de17 CC |
344 | |
345 | if (!wireless_status_handle) | |
346 | return (hotk->status & mask) ? 1 : 0; | |
347 | ||
9a816850 CC |
348 | rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, &status); |
349 | if (ACPI_FAILURE(rv)) | |
2fcc23da | 350 | pr_warning("Error reading Wireless status\n"); |
9a816850 CC |
351 | else |
352 | return (status & mask) ? 1 : 0; | |
4564de17 CC |
353 | |
354 | return (hotk->status & mask) ? 1 : 0; | |
355 | } | |
356 | ||
f3985327 CC |
357 | static int read_gps_status(void) |
358 | { | |
27663c58 | 359 | unsigned long long status; |
e539c2f6 CC |
360 | acpi_status rv = AE_OK; |
361 | ||
362 | rv = acpi_evaluate_integer(gps_status_handle, NULL, NULL, &status); | |
363 | if (ACPI_FAILURE(rv)) | |
2fcc23da | 364 | pr_warning("Error reading GPS status\n"); |
e539c2f6 | 365 | else |
f3985327 | 366 | return status ? 1 : 0; |
e539c2f6 | 367 | |
f3985327 | 368 | return (hotk->status & GPS_ON) ? 1 : 0; |
e539c2f6 CC |
369 | } |
370 | ||
be18cdab CC |
371 | /* Generic LED functions */ |
372 | static int read_status(int mask) | |
373 | { | |
4564de17 CC |
374 | /* There is a special method for both wireless devices */ |
375 | if (mask == BT_ON || mask == WL_ON) | |
376 | return read_wireless_status(mask); | |
f3985327 CC |
377 | else if (mask == GPS_ON) |
378 | return read_gps_status(); | |
4564de17 | 379 | |
be18cdab CC |
380 | return (hotk->status & mask) ? 1 : 0; |
381 | } | |
382 | ||
935ffeec | 383 | static void write_status(acpi_handle handle, int out, int mask) |
be18cdab CC |
384 | { |
385 | hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask); | |
386 | ||
935ffeec CC |
387 | switch (mask) { |
388 | case MLED_ON: | |
e1af14e4 | 389 | out = !(out & 0x1); |
935ffeec | 390 | break; |
fdd8d080 CC |
391 | case GLED_ON: |
392 | out = (out & 0x1) + 1; | |
393 | break; | |
e539c2f6 CC |
394 | case GPS_ON: |
395 | handle = (out) ? gps_on_handle : gps_off_handle; | |
396 | out = 0x02; | |
397 | break; | |
935ffeec CC |
398 | default: |
399 | out &= 0x1; | |
400 | break; | |
401 | } | |
be18cdab | 402 | |
f8d1c94b | 403 | if (write_acpi_int(handle, NULL, out, NULL)) |
2fcc23da | 404 | pr_warning(" write failed %x\n", mask); |
be18cdab CC |
405 | } |
406 | ||
407 | /* /sys/class/led handlers */ | |
935ffeec | 408 | #define ASUS_LED_HANDLER(object, mask) \ |
be18cdab CC |
409 | static void object##_led_set(struct led_classdev *led_cdev, \ |
410 | enum led_brightness value) \ | |
411 | { \ | |
e3deda9c | 412 | object##_led_wk = (value > 0) ? 1 : 0; \ |
be18cdab CC |
413 | queue_work(led_workqueue, &object##_led_work); \ |
414 | } \ | |
415 | static void object##_led_update(struct work_struct *ignored) \ | |
416 | { \ | |
417 | int value = object##_led_wk; \ | |
935ffeec | 418 | write_status(object##_set_handle, value, (mask)); \ |
abfa57e1 CC |
419 | } \ |
420 | static enum led_brightness object##_led_get( \ | |
421 | struct led_classdev *led_cdev) \ | |
422 | { \ | |
423 | return led_cdev->brightness; \ | |
be18cdab CC |
424 | } |
425 | ||
935ffeec CC |
426 | ASUS_LED_HANDLER(mled, MLED_ON); |
427 | ASUS_LED_HANDLER(pled, PLED_ON); | |
428 | ASUS_LED_HANDLER(rled, RLED_ON); | |
429 | ASUS_LED_HANDLER(tled, TLED_ON); | |
fdd8d080 | 430 | ASUS_LED_HANDLER(gled, GLED_ON); |
be18cdab | 431 | |
b7d3fbc2 CC |
432 | /* |
433 | * Keyboard backlight | |
434 | */ | |
435 | static int get_kled_lvl(void) | |
436 | { | |
437 | unsigned long long kblv; | |
438 | struct acpi_object_list params; | |
439 | union acpi_object in_obj; | |
440 | acpi_status rv; | |
441 | ||
442 | params.count = 1; | |
443 | params.pointer = &in_obj; | |
444 | in_obj.type = ACPI_TYPE_INTEGER; | |
445 | in_obj.integer.value = 2; | |
446 | ||
447 | rv = acpi_evaluate_integer(kled_get_handle, NULL, ¶ms, &kblv); | |
448 | if (ACPI_FAILURE(rv)) { | |
449 | pr_warning("Error reading kled level\n"); | |
450 | return 0; | |
451 | } | |
452 | return kblv; | |
453 | } | |
454 | ||
455 | static int set_kled_lvl(int kblv) | |
456 | { | |
457 | if (kblv > 0) | |
458 | kblv = (1 << 7) | (kblv & 0x7F); | |
459 | else | |
460 | kblv = 0; | |
461 | ||
462 | if (write_acpi_int(kled_set_handle, NULL, kblv, NULL)) { | |
463 | pr_warning("Keyboard LED display write failed\n"); | |
464 | return -EINVAL; | |
465 | } | |
466 | return 0; | |
467 | } | |
468 | ||
469 | static void kled_led_set(struct led_classdev *led_cdev, | |
470 | enum led_brightness value) | |
471 | { | |
472 | kled_led_wk = value; | |
473 | queue_work(led_workqueue, &kled_led_work); | |
474 | } | |
475 | ||
476 | static void kled_led_update(struct work_struct *ignored) | |
477 | { | |
478 | set_kled_lvl(kled_led_wk); | |
479 | } | |
480 | ||
481 | static enum led_brightness kled_led_get(struct led_classdev *led_cdev) | |
482 | { | |
483 | return get_kled_lvl(); | |
484 | } | |
485 | ||
6b7091e7 CC |
486 | static int get_lcd_state(void) |
487 | { | |
488 | return read_status(LCD_ON); | |
489 | } | |
490 | ||
491 | static int set_lcd_state(int value) | |
492 | { | |
493 | int lcd = 0; | |
494 | acpi_status status = 0; | |
495 | ||
496 | lcd = value ? 1 : 0; | |
497 | ||
498 | if (lcd == get_lcd_state()) | |
499 | return 0; | |
500 | ||
8def05fa | 501 | if (lcd_switch_handle) { |
6b7091e7 CC |
502 | status = acpi_evaluate_object(lcd_switch_handle, |
503 | NULL, NULL, NULL); | |
504 | ||
505 | if (ACPI_FAILURE(status)) | |
2fcc23da | 506 | pr_warning("Error switching LCD\n"); |
6b7091e7 CC |
507 | } |
508 | ||
935ffeec | 509 | write_status(NULL, lcd, LCD_ON); |
6b7091e7 CC |
510 | return 0; |
511 | } | |
512 | ||
513 | static void lcd_blank(int blank) | |
514 | { | |
515 | struct backlight_device *bd = asus_backlight_device; | |
516 | ||
8def05fa | 517 | if (bd) { |
599a52d1 | 518 | bd->props.power = blank; |
28ee086d | 519 | backlight_update_status(bd); |
6b7091e7 CC |
520 | } |
521 | } | |
522 | ||
523 | static int read_brightness(struct backlight_device *bd) | |
524 | { | |
27663c58 | 525 | unsigned long long value; |
9a816850 | 526 | acpi_status rv = AE_OK; |
6b7091e7 | 527 | |
9a816850 CC |
528 | rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, &value); |
529 | if (ACPI_FAILURE(rv)) | |
2fcc23da | 530 | pr_warning("Error reading brightness\n"); |
6b7091e7 CC |
531 | |
532 | return value; | |
533 | } | |
534 | ||
535 | static int set_brightness(struct backlight_device *bd, int value) | |
536 | { | |
537 | int ret = 0; | |
538 | ||
539 | value = (0 < value) ? ((15 < value) ? 15 : value) : 0; | |
540 | /* 0 <= value <= 15 */ | |
541 | ||
f8d1c94b | 542 | if (write_acpi_int(brightness_set_handle, NULL, value, NULL)) { |
2fcc23da | 543 | pr_warning("Error changing brightness\n"); |
6b7091e7 CC |
544 | ret = -EIO; |
545 | } | |
546 | ||
547 | return ret; | |
548 | } | |
549 | ||
550 | static int update_bl_status(struct backlight_device *bd) | |
551 | { | |
552 | int rv; | |
599a52d1 | 553 | int value = bd->props.brightness; |
6b7091e7 CC |
554 | |
555 | rv = set_brightness(bd, value); | |
8def05fa | 556 | if (rv) |
6b7091e7 CC |
557 | return rv; |
558 | ||
599a52d1 | 559 | value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0; |
6b7091e7 CC |
560 | return set_lcd_state(value); |
561 | } | |
562 | ||
85091b71 CC |
563 | /* |
564 | * Platform device handlers | |
565 | */ | |
566 | ||
567 | /* | |
568 | * We write our info in page, we begin at offset off and cannot write more | |
569 | * than count bytes. We set eof to 1 if we handle those 2 values. We return the | |
570 | * number of bytes written in page | |
571 | */ | |
572 | static ssize_t show_infos(struct device *dev, | |
8def05fa | 573 | struct device_attribute *attr, char *page) |
85091b71 CC |
574 | { |
575 | int len = 0; | |
27663c58 | 576 | unsigned long long temp; |
85091b71 | 577 | char buf[16]; //enough for all info |
9a816850 CC |
578 | acpi_status rv = AE_OK; |
579 | ||
85091b71 CC |
580 | /* |
581 | * We use the easy way, we don't care of off and count, so we don't set eof | |
582 | * to 1 | |
583 | */ | |
584 | ||
585 | len += sprintf(page, ASUS_HOTK_NAME " " ASUS_LAPTOP_VERSION "\n"); | |
586 | len += sprintf(page + len, "Model reference : %s\n", hotk->name); | |
587 | /* | |
588 | * The SFUN method probably allows the original driver to get the list | |
589 | * of features supported by a given model. For now, 0x0100 or 0x0800 | |
590 | * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. | |
591 | * The significance of others is yet to be found. | |
592 | */ | |
9a816850 CC |
593 | rv = acpi_evaluate_integer(hotk->handle, "SFUN", NULL, &temp); |
594 | if (!ACPI_FAILURE(rv)) | |
1d4a3800 CC |
595 | len += sprintf(page + len, "SFUN value : %#x\n", |
596 | (uint) temp); | |
597 | /* | |
598 | * The HWRS method return informations about the hardware. | |
599 | * 0x80 bit is for WLAN, 0x100 for Bluetooth. | |
600 | * The significance of others is yet to be found. | |
601 | * If we don't find the method, we assume the device are present. | |
602 | */ | |
603 | rv = acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &temp); | |
604 | if (!ACPI_FAILURE(rv)) | |
605 | len += sprintf(page + len, "HRWS value : %#x\n", | |
9a816850 | 606 | (uint) temp); |
85091b71 CC |
607 | /* |
608 | * Another value for userspace: the ASYM method returns 0x02 for | |
609 | * battery low and 0x04 for battery critical, its readings tend to be | |
610 | * more accurate than those provided by _BST. | |
611 | * Note: since not all the laptops provide this method, errors are | |
612 | * silently ignored. | |
613 | */ | |
9a816850 CC |
614 | rv = acpi_evaluate_integer(hotk->handle, "ASYM", NULL, &temp); |
615 | if (!ACPI_FAILURE(rv)) | |
1d4a3800 | 616 | len += sprintf(page + len, "ASYM value : %#x\n", |
9a816850 | 617 | (uint) temp); |
85091b71 CC |
618 | if (asus_info) { |
619 | snprintf(buf, 16, "%d", asus_info->length); | |
620 | len += sprintf(page + len, "DSDT length : %s\n", buf); | |
621 | snprintf(buf, 16, "%d", asus_info->checksum); | |
622 | len += sprintf(page + len, "DSDT checksum : %s\n", buf); | |
623 | snprintf(buf, 16, "%d", asus_info->revision); | |
624 | len += sprintf(page + len, "DSDT revision : %s\n", buf); | |
625 | snprintf(buf, 7, "%s", asus_info->oem_id); | |
626 | len += sprintf(page + len, "OEM id : %s\n", buf); | |
627 | snprintf(buf, 9, "%s", asus_info->oem_table_id); | |
628 | len += sprintf(page + len, "OEM table id : %s\n", buf); | |
629 | snprintf(buf, 16, "%x", asus_info->oem_revision); | |
630 | len += sprintf(page + len, "OEM revision : 0x%s\n", buf); | |
631 | snprintf(buf, 5, "%s", asus_info->asl_compiler_id); | |
632 | len += sprintf(page + len, "ASL comp vendor id : %s\n", buf); | |
633 | snprintf(buf, 16, "%x", asus_info->asl_compiler_revision); | |
634 | len += sprintf(page + len, "ASL comp revision : 0x%s\n", buf); | |
635 | } | |
636 | ||
637 | return len; | |
638 | } | |
639 | ||
640 | static int parse_arg(const char *buf, unsigned long count, int *val) | |
641 | { | |
642 | if (!count) | |
643 | return 0; | |
644 | if (count > 31) | |
645 | return -EINVAL; | |
646 | if (sscanf(buf, "%i", val) != 1) | |
647 | return -EINVAL; | |
648 | return count; | |
649 | } | |
650 | ||
4564de17 | 651 | static ssize_t store_status(const char *buf, size_t count, |
935ffeec | 652 | acpi_handle handle, int mask) |
4564de17 CC |
653 | { |
654 | int rv, value; | |
655 | int out = 0; | |
656 | ||
657 | rv = parse_arg(buf, count, &value); | |
658 | if (rv > 0) | |
659 | out = value ? 1 : 0; | |
660 | ||
935ffeec | 661 | write_status(handle, out, mask); |
4564de17 CC |
662 | |
663 | return rv; | |
664 | } | |
665 | ||
722ad971 CC |
666 | /* |
667 | * LEDD display | |
668 | */ | |
669 | static ssize_t show_ledd(struct device *dev, | |
670 | struct device_attribute *attr, char *buf) | |
671 | { | |
672 | return sprintf(buf, "0x%08x\n", hotk->ledd_status); | |
673 | } | |
674 | ||
675 | static ssize_t store_ledd(struct device *dev, struct device_attribute *attr, | |
676 | const char *buf, size_t count) | |
677 | { | |
678 | int rv, value; | |
679 | ||
680 | rv = parse_arg(buf, count, &value); | |
681 | if (rv > 0) { | |
f8d1c94b | 682 | if (write_acpi_int(ledd_set_handle, NULL, value, NULL)) |
2fcc23da | 683 | pr_warning("LED display write failed\n"); |
722ad971 CC |
684 | else |
685 | hotk->ledd_status = (u32) value; | |
686 | } | |
687 | return rv; | |
688 | } | |
689 | ||
4564de17 CC |
690 | /* |
691 | * WLAN | |
692 | */ | |
693 | static ssize_t show_wlan(struct device *dev, | |
694 | struct device_attribute *attr, char *buf) | |
695 | { | |
696 | return sprintf(buf, "%d\n", read_status(WL_ON)); | |
697 | } | |
698 | ||
699 | static ssize_t store_wlan(struct device *dev, struct device_attribute *attr, | |
700 | const char *buf, size_t count) | |
701 | { | |
935ffeec | 702 | return store_status(buf, count, wl_switch_handle, WL_ON); |
4564de17 CC |
703 | } |
704 | ||
705 | /* | |
706 | * Bluetooth | |
707 | */ | |
708 | static ssize_t show_bluetooth(struct device *dev, | |
709 | struct device_attribute *attr, char *buf) | |
710 | { | |
711 | return sprintf(buf, "%d\n", read_status(BT_ON)); | |
712 | } | |
713 | ||
8def05fa LB |
714 | static ssize_t store_bluetooth(struct device *dev, |
715 | struct device_attribute *attr, const char *buf, | |
716 | size_t count) | |
4564de17 | 717 | { |
935ffeec | 718 | return store_status(buf, count, bt_switch_handle, BT_ON); |
4564de17 CC |
719 | } |
720 | ||
78127b4a CC |
721 | /* |
722 | * Display | |
723 | */ | |
724 | static void set_display(int value) | |
725 | { | |
726 | /* no sanity check needed for now */ | |
f8d1c94b | 727 | if (write_acpi_int(display_set_handle, NULL, value, NULL)) |
2fcc23da | 728 | pr_warning("Error setting display\n"); |
78127b4a CC |
729 | return; |
730 | } | |
731 | ||
732 | static int read_display(void) | |
733 | { | |
27663c58 | 734 | unsigned long long value = 0; |
9a816850 | 735 | acpi_status rv = AE_OK; |
78127b4a CC |
736 | |
737 | /* In most of the case, we know how to set the display, but sometime | |
738 | we can't read it */ | |
8def05fa | 739 | if (display_get_handle) { |
9a816850 CC |
740 | rv = acpi_evaluate_integer(display_get_handle, NULL, |
741 | NULL, &value); | |
742 | if (ACPI_FAILURE(rv)) | |
2fcc23da | 743 | pr_warning("Error reading display status\n"); |
78127b4a CC |
744 | } |
745 | ||
746 | value &= 0x0F; /* needed for some models, shouldn't hurt others */ | |
747 | ||
748 | return value; | |
749 | } | |
8def05fa | 750 | |
78127b4a CC |
751 | /* |
752 | * Now, *this* one could be more user-friendly, but so far, no-one has | |
753 | * complained. The significance of bits is the same as in store_disp() | |
754 | */ | |
755 | static ssize_t show_disp(struct device *dev, | |
756 | struct device_attribute *attr, char *buf) | |
757 | { | |
758 | return sprintf(buf, "%d\n", read_display()); | |
759 | } | |
760 | ||
761 | /* | |
762 | * Experimental support for display switching. As of now: 1 should activate | |
763 | * the LCD output, 2 should do for CRT, 4 for TV-Out and 8 for DVI. | |
764 | * Any combination (bitwise) of these will suffice. I never actually tested 4 | |
765 | * displays hooked up simultaneously, so be warned. See the acpi4asus README | |
766 | * for more info. | |
767 | */ | |
768 | static ssize_t store_disp(struct device *dev, struct device_attribute *attr, | |
769 | const char *buf, size_t count) | |
770 | { | |
771 | int rv, value; | |
772 | ||
773 | rv = parse_arg(buf, count, &value); | |
774 | if (rv > 0) | |
775 | set_display(value); | |
776 | return rv; | |
777 | } | |
778 | ||
8b857353 CC |
779 | /* |
780 | * Light Sens | |
781 | */ | |
782 | static void set_light_sens_switch(int value) | |
783 | { | |
f8d1c94b | 784 | if (write_acpi_int(ls_switch_handle, NULL, value, NULL)) |
2fcc23da | 785 | pr_warning("Error setting light sensor switch\n"); |
8b857353 CC |
786 | hotk->light_switch = value; |
787 | } | |
788 | ||
789 | static ssize_t show_lssw(struct device *dev, | |
790 | struct device_attribute *attr, char *buf) | |
791 | { | |
792 | return sprintf(buf, "%d\n", hotk->light_switch); | |
793 | } | |
794 | ||
795 | static ssize_t store_lssw(struct device *dev, struct device_attribute *attr, | |
796 | const char *buf, size_t count) | |
797 | { | |
798 | int rv, value; | |
799 | ||
800 | rv = parse_arg(buf, count, &value); | |
801 | if (rv > 0) | |
802 | set_light_sens_switch(value ? 1 : 0); | |
803 | ||
804 | return rv; | |
805 | } | |
806 | ||
807 | static void set_light_sens_level(int value) | |
808 | { | |
f8d1c94b | 809 | if (write_acpi_int(ls_level_handle, NULL, value, NULL)) |
2fcc23da | 810 | pr_warning("Error setting light sensor level\n"); |
8b857353 CC |
811 | hotk->light_level = value; |
812 | } | |
813 | ||
814 | static ssize_t show_lslvl(struct device *dev, | |
815 | struct device_attribute *attr, char *buf) | |
816 | { | |
817 | return sprintf(buf, "%d\n", hotk->light_level); | |
818 | } | |
819 | ||
820 | static ssize_t store_lslvl(struct device *dev, struct device_attribute *attr, | |
821 | const char *buf, size_t count) | |
822 | { | |
823 | int rv, value; | |
824 | ||
825 | rv = parse_arg(buf, count, &value); | |
826 | if (rv > 0) { | |
827 | value = (0 < value) ? ((15 < value) ? 15 : value) : 0; | |
828 | /* 0 <= value <= 15 */ | |
829 | set_light_sens_level(value); | |
830 | } | |
831 | ||
832 | return rv; | |
833 | } | |
834 | ||
e539c2f6 CC |
835 | /* |
836 | * GPS | |
837 | */ | |
838 | static ssize_t show_gps(struct device *dev, | |
839 | struct device_attribute *attr, char *buf) | |
840 | { | |
841 | return sprintf(buf, "%d\n", read_status(GPS_ON)); | |
842 | } | |
843 | ||
844 | static ssize_t store_gps(struct device *dev, struct device_attribute *attr, | |
845 | const char *buf, size_t count) | |
846 | { | |
f3985327 | 847 | return store_status(buf, count, NULL, GPS_ON); |
e539c2f6 CC |
848 | } |
849 | ||
034ce90a CC |
850 | /* |
851 | * Hotkey functions | |
852 | */ | |
853 | static struct key_entry *asus_get_entry_by_scancode(int code) | |
854 | { | |
855 | struct key_entry *key; | |
856 | ||
857 | for (key = asus_keymap; key->type != KE_END; key++) | |
858 | if (code == key->code) | |
859 | return key; | |
860 | ||
861 | return NULL; | |
862 | } | |
863 | ||
864 | static struct key_entry *asus_get_entry_by_keycode(int code) | |
865 | { | |
866 | struct key_entry *key; | |
867 | ||
868 | for (key = asus_keymap; key->type != KE_END; key++) | |
869 | if (code == key->keycode && key->type == KE_KEY) | |
870 | return key; | |
871 | ||
872 | return NULL; | |
873 | } | |
874 | ||
875 | static int asus_getkeycode(struct input_dev *dev, int scancode, int *keycode) | |
876 | { | |
877 | struct key_entry *key = asus_get_entry_by_scancode(scancode); | |
878 | ||
879 | if (key && key->type == KE_KEY) { | |
880 | *keycode = key->keycode; | |
881 | return 0; | |
882 | } | |
883 | ||
884 | return -EINVAL; | |
885 | } | |
886 | ||
887 | static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode) | |
888 | { | |
889 | struct key_entry *key; | |
890 | int old_keycode; | |
891 | ||
892 | if (keycode < 0 || keycode > KEY_MAX) | |
893 | return -EINVAL; | |
894 | ||
895 | key = asus_get_entry_by_scancode(scancode); | |
896 | if (key && key->type == KE_KEY) { | |
897 | old_keycode = key->keycode; | |
898 | key->keycode = keycode; | |
899 | set_bit(keycode, dev->keybit); | |
900 | if (!asus_get_entry_by_keycode(old_keycode)) | |
901 | clear_bit(old_keycode, dev->keybit); | |
902 | return 0; | |
903 | } | |
904 | ||
905 | return -EINVAL; | |
906 | } | |
907 | ||
586ed160 | 908 | static void asus_hotk_notify(struct acpi_device *device, u32 event) |
85091b71 | 909 | { |
034ce90a | 910 | static struct key_entry *key; |
6050c8dd | 911 | u16 count; |
034ce90a | 912 | |
85091b71 CC |
913 | /* TODO Find a better way to handle events count. */ |
914 | if (!hotk) | |
915 | return; | |
916 | ||
6b7091e7 CC |
917 | /* |
918 | * We need to tell the backlight device when the backlight power is | |
919 | * switched | |
920 | */ | |
921 | if (event == ATKD_LCD_ON) { | |
935ffeec | 922 | write_status(NULL, 1, LCD_ON); |
6b7091e7 | 923 | lcd_blank(FB_BLANK_UNBLANK); |
8def05fa | 924 | } else if (event == ATKD_LCD_OFF) { |
935ffeec | 925 | write_status(NULL, 0, LCD_ON); |
6b7091e7 CC |
926 | lcd_blank(FB_BLANK_POWERDOWN); |
927 | } | |
928 | ||
6050c8dd CC |
929 | count = hotk->event_count[event % 128]++; |
930 | acpi_bus_generate_proc_event(hotk->device, event, count); | |
2a7dc0d8 CC |
931 | acpi_bus_generate_netlink_event(hotk->device->pnp.device_class, |
932 | dev_name(&hotk->device->dev), event, | |
6050c8dd | 933 | count); |
85091b71 | 934 | |
034ce90a CC |
935 | if (hotk->inputdev) { |
936 | key = asus_get_entry_by_scancode(event); | |
937 | if (!key) | |
938 | return ; | |
939 | ||
940 | switch (key->type) { | |
941 | case KE_KEY: | |
942 | input_report_key(hotk->inputdev, key->keycode, 1); | |
943 | input_sync(hotk->inputdev); | |
944 | input_report_key(hotk->inputdev, key->keycode, 0); | |
945 | input_sync(hotk->inputdev); | |
946 | break; | |
947 | } | |
948 | } | |
85091b71 CC |
949 | } |
950 | ||
951 | #define ASUS_CREATE_DEVICE_ATTR(_name) \ | |
952 | struct device_attribute dev_attr_##_name = { \ | |
953 | .attr = { \ | |
954 | .name = __stringify(_name), \ | |
7b595756 | 955 | .mode = 0 }, \ |
85091b71 CC |
956 | .show = NULL, \ |
957 | .store = NULL, \ | |
958 | } | |
959 | ||
960 | #define ASUS_SET_DEVICE_ATTR(_name, _mode, _show, _store) \ | |
961 | do { \ | |
962 | dev_attr_##_name.attr.mode = _mode; \ | |
963 | dev_attr_##_name.show = _show; \ | |
964 | dev_attr_##_name.store = _store; \ | |
965 | } while(0) | |
966 | ||
967 | static ASUS_CREATE_DEVICE_ATTR(infos); | |
4564de17 CC |
968 | static ASUS_CREATE_DEVICE_ATTR(wlan); |
969 | static ASUS_CREATE_DEVICE_ATTR(bluetooth); | |
78127b4a | 970 | static ASUS_CREATE_DEVICE_ATTR(display); |
722ad971 | 971 | static ASUS_CREATE_DEVICE_ATTR(ledd); |
8b857353 CC |
972 | static ASUS_CREATE_DEVICE_ATTR(ls_switch); |
973 | static ASUS_CREATE_DEVICE_ATTR(ls_level); | |
e539c2f6 | 974 | static ASUS_CREATE_DEVICE_ATTR(gps); |
85091b71 CC |
975 | |
976 | static struct attribute *asuspf_attributes[] = { | |
8def05fa LB |
977 | &dev_attr_infos.attr, |
978 | &dev_attr_wlan.attr, | |
979 | &dev_attr_bluetooth.attr, | |
980 | &dev_attr_display.attr, | |
981 | &dev_attr_ledd.attr, | |
982 | &dev_attr_ls_switch.attr, | |
983 | &dev_attr_ls_level.attr, | |
e539c2f6 | 984 | &dev_attr_gps.attr, |
8def05fa | 985 | NULL |
85091b71 CC |
986 | }; |
987 | ||
988 | static struct attribute_group asuspf_attribute_group = { | |
8def05fa | 989 | .attrs = asuspf_attributes |
85091b71 CC |
990 | }; |
991 | ||
992 | static struct platform_driver asuspf_driver = { | |
8def05fa LB |
993 | .driver = { |
994 | .name = ASUS_HOTK_FILE, | |
995 | .owner = THIS_MODULE, | |
996 | } | |
85091b71 CC |
997 | }; |
998 | ||
999 | static struct platform_device *asuspf_device; | |
1000 | ||
85091b71 CC |
1001 | static void asus_hotk_add_fs(void) |
1002 | { | |
1003 | ASUS_SET_DEVICE_ATTR(infos, 0444, show_infos, NULL); | |
4564de17 CC |
1004 | |
1005 | if (wl_switch_handle) | |
1006 | ASUS_SET_DEVICE_ATTR(wlan, 0644, show_wlan, store_wlan); | |
1007 | ||
1008 | if (bt_switch_handle) | |
1009 | ASUS_SET_DEVICE_ATTR(bluetooth, 0644, | |
1010 | show_bluetooth, store_bluetooth); | |
78127b4a CC |
1011 | |
1012 | if (display_set_handle && display_get_handle) | |
1013 | ASUS_SET_DEVICE_ATTR(display, 0644, show_disp, store_disp); | |
8def05fa | 1014 | else if (display_set_handle) |
78127b4a CC |
1015 | ASUS_SET_DEVICE_ATTR(display, 0200, NULL, store_disp); |
1016 | ||
722ad971 CC |
1017 | if (ledd_set_handle) |
1018 | ASUS_SET_DEVICE_ATTR(ledd, 0644, show_ledd, store_ledd); | |
1019 | ||
8b857353 CC |
1020 | if (ls_switch_handle && ls_level_handle) { |
1021 | ASUS_SET_DEVICE_ATTR(ls_level, 0644, show_lslvl, store_lslvl); | |
1022 | ASUS_SET_DEVICE_ATTR(ls_switch, 0644, show_lssw, store_lssw); | |
1023 | } | |
e539c2f6 | 1024 | |
f3985327 | 1025 | if (gps_status_handle && gps_on_handle && gps_off_handle) |
e539c2f6 | 1026 | ASUS_SET_DEVICE_ATTR(gps, 0644, show_gps, store_gps); |
85091b71 CC |
1027 | } |
1028 | ||
8def05fa | 1029 | static int asus_handle_init(char *name, acpi_handle * handle, |
85091b71 CC |
1030 | char **paths, int num_paths) |
1031 | { | |
1032 | int i; | |
1033 | acpi_status status; | |
1034 | ||
1035 | for (i = 0; i < num_paths; i++) { | |
1036 | status = acpi_get_handle(NULL, paths[i], handle); | |
1037 | if (ACPI_SUCCESS(status)) | |
1038 | return 0; | |
1039 | } | |
1040 | ||
1041 | *handle = NULL; | |
1042 | return -ENODEV; | |
1043 | } | |
1044 | ||
1045 | #define ASUS_HANDLE_INIT(object) \ | |
1046 | asus_handle_init(#object, &object##_handle, object##_paths, \ | |
1047 | ARRAY_SIZE(object##_paths)) | |
1048 | ||
85091b71 CC |
1049 | /* |
1050 | * This function is used to initialize the hotk with right values. In this | |
1051 | * method, we can make all the detection we want, and modify the hotk struct | |
1052 | */ | |
1053 | static int asus_hotk_get_info(void) | |
1054 | { | |
1055 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | |
85091b71 | 1056 | union acpi_object *model = NULL; |
27663c58 | 1057 | unsigned long long bsts_result, hwrs_result; |
85091b71 CC |
1058 | char *string = NULL; |
1059 | acpi_status status; | |
1060 | ||
1061 | /* | |
1062 | * Get DSDT headers early enough to allow for differentiating between | |
1063 | * models, but late enough to allow acpi_bus_register_driver() to fail | |
1064 | * before doing anything ACPI-specific. Should we encounter a machine, | |
1065 | * which needs special handling (i.e. its hotkey device has a different | |
1066 | * HID), this bit will be moved. A global variable asus_info contains | |
1067 | * the DSDT header. | |
1068 | */ | |
894d79be | 1069 | status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info); |
85091b71 | 1070 | if (ACPI_FAILURE(status)) |
2fcc23da | 1071 | pr_warning("Couldn't get the DSDT table header\n"); |
85091b71 CC |
1072 | |
1073 | /* We have to write 0 on init this far for all ASUS models */ | |
f8d1c94b | 1074 | if (write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { |
2fcc23da | 1075 | pr_err("Hotkey initialization failed\n"); |
85091b71 CC |
1076 | return -ENODEV; |
1077 | } | |
1078 | ||
1079 | /* This needs to be called for some laptops to init properly */ | |
9a816850 CC |
1080 | status = |
1081 | acpi_evaluate_integer(hotk->handle, "BSTS", NULL, &bsts_result); | |
1082 | if (ACPI_FAILURE(status)) | |
2fcc23da | 1083 | pr_warning("Error calling BSTS\n"); |
85091b71 | 1084 | else if (bsts_result) |
2fcc23da | 1085 | pr_notice("BSTS called, 0x%02x returned\n", |
9a816850 | 1086 | (uint) bsts_result); |
85091b71 | 1087 | |
185e5af9 CC |
1088 | /* This too ... */ |
1089 | write_acpi_int(hotk->handle, "CWAP", wapf, NULL); | |
1090 | ||
85091b71 CC |
1091 | /* |
1092 | * Try to match the object returned by INIT to the specific model. | |
1093 | * Handle every possible object (or the lack of thereof) the DSDT | |
1094 | * writers might throw at us. When in trouble, we pass NULL to | |
1095 | * asus_model_match() and try something completely different. | |
1096 | */ | |
1097 | if (buffer.pointer) { | |
1098 | model = buffer.pointer; | |
1099 | switch (model->type) { | |
1100 | case ACPI_TYPE_STRING: | |
1101 | string = model->string.pointer; | |
1102 | break; | |
1103 | case ACPI_TYPE_BUFFER: | |
1104 | string = model->buffer.pointer; | |
1105 | break; | |
1106 | default: | |
1107 | string = ""; | |
1108 | break; | |
1109 | } | |
1110 | } | |
1111 | hotk->name = kstrdup(string, GFP_KERNEL); | |
1112 | if (!hotk->name) | |
1113 | return -ENOMEM; | |
1114 | ||
8def05fa | 1115 | if (*string) |
2fcc23da | 1116 | pr_notice(" %s model detected\n", string); |
85091b71 | 1117 | |
be18cdab CC |
1118 | ASUS_HANDLE_INIT(mled_set); |
1119 | ASUS_HANDLE_INIT(tled_set); | |
1120 | ASUS_HANDLE_INIT(rled_set); | |
1121 | ASUS_HANDLE_INIT(pled_set); | |
fdd8d080 | 1122 | ASUS_HANDLE_INIT(gled_set); |
be18cdab | 1123 | |
722ad971 CC |
1124 | ASUS_HANDLE_INIT(ledd_set); |
1125 | ||
b7d3fbc2 CC |
1126 | ASUS_HANDLE_INIT(kled_set); |
1127 | ASUS_HANDLE_INIT(kled_get); | |
1128 | ||
4564de17 CC |
1129 | /* |
1130 | * The HWRS method return informations about the hardware. | |
1131 | * 0x80 bit is for WLAN, 0x100 for Bluetooth. | |
1132 | * The significance of others is yet to be found. | |
1133 | * If we don't find the method, we assume the device are present. | |
1134 | */ | |
9a816850 CC |
1135 | status = |
1136 | acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &hwrs_result); | |
1137 | if (ACPI_FAILURE(status)) | |
4564de17 CC |
1138 | hwrs_result = WL_HWRS | BT_HWRS; |
1139 | ||
8def05fa | 1140 | if (hwrs_result & WL_HWRS) |
4564de17 | 1141 | ASUS_HANDLE_INIT(wl_switch); |
8def05fa | 1142 | if (hwrs_result & BT_HWRS) |
4564de17 CC |
1143 | ASUS_HANDLE_INIT(bt_switch); |
1144 | ||
1145 | ASUS_HANDLE_INIT(wireless_status); | |
1146 | ||
6b7091e7 CC |
1147 | ASUS_HANDLE_INIT(brightness_set); |
1148 | ASUS_HANDLE_INIT(brightness_get); | |
1149 | ||
1150 | ASUS_HANDLE_INIT(lcd_switch); | |
1151 | ||
78127b4a CC |
1152 | ASUS_HANDLE_INIT(display_set); |
1153 | ASUS_HANDLE_INIT(display_get); | |
1154 | ||
8b857353 CC |
1155 | /* There is a lot of models with "ALSL", but a few get |
1156 | a real light sens, so we need to check it. */ | |
832d9950 | 1157 | if (!ASUS_HANDLE_INIT(ls_switch)) |
8b857353 CC |
1158 | ASUS_HANDLE_INIT(ls_level); |
1159 | ||
e539c2f6 CC |
1160 | ASUS_HANDLE_INIT(gps_on); |
1161 | ASUS_HANDLE_INIT(gps_off); | |
1162 | ASUS_HANDLE_INIT(gps_status); | |
1163 | ||
85091b71 CC |
1164 | kfree(model); |
1165 | ||
1166 | return AE_OK; | |
1167 | } | |
1168 | ||
034ce90a CC |
1169 | static int asus_input_init(void) |
1170 | { | |
1171 | const struct key_entry *key; | |
1172 | int result; | |
1173 | ||
1174 | hotk->inputdev = input_allocate_device(); | |
1175 | if (!hotk->inputdev) { | |
2fcc23da | 1176 | pr_info("Unable to allocate input device\n"); |
034ce90a CC |
1177 | return 0; |
1178 | } | |
1179 | hotk->inputdev->name = "Asus Laptop extra buttons"; | |
1180 | hotk->inputdev->phys = ASUS_HOTK_FILE "/input0"; | |
1181 | hotk->inputdev->id.bustype = BUS_HOST; | |
1182 | hotk->inputdev->getkeycode = asus_getkeycode; | |
1183 | hotk->inputdev->setkeycode = asus_setkeycode; | |
1184 | ||
1185 | for (key = asus_keymap; key->type != KE_END; key++) { | |
1186 | switch (key->type) { | |
1187 | case KE_KEY: | |
1188 | set_bit(EV_KEY, hotk->inputdev->evbit); | |
1189 | set_bit(key->keycode, hotk->inputdev->keybit); | |
1190 | break; | |
1191 | } | |
1192 | } | |
1193 | result = input_register_device(hotk->inputdev); | |
1194 | if (result) { | |
2fcc23da | 1195 | pr_info("Unable to register input device\n"); |
034ce90a CC |
1196 | input_free_device(hotk->inputdev); |
1197 | } | |
1198 | return result; | |
1199 | } | |
1200 | ||
85091b71 CC |
1201 | static int asus_hotk_check(void) |
1202 | { | |
1203 | int result = 0; | |
1204 | ||
1205 | result = acpi_bus_get_status(hotk->device); | |
1206 | if (result) | |
1207 | return result; | |
1208 | ||
1209 | if (hotk->device->status.present) { | |
1210 | result = asus_hotk_get_info(); | |
1211 | } else { | |
2fcc23da | 1212 | pr_err("Hotkey device not present, aborting\n"); |
85091b71 CC |
1213 | return -EINVAL; |
1214 | } | |
1215 | ||
1216 | return result; | |
1217 | } | |
1218 | ||
1219 | static int asus_hotk_found; | |
1220 | ||
1221 | static int asus_hotk_add(struct acpi_device *device) | |
1222 | { | |
85091b71 CC |
1223 | int result; |
1224 | ||
1225 | if (!device) | |
1226 | return -EINVAL; | |
1227 | ||
2fcc23da | 1228 | pr_notice("Asus Laptop Support version %s\n", |
85091b71 CC |
1229 | ASUS_LAPTOP_VERSION); |
1230 | ||
dd00cc48 | 1231 | hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); |
85091b71 CC |
1232 | if (!hotk) |
1233 | return -ENOMEM; | |
85091b71 CC |
1234 | |
1235 | hotk->handle = device->handle; | |
1236 | strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME); | |
1237 | strcpy(acpi_device_class(device), ASUS_HOTK_CLASS); | |
db89b4f0 | 1238 | device->driver_data = hotk; |
85091b71 CC |
1239 | hotk->device = device; |
1240 | ||
1241 | result = asus_hotk_check(); | |
1242 | if (result) | |
1243 | goto end; | |
1244 | ||
1245 | asus_hotk_add_fs(); | |
1246 | ||
85091b71 CC |
1247 | asus_hotk_found = 1; |
1248 | ||
6b7091e7 | 1249 | /* WLED and BLED are on by default */ |
935ffeec CC |
1250 | write_status(bt_switch_handle, 1, BT_ON); |
1251 | write_status(wl_switch_handle, 1, WL_ON); | |
1252 | ||
1253 | /* If the h/w switch is off, we need to check the real status */ | |
1254 | write_status(NULL, read_status(BT_ON), BT_ON); | |
1255 | write_status(NULL, read_status(WL_ON), WL_ON); | |
4564de17 | 1256 | |
6b7091e7 | 1257 | /* LCD Backlight is on by default */ |
935ffeec | 1258 | write_status(NULL, 1, LCD_ON); |
6b7091e7 | 1259 | |
b7d3fbc2 CC |
1260 | /* Keyboard Backlight is on by default */ |
1261 | if (kled_set_handle) | |
1262 | set_kled_lvl(1); | |
1263 | ||
722ad971 CC |
1264 | /* LED display is off by default */ |
1265 | hotk->ledd_status = 0xFFF; | |
1266 | ||
8def05fa LB |
1267 | /* Set initial values of light sensor and level */ |
1268 | hotk->light_switch = 1; /* Default to light sensor disabled */ | |
1269 | hotk->light_level = 0; /* level 5 for sensor sensitivity */ | |
8b857353 | 1270 | |
8def05fa LB |
1271 | if (ls_switch_handle) |
1272 | set_light_sens_switch(hotk->light_switch); | |
8b857353 | 1273 | |
8def05fa LB |
1274 | if (ls_level_handle) |
1275 | set_light_sens_level(hotk->light_level); | |
8b857353 | 1276 | |
e539c2f6 CC |
1277 | /* GPS is on by default */ |
1278 | write_status(NULL, 1, GPS_ON); | |
1279 | ||
ed6f4421 | 1280 | end: |
85091b71 CC |
1281 | if (result) { |
1282 | kfree(hotk->name); | |
1283 | kfree(hotk); | |
1284 | } | |
1285 | ||
1286 | return result; | |
1287 | } | |
1288 | ||
1289 | static int asus_hotk_remove(struct acpi_device *device, int type) | |
1290 | { | |
85091b71 CC |
1291 | if (!device || !acpi_driver_data(device)) |
1292 | return -EINVAL; | |
1293 | ||
85091b71 CC |
1294 | kfree(hotk->name); |
1295 | kfree(hotk); | |
1296 | ||
1297 | return 0; | |
1298 | } | |
1299 | ||
6b7091e7 CC |
1300 | static void asus_backlight_exit(void) |
1301 | { | |
8def05fa | 1302 | if (asus_backlight_device) |
6b7091e7 CC |
1303 | backlight_device_unregister(asus_backlight_device); |
1304 | } | |
1305 | ||
be18cdab | 1306 | #define ASUS_LED_UNREGISTER(object) \ |
e1996a69 GC |
1307 | if (object##_led.dev) \ |
1308 | led_classdev_unregister(&object##_led) | |
be18cdab CC |
1309 | |
1310 | static void asus_led_exit(void) | |
1311 | { | |
3b0d7117 | 1312 | destroy_workqueue(led_workqueue); |
be18cdab CC |
1313 | ASUS_LED_UNREGISTER(mled); |
1314 | ASUS_LED_UNREGISTER(tled); | |
1315 | ASUS_LED_UNREGISTER(pled); | |
1316 | ASUS_LED_UNREGISTER(rled); | |
fdd8d080 | 1317 | ASUS_LED_UNREGISTER(gled); |
b7d3fbc2 | 1318 | ASUS_LED_UNREGISTER(kled); |
be18cdab CC |
1319 | } |
1320 | ||
034ce90a CC |
1321 | static void asus_input_exit(void) |
1322 | { | |
1323 | if (hotk->inputdev) | |
1324 | input_unregister_device(hotk->inputdev); | |
1325 | } | |
1326 | ||
85091b71 CC |
1327 | static void __exit asus_laptop_exit(void) |
1328 | { | |
6b7091e7 | 1329 | asus_backlight_exit(); |
be18cdab | 1330 | asus_led_exit(); |
034ce90a | 1331 | asus_input_exit(); |
be18cdab | 1332 | |
85091b71 | 1333 | acpi_bus_unregister_driver(&asus_hotk_driver); |
8def05fa LB |
1334 | sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group); |
1335 | platform_device_unregister(asuspf_device); | |
1336 | platform_driver_unregister(&asuspf_driver); | |
85091b71 CC |
1337 | } |
1338 | ||
8def05fa | 1339 | static int asus_backlight_init(struct device *dev) |
6b7091e7 CC |
1340 | { |
1341 | struct backlight_device *bd; | |
1342 | ||
8def05fa LB |
1343 | if (brightness_set_handle && lcd_switch_handle) { |
1344 | bd = backlight_device_register(ASUS_HOTK_FILE, dev, | |
599a52d1 | 1345 | NULL, &asusbl_ops); |
8def05fa | 1346 | if (IS_ERR(bd)) { |
2fcc23da | 1347 | pr_err("Could not register asus backlight device\n"); |
6b7091e7 CC |
1348 | asus_backlight_device = NULL; |
1349 | return PTR_ERR(bd); | |
1350 | } | |
1351 | ||
1352 | asus_backlight_device = bd; | |
1353 | ||
599a52d1 RP |
1354 | bd->props.max_brightness = 15; |
1355 | bd->props.brightness = read_brightness(NULL); | |
1356 | bd->props.power = FB_BLANK_UNBLANK; | |
28ee086d | 1357 | backlight_update_status(bd); |
6b7091e7 CC |
1358 | } |
1359 | return 0; | |
1360 | } | |
1361 | ||
be18cdab | 1362 | static int asus_led_register(acpi_handle handle, |
8def05fa | 1363 | struct led_classdev *ldev, struct device *dev) |
be18cdab | 1364 | { |
8def05fa | 1365 | if (!handle) |
be18cdab CC |
1366 | return 0; |
1367 | ||
1368 | return led_classdev_register(dev, ldev); | |
1369 | } | |
8def05fa | 1370 | |
be18cdab CC |
1371 | #define ASUS_LED_REGISTER(object, device) \ |
1372 | asus_led_register(object##_set_handle, &object##_led, device) | |
1373 | ||
8def05fa | 1374 | static int asus_led_init(struct device *dev) |
be18cdab CC |
1375 | { |
1376 | int rv; | |
1377 | ||
1378 | rv = ASUS_LED_REGISTER(mled, dev); | |
8def05fa | 1379 | if (rv) |
3b0d7117 | 1380 | goto out; |
be18cdab CC |
1381 | |
1382 | rv = ASUS_LED_REGISTER(tled, dev); | |
8def05fa | 1383 | if (rv) |
3b0d7117 | 1384 | goto out1; |
be18cdab CC |
1385 | |
1386 | rv = ASUS_LED_REGISTER(rled, dev); | |
8def05fa | 1387 | if (rv) |
3b0d7117 | 1388 | goto out2; |
be18cdab CC |
1389 | |
1390 | rv = ASUS_LED_REGISTER(pled, dev); | |
8def05fa | 1391 | if (rv) |
3b0d7117 | 1392 | goto out3; |
be18cdab | 1393 | |
fdd8d080 CC |
1394 | rv = ASUS_LED_REGISTER(gled, dev); |
1395 | if (rv) | |
3b0d7117 | 1396 | goto out4; |
fdd8d080 | 1397 | |
b7d3fbc2 CC |
1398 | if (kled_set_handle && kled_get_handle) |
1399 | rv = ASUS_LED_REGISTER(kled, dev); | |
1400 | if (rv) | |
1401 | goto out5; | |
1402 | ||
be18cdab | 1403 | led_workqueue = create_singlethread_workqueue("led_workqueue"); |
8def05fa | 1404 | if (!led_workqueue) |
b7d3fbc2 | 1405 | goto out6; |
be18cdab CC |
1406 | |
1407 | return 0; | |
b7d3fbc2 | 1408 | out6: |
3b0d7117 | 1409 | rv = -ENOMEM; |
b7d3fbc2 CC |
1410 | ASUS_LED_UNREGISTER(kled); |
1411 | out5: | |
3b0d7117 AV |
1412 | ASUS_LED_UNREGISTER(gled); |
1413 | out4: | |
1414 | ASUS_LED_UNREGISTER(pled); | |
1415 | out3: | |
1416 | ASUS_LED_UNREGISTER(rled); | |
1417 | out2: | |
1418 | ASUS_LED_UNREGISTER(tled); | |
1419 | out1: | |
1420 | ASUS_LED_UNREGISTER(mled); | |
1421 | out: | |
1422 | return rv; | |
be18cdab CC |
1423 | } |
1424 | ||
85091b71 CC |
1425 | static int __init asus_laptop_init(void) |
1426 | { | |
1427 | int result; | |
1428 | ||
1429 | if (acpi_disabled) | |
1430 | return -ENODEV; | |
1431 | ||
85091b71 CC |
1432 | result = acpi_bus_register_driver(&asus_hotk_driver); |
1433 | if (result < 0) | |
1434 | return result; | |
1435 | ||
1436 | /* | |
1437 | * This is a bit of a kludge. We only want this module loaded | |
1438 | * for ASUS systems, but there's currently no way to probe the | |
1439 | * ACPI namespace for ASUS HIDs. So we just return failure if | |
1440 | * we didn't find one, which will cause the module to be | |
1441 | * unloaded. | |
1442 | */ | |
1443 | if (!asus_hotk_found) { | |
1444 | acpi_bus_unregister_driver(&asus_hotk_driver); | |
1445 | return -ENODEV; | |
1446 | } | |
1447 | ||
034ce90a CC |
1448 | result = asus_input_init(); |
1449 | if (result) | |
1450 | goto fail_input; | |
1451 | ||
8def05fa | 1452 | /* Register platform stuff */ |
85091b71 | 1453 | result = platform_driver_register(&asuspf_driver); |
8def05fa LB |
1454 | if (result) |
1455 | goto fail_platform_driver; | |
85091b71 | 1456 | |
8def05fa LB |
1457 | asuspf_device = platform_device_alloc(ASUS_HOTK_FILE, -1); |
1458 | if (!asuspf_device) { | |
1459 | result = -ENOMEM; | |
1460 | goto fail_platform_device1; | |
1461 | } | |
85091b71 | 1462 | |
8def05fa LB |
1463 | result = platform_device_add(asuspf_device); |
1464 | if (result) | |
1465 | goto fail_platform_device2; | |
85091b71 | 1466 | |
8def05fa | 1467 | result = sysfs_create_group(&asuspf_device->dev.kobj, |
85091b71 | 1468 | &asuspf_attribute_group); |
8def05fa LB |
1469 | if (result) |
1470 | goto fail_sysfs; | |
85091b71 | 1471 | |
116bf2e0 CC |
1472 | result = asus_led_init(&asuspf_device->dev); |
1473 | if (result) | |
1474 | goto fail_led; | |
1475 | ||
1476 | if (!acpi_video_backlight_support()) { | |
1477 | result = asus_backlight_init(&asuspf_device->dev); | |
1478 | if (result) | |
1479 | goto fail_backlight; | |
1480 | } else | |
2fcc23da | 1481 | pr_info("Brightness ignored, must be controlled by " |
116bf2e0 CC |
1482 | "ACPI video driver\n"); |
1483 | ||
8def05fa | 1484 | return 0; |
85091b71 | 1485 | |
116bf2e0 CC |
1486 | fail_backlight: |
1487 | asus_led_exit(); | |
1488 | ||
1489 | fail_led: | |
1490 | sysfs_remove_group(&asuspf_device->dev.kobj, | |
1491 | &asuspf_attribute_group); | |
1492 | ||
ed6f4421 | 1493 | fail_sysfs: |
8def05fa | 1494 | platform_device_del(asuspf_device); |
85091b71 | 1495 | |
ed6f4421 | 1496 | fail_platform_device2: |
85091b71 CC |
1497 | platform_device_put(asuspf_device); |
1498 | ||
ed6f4421 | 1499 | fail_platform_device1: |
8def05fa | 1500 | platform_driver_unregister(&asuspf_driver); |
85091b71 | 1501 | |
ed6f4421 | 1502 | fail_platform_driver: |
034ce90a CC |
1503 | asus_input_exit(); |
1504 | ||
ed6f4421 | 1505 | fail_input: |
85091b71 CC |
1506 | |
1507 | return result; | |
1508 | } | |
1509 | ||
1510 | module_init(asus_laptop_init); | |
1511 | module_exit(asus_laptop_exit); |