xref: /linux/drivers/platform/x86/asus-nb-wmi.c (revision 31354121bf03dac6498a4236928a38490745d601)
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 int tablet_mode_sw = -1;
45 module_param(tablet_mode_sw, uint, 0444);
46 MODULE_PARM_DESC(tablet_mode_sw, "Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip 3:lid-flip-rog");
47 
48 static struct quirk_entry *quirks;
49 
50 static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
51 			      struct serio *port)
52 {
53 	static bool extended;
54 	bool ret = false;
55 
56 	if (str & I8042_STR_AUXDATA)
57 		return false;
58 
59 	if (unlikely(data == 0xe1)) {
60 		extended = true;
61 		ret = true;
62 	} else if (unlikely(extended)) {
63 		extended = false;
64 		ret = true;
65 	}
66 
67 	return ret;
68 }
69 
70 static struct quirk_entry quirk_asus_unknown = {
71 	.wapf = 0,
72 	.wmi_backlight_set_devstate = true,
73 };
74 
75 static struct quirk_entry quirk_asus_q500a = {
76 	.i8042_filter = asus_q500a_i8042_filter,
77 	.wmi_backlight_set_devstate = true,
78 };
79 
80 /*
81  * For those machines that need software to control bt/wifi status
82  * and have duplicate events(ACPI and WMI) for display toggle
83  */
84 static struct quirk_entry quirk_asus_x55u = {
85 	.wapf = 4,
86 	.wmi_backlight_set_devstate = true,
87 	.no_display_toggle = true,
88 };
89 
90 static struct quirk_entry quirk_asus_wapf4 = {
91 	.wapf = 4,
92 	.wmi_backlight_set_devstate = true,
93 };
94 
95 static struct quirk_entry quirk_asus_x200ca = {
96 	.wapf = 2,
97 	.wmi_backlight_set_devstate = true,
98 };
99 
100 static struct quirk_entry quirk_asus_x550lb = {
101 	.wmi_backlight_set_devstate = true,
102 	.xusb2pr = 0x01D9,
103 };
104 
105 static struct quirk_entry quirk_asus_forceals = {
106 	.wmi_backlight_set_devstate = true,
107 	.wmi_force_als_set = true,
108 };
109 
110 static struct quirk_entry quirk_asus_use_kbd_dock_devid = {
111 	.tablet_switch_mode = asus_wmi_kbd_dock_devid,
112 };
113 
114 static struct quirk_entry quirk_asus_use_lid_flip_devid = {
115 	.wmi_backlight_set_devstate = true,
116 	.tablet_switch_mode = asus_wmi_lid_flip_devid,
117 };
118 
119 static struct quirk_entry quirk_asus_tablet_mode = {
120 	.wmi_backlight_set_devstate = true,
121 	.tablet_switch_mode = asus_wmi_lid_flip_rog_devid,
122 };
123 
124 static int dmi_matched(const struct dmi_system_id *dmi)
125 {
126 	pr_info("Identified laptop model '%s'\n", dmi->ident);
127 	quirks = dmi->driver_data;
128 	return 1;
129 }
130 
131 static const struct dmi_system_id asus_quirks[] = {
132 	{
133 		.callback = dmi_matched,
134 		.ident = "ASUSTeK COMPUTER INC. Q500A",
135 		.matches = {
136 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
137 			DMI_MATCH(DMI_PRODUCT_NAME, "Q500A"),
138 		},
139 		.driver_data = &quirk_asus_q500a,
140 	},
141 	{
142 		.callback = dmi_matched,
143 		.ident = "ASUSTeK COMPUTER INC. U32U",
144 		.matches = {
145 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
146 			DMI_MATCH(DMI_PRODUCT_NAME, "U32U"),
147 		},
148 		.driver_data = &quirk_asus_wapf4,
149 	},
150 	{
151 		.callback = dmi_matched,
152 		.ident = "ASUSTeK COMPUTER INC. X302UA",
153 		.matches = {
154 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
155 			DMI_MATCH(DMI_PRODUCT_NAME, "X302UA"),
156 		},
157 		.driver_data = &quirk_asus_wapf4,
158 	},
159 	{
160 		.callback = dmi_matched,
161 		.ident = "ASUSTeK COMPUTER INC. X401U",
162 		.matches = {
163 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
164 			DMI_MATCH(DMI_PRODUCT_NAME, "X401U"),
165 		},
166 		.driver_data = &quirk_asus_x55u,
167 	},
168 	{
169 		.callback = dmi_matched,
170 		.ident = "ASUSTeK COMPUTER INC. X401A",
171 		.matches = {
172 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
173 			DMI_MATCH(DMI_PRODUCT_NAME, "X401A"),
174 		},
175 		.driver_data = &quirk_asus_wapf4,
176 	},
177 	{
178 		.callback = dmi_matched,
179 		.ident = "ASUSTeK COMPUTER INC. X401A1",
180 		.matches = {
181 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
182 			DMI_MATCH(DMI_PRODUCT_NAME, "X401A1"),
183 		},
184 		.driver_data = &quirk_asus_wapf4,
185 	},
186 	{
187 		.callback = dmi_matched,
188 		.ident = "ASUSTeK COMPUTER INC. X45U",
189 		.matches = {
190 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
191 			DMI_MATCH(DMI_PRODUCT_NAME, "X45U"),
192 		},
193 		.driver_data = &quirk_asus_wapf4,
194 	},
195 	{
196 		.callback = dmi_matched,
197 		.ident = "ASUSTeK COMPUTER INC. X456UA",
198 		.matches = {
199 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
200 			DMI_MATCH(DMI_PRODUCT_NAME, "X456UA"),
201 		},
202 		.driver_data = &quirk_asus_wapf4,
203 	},
204 	{
205 		.callback = dmi_matched,
206 		.ident = "ASUSTeK COMPUTER INC. X456UF",
207 		.matches = {
208 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
209 			DMI_MATCH(DMI_PRODUCT_NAME, "X456UF"),
210 		},
211 		.driver_data = &quirk_asus_wapf4,
212 	},
213 	{
214 		.callback = dmi_matched,
215 		.ident = "ASUSTeK COMPUTER INC. X501U",
216 		.matches = {
217 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
218 			DMI_MATCH(DMI_PRODUCT_NAME, "X501U"),
219 		},
220 		.driver_data = &quirk_asus_x55u,
221 	},
222 	{
223 		.callback = dmi_matched,
224 		.ident = "ASUSTeK COMPUTER INC. X501A",
225 		.matches = {
226 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
227 			DMI_MATCH(DMI_PRODUCT_NAME, "X501A"),
228 		},
229 		.driver_data = &quirk_asus_wapf4,
230 	},
231 	{
232 		.callback = dmi_matched,
233 		.ident = "ASUSTeK COMPUTER INC. X501A1",
234 		.matches = {
235 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
236 			DMI_MATCH(DMI_PRODUCT_NAME, "X501A1"),
237 		},
238 		.driver_data = &quirk_asus_wapf4,
239 	},
240 	{
241 		.callback = dmi_matched,
242 		.ident = "ASUSTeK COMPUTER INC. X550CA",
243 		.matches = {
244 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
245 			DMI_MATCH(DMI_PRODUCT_NAME, "X550CA"),
246 		},
247 		.driver_data = &quirk_asus_wapf4,
248 	},
249 	{
250 		.callback = dmi_matched,
251 		.ident = "ASUSTeK COMPUTER INC. X550CC",
252 		.matches = {
253 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
254 			DMI_MATCH(DMI_PRODUCT_NAME, "X550CC"),
255 		},
256 		.driver_data = &quirk_asus_wapf4,
257 	},
258 	{
259 		.callback = dmi_matched,
260 		.ident = "ASUSTeK COMPUTER INC. X550CL",
261 		.matches = {
262 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
263 			DMI_MATCH(DMI_PRODUCT_NAME, "X550CL"),
264 		},
265 		.driver_data = &quirk_asus_wapf4,
266 	},
267 	{
268 		.callback = dmi_matched,
269 		.ident = "ASUSTeK COMPUTER INC. X550VB",
270 		.matches = {
271 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
272 			DMI_MATCH(DMI_PRODUCT_NAME, "X550VB"),
273 		},
274 		.driver_data = &quirk_asus_wapf4,
275 	},
276 	{
277 		.callback = dmi_matched,
278 		.ident = "ASUSTeK COMPUTER INC. X551CA",
279 		.matches = {
280 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
281 			DMI_MATCH(DMI_PRODUCT_NAME, "X551CA"),
282 		},
283 		.driver_data = &quirk_asus_wapf4,
284 	},
285 	{
286 		.callback = dmi_matched,
287 		.ident = "ASUSTeK COMPUTER INC. X55A",
288 		.matches = {
289 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
290 			DMI_MATCH(DMI_PRODUCT_NAME, "X55A"),
291 		},
292 		.driver_data = &quirk_asus_wapf4,
293 	},
294 	{
295 		.callback = dmi_matched,
296 		.ident = "ASUSTeK COMPUTER INC. X55C",
297 		.matches = {
298 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
299 			DMI_MATCH(DMI_PRODUCT_NAME, "X55C"),
300 		},
301 		.driver_data = &quirk_asus_wapf4,
302 	},
303 	{
304 		.callback = dmi_matched,
305 		.ident = "ASUSTeK COMPUTER INC. X55U",
306 		.matches = {
307 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
308 			DMI_MATCH(DMI_PRODUCT_NAME, "X55U"),
309 		},
310 		.driver_data = &quirk_asus_x55u,
311 	},
312 	{
313 		.callback = dmi_matched,
314 		.ident = "ASUSTeK COMPUTER INC. X55VD",
315 		.matches = {
316 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
317 			DMI_MATCH(DMI_PRODUCT_NAME, "X55VD"),
318 		},
319 		.driver_data = &quirk_asus_wapf4,
320 	},
321 	{
322 		.callback = dmi_matched,
323 		.ident = "ASUSTeK COMPUTER INC. X75A",
324 		.matches = {
325 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
326 			DMI_MATCH(DMI_PRODUCT_NAME, "X75A"),
327 		},
328 		.driver_data = &quirk_asus_wapf4,
329 	},
330 	{
331 		.callback = dmi_matched,
332 		.ident = "ASUSTeK COMPUTER INC. X75VBP",
333 		.matches = {
334 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
335 			DMI_MATCH(DMI_PRODUCT_NAME, "X75VBP"),
336 		},
337 		.driver_data = &quirk_asus_wapf4,
338 	},
339 	{
340 		.callback = dmi_matched,
341 		.ident = "ASUSTeK COMPUTER INC. X75VD",
342 		.matches = {
343 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
344 			DMI_MATCH(DMI_PRODUCT_NAME, "X75VD"),
345 		},
346 		.driver_data = &quirk_asus_wapf4,
347 	},
348 	{
349 		.callback = dmi_matched,
350 		.ident = "ASUSTeK COMPUTER INC. 1015E",
351 		.matches = {
352 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
353 			DMI_MATCH(DMI_PRODUCT_NAME, "1015E"),
354 		},
355 		.driver_data = &quirk_asus_wapf4,
356 	},
357 	{
358 		.callback = dmi_matched,
359 		.ident = "ASUSTeK COMPUTER INC. 1015U",
360 		.matches = {
361 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
362 			DMI_MATCH(DMI_PRODUCT_NAME, "1015U"),
363 		},
364 		.driver_data = &quirk_asus_wapf4,
365 	},
366 	{
367 		.callback = dmi_matched,
368 		.ident = "ASUSTeK COMPUTER INC. X200CA",
369 		.matches = {
370 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
371 			DMI_MATCH(DMI_PRODUCT_NAME, "X200CA"),
372 		},
373 		.driver_data = &quirk_asus_x200ca,
374 	},
375 	{
376 		.callback = dmi_matched,
377 		.ident = "ASUSTeK COMPUTER INC. UX330UAK",
378 		.matches = {
379 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
380 			DMI_MATCH(DMI_PRODUCT_NAME, "UX330UAK"),
381 		},
382 		.driver_data = &quirk_asus_forceals,
383 	},
384 	{
385 		.callback = dmi_matched,
386 		.ident = "ASUSTeK COMPUTER INC. X550LB",
387 		.matches = {
388 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
389 			DMI_MATCH(DMI_PRODUCT_NAME, "X550LB"),
390 		},
391 		.driver_data = &quirk_asus_x550lb,
392 	},
393 	{
394 		.callback = dmi_matched,
395 		.ident = "ASUSTeK COMPUTER INC. UX430UQ",
396 		.matches = {
397 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
398 			DMI_MATCH(DMI_PRODUCT_NAME, "UX430UQ"),
399 		},
400 		.driver_data = &quirk_asus_forceals,
401 	},
402 	{
403 		.callback = dmi_matched,
404 		.ident = "ASUSTeK COMPUTER INC. UX430UNR",
405 		.matches = {
406 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
407 			DMI_MATCH(DMI_PRODUCT_NAME, "UX430UNR"),
408 		},
409 		.driver_data = &quirk_asus_forceals,
410 	},
411 	{
412 		.callback = dmi_matched,
413 		.ident = "Asus Transformer T100TA / T100HA / T100CHI",
414 		.matches = {
415 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
416 			/* Match *T100* */
417 			DMI_MATCH(DMI_PRODUCT_NAME, "T100"),
418 		},
419 		.driver_data = &quirk_asus_use_kbd_dock_devid,
420 	},
421 	{
422 		.callback = dmi_matched,
423 		.ident = "Asus Transformer T101HA",
424 		.matches = {
425 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
426 			DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"),
427 		},
428 		.driver_data = &quirk_asus_use_kbd_dock_devid,
429 	},
430 	{
431 		.callback = dmi_matched,
432 		.ident = "Asus Transformer T200TA",
433 		.matches = {
434 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
435 			DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
436 		},
437 		.driver_data = &quirk_asus_use_kbd_dock_devid,
438 	},
439 	{
440 		.callback = dmi_matched,
441 		.ident = "ASUS ZenBook Flip UX360",
442 		.matches = {
443 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
444 			/* Match UX360* */
445 			DMI_MATCH(DMI_PRODUCT_NAME, "UX360"),
446 		},
447 		.driver_data = &quirk_asus_use_lid_flip_devid,
448 	},
449 	{
450 		.callback = dmi_matched,
451 		.ident = "ASUS TP200s / E205SA",
452 		.matches = {
453 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
454 			DMI_MATCH(DMI_PRODUCT_NAME, "E205SA"),
455 		},
456 		.driver_data = &quirk_asus_use_lid_flip_devid,
457 	},
458 	{
459 		.callback = dmi_matched,
460 		.ident = "ASUS ROG FLOW X13",
461 		.matches = {
462 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
463 			DMI_MATCH(DMI_PRODUCT_NAME, "GV301Q"),
464 		},
465 		.driver_data = &quirk_asus_tablet_mode,
466 	},
467 	{},
468 };
469 
470 static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
471 {
472 	int ret;
473 
474 	quirks = &quirk_asus_unknown;
475 	dmi_check_system(asus_quirks);
476 
477 	driver->quirks = quirks;
478 	driver->panel_power = FB_BLANK_UNBLANK;
479 
480 	/* overwrite the wapf setting if the wapf paramater is specified */
481 	if (wapf != -1)
482 		quirks->wapf = wapf;
483 	else
484 		wapf = quirks->wapf;
485 
486 	if (tablet_mode_sw != -1)
487 		quirks->tablet_switch_mode = tablet_mode_sw;
488 
489 	if (quirks->i8042_filter) {
490 		ret = i8042_install_filter(quirks->i8042_filter);
491 		if (ret) {
492 			pr_warn("Unable to install key filter\n");
493 			return;
494 		}
495 		pr_info("Using i8042 filter function for receiving events\n");
496 	}
497 }
498 
499 static const struct key_entry asus_nb_wmi_keymap[] = {
500 	{ KE_KEY, ASUS_WMI_BRN_DOWN, { KEY_BRIGHTNESSDOWN } },
501 	{ KE_KEY, ASUS_WMI_BRN_UP, { KEY_BRIGHTNESSUP } },
502 	{ KE_KEY, 0x30, { KEY_VOLUMEUP } },
503 	{ KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
504 	{ KE_KEY, 0x32, { KEY_MUTE } },
505 	{ KE_KEY, 0x35, { KEY_SCREENLOCK } },
506 	{ KE_KEY, 0x38, { KEY_PROG3 } }, /* Armoury Crate */
507 	{ KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
508 	{ KE_KEY, 0x41, { KEY_NEXTSONG } },
509 	{ KE_KEY, 0x43, { KEY_STOPCD } }, /* Stop/Eject */
510 	{ KE_KEY, 0x45, { KEY_PLAYPAUSE } },
511 	{ KE_KEY, 0x4c, { KEY_MEDIA } }, /* WMP Key */
512 	{ KE_KEY, 0x50, { KEY_EMAIL } },
513 	{ KE_KEY, 0x51, { KEY_WWW } },
514 	{ KE_KEY, 0x55, { KEY_CALC } },
515 	{ KE_IGNORE, 0x57, },  /* Battery mode */
516 	{ KE_IGNORE, 0x58, },  /* AC mode */
517 	{ KE_KEY, 0x5C, { KEY_F15 } },  /* Power Gear key */
518 	{ KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */
519 	{ KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */
520 	{ KE_KEY, 0x5F, { KEY_WLAN } }, /* Wireless console Disable */
521 	{ KE_KEY, 0x60, { KEY_TOUCHPAD_ON } },
522 	{ KE_KEY, 0x61, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD only */
523 	{ KE_KEY, 0x62, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT only */
524 	{ KE_KEY, 0x63, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT */
525 	{ KE_KEY, 0x64, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV */
526 	{ KE_KEY, 0x65, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV */
527 	{ KE_KEY, 0x66, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV */
528 	{ KE_KEY, 0x67, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV */
529 	{ KE_KEY, 0x6B, { KEY_TOUCHPAD_TOGGLE } },
530 	{ KE_IGNORE, 0x6E, },  /* Low Battery notification */
531 	{ KE_KEY, 0x71, { KEY_F13 } }, /* General-purpose button */
532 	{ KE_IGNORE, 0x79, },  /* Charger type dectection notification */
533 	{ KE_KEY, 0x7a, { KEY_ALS_TOGGLE } }, /* Ambient Light Sensor Toggle */
534 	{ KE_KEY, 0x7c, { KEY_MICMUTE } },
535 	{ KE_KEY, 0x7D, { KEY_BLUETOOTH } }, /* Bluetooth Enable */
536 	{ KE_KEY, 0x7E, { KEY_BLUETOOTH } }, /* Bluetooth Disable */
537 	{ KE_KEY, 0x82, { KEY_CAMERA } },
538 	{ KE_KEY, 0x86, { KEY_PROG1 } }, /* MyASUS Key */
539 	{ KE_KEY, 0x88, { KEY_RFKILL  } }, /* Radio Toggle Key */
540 	{ KE_KEY, 0x8A, { KEY_PROG1 } }, /* Color enhancement mode */
541 	{ KE_KEY, 0x8C, { KEY_SWITCHVIDEOMODE } }, /* SDSP DVI only */
542 	{ KE_KEY, 0x8D, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + DVI */
543 	{ KE_KEY, 0x8E, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + DVI */
544 	{ KE_KEY, 0x8F, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + DVI */
545 	{ KE_KEY, 0x90, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + DVI */
546 	{ KE_KEY, 0x91, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + DVI */
547 	{ KE_KEY, 0x92, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + DVI */
548 	{ KE_KEY, 0x93, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + DVI */
549 	{ KE_KEY, 0x95, { KEY_MEDIA } },
550 	{ KE_KEY, 0x99, { KEY_PHONE } }, /* Conflicts with fan mode switch */
551 	{ KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
552 	{ KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
553 	{ KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
554 	{ KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */
555 	{ KE_KEY, 0xA4, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + HDMI */
556 	{ KE_KEY, 0xA5, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + HDMI */
557 	{ KE_KEY, 0xA6, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + HDMI */
558 	{ KE_KEY, 0xA7, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + HDMI */
559 	{ KE_KEY, 0xAE, { KEY_FN_F5 } }, /* Fn+F5 fan mode on 2020+ */
560 	{ KE_KEY, 0xB3, { KEY_PROG4 } }, /* AURA */
561 	{ KE_KEY, 0xB5, { KEY_CALC } },
562 	{ KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
563 	{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
564 	{ KE_IGNORE, 0xC6, },  /* Ambient Light Sensor notification */
565 	{ KE_KEY, 0xFA, { KEY_PROG2 } },           /* Lid flip action */
566 	{ KE_KEY, 0xBD, { KEY_PROG2 } },           /* Lid flip action on ROG xflow laptops */
567 	{ KE_END, 0},
568 };
569 
570 static struct asus_wmi_driver asus_nb_wmi_driver = {
571 	.name = ASUS_NB_WMI_FILE,
572 	.owner = THIS_MODULE,
573 	.event_guid = ASUS_NB_WMI_EVENT_GUID,
574 	.keymap = asus_nb_wmi_keymap,
575 	.input_name = "Asus WMI hotkeys",
576 	.input_phys = ASUS_NB_WMI_FILE "/input0",
577 	.detect_quirks = asus_nb_wmi_quirks,
578 };
579 
580 
581 static int __init asus_nb_wmi_init(void)
582 {
583 	return asus_wmi_register_driver(&asus_nb_wmi_driver);
584 }
585 
586 static void __exit asus_nb_wmi_exit(void)
587 {
588 	asus_wmi_unregister_driver(&asus_nb_wmi_driver);
589 }
590 
591 module_init(asus_nb_wmi_init);
592 module_exit(asus_nb_wmi_exit);
593