1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Asus Notebooks WMI hotkey driver
5 * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10 #include <linux/backlight.h>
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/input.h>
15 #include <linux/input/sparse-keymap.h>
16 #include <linux/dmi.h>
17 #include <linux/i8042.h>
19 #include <acpi/video.h>
23 #define ASUS_NB_WMI_FILE "asus-nb-wmi"
25 MODULE_AUTHOR("Corentin Chary <corentin.chary@gmail.com>");
26 MODULE_DESCRIPTION("Asus Notebooks WMI Hotkey Driver");
27 MODULE_LICENSE("GPL");
29 #define ASUS_NB_WMI_EVENT_GUID "0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C"
31 MODULE_ALIAS("wmi:"ASUS_NB_WMI_EVENT_GUID
);
34 * WAPF defines the behavior of the Fn+Fx wlan key
35 * The significance of values is yet to be found, but
37 * Bit | Bluetooth | WLAN
38 * 0 | Hardware | Hardware
39 * 1 | Hardware | Software
40 * 4 | Software | Software
43 module_param(wapf
, uint
, 0444);
44 MODULE_PARM_DESC(wapf
, "WAPF value");
46 static int tablet_mode_sw
= -1;
47 module_param(tablet_mode_sw
, uint
, 0444);
48 MODULE_PARM_DESC(tablet_mode_sw
, "Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip 3:lid-flip-rog");
50 static struct quirk_entry
*quirks
;
51 static bool atkbd_reports_vol_keys
;
53 static bool asus_i8042_filter(unsigned char data
, unsigned char str
, struct serio
*port
)
55 static bool extended_e0
;
56 static bool extended_e1
;
58 if (str
& I8042_STR_AUXDATA
)
61 if (quirks
->filter_i8042_e1_extended_codes
) {
75 } else if (extended_e0
) {
78 switch (data
& 0x7f) {
79 case 0x20: /* e0 20 / e0 a0, Volume Mute press / release */
80 case 0x2e: /* e0 2e / e0 ae, Volume Down press / release */
81 case 0x30: /* e0 30 / e0 b0, Volume Up press / release */
82 atkbd_reports_vol_keys
= true;
90 static struct quirk_entry quirk_asus_unknown
= {
92 .wmi_backlight_set_devstate
= true,
95 static struct quirk_entry quirk_asus_q500a
= {
96 .filter_i8042_e1_extended_codes
= true,
97 .wmi_backlight_set_devstate
= true,
101 * For those machines that need software to control bt/wifi status
102 * and have duplicate events(ACPI and WMI) for display toggle
104 static struct quirk_entry quirk_asus_x55u
= {
106 .wmi_backlight_set_devstate
= true,
107 .no_display_toggle
= true,
110 static struct quirk_entry quirk_asus_wapf4
= {
112 .wmi_backlight_set_devstate
= true,
115 static struct quirk_entry quirk_asus_x200ca
= {
117 .wmi_backlight_set_devstate
= true,
120 static struct quirk_entry quirk_asus_x550lb
= {
121 .wmi_backlight_set_devstate
= true,
125 static struct quirk_entry quirk_asus_forceals
= {
126 .wmi_backlight_set_devstate
= true,
127 .wmi_force_als_set
= true,
130 static struct quirk_entry quirk_asus_use_kbd_dock_devid
= {
131 .tablet_switch_mode
= asus_wmi_kbd_dock_devid
,
134 static struct quirk_entry quirk_asus_use_lid_flip_devid
= {
135 .wmi_backlight_set_devstate
= true,
136 .tablet_switch_mode
= asus_wmi_lid_flip_devid
,
139 static struct quirk_entry quirk_asus_tablet_mode
= {
140 .wmi_backlight_set_devstate
= true,
141 .tablet_switch_mode
= asus_wmi_lid_flip_rog_devid
,
144 static struct quirk_entry quirk_asus_ignore_fan
= {
145 .wmi_ignore_fan
= true,
148 static struct quirk_entry quirk_asus_zenbook_duo_kbd
= {
149 .ignore_key_wlan
= true,
152 static int dmi_matched(const struct dmi_system_id
*dmi
)
154 pr_info("Identified laptop model '%s'\n", dmi
->ident
);
155 quirks
= dmi
->driver_data
;
159 static const struct dmi_system_id asus_quirks
[] = {
161 .callback
= dmi_matched
,
162 .ident
= "ASUSTeK COMPUTER INC. Q500A",
164 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
165 DMI_MATCH(DMI_PRODUCT_NAME
, "Q500A"),
167 .driver_data
= &quirk_asus_q500a
,
170 .callback
= dmi_matched
,
171 .ident
= "ASUSTeK COMPUTER INC. U32U",
173 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK Computer Inc."),
174 DMI_MATCH(DMI_PRODUCT_NAME
, "U32U"),
176 .driver_data
= &quirk_asus_wapf4
,
179 .callback
= dmi_matched
,
180 .ident
= "ASUSTeK COMPUTER INC. X302UA",
182 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
183 DMI_MATCH(DMI_PRODUCT_NAME
, "X302UA"),
185 .driver_data
= &quirk_asus_wapf4
,
188 .callback
= dmi_matched
,
189 .ident
= "ASUSTeK COMPUTER INC. X401U",
191 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
192 DMI_MATCH(DMI_PRODUCT_NAME
, "X401U"),
194 .driver_data
= &quirk_asus_x55u
,
197 .callback
= dmi_matched
,
198 .ident
= "ASUSTeK COMPUTER INC. X401A",
200 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
201 DMI_MATCH(DMI_PRODUCT_NAME
, "X401A"),
203 .driver_data
= &quirk_asus_wapf4
,
206 .callback
= dmi_matched
,
207 .ident
= "ASUSTeK COMPUTER INC. X401A1",
209 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
210 DMI_MATCH(DMI_PRODUCT_NAME
, "X401A1"),
212 .driver_data
= &quirk_asus_wapf4
,
215 .callback
= dmi_matched
,
216 .ident
= "ASUSTeK COMPUTER INC. X45U",
218 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
219 DMI_MATCH(DMI_PRODUCT_NAME
, "X45U"),
221 .driver_data
= &quirk_asus_wapf4
,
224 .callback
= dmi_matched
,
225 .ident
= "ASUSTeK COMPUTER INC. X456UA",
227 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
228 DMI_MATCH(DMI_PRODUCT_NAME
, "X456UA"),
230 .driver_data
= &quirk_asus_wapf4
,
233 .callback
= dmi_matched
,
234 .ident
= "ASUSTeK COMPUTER INC. X456UF",
236 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
237 DMI_MATCH(DMI_PRODUCT_NAME
, "X456UF"),
239 .driver_data
= &quirk_asus_wapf4
,
242 .callback
= dmi_matched
,
243 .ident
= "ASUSTeK COMPUTER INC. X501U",
245 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
246 DMI_MATCH(DMI_PRODUCT_NAME
, "X501U"),
248 .driver_data
= &quirk_asus_x55u
,
251 .callback
= dmi_matched
,
252 .ident
= "ASUSTeK COMPUTER INC. X501A",
254 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
255 DMI_MATCH(DMI_PRODUCT_NAME
, "X501A"),
257 .driver_data
= &quirk_asus_wapf4
,
260 .callback
= dmi_matched
,
261 .ident
= "ASUSTeK COMPUTER INC. X501A1",
263 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
264 DMI_MATCH(DMI_PRODUCT_NAME
, "X501A1"),
266 .driver_data
= &quirk_asus_wapf4
,
269 .callback
= dmi_matched
,
270 .ident
= "ASUSTeK COMPUTER INC. X550CA",
272 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
273 DMI_MATCH(DMI_PRODUCT_NAME
, "X550CA"),
275 .driver_data
= &quirk_asus_wapf4
,
278 .callback
= dmi_matched
,
279 .ident
= "ASUSTeK COMPUTER INC. X550CC",
281 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
282 DMI_MATCH(DMI_PRODUCT_NAME
, "X550CC"),
284 .driver_data
= &quirk_asus_wapf4
,
287 .callback
= dmi_matched
,
288 .ident
= "ASUSTeK COMPUTER INC. X550CL",
290 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
291 DMI_MATCH(DMI_PRODUCT_NAME
, "X550CL"),
293 .driver_data
= &quirk_asus_wapf4
,
296 .callback
= dmi_matched
,
297 .ident
= "ASUSTeK COMPUTER INC. X550VB",
299 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
300 DMI_MATCH(DMI_PRODUCT_NAME
, "X550VB"),
302 .driver_data
= &quirk_asus_wapf4
,
305 .callback
= dmi_matched
,
306 .ident
= "ASUSTeK COMPUTER INC. X551CA",
308 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
309 DMI_MATCH(DMI_PRODUCT_NAME
, "X551CA"),
311 .driver_data
= &quirk_asus_wapf4
,
314 .callback
= dmi_matched
,
315 .ident
= "ASUSTeK COMPUTER INC. X55A",
317 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
318 DMI_MATCH(DMI_PRODUCT_NAME
, "X55A"),
320 .driver_data
= &quirk_asus_wapf4
,
323 .callback
= dmi_matched
,
324 .ident
= "ASUSTeK COMPUTER INC. X55C",
326 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
327 DMI_MATCH(DMI_PRODUCT_NAME
, "X55C"),
329 .driver_data
= &quirk_asus_wapf4
,
332 .callback
= dmi_matched
,
333 .ident
= "ASUSTeK COMPUTER INC. X55U",
335 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
336 DMI_MATCH(DMI_PRODUCT_NAME
, "X55U"),
338 .driver_data
= &quirk_asus_x55u
,
341 .callback
= dmi_matched
,
342 .ident
= "ASUSTeK COMPUTER INC. X55VD",
344 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
345 DMI_MATCH(DMI_PRODUCT_NAME
, "X55VD"),
347 .driver_data
= &quirk_asus_wapf4
,
350 .callback
= dmi_matched
,
351 .ident
= "ASUSTeK COMPUTER INC. X75A",
353 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
354 DMI_MATCH(DMI_PRODUCT_NAME
, "X75A"),
356 .driver_data
= &quirk_asus_wapf4
,
359 .callback
= dmi_matched
,
360 .ident
= "ASUSTeK COMPUTER INC. X75VBP",
362 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
363 DMI_MATCH(DMI_PRODUCT_NAME
, "X75VBP"),
365 .driver_data
= &quirk_asus_wapf4
,
368 .callback
= dmi_matched
,
369 .ident
= "ASUSTeK COMPUTER INC. X75VD",
371 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
372 DMI_MATCH(DMI_PRODUCT_NAME
, "X75VD"),
374 .driver_data
= &quirk_asus_wapf4
,
377 .callback
= dmi_matched
,
378 .ident
= "ASUSTeK COMPUTER INC. 1015E",
380 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
381 DMI_MATCH(DMI_PRODUCT_NAME
, "1015E"),
383 .driver_data
= &quirk_asus_wapf4
,
386 .callback
= dmi_matched
,
387 .ident
= "ASUSTeK COMPUTER INC. 1015U",
389 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
390 DMI_MATCH(DMI_PRODUCT_NAME
, "1015U"),
392 .driver_data
= &quirk_asus_wapf4
,
395 .callback
= dmi_matched
,
396 .ident
= "ASUSTeK COMPUTER INC. X200CA",
398 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
399 DMI_MATCH(DMI_PRODUCT_NAME
, "X200CA"),
401 .driver_data
= &quirk_asus_x200ca
,
404 .callback
= dmi_matched
,
405 .ident
= "ASUSTeK COMPUTER INC. UX330UAK",
407 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
408 DMI_MATCH(DMI_PRODUCT_NAME
, "UX330UAK"),
410 .driver_data
= &quirk_asus_forceals
,
413 .callback
= dmi_matched
,
414 .ident
= "ASUSTeK COMPUTER INC. X550LB",
416 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
417 DMI_MATCH(DMI_PRODUCT_NAME
, "X550LB"),
419 .driver_data
= &quirk_asus_x550lb
,
422 .callback
= dmi_matched
,
423 .ident
= "ASUSTeK COMPUTER INC. UX430UQ",
425 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
426 DMI_MATCH(DMI_PRODUCT_NAME
, "UX430UQ"),
428 .driver_data
= &quirk_asus_forceals
,
431 .callback
= dmi_matched
,
432 .ident
= "ASUSTeK COMPUTER INC. UX430UNR",
434 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
435 DMI_MATCH(DMI_PRODUCT_NAME
, "UX430UNR"),
437 .driver_data
= &quirk_asus_forceals
,
440 .callback
= dmi_matched
,
441 .ident
= "Asus Transformer T100TA / T100HA / T100CHI",
443 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
445 DMI_MATCH(DMI_PRODUCT_NAME
, "T100"),
447 .driver_data
= &quirk_asus_use_kbd_dock_devid
,
450 .callback
= dmi_matched
,
451 .ident
= "Asus Transformer T101HA",
453 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
454 DMI_MATCH(DMI_PRODUCT_NAME
, "T101HA"),
456 .driver_data
= &quirk_asus_use_kbd_dock_devid
,
459 .callback
= dmi_matched
,
460 .ident
= "Asus Transformer T200TA",
462 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
463 DMI_MATCH(DMI_PRODUCT_NAME
, "T200TA"),
465 .driver_data
= &quirk_asus_use_kbd_dock_devid
,
468 .callback
= dmi_matched
,
469 .ident
= "ASUS ZenBook Flip UX360",
471 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
473 DMI_MATCH(DMI_PRODUCT_NAME
, "UX360"),
475 .driver_data
= &quirk_asus_use_lid_flip_devid
,
478 .callback
= dmi_matched
,
479 .ident
= "ASUS TP200s / E205SA",
481 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
482 DMI_MATCH(DMI_PRODUCT_NAME
, "E205SA"),
484 .driver_data
= &quirk_asus_use_lid_flip_devid
,
487 .callback
= dmi_matched
,
488 .ident
= "ASUS ROG FLOW X13",
490 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
492 DMI_MATCH(DMI_PRODUCT_NAME
, "GV301"),
494 .driver_data
= &quirk_asus_tablet_mode
,
497 .callback
= dmi_matched
,
498 .ident
= "ASUS ROG FLOW X16",
500 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
501 DMI_MATCH(DMI_PRODUCT_NAME
, "GV601R"),
503 .driver_data
= &quirk_asus_tablet_mode
,
506 .callback
= dmi_matched
,
507 .ident
= "ASUS ROG FLOW X16",
509 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
510 DMI_MATCH(DMI_PRODUCT_NAME
, "GV601V"),
512 .driver_data
= &quirk_asus_tablet_mode
,
515 .callback
= dmi_matched
,
516 .ident
= "ASUS VivoBook E410MA",
518 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
519 DMI_MATCH(DMI_PRODUCT_NAME
, "E410MA"),
521 .driver_data
= &quirk_asus_ignore_fan
,
524 .callback
= dmi_matched
,
525 .ident
= "ASUS Zenbook Duo UX8406MA",
527 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
528 DMI_MATCH(DMI_PRODUCT_NAME
, "UX8406MA"),
530 .driver_data
= &quirk_asus_zenbook_duo_kbd
,
535 static void asus_nb_wmi_quirks(struct asus_wmi_driver
*driver
)
537 quirks
= &quirk_asus_unknown
;
538 dmi_check_system(asus_quirks
);
540 driver
->quirks
= quirks
;
541 driver
->panel_power
= BACKLIGHT_POWER_ON
;
543 /* overwrite the wapf setting if the wapf paramater is specified */
549 if (tablet_mode_sw
!= -1)
550 quirks
->tablet_switch_mode
= tablet_mode_sw
;
553 static const struct key_entry asus_nb_wmi_keymap
[] = {
554 { KE_KEY
, ASUS_WMI_BRN_DOWN
, { KEY_BRIGHTNESSDOWN
} },
555 { KE_KEY
, ASUS_WMI_BRN_UP
, { KEY_BRIGHTNESSUP
} },
556 { KE_KEY
, 0x2a, { KEY_SELECTIVE_SCREENSHOT
} },
557 { KE_IGNORE
, 0x2b, }, /* PrintScreen (also send via PS/2) on newer models */
558 { KE_IGNORE
, 0x2c, }, /* CapsLock (also send via PS/2) on newer models */
559 { KE_KEY
, 0x30, { KEY_VOLUMEUP
} },
560 { KE_KEY
, 0x31, { KEY_VOLUMEDOWN
} },
561 { KE_KEY
, 0x32, { KEY_MUTE
} },
562 { KE_KEY
, 0x33, { KEY_SCREENLOCK
} },
563 { KE_KEY
, 0x35, { KEY_SCREENLOCK
} },
564 { KE_KEY
, 0x38, { KEY_PROG3
} }, /* Armoury Crate */
565 { KE_KEY
, 0x40, { KEY_PREVIOUSSONG
} },
566 { KE_KEY
, 0x41, { KEY_NEXTSONG
} },
567 { KE_KEY
, 0x43, { KEY_STOPCD
} }, /* Stop/Eject */
568 { KE_KEY
, 0x45, { KEY_PLAYPAUSE
} },
569 { KE_KEY
, 0x4c, { KEY_MEDIA
} }, /* WMP Key */
570 { KE_KEY
, 0x50, { KEY_EMAIL
} },
571 { KE_KEY
, 0x51, { KEY_WWW
} },
572 { KE_KEY
, 0x55, { KEY_CALC
} },
573 { KE_IGNORE
, 0x57, }, /* Battery mode */
574 { KE_IGNORE
, 0x58, }, /* AC mode */
575 { KE_KEY
, 0x5C, { KEY_F15
} }, /* Power Gear key */
576 { KE_KEY
, 0x5D, { KEY_WLAN
} }, /* Wireless console Toggle */
577 { KE_KEY
, 0x5E, { KEY_WLAN
} }, /* Wireless console Enable */
578 { KE_KEY
, 0x5F, { KEY_WLAN
} }, /* Wireless console Disable */
579 { KE_KEY
, 0x60, { KEY_TOUCHPAD_ON
} },
580 { KE_KEY
, 0x61, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD only */
581 { KE_KEY
, 0x62, { KEY_SWITCHVIDEOMODE
} }, /* SDSP CRT only */
582 { KE_KEY
, 0x63, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + CRT */
583 { KE_KEY
, 0x64, { KEY_SWITCHVIDEOMODE
} }, /* SDSP TV */
584 { KE_KEY
, 0x65, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + TV */
585 { KE_KEY
, 0x66, { KEY_SWITCHVIDEOMODE
} }, /* SDSP CRT + TV */
586 { KE_KEY
, 0x67, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + CRT + TV */
587 { KE_KEY
, 0x6B, { KEY_TOUCHPAD_TOGGLE
} },
588 { KE_IGNORE
, 0x6E, }, /* Low Battery notification */
589 { KE_KEY
, 0x71, { KEY_F13
} }, /* General-purpose button */
590 { KE_IGNORE
, 0x79, }, /* Charger type dectection notification */
591 { KE_KEY
, 0x7a, { KEY_ALS_TOGGLE
} }, /* Ambient Light Sensor Toggle */
592 { KE_IGNORE
, 0x7B, }, /* Charger connect/disconnect notification */
593 { KE_KEY
, 0x7c, { KEY_MICMUTE
} },
594 { KE_KEY
, 0x7D, { KEY_BLUETOOTH
} }, /* Bluetooth Enable */
595 { KE_KEY
, 0x7E, { KEY_BLUETOOTH
} }, /* Bluetooth Disable */
596 { KE_KEY
, 0x82, { KEY_CAMERA
} },
597 { KE_KEY
, 0x85, { KEY_CAMERA
} },
598 { KE_KEY
, 0x86, { KEY_PROG1
} }, /* MyASUS Key */
599 { KE_KEY
, 0x88, { KEY_RFKILL
} }, /* Radio Toggle Key */
600 { KE_KEY
, 0x8A, { KEY_PROG1
} }, /* Color enhancement mode */
601 { KE_KEY
, 0x8C, { KEY_SWITCHVIDEOMODE
} }, /* SDSP DVI only */
602 { KE_KEY
, 0x8D, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + DVI */
603 { KE_KEY
, 0x8E, { KEY_SWITCHVIDEOMODE
} }, /* SDSP CRT + DVI */
604 { KE_KEY
, 0x8F, { KEY_SWITCHVIDEOMODE
} }, /* SDSP TV + DVI */
605 { KE_KEY
, 0x90, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + CRT + DVI */
606 { KE_KEY
, 0x91, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + TV + DVI */
607 { KE_KEY
, 0x92, { KEY_SWITCHVIDEOMODE
} }, /* SDSP CRT + TV + DVI */
608 { KE_KEY
, 0x93, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + CRT + TV + DVI */
609 { KE_KEY
, 0x95, { KEY_MEDIA
} },
610 { KE_KEY
, 0x99, { KEY_PHONE
} }, /* Conflicts with fan mode switch */
611 { KE_KEY
, 0xA0, { KEY_SWITCHVIDEOMODE
} }, /* SDSP HDMI only */
612 { KE_KEY
, 0xA1, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + HDMI */
613 { KE_KEY
, 0xA2, { KEY_SWITCHVIDEOMODE
} }, /* SDSP CRT + HDMI */
614 { KE_KEY
, 0xA3, { KEY_SWITCHVIDEOMODE
} }, /* SDSP TV + HDMI */
615 { KE_KEY
, 0xA4, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + CRT + HDMI */
616 { KE_KEY
, 0xA5, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + TV + HDMI */
617 { KE_KEY
, 0xA6, { KEY_SWITCHVIDEOMODE
} }, /* SDSP CRT + TV + HDMI */
618 { KE_KEY
, 0xA7, { KEY_SWITCHVIDEOMODE
} }, /* SDSP LCD + CRT + TV + HDMI */
619 { KE_KEY
, 0xAE, { KEY_FN_F5
} }, /* Fn+F5 fan mode on 2020+ */
620 { KE_KEY
, 0xB3, { KEY_PROG4
} }, /* AURA */
621 { KE_KEY
, 0xB5, { KEY_CALC
} },
622 { KE_IGNORE
, 0xC0, }, /* External display connect/disconnect notification */
623 { KE_KEY
, 0xC4, { KEY_KBDILLUMUP
} },
624 { KE_KEY
, 0xC5, { KEY_KBDILLUMDOWN
} },
625 { KE_IGNORE
, 0xC6, }, /* Ambient Light Sensor notification */
626 { KE_KEY
, 0xFA, { KEY_PROG2
} }, /* Lid flip action */
627 { KE_KEY
, 0xBD, { KEY_PROG2
} }, /* Lid flip action on ROG xflow laptops */
631 static void asus_nb_wmi_key_filter(struct asus_wmi_driver
*asus_wmi
, int *code
,
632 unsigned int *value
, bool *autorelease
)
635 case ASUS_WMI_BRN_DOWN
:
636 case ASUS_WMI_BRN_UP
:
637 if (acpi_video_handles_brightness_key_presses())
638 *code
= ASUS_WMI_KEY_IGNORE
;
641 case 0x30: /* Volume Up */
642 case 0x31: /* Volume Down */
643 case 0x32: /* Volume Mute */
644 if (atkbd_reports_vol_keys
)
645 *code
= ASUS_WMI_KEY_IGNORE
;
647 case 0x5D: /* Wireless console Toggle */
648 case 0x5E: /* Wireless console Enable */
649 case 0x5F: /* Wireless console Disable */
650 if (quirks
->ignore_key_wlan
)
651 *code
= ASUS_WMI_KEY_IGNORE
;
656 static struct asus_wmi_driver asus_nb_wmi_driver
= {
657 .name
= ASUS_NB_WMI_FILE
,
658 .owner
= THIS_MODULE
,
659 .event_guid
= ASUS_NB_WMI_EVENT_GUID
,
660 .keymap
= asus_nb_wmi_keymap
,
661 .input_name
= "Asus WMI hotkeys",
662 .input_phys
= ASUS_NB_WMI_FILE
"/input0",
663 .detect_quirks
= asus_nb_wmi_quirks
,
664 .key_filter
= asus_nb_wmi_key_filter
,
665 .i8042_filter
= asus_i8042_filter
,
669 static int __init
asus_nb_wmi_init(void)
671 return asus_wmi_register_driver(&asus_nb_wmi_driver
);
674 static void __exit
asus_nb_wmi_exit(void)
676 asus_wmi_unregister_driver(&asus_nb_wmi_driver
);
679 module_init(asus_nb_wmi_init
);
680 module_exit(asus_nb_wmi_exit
);