forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/platform/x86/asus-nb-wmi.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Asus Notebooks WMI hotkey driver
34 *
45 * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
196 */
207
218 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -121,6 +108,10 @@
121108 static struct quirk_entry quirk_asus_forceals = {
122109 .wmi_backlight_set_devstate = true,
123110 .wmi_force_als_set = true,
111
+};
112
+
113
+static struct quirk_entry quirk_asus_use_kbd_dock_devid = {
114
+ .use_kbd_dock_devid = true,
124115 };
125116
126117 static int dmi_matched(const struct dmi_system_id *dmi)
....@@ -415,6 +406,43 @@
415406 },
416407 .driver_data = &quirk_asus_forceals,
417408 },
409
+ {
410
+ .callback = dmi_matched,
411
+ .ident = "ASUSTeK COMPUTER INC. UX430UNR",
412
+ .matches = {
413
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
414
+ DMI_MATCH(DMI_PRODUCT_NAME, "UX430UNR"),
415
+ },
416
+ .driver_data = &quirk_asus_forceals,
417
+ },
418
+ {
419
+ .callback = dmi_matched,
420
+ .ident = "Asus Transformer T100TA / T100HA / T100CHI",
421
+ .matches = {
422
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
423
+ /* Match *T100* */
424
+ DMI_MATCH(DMI_PRODUCT_NAME, "T100"),
425
+ },
426
+ .driver_data = &quirk_asus_use_kbd_dock_devid,
427
+ },
428
+ {
429
+ .callback = dmi_matched,
430
+ .ident = "Asus Transformer T101HA",
431
+ .matches = {
432
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
433
+ DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"),
434
+ },
435
+ .driver_data = &quirk_asus_use_kbd_dock_devid,
436
+ },
437
+ {
438
+ .callback = dmi_matched,
439
+ .ident = "Asus Transformer T200TA",
440
+ .matches = {
441
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
442
+ DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
443
+ },
444
+ .driver_data = &quirk_asus_use_kbd_dock_devid,
445
+ },
418446 {},
419447 };
420448
....@@ -450,6 +478,7 @@
450478 { KE_KEY, 0x30, { KEY_VOLUMEUP } },
451479 { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
452480 { KE_KEY, 0x32, { KEY_MUTE } },
481
+ { KE_KEY, 0x33, { KEY_SCREENLOCK } },
453482 { KE_KEY, 0x35, { KEY_SCREENLOCK } },
454483 { KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
455484 { KE_KEY, 0x41, { KEY_NEXTSONG } },
....@@ -475,7 +504,11 @@
475504 { KE_KEY, 0x67, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV */
476505 { KE_KEY, 0x6B, { KEY_TOUCHPAD_TOGGLE } },
477506 { KE_IGNORE, 0x6E, }, /* Low Battery notification */
507
+ { KE_KEY, 0x71, { KEY_F13 } }, /* General-purpose button */
508
+ { KE_IGNORE, 0x79, }, /* Charger type dectection notification */
478509 { KE_KEY, 0x7a, { KEY_ALS_TOGGLE } }, /* Ambient Light Sensor Toggle */
510
+ { KE_IGNORE, 0x7B, }, /* Charger connect/disconnect notification */
511
+ { KE_KEY, 0x7c, { KEY_MICMUTE } },
479512 { KE_KEY, 0x7D, { KEY_BLUETOOTH } }, /* Bluetooth Enable */
480513 { KE_KEY, 0x7E, { KEY_BLUETOOTH } }, /* Bluetooth Disable */
481514 { KE_KEY, 0x82, { KEY_CAMERA } },
....@@ -490,7 +523,7 @@
490523 { KE_KEY, 0x92, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + DVI */
491524 { KE_KEY, 0x93, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + DVI */
492525 { KE_KEY, 0x95, { KEY_MEDIA } },
493
- { KE_KEY, 0x99, { KEY_PHONE } },
526
+ { KE_KEY, 0x99, { KEY_PHONE } }, /* Conflicts with fan mode switch */
494527 { KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
495528 { KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
496529 { KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
....@@ -500,6 +533,7 @@
500533 { KE_KEY, 0xA6, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + HDMI */
501534 { KE_KEY, 0xA7, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + HDMI */
502535 { KE_KEY, 0xB5, { KEY_CALC } },
536
+ { KE_IGNORE, 0xC0, }, /* External display connect/disconnect notification */
503537 { KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
504538 { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
505539 { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */
....@@ -517,33 +551,9 @@
517551 .detect_quirks = asus_nb_wmi_quirks,
518552 };
519553
520
-static const struct dmi_system_id asus_nb_wmi_blacklist[] __initconst = {
521
- {
522
- /*
523
- * asus-nb-wm adds no functionality. The T100TA has a detachable
524
- * USB kbd, so no hotkeys and it has no WMI rfkill; and loading
525
- * asus-nb-wm causes the camera LED to turn and _stay_ on.
526
- */
527
- .matches = {
528
- DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
529
- DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
530
- },
531
- },
532
- {
533
- /* The Asus T200TA has the same issue as the T100TA */
534
- .matches = {
535
- DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
536
- DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T200TA"),
537
- },
538
- },
539
- {} /* Terminating entry */
540
-};
541554
542555 static int __init asus_nb_wmi_init(void)
543556 {
544
- if (dmi_check_system(asus_nb_wmi_blacklist))
545
- return -ENODEV;
546
-
547557 return asus_wmi_register_driver(&asus_nb_wmi_driver);
548558 }
549559