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("dell_uart", acpi_video_backlight_string
))
58 acpi_backlight_cmdline
= acpi_backlight_dell_uart
;
59 if (!strcmp("none", acpi_video_backlight_string
))
60 acpi_backlight_cmdline
= acpi_backlight_none
;
64 find_video(acpi_handle handle
, u32 lvl
, void *context
, void **rv
)
66 struct acpi_device
*acpi_dev
= acpi_fetch_acpi_dev(handle
);
70 static const struct acpi_device_id video_ids
[] = {
75 if (acpi_dev
&& !acpi_match_device_ids(acpi_dev
, video_ids
)) {
76 dev
= acpi_get_pci_dev(handle
);
80 *cap
|= acpi_is_video_device(handle
);
85 /* This depends on ACPI_WMI which is X86 only */
87 static bool nvidia_wmi_ec_supported(void)
89 struct wmi_brightness_args args
= {
90 .mode
= WMI_BRIGHTNESS_MODE_GET
,
94 struct acpi_buffer buf
= { (acpi_size
)sizeof(args
), &args
};
97 status
= wmi_evaluate_method(WMI_BRIGHTNESS_GUID
, 0,
98 WMI_BRIGHTNESS_METHOD_SOURCE
, &buf
, &buf
);
99 if (ACPI_FAILURE(status
))
103 * If brightness is handled by the EC then nvidia-wmi-ec-backlight
104 * should be used, else the GPU driver(s) should be used.
106 return args
.ret
== WMI_BRIGHTNESS_SOURCE_EC
;
109 static bool nvidia_wmi_ec_supported(void)
115 /* Force to use vendor driver when the ACPI device is known to be
117 static int video_detect_force_vendor(const struct dmi_system_id
*d
)
119 acpi_backlight_dmi
= acpi_backlight_vendor
;
123 static int video_detect_force_video(const struct dmi_system_id
*d
)
125 acpi_backlight_dmi
= acpi_backlight_video
;
129 static int video_detect_force_native(const struct dmi_system_id
*d
)
131 acpi_backlight_dmi
= acpi_backlight_native
;
135 static int video_detect_portege_r100(const struct dmi_system_id
*d
)
138 /* Search for Trident CyberBlade XP4m32 to confirm Portégé R100 */
139 dev
= pci_get_device(PCI_VENDOR_ID_TRIDENT
, 0x2100, NULL
);
141 acpi_backlight_dmi
= acpi_backlight_vendor
;
145 static const struct dmi_system_id video_detect_dmi_table
[] = {
147 * Models which should use the vendor backlight interface,
148 * because of broken ACPI video backlight control.
151 /* https://bugzilla.redhat.com/show_bug.cgi?id=1128309 */
152 .callback
= video_detect_force_vendor
,
155 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
156 DMI_MATCH(DMI_PRODUCT_NAME
, "KAV80"),
160 .callback
= video_detect_force_vendor
,
163 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK Computer Inc."),
164 DMI_MATCH(DMI_PRODUCT_NAME
, "UL30VT"),
168 .callback
= video_detect_force_vendor
,
171 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK Computer Inc."),
172 DMI_MATCH(DMI_PRODUCT_NAME
, "UL30A"),
176 .callback
= video_detect_force_vendor
,
179 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
180 DMI_MATCH(DMI_PRODUCT_NAME
, "X55U"),
184 /* https://bugs.launchpad.net/bugs/1000146 */
185 .callback
= video_detect_force_vendor
,
188 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
189 DMI_MATCH(DMI_PRODUCT_NAME
, "X101CH"),
193 .callback
= video_detect_force_vendor
,
196 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
197 DMI_MATCH(DMI_PRODUCT_NAME
, "X401U"),
201 .callback
= video_detect_force_vendor
,
204 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
205 DMI_MATCH(DMI_PRODUCT_NAME
, "X501U"),
209 /* https://bugs.launchpad.net/bugs/1000146 */
210 .callback
= video_detect_force_vendor
,
213 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
214 DMI_MATCH(DMI_PRODUCT_NAME
, "1015CX"),
218 .callback
= video_detect_force_vendor
,
219 /* Samsung N150/N210/N220 */
221 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
222 DMI_MATCH(DMI_PRODUCT_NAME
, "N150/N210/N220"),
223 DMI_MATCH(DMI_BOARD_NAME
, "N150/N210/N220"),
227 .callback
= video_detect_force_vendor
,
228 /* Samsung NF110/NF210/NF310 */
230 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
231 DMI_MATCH(DMI_PRODUCT_NAME
, "NF110/NF210/NF310"),
232 DMI_MATCH(DMI_BOARD_NAME
, "NF110/NF210/NF310"),
236 .callback
= video_detect_force_vendor
,
239 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
240 DMI_MATCH(DMI_PRODUCT_NAME
, "NC210/NC110"),
241 DMI_MATCH(DMI_BOARD_NAME
, "NC210/NC110"),
246 * Models which should use the vendor backlight interface,
247 * because of broken native backlight control.
250 .callback
= video_detect_force_vendor
,
251 /* Sony Vaio PCG-FRV35 */
253 DMI_MATCH(DMI_SYS_VENDOR
, "Sony Corporation"),
254 DMI_MATCH(DMI_PRODUCT_NAME
, "PCG-FRV35"),
258 .callback
= video_detect_force_vendor
,
259 /* Panasonic Toughbook CF-18 */
261 DMI_MATCH(DMI_SYS_VENDOR
, "Matsushita Electric Industrial"),
262 DMI_MATCH(DMI_PRODUCT_NAME
, "CF-18"),
267 * Toshiba models with Transflective display, these need to use
268 * the toshiba_acpi vendor driver for proper Transflective handling.
271 .callback
= video_detect_force_vendor
,
273 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
274 DMI_MATCH(DMI_PRODUCT_NAME
, "PORTEGE R500"),
278 .callback
= video_detect_force_vendor
,
280 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
281 DMI_MATCH(DMI_PRODUCT_NAME
, "PORTEGE R600"),
286 * Toshiba Portégé R100 has working both acpi_video and toshiba_acpi
287 * vendor driver. But none of them gets activated as it has a VGA with
288 * no kernel driver (Trident CyberBlade XP4m32).
289 * The DMI strings are generic so check for the VGA chip in callback.
292 .callback
= video_detect_portege_r100
,
294 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
295 DMI_MATCH(DMI_PRODUCT_NAME
, "Portable PC"),
296 DMI_MATCH(DMI_PRODUCT_VERSION
, "Version 1.0"),
297 DMI_MATCH(DMI_BOARD_NAME
, "Portable PC")
302 * Models which need acpi_video backlight control where the GPU drivers
303 * do not call acpi_video_register_backlight() because no internal panel
304 * is detected. Typically these are all-in-ones (monitors with builtin
305 * PC) where the panel connection shows up as regular DP instead of eDP.
308 .callback
= video_detect_force_video
,
311 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
312 DMI_MATCH(DMI_PRODUCT_NAME
, "iMac14,1"),
316 .callback
= video_detect_force_video
,
319 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
320 DMI_MATCH(DMI_PRODUCT_NAME
, "iMac14,2"),
325 * These models have a working acpi_video backlight control, and using
326 * native backlight causes a regression where backlight does not work
327 * when userspace is not handling brightness key events. Disable
328 * native_backlight on these to fix this:
329 * https://bugzilla.kernel.org/show_bug.cgi?id=81691
332 .callback
= video_detect_force_video
,
335 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
336 DMI_MATCH(DMI_PRODUCT_VERSION
, "ThinkPad T420"),
340 .callback
= video_detect_force_video
,
343 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
344 DMI_MATCH(DMI_PRODUCT_VERSION
, "ThinkPad T520"),
348 .callback
= video_detect_force_video
,
351 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
352 DMI_MATCH(DMI_PRODUCT_VERSION
, "ThinkPad X201s"),
356 .callback
= video_detect_force_video
,
359 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
360 DMI_MATCH(DMI_PRODUCT_VERSION
, "ThinkPad X201T"),
364 /* The native backlight controls do not work on some older machines */
366 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */
367 .callback
= video_detect_force_video
,
368 /* HP ENVY 15 Notebook */
370 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
371 DMI_MATCH(DMI_PRODUCT_NAME
, "HP ENVY 15 Notebook PC"),
375 .callback
= video_detect_force_video
,
376 /* SAMSUNG 870Z5E/880Z5E/680Z5E */
378 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
379 DMI_MATCH(DMI_PRODUCT_NAME
, "870Z5E/880Z5E/680Z5E"),
383 .callback
= video_detect_force_video
,
384 /* SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V */
386 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
387 DMI_MATCH(DMI_PRODUCT_NAME
,
388 "370R4E/370R4V/370R5E/3570RE/370R5V"),
392 /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */
393 .callback
= video_detect_force_video
,
394 /* SAMSUNG 3570R/370R/470R/450R/510R/4450RV */
396 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
397 DMI_MATCH(DMI_PRODUCT_NAME
,
398 "3570R/370R/470R/450R/510R/4450RV"),
402 /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */
403 .callback
= video_detect_force_video
,
406 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
407 DMI_MATCH(DMI_PRODUCT_NAME
, "670Z5E"),
411 /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */
412 .callback
= video_detect_force_video
,
413 /* SAMSUNG 730U3E/740U3E */
415 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
416 DMI_MATCH(DMI_PRODUCT_NAME
, "730U3E/740U3E"),
420 /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */
421 .callback
= video_detect_force_video
,
422 /* SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D */
424 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
425 DMI_MATCH(DMI_PRODUCT_NAME
,
426 "900X3C/900X3D/900X3E/900X4C/900X4D"),
430 /* https://bugzilla.redhat.com/show_bug.cgi?id=1272633 */
431 .callback
= video_detect_force_video
,
432 /* Dell XPS14 L421X */
434 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
435 DMI_MATCH(DMI_PRODUCT_NAME
, "XPS L421X"),
439 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
440 .callback
= video_detect_force_video
,
441 /* Dell XPS15 L521X */
443 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
444 DMI_MATCH(DMI_PRODUCT_NAME
, "XPS L521X"),
448 /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */
449 .callback
= video_detect_force_video
,
450 /* SAMSUNG 530U4E/540U4E */
452 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
453 DMI_MATCH(DMI_PRODUCT_NAME
, "530U4E/540U4E"),
457 /* https://bugs.launchpad.net/bugs/1894667 */
458 .callback
= video_detect_force_video
,
459 /* HP 635 Notebook */
461 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
462 DMI_MATCH(DMI_PRODUCT_NAME
, "HP 635 Notebook PC"),
466 /* Non win8 machines which need native backlight nevertheless */
468 /* https://bugzilla.redhat.com/show_bug.cgi?id=1201530 */
469 .callback
= video_detect_force_native
,
470 /* Lenovo Ideapad S405 */
472 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
473 DMI_MATCH(DMI_BOARD_NAME
, "Lenovo IdeaPad S405"),
477 /* https://bugzilla.suse.com/show_bug.cgi?id=1208724 */
478 .callback
= video_detect_force_native
,
479 /* Lenovo Ideapad Z470 */
481 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
482 DMI_MATCH(DMI_PRODUCT_VERSION
, "IdeaPad Z470"),
486 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
487 .callback
= video_detect_force_native
,
488 /* Lenovo Ideapad Z570 */
490 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
491 DMI_MATCH(DMI_PRODUCT_VERSION
, "Ideapad Z570"),
495 .callback
= video_detect_force_native
,
498 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
499 DMI_MATCH(DMI_PRODUCT_NAME
, "81FS"),
503 .callback
= video_detect_force_native
,
506 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
507 DMI_MATCH(DMI_PRODUCT_NAME
, "82BK"),
511 .callback
= video_detect_force_native
,
512 /* Lenovo Slim 7 16ARH7 */
514 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
515 DMI_MATCH(DMI_PRODUCT_NAME
, "82UX"),
519 .callback
= video_detect_force_native
,
520 /* Lenovo ThinkPad X131e (3371 AMD version) */
522 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
523 DMI_MATCH(DMI_PRODUCT_NAME
, "3371"),
527 .callback
= video_detect_force_native
,
530 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
531 DMI_MATCH(DMI_PRODUCT_NAME
, "iMac11,3"),
535 /* https://gitlab.freedesktop.org/drm/amd/-/issues/1838 */
536 .callback
= video_detect_force_native
,
539 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
540 DMI_MATCH(DMI_PRODUCT_NAME
, "iMac12,1"),
544 /* https://gitlab.freedesktop.org/drm/amd/-/issues/2753 */
545 .callback
= video_detect_force_native
,
548 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
549 DMI_MATCH(DMI_PRODUCT_NAME
, "iMac12,2"),
553 .callback
= video_detect_force_native
,
554 /* Apple MacBook Air 9,1 */
556 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
557 DMI_MATCH(DMI_PRODUCT_NAME
, "MacBookAir9,1"),
561 .callback
= video_detect_force_native
,
562 /* Apple MacBook Pro 9,2 */
564 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
565 DMI_MATCH(DMI_PRODUCT_NAME
, "MacBookPro9,2"),
569 /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */
570 .callback
= video_detect_force_native
,
571 /* Apple MacBook Pro 12,1 */
573 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
574 DMI_MATCH(DMI_PRODUCT_NAME
, "MacBookPro12,1"),
578 .callback
= video_detect_force_native
,
579 /* Apple MacBook Pro 16,2 */
581 DMI_MATCH(DMI_SYS_VENDOR
, "Apple Inc."),
582 DMI_MATCH(DMI_PRODUCT_NAME
, "MacBookPro16,2"),
586 .callback
= video_detect_force_native
,
587 /* Dell Inspiron N4010 */
589 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
590 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron N4010"),
594 .callback
= video_detect_force_native
,
595 /* Dell Vostro V131 */
597 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
598 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro V131"),
602 /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */
603 .callback
= video_detect_force_native
,
604 /* Dell XPS 17 L702X */
606 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
607 DMI_MATCH(DMI_PRODUCT_NAME
, "Dell System XPS L702X"),
611 .callback
= video_detect_force_native
,
612 /* Dell Precision 7510 */
614 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
615 DMI_MATCH(DMI_PRODUCT_NAME
, "Precision 7510"),
619 .callback
= video_detect_force_native
,
620 /* Dell Studio 1569 */
622 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
623 DMI_MATCH(DMI_PRODUCT_NAME
, "Studio 1569"),
627 .callback
= video_detect_force_native
,
628 /* Acer Aspire 3830TG */
630 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
631 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 3830TG"),
635 .callback
= video_detect_force_native
,
636 /* Acer Aspire 4810T */
638 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
639 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 4810T"),
643 .callback
= video_detect_force_native
,
644 /* Acer Aspire 5738z */
646 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
647 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5738"),
648 DMI_MATCH(DMI_BOARD_NAME
, "JV50"),
652 /* https://bugzilla.redhat.com/show_bug.cgi?id=1012674 */
653 .callback
= video_detect_force_native
,
654 /* Acer Aspire 5741 */
656 DMI_MATCH(DMI_BOARD_VENDOR
, "Acer"),
657 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5741"),
661 /* https://bugzilla.kernel.org/show_bug.cgi?id=42993 */
662 .callback
= video_detect_force_native
,
663 /* Acer Aspire 5750 */
665 DMI_MATCH(DMI_BOARD_VENDOR
, "Acer"),
666 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5750"),
670 /* https://bugzilla.kernel.org/show_bug.cgi?id=42833 */
671 .callback
= video_detect_force_native
,
672 /* Acer Extensa 5235 */
674 DMI_MATCH(DMI_BOARD_VENDOR
, "Acer"),
675 DMI_MATCH(DMI_PRODUCT_NAME
, "Extensa 5235"),
679 .callback
= video_detect_force_native
,
680 /* Acer TravelMate 4750 */
682 DMI_MATCH(DMI_BOARD_VENDOR
, "Acer"),
683 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 4750"),
687 /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */
688 .callback
= video_detect_force_native
,
689 /* Acer TravelMate 5735Z */
691 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
692 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 5735Z"),
693 DMI_MATCH(DMI_BOARD_NAME
, "BA51_MV"),
697 /* https://bugzilla.kernel.org/show_bug.cgi?id=36322 */
698 .callback
= video_detect_force_native
,
699 /* Acer TravelMate 5760 */
701 DMI_MATCH(DMI_BOARD_VENDOR
, "Acer"),
702 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 5760"),
706 .callback
= video_detect_force_native
,
707 /* ASUSTeK COMPUTER INC. GA401 */
709 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
710 DMI_MATCH(DMI_PRODUCT_NAME
, "GA401"),
714 .callback
= video_detect_force_native
,
715 /* ASUSTeK COMPUTER INC. GA502 */
717 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
718 DMI_MATCH(DMI_PRODUCT_NAME
, "GA502"),
722 .callback
= video_detect_force_native
,
723 /* ASUSTeK COMPUTER INC. GA503 */
725 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
726 DMI_MATCH(DMI_PRODUCT_NAME
, "GA503"),
730 .callback
= video_detect_force_native
,
733 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK Computer Inc."),
734 DMI_MATCH(DMI_PRODUCT_NAME
, "U46E"),
738 .callback
= video_detect_force_native
,
741 DMI_MATCH(DMI_SYS_VENDOR
, "ASUSTeK COMPUTER INC."),
742 DMI_MATCH(DMI_PRODUCT_NAME
, "UX303UB"),
746 .callback
= video_detect_force_native
,
747 /* HP EliteBook 8460p */
749 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
750 DMI_MATCH(DMI_PRODUCT_NAME
, "HP EliteBook 8460p"),
754 .callback
= video_detect_force_native
,
755 /* HP Pavilion g6-1d80nr / B4U19UA */
757 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
758 DMI_MATCH(DMI_PRODUCT_NAME
, "HP Pavilion g6 Notebook PC"),
759 DMI_MATCH(DMI_PRODUCT_SKU
, "B4U19UA"),
763 .callback
= video_detect_force_native
,
766 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
767 DMI_MATCH(DMI_PRODUCT_NAME
, "N150P"),
768 DMI_MATCH(DMI_BOARD_NAME
, "N150P"),
772 .callback
= video_detect_force_native
,
773 /* Samsung N145P/N250P/N260P */
775 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
776 DMI_MATCH(DMI_PRODUCT_NAME
, "N145P/N250P/N260P"),
777 DMI_MATCH(DMI_BOARD_NAME
, "N145P/N250P/N260P"),
781 .callback
= video_detect_force_native
,
784 DMI_MATCH(DMI_SYS_VENDOR
, "SAMSUNG ELECTRONICS CO., LTD."),
785 DMI_MATCH(DMI_PRODUCT_NAME
, "N250P"),
786 DMI_MATCH(DMI_BOARD_NAME
, "N250P"),
790 /* https://bugzilla.kernel.org/show_bug.cgi?id=202401 */
791 .callback
= video_detect_force_native
,
792 /* Sony Vaio VPCEH3U1E */
794 DMI_MATCH(DMI_SYS_VENDOR
, "Sony Corporation"),
795 DMI_MATCH(DMI_PRODUCT_NAME
, "VPCEH3U1E"),
799 .callback
= video_detect_force_native
,
800 /* Sony Vaio VPCY11S1E */
802 DMI_MATCH(DMI_SYS_VENDOR
, "Sony Corporation"),
803 DMI_MATCH(DMI_PRODUCT_NAME
, "VPCY11S1E"),
808 * These Toshibas have a broken acpi-video interface for brightness
809 * control. They also have an issue where the panel is off after
810 * suspend until a special firmware call is made to turn it back
811 * on. This is handled by the toshiba_acpi kernel module, so that
812 * module must be enabled for these models to work correctly.
815 /* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
816 .callback
= video_detect_force_native
,
817 /* Toshiba Portégé R700 */
819 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
820 DMI_MATCH(DMI_PRODUCT_NAME
, "PORTEGE R700"),
824 /* Portégé: https://bugs.freedesktop.org/show_bug.cgi?id=82634 */
825 /* Satellite: https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
826 .callback
= video_detect_force_native
,
827 /* Toshiba Satellite/Portégé R830 */
829 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
830 DMI_MATCH(DMI_PRODUCT_NAME
, "R830"),
834 .callback
= video_detect_force_native
,
835 /* Toshiba Satellite/Portégé Z830 */
837 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
838 DMI_MATCH(DMI_PRODUCT_NAME
, "Z830"),
843 * Dell AIO (All in Ones) which advertise an UART attached backlight
844 * controller board in their ACPI tables (and may even have one), but
845 * which need native backlight control nevertheless.
848 /* https://github.com/zabbly/linux/issues/26 */
849 .callback
= video_detect_force_native
,
850 /* Dell OptiPlex 5480 AIO */
852 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
853 DMI_MATCH(DMI_PRODUCT_NAME
, "OptiPlex 5480 AIO"),
857 /* https://bugzilla.redhat.com/show_bug.cgi?id=2303936 */
858 .callback
= video_detect_force_native
,
859 /* Dell OptiPlex 7760 AIO */
861 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
862 DMI_MATCH(DMI_PRODUCT_NAME
, "OptiPlex 7760 AIO"),
867 * Models which have nvidia-ec-wmi support, but should not use it.
868 * Note this indicates a likely firmware bug on these models and should
869 * be revisited if/when Linux gets support for dynamic mux mode.
872 .callback
= video_detect_force_native
,
875 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
876 DMI_MATCH(DMI_PRODUCT_NAME
, "Dell G15 5515"),
880 .callback
= video_detect_force_native
,
882 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
883 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro 15 3535"),
888 * x86 android tablets which directly control the backlight through
889 * an external backlight controller, typically TI's LP8557.
890 * The backlight is directly controlled by the lp855x driver on these.
891 * This setup means that neither i915's native nor acpi_video backlight
892 * control works. Add a "vendor" quirk to disable both. Note these
893 * devices do not use vendor control in the typical meaning of
894 * vendor specific SMBIOS or ACPI calls being used.
897 .callback
= video_detect_force_vendor
,
898 /* Lenovo Yoga Book X90F / X90L */
900 DMI_EXACT_MATCH(DMI_SYS_VENDOR
, "Intel Corporation"),
901 DMI_EXACT_MATCH(DMI_PRODUCT_NAME
, "CHERRYVIEW D1 PLATFORM"),
902 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION
, "YETI-11"),
906 .callback
= video_detect_force_vendor
,
908 * Lenovo Yoga Tablet 2 830F/L or 1050F/L (The 8" and 10"
909 * Lenovo Yoga Tablet 2 use the same mainboard)
912 DMI_MATCH(DMI_SYS_VENDOR
, "Intel Corp."),
913 DMI_MATCH(DMI_PRODUCT_NAME
, "VALLEYVIEW C0 PLATFORM"),
914 DMI_MATCH(DMI_BOARD_NAME
, "BYT-T FFD8"),
915 /* Partial match on beginning of BIOS version */
916 DMI_MATCH(DMI_BIOS_VERSION
, "BLADE_21"),
920 .callback
= video_detect_force_vendor
,
921 /* Lenovo Yoga Tab 3 Pro YT3-X90F */
923 DMI_MATCH(DMI_SYS_VENDOR
, "Intel Corporation"),
924 DMI_MATCH(DMI_PRODUCT_VERSION
, "Blade3-10A-001"),
928 .callback
= video_detect_force_vendor
,
929 /* Xiaomi Mi Pad 2 */
931 DMI_MATCH(DMI_SYS_VENDOR
, "Xiaomi Inc"),
932 DMI_MATCH(DMI_PRODUCT_NAME
, "Mipad2"),
938 static bool google_cros_ec_present(void)
940 return acpi_dev_found("GOOG0004") || acpi_dev_found("GOOG000C");
944 * Windows 8 and newer no longer use the ACPI video interface, so it often
945 * does not work. So on win8+ systems prefer native brightness control.
946 * Chromebooks should always prefer native backlight control.
948 static bool prefer_native_over_acpi_video(void)
950 return acpi_osi_is_win8() || google_cros_ec_present();
954 * Determine which type of backlight interface to use on this system,
955 * First check cmdline, then dmi quirks, then do autodetect.
957 enum acpi_backlight_type
__acpi_video_get_backlight_type(bool native
, bool *auto_detect
)
959 static DEFINE_MUTEX(init_mutex
);
960 static bool nvidia_wmi_ec_present
;
961 static bool apple_gmux_present
;
962 static bool dell_uart_present
;
963 static bool native_available
;
964 static bool init_done
;
965 static long video_caps
;
967 /* Parse cmdline, dmi and acpi only once */
968 mutex_lock(&init_mutex
);
970 acpi_video_parse_cmdline();
971 dmi_check_system(video_detect_dmi_table
);
972 acpi_walk_namespace(ACPI_TYPE_DEVICE
, ACPI_ROOT_OBJECT
,
973 ACPI_UINT32_MAX
, find_video
, NULL
,
975 nvidia_wmi_ec_present
= nvidia_wmi_ec_supported();
976 apple_gmux_present
= apple_gmux_detect(NULL
, NULL
);
977 dell_uart_present
= acpi_dev_present("DELL0501", NULL
, -1);
981 native_available
= true;
982 mutex_unlock(&init_mutex
);
985 *auto_detect
= false;
988 * The below heuristics / detection steps are in order of descending
989 * presedence. The commandline takes presedence over anything else.
991 if (acpi_backlight_cmdline
!= acpi_backlight_undef
)
992 return acpi_backlight_cmdline
;
994 /* DMI quirks override any autodetection. */
995 if (acpi_backlight_dmi
!= acpi_backlight_undef
)
996 return acpi_backlight_dmi
;
1001 /* Special cases such as nvidia_wmi_ec and apple gmux. */
1002 if (nvidia_wmi_ec_present
)
1003 return acpi_backlight_nvidia_wmi_ec
;
1005 if (apple_gmux_present
)
1006 return acpi_backlight_apple_gmux
;
1008 if (dell_uart_present
)
1009 return acpi_backlight_dell_uart
;
1011 /* Use ACPI video if available, except when native should be preferred. */
1012 if ((video_caps
& ACPI_VIDEO_BACKLIGHT
) &&
1013 !(native_available
&& prefer_native_over_acpi_video()))
1014 return acpi_backlight_video
;
1016 /* Use native if available */
1017 if (native_available
)
1018 return acpi_backlight_native
;
1021 * The vendor specific BIOS interfaces are only necessary for
1022 * laptops from before ~2008.
1024 * For laptops from ~2008 till ~2023 this point is never reached
1025 * because on those (video_caps & ACPI_VIDEO_BACKLIGHT) above is true.
1027 * Laptops from after ~2023 no longer support ACPI_VIDEO_BACKLIGHT,
1028 * if this point is reached on those, this likely means that
1029 * the GPU kms driver which sets native_available has not loaded yet.
1031 * Returning acpi_backlight_vendor in this case is known to sometimes
1032 * cause a non working vendor specific /sys/class/backlight device to
1035 * Return acpi_backlight_none on laptops with ACPI tables written
1036 * for Windows 8 (laptops from after ~2012) to avoid this problem.
1038 if (acpi_osi_is_win8())
1039 return acpi_backlight_none
;
1041 /* No ACPI video/native (old hw), use vendor specific fw methods. */
1042 return acpi_backlight_vendor
;
1044 EXPORT_SYMBOL(__acpi_video_get_backlight_type
);