2 * Copyright (C) 2015 Red Hat Inc.
3 * Hans de Goede <hdegoede@redhat.com>
4 * Copyright (C) 2008 SuSE Linux Products GmbH
5 * Thomas Renninger <trenn@suse.de>
7 * May be copied or modified under the terms of the GNU General Public License
10 * After PCI devices are glued with ACPI devices
11 * acpi_get_pci_dev() can be called to identify ACPI graphics
12 * devices for which a real graphics card is plugged in
14 * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B)
15 * are available, video.ko should be used to handle the device.
17 * Otherwise vendor specific drivers like thinkpad_acpi, asus-laptop,
18 * sony_acpi,... can take care about backlight brightness.
20 * Backlight drivers can use acpi_video_get_backlight_type() to determine which
21 * driver should handle the backlight. RAW/GPU-driver backlight drivers must
22 * use the acpi_video_backlight_use_native() helper for this.
24 * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m)
25 * this file will not be compiled and acpi_video_get_backlight_type() will
26 * always return acpi_backlight_vendor.
29 #include <linux/export.h>
30 #include <linux/acpi.h>
31 #include <linux/apple-gmux.h>
32 #include <linux/backlight.h>
33 #include <linux/dmi.h>
34 #include <linux/module.h>
35 #include <linux/pci.h>
36 #include <linux/platform_data/x86/nvidia-wmi-ec-backlight.h>
37 #include <linux/pnp.h>
38 #include <linux/types.h>
39 #include <linux/workqueue.h>
40 #include <acpi/video.h>
42 static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef;
43 static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef;
45 static void acpi_video_parse_cmdline(void)
47 if (!strcmp("vendor", acpi_video_backlight_string))
48 acpi_backlight_cmdline = acpi_backlight_vendor;
49 if (!strcmp("video", acpi_video_backlight_string))
50 acpi_backlight_cmdline = acpi_backlight_video;
51 if (!strcmp("native", acpi_video_backlight_string))
52 acpi_backlight_cmdline = acpi_backlight_native;
53 if (!strcmp("nvidia_wmi_ec", acpi_video_backlight_string))
54 acpi_backlight_cmdline = acpi_backlight_nvidia_wmi_ec;
55 if (!strcmp("apple_gmux", acpi_video_backlight_string))
56 acpi_backlight_cmdline = acpi_backlight_apple_gmux;
57 if (!strcmp("none", acpi_video_backlight_string))
58 acpi_backlight_cmdline = acpi_backlight_none;
62 find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
64 struct acpi_device *acpi_dev = acpi_fetch_acpi_dev(handle);
68 static const struct acpi_device_id video_ids[] = {
73 if (acpi_dev && !acpi_match_device_ids(acpi_dev, video_ids)) {
74 dev = acpi_get_pci_dev(handle);
78 *cap |= acpi_is_video_device(handle);
83 /* This depends on ACPI_WMI which is X86 only */
85 static bool nvidia_wmi_ec_supported(void)
87 struct wmi_brightness_args args = {
88 .mode = WMI_BRIGHTNESS_MODE_GET,
92 struct acpi_buffer buf = { (acpi_size)sizeof(args), &args };
95 status = wmi_evaluate_method(WMI_BRIGHTNESS_GUID, 0,
96 WMI_BRIGHTNESS_METHOD_SOURCE, &buf, &buf);
97 if (ACPI_FAILURE(status))
101 * If brightness is handled by the EC then nvidia-wmi-ec-backlight
102 * should be used, else the GPU driver(s) should be used.
104 return args.ret == WMI_BRIGHTNESS_SOURCE_EC;
107 static bool nvidia_wmi_ec_supported(void)
113 /* Force to use vendor driver when the ACPI device is known to be
115 static int video_detect_force_vendor(const struct dmi_system_id *d)
117 acpi_backlight_dmi = acpi_backlight_vendor;
121 static int video_detect_force_video(const struct dmi_system_id *d)
123 acpi_backlight_dmi = acpi_backlight_video;
127 static int video_detect_force_native(const struct dmi_system_id *d)
129 acpi_backlight_dmi = acpi_backlight_native;
133 static const struct dmi_system_id video_detect_dmi_table[] = {
135 * Models which should use the vendor backlight interface,
136 * because of broken ACPI video backlight control.
139 /* https://bugzilla.redhat.com/show_bug.cgi?id=1128309 */
140 .callback = video_detect_force_vendor,
143 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
144 DMI_MATCH(DMI_PRODUCT_NAME, "KAV80"),
148 .callback = video_detect_force_vendor,
151 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
152 DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"),
156 .callback = video_detect_force_vendor,
159 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
160 DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
164 .callback = video_detect_force_vendor,
167 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
168 DMI_MATCH(DMI_PRODUCT_NAME, "X55U"),
172 /* https://bugs.launchpad.net/bugs/1000146 */
173 .callback = video_detect_force_vendor,
176 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
177 DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
181 .callback = video_detect_force_vendor,
184 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
185 DMI_MATCH(DMI_PRODUCT_NAME, "X401U"),
189 .callback = video_detect_force_vendor,
192 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
193 DMI_MATCH(DMI_PRODUCT_NAME, "X501U"),
197 /* https://bugs.launchpad.net/bugs/1000146 */
198 .callback = video_detect_force_vendor,
201 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
202 DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
206 .callback = video_detect_force_vendor,
207 /* Samsung N150/N210/N220 */
209 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
210 DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
211 DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
215 .callback = video_detect_force_vendor,
216 /* Samsung NF110/NF210/NF310 */
218 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
219 DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
220 DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
224 .callback = video_detect_force_vendor,
227 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
228 DMI_MATCH(DMI_PRODUCT_NAME, "NC210/NC110"),
229 DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
233 .callback = video_detect_force_vendor,
234 /* Xiaomi Mi Pad 2 */
236 DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
237 DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
242 * Models which should use the vendor backlight interface,
243 * because of broken native backlight control.
246 .callback = video_detect_force_vendor,
247 /* Sony Vaio PCG-FRV35 */
249 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
250 DMI_MATCH(DMI_PRODUCT_NAME, "PCG-FRV35"),
255 * Toshiba models with Transflective display, these need to use
256 * the toshiba_acpi vendor driver for proper Transflective handling.
259 .callback = video_detect_force_vendor,
261 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
262 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R500"),
266 .callback = video_detect_force_vendor,
268 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
269 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R600"),
274 * Models which need acpi_video backlight control where the GPU drivers
275 * do not call acpi_video_register_backlight() because no internal panel
276 * is detected. Typically these are all-in-ones (monitors with builtin
277 * PC) where the panel connection shows up as regular DP instead of eDP.
280 .callback = video_detect_force_video,
283 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
284 DMI_MATCH(DMI_PRODUCT_NAME, "iMac14,1"),
288 .callback = video_detect_force_video,
291 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
292 DMI_MATCH(DMI_PRODUCT_NAME, "iMac14,2"),
297 * Older models with nvidia GPU which need acpi_video backlight
298 * control and where the old nvidia binary driver series does not
299 * call acpi_video_register_backlight().
302 .callback = video_detect_force_video,
305 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
306 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W530"),
311 * These models have a working acpi_video backlight control, and using
312 * native backlight causes a regression where backlight does not work
313 * when userspace is not handling brightness key events. Disable
314 * native_backlight on these to fix this:
315 * https://bugzilla.kernel.org/show_bug.cgi?id=81691
318 .callback = video_detect_force_video,
321 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
322 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"),
326 .callback = video_detect_force_video,
329 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
330 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"),
334 .callback = video_detect_force_video,
337 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
338 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
342 .callback = video_detect_force_video,
345 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
346 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"),
350 /* The native backlight controls do not work on some older machines */
352 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */
353 .callback = video_detect_force_video,
354 /* HP ENVY 15 Notebook */
356 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
357 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),
361 .callback = video_detect_force_video,
362 /* SAMSUNG 870Z5E/880Z5E/680Z5E */
364 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
365 DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"),
369 .callback = video_detect_force_video,
370 /* SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V */
372 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
373 DMI_MATCH(DMI_PRODUCT_NAME,
374 "370R4E/370R4V/370R5E/3570RE/370R5V"),
378 /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */
379 .callback = video_detect_force_video,
380 /* SAMSUNG 3570R/370R/470R/450R/510R/4450RV */
382 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
383 DMI_MATCH(DMI_PRODUCT_NAME,
384 "3570R/370R/470R/450R/510R/4450RV"),
388 /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */
389 .callback = video_detect_force_video,
392 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
393 DMI_MATCH(DMI_PRODUCT_NAME, "670Z5E"),
397 /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */
398 .callback = video_detect_force_video,
399 /* SAMSUNG 730U3E/740U3E */
401 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
402 DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"),
406 /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */
407 .callback = video_detect_force_video,
408 /* SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D */
410 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
411 DMI_MATCH(DMI_PRODUCT_NAME,
412 "900X3C/900X3D/900X3E/900X4C/900X4D"),
416 /* https://bugzilla.redhat.com/show_bug.cgi?id=1272633 */
417 .callback = video_detect_force_video,
418 /* Dell XPS14 L421X */
420 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
421 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"),
425 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
426 .callback = video_detect_force_video,
427 /* Dell XPS15 L521X */
429 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
430 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
434 /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */
435 .callback = video_detect_force_video,
436 /* SAMSUNG 530U4E/540U4E */
438 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
439 DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"),
443 /* https://bugs.launchpad.net/bugs/1894667 */
444 .callback = video_detect_force_video,
445 /* HP 635 Notebook */
447 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
448 DMI_MATCH(DMI_PRODUCT_NAME, "HP 635 Notebook PC"),
452 /* Non win8 machines which need native backlight nevertheless */
454 /* https://bugzilla.redhat.com/show_bug.cgi?id=1201530 */
455 .callback = video_detect_force_native,
456 /* Lenovo Ideapad S405 */
458 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
459 DMI_MATCH(DMI_BOARD_NAME, "Lenovo IdeaPad S405"),
463 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
464 .callback = video_detect_force_native,
465 /* Lenovo Ideapad Z570 */
467 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
468 DMI_MATCH(DMI_PRODUCT_VERSION, "Ideapad Z570"),
472 .callback = video_detect_force_native,
475 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
476 DMI_MATCH(DMI_PRODUCT_NAME, "81FS"),
480 .callback = video_detect_force_native,
483 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
484 DMI_MATCH(DMI_PRODUCT_NAME, "82BK"),
488 /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */
489 .callback = video_detect_force_native,
490 /* Apple MacBook Pro 12,1 */
492 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
493 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"),
497 .callback = video_detect_force_native,
498 /* Dell Inspiron N4010 */
500 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
501 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N4010"),
505 .callback = video_detect_force_native,
506 /* Dell Vostro V131 */
508 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
509 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),
513 /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */
514 .callback = video_detect_force_native,
515 /* Dell XPS 17 L702X */
517 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
518 DMI_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L702X"),
522 .callback = video_detect_force_native,
523 /* Dell Precision 7510 */
525 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
526 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7510"),
530 .callback = video_detect_force_native,
531 /* Acer Aspire 3830TG */
533 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
534 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3830TG"),
538 .callback = video_detect_force_native,
539 /* Acer Aspire 4810T */
541 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
542 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 4810T"),
546 .callback = video_detect_force_native,
547 /* Acer Aspire 5738z */
549 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
550 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
551 DMI_MATCH(DMI_BOARD_NAME, "JV50"),
555 /* https://bugzilla.redhat.com/show_bug.cgi?id=1012674 */
556 .callback = video_detect_force_native,
557 /* Acer Aspire 5741 */
559 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
560 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"),
564 /* https://bugzilla.kernel.org/show_bug.cgi?id=42993 */
565 .callback = video_detect_force_native,
566 /* Acer Aspire 5750 */
568 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
569 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5750"),
573 /* https://bugzilla.kernel.org/show_bug.cgi?id=42833 */
574 .callback = video_detect_force_native,
575 /* Acer Extensa 5235 */
577 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
578 DMI_MATCH(DMI_PRODUCT_NAME, "Extensa 5235"),
582 .callback = video_detect_force_native,
583 /* Acer TravelMate 4750 */
585 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
586 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4750"),
590 /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */
591 .callback = video_detect_force_native,
592 /* Acer TravelMate 5735Z */
594 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
595 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5735Z"),
596 DMI_MATCH(DMI_BOARD_NAME, "BA51_MV"),
600 /* https://bugzilla.kernel.org/show_bug.cgi?id=36322 */
601 .callback = video_detect_force_native,
602 /* Acer TravelMate 5760 */
604 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
605 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5760"),
609 .callback = video_detect_force_native,
610 /* ASUSTeK COMPUTER INC. GA401 */
612 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
613 DMI_MATCH(DMI_PRODUCT_NAME, "GA401"),
617 .callback = video_detect_force_native,
618 /* ASUSTeK COMPUTER INC. GA502 */
620 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
621 DMI_MATCH(DMI_PRODUCT_NAME, "GA502"),
625 .callback = video_detect_force_native,
626 /* ASUSTeK COMPUTER INC. GA503 */
628 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
629 DMI_MATCH(DMI_PRODUCT_NAME, "GA503"),
633 .callback = video_detect_force_native,
636 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
637 DMI_MATCH(DMI_PRODUCT_NAME, "U46E"),
641 .callback = video_detect_force_native,
644 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
645 DMI_MATCH(DMI_PRODUCT_NAME, "UX303UB"),
649 .callback = video_detect_force_native,
650 /* HP EliteBook 8460p */
652 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
653 DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8460p"),
657 .callback = video_detect_force_native,
658 /* HP Pavilion g6-1d80nr / B4U19UA */
660 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
661 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion g6 Notebook PC"),
662 DMI_MATCH(DMI_PRODUCT_SKU, "B4U19UA"),
666 .callback = video_detect_force_native,
669 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
670 DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
671 DMI_MATCH(DMI_BOARD_NAME, "N150P"),
675 .callback = video_detect_force_native,
676 /* Samsung N145P/N250P/N260P */
678 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
679 DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
680 DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
684 .callback = video_detect_force_native,
687 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
688 DMI_MATCH(DMI_PRODUCT_NAME, "N250P"),
689 DMI_MATCH(DMI_BOARD_NAME, "N250P"),
693 /* https://bugzilla.kernel.org/show_bug.cgi?id=202401 */
694 .callback = video_detect_force_native,
695 /* Sony Vaio VPCEH3U1E */
697 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
698 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"),
702 .callback = video_detect_force_native,
703 /* Sony Vaio VPCY11S1E */
705 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
706 DMI_MATCH(DMI_PRODUCT_NAME, "VPCY11S1E"),
711 * These Toshibas have a broken acpi-video interface for brightness
712 * control. They also have an issue where the panel is off after
713 * suspend until a special firmware call is made to turn it back
714 * on. This is handled by the toshiba_acpi kernel module, so that
715 * module must be enabled for these models to work correctly.
718 /* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
719 .callback = video_detect_force_native,
720 /* Toshiba Portégé R700 */
722 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
723 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R700"),
727 /* Portégé: https://bugs.freedesktop.org/show_bug.cgi?id=82634 */
728 /* Satellite: https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
729 .callback = video_detect_force_native,
730 /* Toshiba Satellite/Portégé R830 */
732 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
733 DMI_MATCH(DMI_PRODUCT_NAME, "R830"),
737 .callback = video_detect_force_native,
738 /* Toshiba Satellite/Portégé Z830 */
740 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
741 DMI_MATCH(DMI_PRODUCT_NAME, "Z830"),
746 * Models which have nvidia-ec-wmi support, but should not use it.
747 * Note this indicates a likely firmware bug on these models and should
748 * be revisited if/when Linux gets support for dynamic mux mode.
751 .callback = video_detect_force_native,
754 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
755 DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"),
759 .callback = video_detect_force_native,
761 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
762 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 15 3535"),
768 static bool google_cros_ec_present(void)
770 return acpi_dev_found("GOOG0004") || acpi_dev_found("GOOG000C");
774 * Windows 8 and newer no longer use the ACPI video interface, so it often
775 * does not work. So on win8+ systems prefer native brightness control.
776 * Chromebooks should always prefer native backlight control.
778 static bool prefer_native_over_acpi_video(void)
780 return acpi_osi_is_win8() || google_cros_ec_present();
784 * Determine which type of backlight interface to use on this system,
785 * First check cmdline, then dmi quirks, then do autodetect.
787 enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto_detect)
789 static DEFINE_MUTEX(init_mutex);
790 static bool nvidia_wmi_ec_present;
791 static bool apple_gmux_present;
792 static bool native_available;
793 static bool init_done;
794 static long video_caps;
796 /* Parse cmdline, dmi and acpi only once */
797 mutex_lock(&init_mutex);
799 acpi_video_parse_cmdline();
800 dmi_check_system(video_detect_dmi_table);
801 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
802 ACPI_UINT32_MAX, find_video, NULL,
804 nvidia_wmi_ec_present = nvidia_wmi_ec_supported();
805 apple_gmux_present = apple_gmux_detect(NULL, NULL);
809 native_available = true;
810 mutex_unlock(&init_mutex);
813 *auto_detect = false;
816 * The below heuristics / detection steps are in order of descending
817 * presedence. The commandline takes presedence over anything else.
819 if (acpi_backlight_cmdline != acpi_backlight_undef)
820 return acpi_backlight_cmdline;
822 /* DMI quirks override any autodetection. */
823 if (acpi_backlight_dmi != acpi_backlight_undef)
824 return acpi_backlight_dmi;
829 /* Special cases such as nvidia_wmi_ec and apple gmux. */
830 if (nvidia_wmi_ec_present)
831 return acpi_backlight_nvidia_wmi_ec;
833 if (apple_gmux_present)
834 return acpi_backlight_apple_gmux;
836 /* Use ACPI video if available, except when native should be preferred. */
837 if ((video_caps & ACPI_VIDEO_BACKLIGHT) &&
838 !(native_available && prefer_native_over_acpi_video()))
839 return acpi_backlight_video;
841 /* Use native if available */
842 if (native_available)
843 return acpi_backlight_native;
845 /* No ACPI video/native (old hw), use vendor specific fw methods. */
846 return acpi_backlight_vendor;
848 EXPORT_SYMBOL(__acpi_video_get_backlight_type);