xref: /linux/drivers/platform/x86/asus-nb-wmi.c (revision 547f574fd9d5e3925d47fd44decbf6ab6df94b0e)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Asus Notebooks WMI hotkey driver
4  *
5  * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
6  */
7 
8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9 
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/input.h>
14 #include <linux/input/sparse-keymap.h>
15 #include <linux/fb.h>
16 #include <linux/dmi.h>
17 #include <linux/i8042.h>
18 
19 #include "asus-wmi.h"
20 
21 #define	ASUS_NB_WMI_FILE	"asus-nb-wmi"
22 
23 MODULE_AUTHOR("Corentin Chary <corentin.chary@gmail.com>");
24 MODULE_DESCRIPTION("Asus Notebooks WMI Hotkey Driver");
25 MODULE_LICENSE("GPL");
26 
27 #define ASUS_NB_WMI_EVENT_GUID	"0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C"
28 
29 MODULE_ALIAS("wmi:"ASUS_NB_WMI_EVENT_GUID);
30 
31 /*
32  * WAPF defines the behavior of the Fn+Fx wlan key
33  * The significance of values is yet to be found, but
34  * most of the time:
35  * Bit | Bluetooth | WLAN
36  *  0  | Hardware  | Hardware
37  *  1  | Hardware  | Software
38  *  4  | Software  | Software
39  */
40 static int wapf = -1;
41 module_param(wapf, uint, 0444);
42 MODULE_PARM_DESC(wapf, "WAPF value");
43 
44 static struct quirk_entry *quirks;
45 
46 static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
47 			      struct serio *port)
48 {
49 	static bool extended;
50 	bool ret = false;
51 
52 	if (str & I8042_STR_AUXDATA)
53 		return false;
54 
55 	if (unlikely(data == 0xe1)) {
56 		extended = true;
57 		ret = true;
58 	} else if (unlikely(extended)) {
59 		extended = false;
60 		ret = true;
61 	}
62 
63 	return ret;
64 }
65 
66 static struct quirk_entry quirk_asus_unknown = {
67 	.wapf = 0,
68 	.wmi_backlight_set_devstate = true,
69 };
70 
71 static struct quirk_entry quirk_asus_q500a = {
72 	.i8042_filter = asus_q500a_i8042_filter,
73 	.wmi_backlight_set_devstate = true,
74 };
75 
76 /*
77  * For those machines that need software to control bt/wifi status
78  * and can't adjust brightness through ACPI interface
79  * and have duplicate events(ACPI and WMI) for display toggle
80  */
81 static struct quirk_entry quirk_asus_x55u = {
82 	.wapf = 4,
83 	.wmi_backlight_power = true,
84 	.wmi_backlight_set_devstate = true,
85 	.no_display_toggle = true,
86 };
87 
88 static struct quirk_entry quirk_asus_wapf4 = {
89 	.wapf = 4,
90 	.wmi_backlight_set_devstate = true,
91 };
92 
93 static struct quirk_entry quirk_asus_x200ca = {
94 	.wapf = 2,
95 	.wmi_backlight_set_devstate = true,
96 };
97 
98 static struct quirk_entry quirk_asus_ux303ub = {
99 	.wmi_backlight_native = true,
100 	.wmi_backlight_set_devstate = true,
101 };
102 
103 static struct quirk_entry quirk_asus_x550lb = {
104 	.wmi_backlight_set_devstate = true,
105 	.xusb2pr = 0x01D9,
106 };
107 
108 static struct quirk_entry quirk_asus_forceals = {
109 	.wmi_backlight_set_devstate = true,
110 	.wmi_force_als_set = true,
111 };
112 
113 static struct quirk_entry quirk_asus_vendor_backlight = {
114 	.wmi_backlight_power = true,
115 	.wmi_backlight_set_devstate = true,
116 };
117 
118 static struct quirk_entry quirk_asus_use_kbd_dock_devid = {
119 	.use_kbd_dock_devid = true,
120 };
121 
122 static int dmi_matched(const struct dmi_system_id *dmi)
123 {
124 	pr_info("Identified laptop model '%s'\n", dmi->ident);
125 	quirks = dmi->driver_data;
126 	return 1;
127 }
128 
129 static const struct dmi_system_id asus_quirks[] = {
130 	{
131 		.callback = dmi_matched,
132 		.ident = "ASUSTeK COMPUTER INC. Q500A",
133 		.matches = {
134 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
135 			DMI_MATCH(DMI_PRODUCT_NAME, "Q500A"),
136 		},
137 		.driver_data = &quirk_asus_q500a,
138 	},
139 	{
140 		.callback = dmi_matched,
141 		.ident = "ASUSTeK COMPUTER INC. U32U",
142 		.matches = {
143 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
144 			DMI_MATCH(DMI_PRODUCT_NAME, "U32U"),
145 		},
146 		/*
147 		 * Note this machine has a Brazos APU, and most Brazos Asus
148 		 * machines need quirk_asus_x55u / wmi_backlight_power but
149 		 * here acpi-video seems to work fine for backlight control.
150 		 */
151 		.driver_data = &quirk_asus_wapf4,
152 	},
153 	{
154 		.callback = dmi_matched,
155 		.ident = "ASUSTeK COMPUTER INC. X302UA",
156 		.matches = {
157 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
158 			DMI_MATCH(DMI_PRODUCT_NAME, "X302UA"),
159 		},
160 		.driver_data = &quirk_asus_wapf4,
161 	},
162 	{
163 		.callback = dmi_matched,
164 		.ident = "ASUSTeK COMPUTER INC. X401U",
165 		.matches = {
166 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
167 			DMI_MATCH(DMI_PRODUCT_NAME, "X401U"),
168 		},
169 		.driver_data = &quirk_asus_x55u,
170 	},
171 	{
172 		.callback = dmi_matched,
173 		.ident = "ASUSTeK COMPUTER INC. X401A",
174 		.matches = {
175 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
176 			DMI_MATCH(DMI_PRODUCT_NAME, "X401A"),
177 		},
178 		.driver_data = &quirk_asus_wapf4,
179 	},
180 	{
181 		.callback = dmi_matched,
182 		.ident = "ASUSTeK COMPUTER INC. X401A1",
183 		.matches = {
184 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
185 			DMI_MATCH(DMI_PRODUCT_NAME, "X401A1"),
186 		},
187 		.driver_data = &quirk_asus_wapf4,
188 	},
189 	{
190 		.callback = dmi_matched,
191 		.ident = "ASUSTeK COMPUTER INC. X45U",
192 		.matches = {
193 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
194 			DMI_MATCH(DMI_PRODUCT_NAME, "X45U"),
195 		},
196 		.driver_data = &quirk_asus_wapf4,
197 	},
198 	{
199 		.callback = dmi_matched,
200 		.ident = "ASUSTeK COMPUTER INC. X456UA",
201 		.matches = {
202 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
203 			DMI_MATCH(DMI_PRODUCT_NAME, "X456UA"),
204 		},
205 		.driver_data = &quirk_asus_wapf4,
206 	},
207 	{
208 		.callback = dmi_matched,
209 		.ident = "ASUSTeK COMPUTER INC. X456UF",
210 		.matches = {
211 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
212 			DMI_MATCH(DMI_PRODUCT_NAME, "X456UF"),
213 		},
214 		.driver_data = &quirk_asus_wapf4,
215 	},
216 	{
217 		.callback = dmi_matched,
218 		.ident = "ASUSTeK COMPUTER INC. X501U",
219 		.matches = {
220 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
221 			DMI_MATCH(DMI_PRODUCT_NAME, "X501U"),
222 		},
223 		.driver_data = &quirk_asus_x55u,
224 	},
225 	{
226 		.callback = dmi_matched,
227 		.ident = "ASUSTeK COMPUTER INC. X501A",
228 		.matches = {
229 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
230 			DMI_MATCH(DMI_PRODUCT_NAME, "X501A"),
231 		},
232 		.driver_data = &quirk_asus_wapf4,
233 	},
234 	{
235 		.callback = dmi_matched,
236 		.ident = "ASUSTeK COMPUTER INC. X501A1",
237 		.matches = {
238 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
239 			DMI_MATCH(DMI_PRODUCT_NAME, "X501A1"),
240 		},
241 		.driver_data = &quirk_asus_wapf4,
242 	},
243 	{
244 		.callback = dmi_matched,
245 		.ident = "ASUSTeK COMPUTER INC. X550CA",
246 		.matches = {
247 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
248 			DMI_MATCH(DMI_PRODUCT_NAME, "X550CA"),
249 		},
250 		.driver_data = &quirk_asus_wapf4,
251 	},
252 	{
253 		.callback = dmi_matched,
254 		.ident = "ASUSTeK COMPUTER INC. X550CC",
255 		.matches = {
256 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
257 			DMI_MATCH(DMI_PRODUCT_NAME, "X550CC"),
258 		},
259 		.driver_data = &quirk_asus_wapf4,
260 	},
261 	{
262 		.callback = dmi_matched,
263 		.ident = "ASUSTeK COMPUTER INC. X550CL",
264 		.matches = {
265 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
266 			DMI_MATCH(DMI_PRODUCT_NAME, "X550CL"),
267 		},
268 		.driver_data = &quirk_asus_wapf4,
269 	},
270 	{
271 		.callback = dmi_matched,
272 		.ident = "ASUSTeK COMPUTER INC. X550VB",
273 		.matches = {
274 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
275 			DMI_MATCH(DMI_PRODUCT_NAME, "X550VB"),
276 		},
277 		.driver_data = &quirk_asus_wapf4,
278 	},
279 	{
280 		.callback = dmi_matched,
281 		.ident = "ASUSTeK COMPUTER INC. X551CA",
282 		.matches = {
283 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
284 			DMI_MATCH(DMI_PRODUCT_NAME, "X551CA"),
285 		},
286 		.driver_data = &quirk_asus_wapf4,
287 	},
288 	{
289 		.callback = dmi_matched,
290 		.ident = "ASUSTeK COMPUTER INC. X55A",
291 		.matches = {
292 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
293 			DMI_MATCH(DMI_PRODUCT_NAME, "X55A"),
294 		},
295 		.driver_data = &quirk_asus_wapf4,
296 	},
297 	{
298 		.callback = dmi_matched,
299 		.ident = "ASUSTeK COMPUTER INC. X55C",
300 		.matches = {
301 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
302 			DMI_MATCH(DMI_PRODUCT_NAME, "X55C"),
303 		},
304 		.driver_data = &quirk_asus_wapf4,
305 	},
306 	{
307 		.callback = dmi_matched,
308 		.ident = "ASUSTeK COMPUTER INC. X55U",
309 		.matches = {
310 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
311 			DMI_MATCH(DMI_PRODUCT_NAME, "X55U"),
312 		},
313 		.driver_data = &quirk_asus_x55u,
314 	},
315 	{
316 		.callback = dmi_matched,
317 		.ident = "ASUSTeK COMPUTER INC. X55VD",
318 		.matches = {
319 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
320 			DMI_MATCH(DMI_PRODUCT_NAME, "X55VD"),
321 		},
322 		.driver_data = &quirk_asus_wapf4,
323 	},
324 	{
325 		.callback = dmi_matched,
326 		.ident = "ASUSTeK COMPUTER INC. X75A",
327 		.matches = {
328 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
329 			DMI_MATCH(DMI_PRODUCT_NAME, "X75A"),
330 		},
331 		.driver_data = &quirk_asus_wapf4,
332 	},
333 	{
334 		.callback = dmi_matched,
335 		.ident = "ASUSTeK COMPUTER INC. X75VBP",
336 		.matches = {
337 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
338 			DMI_MATCH(DMI_PRODUCT_NAME, "X75VBP"),
339 		},
340 		.driver_data = &quirk_asus_wapf4,
341 	},
342 	{
343 		.callback = dmi_matched,
344 		.ident = "ASUSTeK COMPUTER INC. X75VD",
345 		.matches = {
346 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
347 			DMI_MATCH(DMI_PRODUCT_NAME, "X75VD"),
348 		},
349 		.driver_data = &quirk_asus_wapf4,
350 	},
351 	{
352 		.callback = dmi_matched,
353 		.ident = "ASUSTeK COMPUTER INC. 1015E",
354 		.matches = {
355 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
356 			DMI_MATCH(DMI_PRODUCT_NAME, "1015E"),
357 		},
358 		.driver_data = &quirk_asus_wapf4,
359 	},
360 	{
361 		.callback = dmi_matched,
362 		.ident = "ASUSTeK COMPUTER INC. 1015U",
363 		.matches = {
364 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
365 			DMI_MATCH(DMI_PRODUCT_NAME, "1015U"),
366 		},
367 		.driver_data = &quirk_asus_wapf4,
368 	},
369 	{
370 		.callback = dmi_matched,
371 		.ident = "ASUSTeK COMPUTER INC. X200CA",
372 		.matches = {
373 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
374 			DMI_MATCH(DMI_PRODUCT_NAME, "X200CA"),
375 		},
376 		.driver_data = &quirk_asus_x200ca,
377 	},
378 	{
379 		.callback = dmi_matched,
380 		.ident = "ASUSTeK COMPUTER INC. UX303UB",
381 		.matches = {
382 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
383 			DMI_MATCH(DMI_PRODUCT_NAME, "UX303UB"),
384 		},
385 		.driver_data = &quirk_asus_ux303ub,
386 	},
387 	{
388 		.callback = dmi_matched,
389 		.ident = "ASUSTeK COMPUTER INC. UX330UAK",
390 		.matches = {
391 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
392 			DMI_MATCH(DMI_PRODUCT_NAME, "UX330UAK"),
393 		},
394 		.driver_data = &quirk_asus_forceals,
395 	},
396 	{
397 		.callback = dmi_matched,
398 		.ident = "ASUSTeK COMPUTER INC. X550LB",
399 		.matches = {
400 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
401 			DMI_MATCH(DMI_PRODUCT_NAME, "X550LB"),
402 		},
403 		.driver_data = &quirk_asus_x550lb,
404 	},
405 	{
406 		.callback = dmi_matched,
407 		.ident = "ASUSTeK COMPUTER INC. UX430UQ",
408 		.matches = {
409 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
410 			DMI_MATCH(DMI_PRODUCT_NAME, "UX430UQ"),
411 		},
412 		.driver_data = &quirk_asus_forceals,
413 	},
414 	{
415 		.callback = dmi_matched,
416 		.ident = "ASUSTeK COMPUTER INC. UX430UNR",
417 		.matches = {
418 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
419 			DMI_MATCH(DMI_PRODUCT_NAME, "UX430UNR"),
420 		},
421 		.driver_data = &quirk_asus_forceals,
422 	},
423 	{
424 		.callback = dmi_matched,
425 		.ident = "ASUSTeK COMPUTER INC. GA401IH",
426 		.matches = {
427 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
428 			DMI_MATCH(DMI_PRODUCT_NAME, "GA401IH"),
429 		},
430 		.driver_data = &quirk_asus_vendor_backlight,
431 	},
432 	{
433 		.callback = dmi_matched,
434 		.ident = "ASUSTeK COMPUTER INC. GA401II",
435 		.matches = {
436 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
437 			DMI_MATCH(DMI_PRODUCT_NAME, "GA401II"),
438 		},
439 		.driver_data = &quirk_asus_vendor_backlight,
440 	},
441 	{
442 		.callback = dmi_matched,
443 		.ident = "ASUSTeK COMPUTER INC. GA401IU",
444 		.matches = {
445 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
446 			DMI_MATCH(DMI_PRODUCT_NAME, "GA401IU"),
447 		},
448 		.driver_data = &quirk_asus_vendor_backlight,
449 	},
450 	{
451 		.callback = dmi_matched,
452 		.ident = "ASUSTeK COMPUTER INC. GA401IV",
453 		.matches = {
454 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
455 			DMI_MATCH(DMI_PRODUCT_NAME, "GA401IV"),
456 		},
457 		.driver_data = &quirk_asus_vendor_backlight,
458 	},
459 	{
460 		.callback = dmi_matched,
461 		.ident = "ASUSTeK COMPUTER INC. GA401IVC",
462 		.matches = {
463 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
464 			DMI_MATCH(DMI_PRODUCT_NAME, "GA401IVC"),
465 		},
466 		.driver_data = &quirk_asus_vendor_backlight,
467 	},
468 		{
469 		.callback = dmi_matched,
470 		.ident = "ASUSTeK COMPUTER INC. GA502II",
471 		.matches = {
472 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
473 			DMI_MATCH(DMI_PRODUCT_NAME, "GA502II"),
474 		},
475 		.driver_data = &quirk_asus_vendor_backlight,
476 	},
477 	{
478 		.callback = dmi_matched,
479 		.ident = "ASUSTeK COMPUTER INC. GA502IU",
480 		.matches = {
481 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
482 			DMI_MATCH(DMI_PRODUCT_NAME, "GA502IU"),
483 		},
484 		.driver_data = &quirk_asus_vendor_backlight,
485 	},
486 	{
487 		.callback = dmi_matched,
488 		.ident = "ASUSTeK COMPUTER INC. GA502IV",
489 		.matches = {
490 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
491 			DMI_MATCH(DMI_PRODUCT_NAME, "GA502IV"),
492 		},
493 		.driver_data = &quirk_asus_vendor_backlight,
494 	},
495 	{
496 		.callback = dmi_matched,
497 		.ident = "Asus Transformer T100TA / T100HA / T100CHI",
498 		.matches = {
499 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
500 			/* Match *T100* */
501 			DMI_MATCH(DMI_PRODUCT_NAME, "T100"),
502 		},
503 		.driver_data = &quirk_asus_use_kbd_dock_devid,
504 	},
505 	{
506 		.callback = dmi_matched,
507 		.ident = "Asus Transformer T101HA",
508 		.matches = {
509 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
510 			DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"),
511 		},
512 		.driver_data = &quirk_asus_use_kbd_dock_devid,
513 	},
514 	{
515 		.callback = dmi_matched,
516 		.ident = "Asus Transformer T200TA",
517 		.matches = {
518 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
519 			DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
520 		},
521 		.driver_data = &quirk_asus_use_kbd_dock_devid,
522 	},
523 	{},
524 };
525 
526 static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
527 {
528 	int ret;
529 
530 	quirks = &quirk_asus_unknown;
531 	dmi_check_system(asus_quirks);
532 
533 	driver->quirks = quirks;
534 	driver->panel_power = FB_BLANK_UNBLANK;
535 
536 	/* overwrite the wapf setting if the wapf paramater is specified */
537 	if (wapf != -1)
538 		quirks->wapf = wapf;
539 	else
540 		wapf = quirks->wapf;
541 
542 	if (quirks->i8042_filter) {
543 		ret = i8042_install_filter(quirks->i8042_filter);
544 		if (ret) {
545 			pr_warn("Unable to install key filter\n");
546 			return;
547 		}
548 		pr_info("Using i8042 filter function for receiving events\n");
549 	}
550 }
551 
552 static const struct key_entry asus_nb_wmi_keymap[] = {
553 	{ KE_KEY, ASUS_WMI_BRN_DOWN, { KEY_BRIGHTNESSDOWN } },
554 	{ KE_KEY, ASUS_WMI_BRN_UP, { KEY_BRIGHTNESSUP } },
555 	{ KE_KEY, 0x30, { KEY_VOLUMEUP } },
556 	{ KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
557 	{ KE_KEY, 0x32, { KEY_MUTE } },
558 	{ KE_KEY, 0x35, { KEY_SCREENLOCK } },
559 	{ KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
560 	{ KE_KEY, 0x41, { KEY_NEXTSONG } },
561 	{ KE_KEY, 0x43, { KEY_STOPCD } }, /* Stop/Eject */
562 	{ KE_KEY, 0x45, { KEY_PLAYPAUSE } },
563 	{ KE_KEY, 0x4c, { KEY_MEDIA } }, /* WMP Key */
564 	{ KE_KEY, 0x50, { KEY_EMAIL } },
565 	{ KE_KEY, 0x51, { KEY_WWW } },
566 	{ KE_KEY, 0x55, { KEY_CALC } },
567 	{ KE_IGNORE, 0x57, },  /* Battery mode */
568 	{ KE_IGNORE, 0x58, },  /* AC mode */
569 	{ KE_KEY, 0x5C, { KEY_F15 } },  /* Power Gear key */
570 	{ KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */
571 	{ KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */
572 	{ KE_KEY, 0x5F, { KEY_WLAN } }, /* Wireless console Disable */
573 	{ KE_KEY, 0x60, { KEY_TOUCHPAD_ON } },
574 	{ KE_KEY, 0x61, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD only */
575 	{ KE_KEY, 0x62, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT only */
576 	{ KE_KEY, 0x63, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT */
577 	{ KE_KEY, 0x64, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV */
578 	{ KE_KEY, 0x65, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV */
579 	{ KE_KEY, 0x66, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV */
580 	{ KE_KEY, 0x67, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV */
581 	{ KE_KEY, 0x6B, { KEY_TOUCHPAD_TOGGLE } },
582 	{ KE_IGNORE, 0x6E, },  /* Low Battery notification */
583 	{ KE_KEY, 0x71, { KEY_F13 } }, /* General-purpose button */
584 	{ KE_IGNORE, 0x79, },  /* Charger type dectection notification */
585 	{ KE_KEY, 0x7a, { KEY_ALS_TOGGLE } }, /* Ambient Light Sensor Toggle */
586 	{ KE_KEY, 0x7c, { KEY_MICMUTE } },
587 	{ KE_KEY, 0x7D, { KEY_BLUETOOTH } }, /* Bluetooth Enable */
588 	{ KE_KEY, 0x7E, { KEY_BLUETOOTH } }, /* Bluetooth Disable */
589 	{ KE_KEY, 0x82, { KEY_CAMERA } },
590 	{ KE_KEY, 0x88, { KEY_RFKILL  } }, /* Radio Toggle Key */
591 	{ KE_KEY, 0x8A, { KEY_PROG1 } }, /* Color enhancement mode */
592 	{ KE_KEY, 0x8C, { KEY_SWITCHVIDEOMODE } }, /* SDSP DVI only */
593 	{ KE_KEY, 0x8D, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + DVI */
594 	{ KE_KEY, 0x8E, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + DVI */
595 	{ KE_KEY, 0x8F, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + DVI */
596 	{ KE_KEY, 0x90, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + DVI */
597 	{ KE_KEY, 0x91, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + DVI */
598 	{ KE_KEY, 0x92, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + DVI */
599 	{ KE_KEY, 0x93, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + DVI */
600 	{ KE_KEY, 0x95, { KEY_MEDIA } },
601 	{ KE_KEY, 0x99, { KEY_PHONE } }, /* Conflicts with fan mode switch */
602 	{ KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
603 	{ KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
604 	{ KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
605 	{ KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */
606 	{ KE_KEY, 0xA4, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + HDMI */
607 	{ KE_KEY, 0xA5, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + HDMI */
608 	{ KE_KEY, 0xA6, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + HDMI */
609 	{ KE_KEY, 0xA7, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + HDMI */
610 	{ KE_KEY, 0xB5, { KEY_CALC } },
611 	{ KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
612 	{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
613 	{ KE_IGNORE, 0xC6, },  /* Ambient Light Sensor notification */
614 	{ KE_KEY, 0xFA, { KEY_PROG2 } },           /* Lid flip action */
615 	{ KE_END, 0},
616 };
617 
618 static struct asus_wmi_driver asus_nb_wmi_driver = {
619 	.name = ASUS_NB_WMI_FILE,
620 	.owner = THIS_MODULE,
621 	.event_guid = ASUS_NB_WMI_EVENT_GUID,
622 	.keymap = asus_nb_wmi_keymap,
623 	.input_name = "Asus WMI hotkeys",
624 	.input_phys = ASUS_NB_WMI_FILE "/input0",
625 	.detect_quirks = asus_nb_wmi_quirks,
626 };
627 
628 
629 static int __init asus_nb_wmi_init(void)
630 {
631 	return asus_wmi_register_driver(&asus_nb_wmi_driver);
632 }
633 
634 static void __exit asus_nb_wmi_exit(void)
635 {
636 	asus_wmi_unregister_driver(&asus_nb_wmi_driver);
637 }
638 
639 module_init(asus_nb_wmi_init);
640 module_exit(asus_nb_wmi_exit);
641