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/types.h>
38 #include <linux/workqueue.h>
39 #include <acpi/video.h>
41 static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef;
42 static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef;
44 static void acpi_video_parse_cmdline(void)
46 if (!strcmp("vendor", acpi_video_backlight_string))
47 acpi_backlight_cmdline = acpi_backlight_vendor;
48 if (!strcmp("video", acpi_video_backlight_string))
49 acpi_backlight_cmdline = acpi_backlight_video;
50 if (!strcmp("native", acpi_video_backlight_string))
51 acpi_backlight_cmdline = acpi_backlight_native;
52 if (!strcmp("none", acpi_video_backlight_string))
53 acpi_backlight_cmdline = acpi_backlight_none;
57 find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
59 struct acpi_device *acpi_dev = acpi_fetch_acpi_dev(handle);
63 static const struct acpi_device_id video_ids[] = {
68 if (acpi_dev && !acpi_match_device_ids(acpi_dev, video_ids)) {
69 dev = acpi_get_pci_dev(handle);
73 *cap |= acpi_is_video_device(handle);
78 /* This depends on ACPI_WMI which is X86 only */
80 static bool nvidia_wmi_ec_supported(void)
82 struct wmi_brightness_args args = {
83 .mode = WMI_BRIGHTNESS_MODE_GET,
87 struct acpi_buffer buf = { (acpi_size)sizeof(args), &args };
90 status = wmi_evaluate_method(WMI_BRIGHTNESS_GUID, 0,
91 WMI_BRIGHTNESS_METHOD_SOURCE, &buf, &buf);
92 if (ACPI_FAILURE(status))
96 * If brightness is handled by the EC then nvidia-wmi-ec-backlight
97 * should be used, else the GPU driver(s) should be used.
99 return args.ret == WMI_BRIGHTNESS_SOURCE_EC;
102 static bool nvidia_wmi_ec_supported(void)
108 /* Force to use vendor driver when the ACPI device is known to be
110 static int video_detect_force_vendor(const struct dmi_system_id *d)
112 acpi_backlight_dmi = acpi_backlight_vendor;
116 static int video_detect_force_video(const struct dmi_system_id *d)
118 acpi_backlight_dmi = acpi_backlight_video;
122 static int video_detect_force_native(const struct dmi_system_id *d)
124 acpi_backlight_dmi = acpi_backlight_native;
128 static int video_detect_force_none(const struct dmi_system_id *d)
130 acpi_backlight_dmi = acpi_backlight_none;
134 static const struct dmi_system_id video_detect_dmi_table[] = {
136 /* https://bugzilla.redhat.com/show_bug.cgi?id=1128309 */
137 .callback = video_detect_force_vendor,
140 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
141 DMI_MATCH(DMI_PRODUCT_NAME, "KAV80"),
145 .callback = video_detect_force_vendor,
148 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
149 DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"),
153 .callback = video_detect_force_vendor,
156 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
157 DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
161 .callback = video_detect_force_vendor,
164 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
165 DMI_MATCH(DMI_PRODUCT_NAME, "X55U"),
169 .callback = video_detect_force_vendor,
172 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
173 DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
177 .callback = video_detect_force_vendor,
180 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
181 DMI_MATCH(DMI_PRODUCT_NAME, "X401U"),
185 .callback = video_detect_force_vendor,
188 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
189 DMI_MATCH(DMI_PRODUCT_NAME, "X501U"),
193 .callback = video_detect_force_vendor,
196 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
197 DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
201 .callback = video_detect_force_vendor,
202 /* GIGABYTE GB-BXBT-2807 */
204 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
205 DMI_MATCH(DMI_PRODUCT_NAME, "GB-BXBT-2807"),
209 .callback = video_detect_force_vendor,
210 /* Samsung N150/N210/N220 */
212 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
213 DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
214 DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
218 .callback = video_detect_force_vendor,
219 /* Samsung NF110/NF210/NF310 */
221 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
222 DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
223 DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
227 .callback = video_detect_force_vendor,
230 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
231 DMI_MATCH(DMI_PRODUCT_NAME, "NC210/NC110"),
232 DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
236 .callback = video_detect_force_vendor,
239 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
240 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"),
244 .callback = video_detect_force_vendor,
245 /* Xiaomi Mi Pad 2 */
247 DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
248 DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
253 * Toshiba models with Transflective display, these need to use
254 * the toshiba_acpi vendor driver for proper Transflective handling.
257 .callback = video_detect_force_vendor,
259 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
260 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R500"),
264 .callback = video_detect_force_vendor,
266 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
267 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R600"),
272 * These models have a working acpi_video backlight control, and using
273 * native backlight causes a regression where backlight does not work
274 * when userspace is not handling brightness key events. Disable
275 * native_backlight on these to fix this:
276 * https://bugzilla.kernel.org/show_bug.cgi?id=81691
279 .callback = video_detect_force_video,
282 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
283 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"),
287 .callback = video_detect_force_video,
290 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
291 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"),
295 .callback = video_detect_force_video,
298 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
299 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
303 .callback = video_detect_force_video,
306 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
307 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"),
311 /* The native backlight controls do not work on some older machines */
313 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */
314 .callback = video_detect_force_video,
315 /* HP ENVY 15 Notebook */
317 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
318 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),
322 .callback = video_detect_force_video,
323 /* SAMSUNG 870Z5E/880Z5E/680Z5E */
325 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
326 DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"),
330 .callback = video_detect_force_video,
331 /* SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V */
333 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
334 DMI_MATCH(DMI_PRODUCT_NAME,
335 "370R4E/370R4V/370R5E/3570RE/370R5V"),
339 /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */
340 .callback = video_detect_force_video,
341 /* SAMSUNG 3570R/370R/470R/450R/510R/4450RV */
343 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
344 DMI_MATCH(DMI_PRODUCT_NAME,
345 "3570R/370R/470R/450R/510R/4450RV"),
349 /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */
350 .callback = video_detect_force_video,
353 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
354 DMI_MATCH(DMI_PRODUCT_NAME, "670Z5E"),
358 /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */
359 .callback = video_detect_force_video,
360 /* SAMSUNG 730U3E/740U3E */
362 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
363 DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"),
367 /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */
368 .callback = video_detect_force_video,
369 /* SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D */
371 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
372 DMI_MATCH(DMI_PRODUCT_NAME,
373 "900X3C/900X3D/900X3E/900X4C/900X4D"),
377 /* https://bugzilla.redhat.com/show_bug.cgi?id=1272633 */
378 .callback = video_detect_force_video,
379 /* Dell XPS14 L421X */
381 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
382 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"),
386 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
387 .callback = video_detect_force_video,
388 /* Dell XPS15 L521X */
390 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
391 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
395 /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */
396 .callback = video_detect_force_video,
397 /* SAMSUNG 530U4E/540U4E */
399 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
400 DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"),
403 /* https://bugs.launchpad.net/bugs/1894667 */
405 .callback = video_detect_force_video,
406 /* HP 635 Notebook */
408 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
409 DMI_MATCH(DMI_PRODUCT_NAME, "HP 635 Notebook PC"),
413 /* Non win8 machines which need native backlight nevertheless */
415 /* https://bugzilla.redhat.com/show_bug.cgi?id=1201530 */
416 .callback = video_detect_force_native,
417 /* Lenovo Ideapad S405 */
419 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
420 DMI_MATCH(DMI_BOARD_NAME, "Lenovo IdeaPad S405"),
424 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
425 .callback = video_detect_force_native,
426 /* Lenovo Ideapad Z570 */
428 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
429 DMI_MATCH(DMI_PRODUCT_NAME, "102434U"),
433 .callback = video_detect_force_native,
436 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
437 DMI_MATCH(DMI_PRODUCT_NAME, "81FS"),
441 .callback = video_detect_force_native,
444 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
445 DMI_MATCH(DMI_PRODUCT_NAME, "82BK"),
449 /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */
450 .callback = video_detect_force_native,
451 /* Apple MacBook Pro 12,1 */
453 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
454 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"),
458 .callback = video_detect_force_native,
459 /* Dell Inspiron N4010 */
461 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
462 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N4010"),
466 .callback = video_detect_force_native,
467 /* Dell Vostro V131 */
469 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
470 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),
474 /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */
475 .callback = video_detect_force_native,
476 /* Dell XPS 17 L702X */
478 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
479 DMI_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L702X"),
483 .callback = video_detect_force_native,
484 /* Dell Precision 7510 */
486 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
487 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7510"),
491 .callback = video_detect_force_native,
492 /* Acer Aspire 5738z */
494 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
495 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
496 DMI_MATCH(DMI_BOARD_NAME, "JV50"),
500 /* https://bugzilla.redhat.com/show_bug.cgi?id=1012674 */
501 .callback = video_detect_force_native,
502 /* Acer Aspire 5741 */
504 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
505 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"),
509 /* https://bugzilla.kernel.org/show_bug.cgi?id=42993 */
510 .callback = video_detect_force_native,
511 /* Acer Aspire 5750 */
513 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
514 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5750"),
518 /* https://bugzilla.kernel.org/show_bug.cgi?id=42833 */
519 .callback = video_detect_force_native,
520 /* Acer Extensa 5235 */
522 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
523 DMI_MATCH(DMI_PRODUCT_NAME, "Extensa 5235"),
527 .callback = video_detect_force_native,
528 /* Acer TravelMate 4750 */
530 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
531 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4750"),
535 /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */
536 .callback = video_detect_force_native,
537 /* Acer TravelMate 5735Z */
539 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
540 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5735Z"),
541 DMI_MATCH(DMI_BOARD_NAME, "BA51_MV"),
545 /* https://bugzilla.kernel.org/show_bug.cgi?id=36322 */
546 .callback = video_detect_force_native,
547 /* Acer TravelMate 5760 */
549 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
550 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5760"),
554 .callback = video_detect_force_native,
555 /* ASUSTeK COMPUTER INC. GA401 */
557 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
558 DMI_MATCH(DMI_PRODUCT_NAME, "GA401"),
562 .callback = video_detect_force_native,
563 /* ASUSTeK COMPUTER INC. GA502 */
565 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
566 DMI_MATCH(DMI_PRODUCT_NAME, "GA502"),
570 .callback = video_detect_force_native,
571 /* ASUSTeK COMPUTER INC. GA503 */
573 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
574 DMI_MATCH(DMI_PRODUCT_NAME, "GA503"),
578 .callback = video_detect_force_native,
581 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
582 DMI_MATCH(DMI_PRODUCT_NAME, "UX303UB"),
586 .callback = video_detect_force_native,
589 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
590 DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
591 DMI_MATCH(DMI_BOARD_NAME, "N150P"),
595 .callback = video_detect_force_native,
596 /* Samsung N145P/N250P/N260P */
598 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
599 DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
600 DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
604 .callback = video_detect_force_native,
607 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
608 DMI_MATCH(DMI_PRODUCT_NAME, "N250P"),
609 DMI_MATCH(DMI_BOARD_NAME, "N250P"),
614 * These Toshibas have a broken acpi-video interface for brightness
615 * control. They also have an issue where the panel is off after
616 * suspend until a special firmware call is made to turn it back
617 * on. This is handled by the toshiba_acpi kernel module, so that
618 * module must be enabled for these models to work correctly.
621 /* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
622 .callback = video_detect_force_native,
623 /* Toshiba Portégé R700 */
625 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
626 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R700"),
630 /* Portégé: https://bugs.freedesktop.org/show_bug.cgi?id=82634 */
631 /* Satellite: https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
632 .callback = video_detect_force_native,
633 /* Toshiba Satellite/Portégé R830 */
635 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
636 DMI_MATCH(DMI_PRODUCT_NAME, "R830"),
640 .callback = video_detect_force_native,
641 /* Toshiba Satellite/Portégé Z830 */
643 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
644 DMI_MATCH(DMI_PRODUCT_NAME, "Z830"),
649 * Models which have nvidia-ec-wmi support, but should not use it.
650 * Note this indicates a likely firmware bug on these models and should
651 * be revisited if/when Linux gets support for dynamic mux mode.
654 .callback = video_detect_force_native,
657 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
658 DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"),
663 * Desktops which falsely report a backlight and which our heuristics
664 * for this do not catch.
667 .callback = video_detect_force_none,
668 /* Dell OptiPlex 9020M */
670 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
671 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 9020M"),
675 .callback = video_detect_force_none,
678 DMI_MATCH(DMI_SYS_VENDOR, "MSI"),
679 DMI_MATCH(DMI_PRODUCT_NAME, "MS-7721"),
685 static bool google_cros_ec_present(void)
687 return acpi_dev_found("GOOG0004") || acpi_dev_found("GOOG000C");
691 * Determine which type of backlight interface to use on this system,
692 * First check cmdline, then dmi quirks, then do autodetect.
694 static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
696 static DEFINE_MUTEX(init_mutex);
697 static bool nvidia_wmi_ec_present;
698 static bool native_available;
699 static bool init_done;
700 static long video_caps;
702 /* Parse cmdline, dmi and acpi only once */
703 mutex_lock(&init_mutex);
705 acpi_video_parse_cmdline();
706 dmi_check_system(video_detect_dmi_table);
707 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
708 ACPI_UINT32_MAX, find_video, NULL,
710 nvidia_wmi_ec_present = nvidia_wmi_ec_supported();
714 native_available = true;
715 mutex_unlock(&init_mutex);
718 * The below heuristics / detection steps are in order of descending
719 * presedence. The commandline takes presedence over anything else.
721 if (acpi_backlight_cmdline != acpi_backlight_undef)
722 return acpi_backlight_cmdline;
724 /* DMI quirks override any autodetection. */
725 if (acpi_backlight_dmi != acpi_backlight_undef)
726 return acpi_backlight_dmi;
728 /* Special cases such as nvidia_wmi_ec and apple gmux. */
729 if (nvidia_wmi_ec_present)
730 return acpi_backlight_nvidia_wmi_ec;
732 if (apple_gmux_present())
733 return acpi_backlight_apple_gmux;
735 /* Chromebooks should always prefer native backlight control. */
736 if (google_cros_ec_present() && native_available)
737 return acpi_backlight_native;
739 /* On systems with ACPI video use either native or ACPI video. */
740 if (video_caps & ACPI_VIDEO_BACKLIGHT) {
742 * Windows 8 and newer no longer use the ACPI video interface,
743 * so it often does not work. If the ACPI tables are written
744 * for win8 and native brightness ctl is available, use that.
746 * The native check deliberately is inside the if acpi-video
747 * block on older devices without acpi-video support native
748 * is usually not the best choice.
750 if (acpi_osi_is_win8() && native_available)
751 return acpi_backlight_native;
753 return acpi_backlight_video;
756 /* No ACPI video (old hw), use vendor specific fw methods. */
757 return acpi_backlight_vendor;
760 enum acpi_backlight_type acpi_video_get_backlight_type(void)
762 return __acpi_video_get_backlight_type(false);
764 EXPORT_SYMBOL(acpi_video_get_backlight_type);
766 bool acpi_video_backlight_use_native(void)
769 * Call __acpi_video_get_backlight_type() to let it know that
770 * a native backlight is available.
772 __acpi_video_get_backlight_type(true);
775 * For now just always return true. There is a whole bunch of laptop
776 * models where (video_caps & ACPI_VIDEO_BACKLIGHT) is false causing
777 * __acpi_video_get_backlight_type() to return vendor, while these
778 * models only have a native backlight control.
782 EXPORT_SYMBOL(acpi_video_backlight_use_native);