18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (C) 2015 Red Hat Inc. 38c2ecf20Sopenharmony_ci * Hans de Goede <hdegoede@redhat.com> 48c2ecf20Sopenharmony_ci * Copyright (C) 2008 SuSE Linux Products GmbH 58c2ecf20Sopenharmony_ci * Thomas Renninger <trenn@suse.de> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * May be copied or modified under the terms of the GNU General Public License 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * video_detect.c: 108c2ecf20Sopenharmony_ci * After PCI devices are glued with ACPI devices 118c2ecf20Sopenharmony_ci * acpi_get_pci_dev() can be called to identify ACPI graphics 128c2ecf20Sopenharmony_ci * devices for which a real graphics card is plugged in 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B) 158c2ecf20Sopenharmony_ci * are available, video.ko should be used to handle the device. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * Otherwise vendor specific drivers like thinkpad_acpi, asus-laptop, 188c2ecf20Sopenharmony_ci * sony_acpi,... can take care about backlight brightness. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Backlight drivers can use acpi_video_get_backlight_type() to determine 218c2ecf20Sopenharmony_ci * which driver should handle the backlight. 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m) 248c2ecf20Sopenharmony_ci * this file will not be compiled and acpi_video_get_backlight_type() will 258c2ecf20Sopenharmony_ci * always return acpi_backlight_vendor. 268c2ecf20Sopenharmony_ci */ 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#include <linux/export.h> 298c2ecf20Sopenharmony_ci#include <linux/acpi.h> 308c2ecf20Sopenharmony_ci#include <linux/backlight.h> 318c2ecf20Sopenharmony_ci#include <linux/dmi.h> 328c2ecf20Sopenharmony_ci#include <linux/module.h> 338c2ecf20Sopenharmony_ci#include <linux/pci.h> 348c2ecf20Sopenharmony_ci#include <linux/types.h> 358c2ecf20Sopenharmony_ci#include <linux/workqueue.h> 368c2ecf20Sopenharmony_ci#include <acpi/video.h> 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_civoid acpi_video_unregister_backlight(void); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cistatic bool backlight_notifier_registered; 418c2ecf20Sopenharmony_cistatic struct notifier_block backlight_nb; 428c2ecf20Sopenharmony_cistatic struct work_struct backlight_notify_work; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; 458c2ecf20Sopenharmony_cistatic enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistatic void acpi_video_parse_cmdline(void) 488c2ecf20Sopenharmony_ci{ 498c2ecf20Sopenharmony_ci if (!strcmp("vendor", acpi_video_backlight_string)) 508c2ecf20Sopenharmony_ci acpi_backlight_cmdline = acpi_backlight_vendor; 518c2ecf20Sopenharmony_ci if (!strcmp("video", acpi_video_backlight_string)) 528c2ecf20Sopenharmony_ci acpi_backlight_cmdline = acpi_backlight_video; 538c2ecf20Sopenharmony_ci if (!strcmp("native", acpi_video_backlight_string)) 548c2ecf20Sopenharmony_ci acpi_backlight_cmdline = acpi_backlight_native; 558c2ecf20Sopenharmony_ci if (!strcmp("none", acpi_video_backlight_string)) 568c2ecf20Sopenharmony_ci acpi_backlight_cmdline = acpi_backlight_none; 578c2ecf20Sopenharmony_ci} 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistatic acpi_status 608c2ecf20Sopenharmony_cifind_video(acpi_handle handle, u32 lvl, void *context, void **rv) 618c2ecf20Sopenharmony_ci{ 628c2ecf20Sopenharmony_ci long *cap = context; 638c2ecf20Sopenharmony_ci struct pci_dev *dev; 648c2ecf20Sopenharmony_ci struct acpi_device *acpi_dev; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci static const struct acpi_device_id video_ids[] = { 678c2ecf20Sopenharmony_ci {ACPI_VIDEO_HID, 0}, 688c2ecf20Sopenharmony_ci {"", 0}, 698c2ecf20Sopenharmony_ci }; 708c2ecf20Sopenharmony_ci if (acpi_bus_get_device(handle, &acpi_dev)) 718c2ecf20Sopenharmony_ci return AE_OK; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci if (!acpi_match_device_ids(acpi_dev, video_ids)) { 748c2ecf20Sopenharmony_ci dev = acpi_get_pci_dev(handle); 758c2ecf20Sopenharmony_ci if (!dev) 768c2ecf20Sopenharmony_ci return AE_OK; 778c2ecf20Sopenharmony_ci pci_dev_put(dev); 788c2ecf20Sopenharmony_ci *cap |= acpi_is_video_device(handle); 798c2ecf20Sopenharmony_ci } 808c2ecf20Sopenharmony_ci return AE_OK; 818c2ecf20Sopenharmony_ci} 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* Force to use vendor driver when the ACPI device is known to be 848c2ecf20Sopenharmony_ci * buggy */ 858c2ecf20Sopenharmony_cistatic int video_detect_force_vendor(const struct dmi_system_id *d) 868c2ecf20Sopenharmony_ci{ 878c2ecf20Sopenharmony_ci acpi_backlight_dmi = acpi_backlight_vendor; 888c2ecf20Sopenharmony_ci return 0; 898c2ecf20Sopenharmony_ci} 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistatic int video_detect_force_video(const struct dmi_system_id *d) 928c2ecf20Sopenharmony_ci{ 938c2ecf20Sopenharmony_ci acpi_backlight_dmi = acpi_backlight_video; 948c2ecf20Sopenharmony_ci return 0; 958c2ecf20Sopenharmony_ci} 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic int video_detect_force_native(const struct dmi_system_id *d) 988c2ecf20Sopenharmony_ci{ 998c2ecf20Sopenharmony_ci acpi_backlight_dmi = acpi_backlight_native; 1008c2ecf20Sopenharmony_ci return 0; 1018c2ecf20Sopenharmony_ci} 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cistatic int video_detect_force_none(const struct dmi_system_id *d) 1048c2ecf20Sopenharmony_ci{ 1058c2ecf20Sopenharmony_ci acpi_backlight_dmi = acpi_backlight_none; 1068c2ecf20Sopenharmony_ci return 0; 1078c2ecf20Sopenharmony_ci} 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic const struct dmi_system_id video_detect_dmi_table[] = { 1108c2ecf20Sopenharmony_ci /* On Samsung X360, the BIOS will set a flag (VDRV) if generic 1118c2ecf20Sopenharmony_ci * ACPI backlight device is used. This flag will definitively break 1128c2ecf20Sopenharmony_ci * the backlight interface (even the vendor interface) until next 1138c2ecf20Sopenharmony_ci * reboot. It's why we should prevent video.ko from being used here 1148c2ecf20Sopenharmony_ci * and we can't rely on a later call to acpi_video_unregister(). 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_ci { 1178c2ecf20Sopenharmony_ci .callback = video_detect_force_vendor, 1188c2ecf20Sopenharmony_ci .ident = "X360", 1198c2ecf20Sopenharmony_ci .matches = { 1208c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1218c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "X360"), 1228c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "X360"), 1238c2ecf20Sopenharmony_ci }, 1248c2ecf20Sopenharmony_ci }, 1258c2ecf20Sopenharmony_ci { 1268c2ecf20Sopenharmony_ci .callback = video_detect_force_vendor, 1278c2ecf20Sopenharmony_ci .ident = "Asus UL30VT", 1288c2ecf20Sopenharmony_ci .matches = { 1298c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), 1308c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), 1318c2ecf20Sopenharmony_ci }, 1328c2ecf20Sopenharmony_ci }, 1338c2ecf20Sopenharmony_ci { 1348c2ecf20Sopenharmony_ci .callback = video_detect_force_vendor, 1358c2ecf20Sopenharmony_ci .ident = "Asus UL30A", 1368c2ecf20Sopenharmony_ci .matches = { 1378c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), 1388c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), 1398c2ecf20Sopenharmony_ci }, 1408c2ecf20Sopenharmony_ci }, 1418c2ecf20Sopenharmony_ci { 1428c2ecf20Sopenharmony_ci .callback = video_detect_force_vendor, 1438c2ecf20Sopenharmony_ci .ident = "GIGABYTE GB-BXBT-2807", 1448c2ecf20Sopenharmony_ci .matches = { 1458c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), 1468c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "GB-BXBT-2807"), 1478c2ecf20Sopenharmony_ci }, 1488c2ecf20Sopenharmony_ci }, 1498c2ecf20Sopenharmony_ci { 1508c2ecf20Sopenharmony_ci .callback = video_detect_force_vendor, 1518c2ecf20Sopenharmony_ci .ident = "Sony VPCEH3U1E", 1528c2ecf20Sopenharmony_ci .matches = { 1538c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 1548c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"), 1558c2ecf20Sopenharmony_ci }, 1568c2ecf20Sopenharmony_ci }, 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci /* 1598c2ecf20Sopenharmony_ci * These models have a working acpi_video backlight control, and using 1608c2ecf20Sopenharmony_ci * native backlight causes a regression where backlight does not work 1618c2ecf20Sopenharmony_ci * when userspace is not handling brightness key events. Disable 1628c2ecf20Sopenharmony_ci * native_backlight on these to fix this: 1638c2ecf20Sopenharmony_ci * https://bugzilla.kernel.org/show_bug.cgi?id=81691 1648c2ecf20Sopenharmony_ci */ 1658c2ecf20Sopenharmony_ci { 1668c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 1678c2ecf20Sopenharmony_ci .ident = "ThinkPad T420", 1688c2ecf20Sopenharmony_ci .matches = { 1698c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1708c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"), 1718c2ecf20Sopenharmony_ci }, 1728c2ecf20Sopenharmony_ci }, 1738c2ecf20Sopenharmony_ci { 1748c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 1758c2ecf20Sopenharmony_ci .ident = "ThinkPad T520", 1768c2ecf20Sopenharmony_ci .matches = { 1778c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1788c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), 1798c2ecf20Sopenharmony_ci }, 1808c2ecf20Sopenharmony_ci }, 1818c2ecf20Sopenharmony_ci { 1828c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 1838c2ecf20Sopenharmony_ci .ident = "ThinkPad X201s", 1848c2ecf20Sopenharmony_ci .matches = { 1858c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1868c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"), 1878c2ecf20Sopenharmony_ci }, 1888c2ecf20Sopenharmony_ci }, 1898c2ecf20Sopenharmony_ci { 1908c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 1918c2ecf20Sopenharmony_ci .ident = "ThinkPad X201T", 1928c2ecf20Sopenharmony_ci .matches = { 1938c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1948c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"), 1958c2ecf20Sopenharmony_ci }, 1968c2ecf20Sopenharmony_ci }, 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci /* The native backlight controls do not work on some older machines */ 1998c2ecf20Sopenharmony_ci { 2008c2ecf20Sopenharmony_ci /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */ 2018c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2028c2ecf20Sopenharmony_ci .ident = "HP ENVY 15 Notebook", 2038c2ecf20Sopenharmony_ci .matches = { 2048c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 2058c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"), 2068c2ecf20Sopenharmony_ci }, 2078c2ecf20Sopenharmony_ci }, 2088c2ecf20Sopenharmony_ci { 2098c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2108c2ecf20Sopenharmony_ci .ident = "SAMSUNG 870Z5E/880Z5E/680Z5E", 2118c2ecf20Sopenharmony_ci .matches = { 2128c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2138c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"), 2148c2ecf20Sopenharmony_ci }, 2158c2ecf20Sopenharmony_ci }, 2168c2ecf20Sopenharmony_ci { 2178c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2188c2ecf20Sopenharmony_ci .ident = "SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V", 2198c2ecf20Sopenharmony_ci .matches = { 2208c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2218c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, 2228c2ecf20Sopenharmony_ci "370R4E/370R4V/370R5E/3570RE/370R5V"), 2238c2ecf20Sopenharmony_ci }, 2248c2ecf20Sopenharmony_ci }, 2258c2ecf20Sopenharmony_ci { 2268c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */ 2278c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2288c2ecf20Sopenharmony_ci .ident = "SAMSUNG 3570R/370R/470R/450R/510R/4450RV", 2298c2ecf20Sopenharmony_ci .matches = { 2308c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2318c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, 2328c2ecf20Sopenharmony_ci "3570R/370R/470R/450R/510R/4450RV"), 2338c2ecf20Sopenharmony_ci }, 2348c2ecf20Sopenharmony_ci }, 2358c2ecf20Sopenharmony_ci { 2368c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */ 2378c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2388c2ecf20Sopenharmony_ci .ident = "SAMSUNG 670Z5E", 2398c2ecf20Sopenharmony_ci .matches = { 2408c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2418c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "670Z5E"), 2428c2ecf20Sopenharmony_ci }, 2438c2ecf20Sopenharmony_ci }, 2448c2ecf20Sopenharmony_ci { 2458c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */ 2468c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2478c2ecf20Sopenharmony_ci .ident = "SAMSUNG 730U3E/740U3E", 2488c2ecf20Sopenharmony_ci .matches = { 2498c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2508c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"), 2518c2ecf20Sopenharmony_ci }, 2528c2ecf20Sopenharmony_ci }, 2538c2ecf20Sopenharmony_ci { 2548c2ecf20Sopenharmony_ci /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */ 2558c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2568c2ecf20Sopenharmony_ci .ident = "SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D", 2578c2ecf20Sopenharmony_ci .matches = { 2588c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2598c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, 2608c2ecf20Sopenharmony_ci "900X3C/900X3D/900X3E/900X4C/900X4D"), 2618c2ecf20Sopenharmony_ci }, 2628c2ecf20Sopenharmony_ci }, 2638c2ecf20Sopenharmony_ci { 2648c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1272633 */ 2658c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2668c2ecf20Sopenharmony_ci .ident = "Dell XPS14 L421X", 2678c2ecf20Sopenharmony_ci .matches = { 2688c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 2698c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"), 2708c2ecf20Sopenharmony_ci }, 2718c2ecf20Sopenharmony_ci }, 2728c2ecf20Sopenharmony_ci { 2738c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */ 2748c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2758c2ecf20Sopenharmony_ci .ident = "Dell XPS15 L521X", 2768c2ecf20Sopenharmony_ci .matches = { 2778c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 2788c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"), 2798c2ecf20Sopenharmony_ci }, 2808c2ecf20Sopenharmony_ci }, 2818c2ecf20Sopenharmony_ci { 2828c2ecf20Sopenharmony_ci /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */ 2838c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2848c2ecf20Sopenharmony_ci .ident = "SAMSUNG 530U4E/540U4E", 2858c2ecf20Sopenharmony_ci .matches = { 2868c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 2878c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"), 2888c2ecf20Sopenharmony_ci }, 2898c2ecf20Sopenharmony_ci }, 2908c2ecf20Sopenharmony_ci /* https://bugs.launchpad.net/bugs/1894667 */ 2918c2ecf20Sopenharmony_ci { 2928c2ecf20Sopenharmony_ci .callback = video_detect_force_video, 2938c2ecf20Sopenharmony_ci .ident = "HP 635 Notebook", 2948c2ecf20Sopenharmony_ci .matches = { 2958c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 2968c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "HP 635 Notebook PC"), 2978c2ecf20Sopenharmony_ci }, 2988c2ecf20Sopenharmony_ci }, 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci /* Non win8 machines which need native backlight nevertheless */ 3018c2ecf20Sopenharmony_ci { 3028c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1201530 */ 3038c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3048c2ecf20Sopenharmony_ci .ident = "Lenovo Ideapad S405", 3058c2ecf20Sopenharmony_ci .matches = { 3068c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 3078c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "Lenovo IdeaPad S405"), 3088c2ecf20Sopenharmony_ci }, 3098c2ecf20Sopenharmony_ci }, 3108c2ecf20Sopenharmony_ci { 3118c2ecf20Sopenharmony_ci /* https://bugzilla.suse.com/show_bug.cgi?id=1208724 */ 3128c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3138c2ecf20Sopenharmony_ci /* Lenovo Ideapad Z470 */ 3148c2ecf20Sopenharmony_ci .matches = { 3158c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 3168c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_VERSION, "IdeaPad Z470"), 3178c2ecf20Sopenharmony_ci }, 3188c2ecf20Sopenharmony_ci }, 3198c2ecf20Sopenharmony_ci { 3208c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */ 3218c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3228c2ecf20Sopenharmony_ci .ident = "Lenovo Ideapad Z570", 3238c2ecf20Sopenharmony_ci .matches = { 3248c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 3258c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_VERSION, "Ideapad Z570"), 3268c2ecf20Sopenharmony_ci }, 3278c2ecf20Sopenharmony_ci }, 3288c2ecf20Sopenharmony_ci { 3298c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3308c2ecf20Sopenharmony_ci .ident = "Lenovo E41-25", 3318c2ecf20Sopenharmony_ci .matches = { 3328c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 3338c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "81FS"), 3348c2ecf20Sopenharmony_ci }, 3358c2ecf20Sopenharmony_ci }, 3368c2ecf20Sopenharmony_ci { 3378c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3388c2ecf20Sopenharmony_ci .ident = "Lenovo E41-45", 3398c2ecf20Sopenharmony_ci .matches = { 3408c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 3418c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "82BK"), 3428c2ecf20Sopenharmony_ci }, 3438c2ecf20Sopenharmony_ci }, 3448c2ecf20Sopenharmony_ci { 3458c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3468c2ecf20Sopenharmony_ci /* Lenovo ThinkPad X131e (3371 AMD version) */ 3478c2ecf20Sopenharmony_ci .matches = { 3488c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 3498c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "3371"), 3508c2ecf20Sopenharmony_ci }, 3518c2ecf20Sopenharmony_ci }, 3528c2ecf20Sopenharmony_ci { 3538c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3548c2ecf20Sopenharmony_ci /* Apple iMac11,3 */ 3558c2ecf20Sopenharmony_ci .matches = { 3568c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 3578c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "iMac11,3"), 3588c2ecf20Sopenharmony_ci }, 3598c2ecf20Sopenharmony_ci }, 3608c2ecf20Sopenharmony_ci { 3618c2ecf20Sopenharmony_ci /* https://gitlab.freedesktop.org/drm/amd/-/issues/1838 */ 3628c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3638c2ecf20Sopenharmony_ci /* Apple iMac12,1 */ 3648c2ecf20Sopenharmony_ci .matches = { 3658c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 3668c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "iMac12,1"), 3678c2ecf20Sopenharmony_ci }, 3688c2ecf20Sopenharmony_ci }, 3698c2ecf20Sopenharmony_ci { 3708c2ecf20Sopenharmony_ci /* https://gitlab.freedesktop.org/drm/amd/-/issues/2753 */ 3718c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3728c2ecf20Sopenharmony_ci /* Apple iMac12,2 */ 3738c2ecf20Sopenharmony_ci .matches = { 3748c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 3758c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "iMac12,2"), 3768c2ecf20Sopenharmony_ci }, 3778c2ecf20Sopenharmony_ci }, 3788c2ecf20Sopenharmony_ci { 3798c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */ 3808c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3818c2ecf20Sopenharmony_ci .ident = "Apple MacBook Pro 12,1", 3828c2ecf20Sopenharmony_ci .matches = { 3838c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 3848c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"), 3858c2ecf20Sopenharmony_ci }, 3868c2ecf20Sopenharmony_ci }, 3878c2ecf20Sopenharmony_ci { 3888c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3898c2ecf20Sopenharmony_ci .ident = "Dell Vostro V131", 3908c2ecf20Sopenharmony_ci .matches = { 3918c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 3928c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), 3938c2ecf20Sopenharmony_ci }, 3948c2ecf20Sopenharmony_ci }, 3958c2ecf20Sopenharmony_ci { 3968c2ecf20Sopenharmony_ci /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */ 3978c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 3988c2ecf20Sopenharmony_ci .ident = "Dell XPS 17 L702X", 3998c2ecf20Sopenharmony_ci .matches = { 4008c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 4018c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L702X"), 4028c2ecf20Sopenharmony_ci }, 4038c2ecf20Sopenharmony_ci }, 4048c2ecf20Sopenharmony_ci { 4058c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4068c2ecf20Sopenharmony_ci .ident = "Dell Precision 7510", 4078c2ecf20Sopenharmony_ci .matches = { 4088c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 4098c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7510"), 4108c2ecf20Sopenharmony_ci }, 4118c2ecf20Sopenharmony_ci }, 4128c2ecf20Sopenharmony_ci { 4138c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4148c2ecf20Sopenharmony_ci .ident = "Acer Aspire 5738z", 4158c2ecf20Sopenharmony_ci .matches = { 4168c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 4178c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"), 4188c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "JV50"), 4198c2ecf20Sopenharmony_ci }, 4208c2ecf20Sopenharmony_ci }, 4218c2ecf20Sopenharmony_ci { 4228c2ecf20Sopenharmony_ci /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */ 4238c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4248c2ecf20Sopenharmony_ci .ident = "Acer TravelMate 5735Z", 4258c2ecf20Sopenharmony_ci .matches = { 4268c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 4278c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5735Z"), 4288c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "BA51_MV"), 4298c2ecf20Sopenharmony_ci }, 4308c2ecf20Sopenharmony_ci }, 4318c2ecf20Sopenharmony_ci { 4328c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4338c2ecf20Sopenharmony_ci .ident = "ASUSTeK COMPUTER INC. GA401", 4348c2ecf20Sopenharmony_ci .matches = { 4358c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 4368c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "GA401"), 4378c2ecf20Sopenharmony_ci }, 4388c2ecf20Sopenharmony_ci }, 4398c2ecf20Sopenharmony_ci { 4408c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4418c2ecf20Sopenharmony_ci .ident = "ASUSTeK COMPUTER INC. GA502", 4428c2ecf20Sopenharmony_ci .matches = { 4438c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 4448c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "GA502"), 4458c2ecf20Sopenharmony_ci }, 4468c2ecf20Sopenharmony_ci }, 4478c2ecf20Sopenharmony_ci { 4488c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4498c2ecf20Sopenharmony_ci .ident = "ASUSTeK COMPUTER INC. GA503", 4508c2ecf20Sopenharmony_ci .matches = { 4518c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 4528c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "GA503"), 4538c2ecf20Sopenharmony_ci }, 4548c2ecf20Sopenharmony_ci }, 4558c2ecf20Sopenharmony_ci /* 4568c2ecf20Sopenharmony_ci * Clevo NL5xRU and NL5xNU/TUXEDO Aura 15 Gen1 and Gen2 have both a 4578c2ecf20Sopenharmony_ci * working native and video interface. However the default detection 4588c2ecf20Sopenharmony_ci * mechanism first registers the video interface before unregistering 4598c2ecf20Sopenharmony_ci * it again and switching to the native interface during boot. This 4608c2ecf20Sopenharmony_ci * results in a dangling SBIOS request for backlight change for some 4618c2ecf20Sopenharmony_ci * reason, causing the backlight to switch to ~2% once per boot on the 4628c2ecf20Sopenharmony_ci * first power cord connect or disconnect event. Setting the native 4638c2ecf20Sopenharmony_ci * interface explicitly circumvents this buggy behaviour, by avoiding 4648c2ecf20Sopenharmony_ci * the unregistering process. 4658c2ecf20Sopenharmony_ci */ 4668c2ecf20Sopenharmony_ci { 4678c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4688c2ecf20Sopenharmony_ci .ident = "Clevo NL5xRU", 4698c2ecf20Sopenharmony_ci .matches = { 4708c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), 4718c2ecf20Sopenharmony_ci }, 4728c2ecf20Sopenharmony_ci }, 4738c2ecf20Sopenharmony_ci { 4748c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4758c2ecf20Sopenharmony_ci .ident = "Clevo NL5xRU", 4768c2ecf20Sopenharmony_ci .matches = { 4778c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 4788c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "AURA1501"), 4798c2ecf20Sopenharmony_ci }, 4808c2ecf20Sopenharmony_ci }, 4818c2ecf20Sopenharmony_ci { 4828c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4838c2ecf20Sopenharmony_ci .ident = "Clevo NL5xRU", 4848c2ecf20Sopenharmony_ci .matches = { 4858c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 4868c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "EDUBOOK1502"), 4878c2ecf20Sopenharmony_ci }, 4888c2ecf20Sopenharmony_ci }, 4898c2ecf20Sopenharmony_ci { 4908c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 4918c2ecf20Sopenharmony_ci .ident = "Clevo NL5xNU", 4928c2ecf20Sopenharmony_ci .matches = { 4938c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), 4948c2ecf20Sopenharmony_ci }, 4958c2ecf20Sopenharmony_ci }, 4968c2ecf20Sopenharmony_ci /* 4978c2ecf20Sopenharmony_ci * The TongFang PF5PU1G, PF4NU1F, PF5NU1G, and PF5LUXG/TUXEDO BA15 Gen10, 4988c2ecf20Sopenharmony_ci * Pulse 14/15 Gen1, and Pulse 15 Gen2 have the same problem as the Clevo 4998c2ecf20Sopenharmony_ci * NL5xRU and NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description 5008c2ecf20Sopenharmony_ci * above. 5018c2ecf20Sopenharmony_ci */ 5028c2ecf20Sopenharmony_ci { 5038c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5048c2ecf20Sopenharmony_ci .ident = "TongFang PF5PU1G", 5058c2ecf20Sopenharmony_ci .matches = { 5068c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "PF5PU1G"), 5078c2ecf20Sopenharmony_ci }, 5088c2ecf20Sopenharmony_ci }, 5098c2ecf20Sopenharmony_ci { 5108c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5118c2ecf20Sopenharmony_ci .ident = "TongFang PF4NU1F", 5128c2ecf20Sopenharmony_ci .matches = { 5138c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "PF4NU1F"), 5148c2ecf20Sopenharmony_ci }, 5158c2ecf20Sopenharmony_ci }, 5168c2ecf20Sopenharmony_ci { 5178c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5188c2ecf20Sopenharmony_ci .ident = "TongFang PF4NU1F", 5198c2ecf20Sopenharmony_ci .matches = { 5208c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 5218c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "PULSE1401"), 5228c2ecf20Sopenharmony_ci }, 5238c2ecf20Sopenharmony_ci }, 5248c2ecf20Sopenharmony_ci { 5258c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5268c2ecf20Sopenharmony_ci .ident = "TongFang PF5NU1G", 5278c2ecf20Sopenharmony_ci .matches = { 5288c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "PF5NU1G"), 5298c2ecf20Sopenharmony_ci }, 5308c2ecf20Sopenharmony_ci }, 5318c2ecf20Sopenharmony_ci { 5328c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5338c2ecf20Sopenharmony_ci .ident = "TongFang PF5NU1G", 5348c2ecf20Sopenharmony_ci .matches = { 5358c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 5368c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "PULSE1501"), 5378c2ecf20Sopenharmony_ci }, 5388c2ecf20Sopenharmony_ci }, 5398c2ecf20Sopenharmony_ci { 5408c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5418c2ecf20Sopenharmony_ci .ident = "TongFang PF5LUXG", 5428c2ecf20Sopenharmony_ci .matches = { 5438c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "PF5LUXG"), 5448c2ecf20Sopenharmony_ci }, 5458c2ecf20Sopenharmony_ci }, 5468c2ecf20Sopenharmony_ci /* 5478c2ecf20Sopenharmony_ci * More Tongfang devices with the same issue as the Clevo NL5xRU and 5488c2ecf20Sopenharmony_ci * NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description above. 5498c2ecf20Sopenharmony_ci */ 5508c2ecf20Sopenharmony_ci { 5518c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5528c2ecf20Sopenharmony_ci .ident = "TongFang GKxNRxx", 5538c2ecf20Sopenharmony_ci .matches = { 5548c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "GKxNRxx"), 5558c2ecf20Sopenharmony_ci }, 5568c2ecf20Sopenharmony_ci }, 5578c2ecf20Sopenharmony_ci { 5588c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5598c2ecf20Sopenharmony_ci .ident = "TongFang GKxNRxx", 5608c2ecf20Sopenharmony_ci .matches = { 5618c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 5628c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A1650TI"), 5638c2ecf20Sopenharmony_ci }, 5648c2ecf20Sopenharmony_ci }, 5658c2ecf20Sopenharmony_ci { 5668c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5678c2ecf20Sopenharmony_ci .ident = "TongFang GKxNRxx", 5688c2ecf20Sopenharmony_ci .matches = { 5698c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 5708c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A2060"), 5718c2ecf20Sopenharmony_ci }, 5728c2ecf20Sopenharmony_ci }, 5738c2ecf20Sopenharmony_ci { 5748c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5758c2ecf20Sopenharmony_ci .ident = "TongFang GKxNRxx", 5768c2ecf20Sopenharmony_ci .matches = { 5778c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 5788c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A1650TI"), 5798c2ecf20Sopenharmony_ci }, 5808c2ecf20Sopenharmony_ci }, 5818c2ecf20Sopenharmony_ci { 5828c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5838c2ecf20Sopenharmony_ci .ident = "TongFang GKxNRxx", 5848c2ecf20Sopenharmony_ci .matches = { 5858c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), 5868c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A2060"), 5878c2ecf20Sopenharmony_ci }, 5888c2ecf20Sopenharmony_ci }, 5898c2ecf20Sopenharmony_ci { 5908c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5918c2ecf20Sopenharmony_ci .ident = "TongFang GMxNGxx", 5928c2ecf20Sopenharmony_ci .matches = { 5938c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "GMxNGxx"), 5948c2ecf20Sopenharmony_ci }, 5958c2ecf20Sopenharmony_ci }, 5968c2ecf20Sopenharmony_ci { 5978c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 5988c2ecf20Sopenharmony_ci .ident = "TongFang GMxZGxx", 5998c2ecf20Sopenharmony_ci .matches = { 6008c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "GMxZGxx"), 6018c2ecf20Sopenharmony_ci }, 6028c2ecf20Sopenharmony_ci }, 6038c2ecf20Sopenharmony_ci { 6048c2ecf20Sopenharmony_ci .callback = video_detect_force_native, 6058c2ecf20Sopenharmony_ci .ident = "TongFang GMxRGxx", 6068c2ecf20Sopenharmony_ci .matches = { 6078c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"), 6088c2ecf20Sopenharmony_ci }, 6098c2ecf20Sopenharmony_ci }, 6108c2ecf20Sopenharmony_ci /* 6118c2ecf20Sopenharmony_ci * Desktops which falsely report a backlight and which our heuristics 6128c2ecf20Sopenharmony_ci * for this do not catch. 6138c2ecf20Sopenharmony_ci */ 6148c2ecf20Sopenharmony_ci { 6158c2ecf20Sopenharmony_ci .callback = video_detect_force_none, 6168c2ecf20Sopenharmony_ci .ident = "Dell OptiPlex 9020M", 6178c2ecf20Sopenharmony_ci .matches = { 6188c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 6198c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 9020M"), 6208c2ecf20Sopenharmony_ci }, 6218c2ecf20Sopenharmony_ci }, 6228c2ecf20Sopenharmony_ci { 6238c2ecf20Sopenharmony_ci .callback = video_detect_force_none, 6248c2ecf20Sopenharmony_ci .ident = "MSI MS-7721", 6258c2ecf20Sopenharmony_ci .matches = { 6268c2ecf20Sopenharmony_ci DMI_MATCH(DMI_SYS_VENDOR, "MSI"), 6278c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MS-7721"), 6288c2ecf20Sopenharmony_ci }, 6298c2ecf20Sopenharmony_ci }, 6308c2ecf20Sopenharmony_ci { }, 6318c2ecf20Sopenharmony_ci}; 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci/* This uses a workqueue to avoid various locking ordering issues */ 6348c2ecf20Sopenharmony_cistatic void acpi_video_backlight_notify_work(struct work_struct *work) 6358c2ecf20Sopenharmony_ci{ 6368c2ecf20Sopenharmony_ci if (acpi_video_get_backlight_type() != acpi_backlight_video) 6378c2ecf20Sopenharmony_ci acpi_video_unregister_backlight(); 6388c2ecf20Sopenharmony_ci} 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_cistatic int acpi_video_backlight_notify(struct notifier_block *nb, 6418c2ecf20Sopenharmony_ci unsigned long val, void *bd) 6428c2ecf20Sopenharmony_ci{ 6438c2ecf20Sopenharmony_ci struct backlight_device *backlight = bd; 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci /* A raw bl registering may change video -> native */ 6468c2ecf20Sopenharmony_ci if (backlight->props.type == BACKLIGHT_RAW && 6478c2ecf20Sopenharmony_ci val == BACKLIGHT_REGISTERED) 6488c2ecf20Sopenharmony_ci schedule_work(&backlight_notify_work); 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_ci return NOTIFY_OK; 6518c2ecf20Sopenharmony_ci} 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci/* 6548c2ecf20Sopenharmony_ci * Determine which type of backlight interface to use on this system, 6558c2ecf20Sopenharmony_ci * First check cmdline, then dmi quirks, then do autodetect. 6568c2ecf20Sopenharmony_ci * 6578c2ecf20Sopenharmony_ci * The autodetect order is: 6588c2ecf20Sopenharmony_ci * 1) Is the acpi-video backlight interface supported -> 6598c2ecf20Sopenharmony_ci * no, use a vendor interface 6608c2ecf20Sopenharmony_ci * 2) Is this a win8 "ready" BIOS and do we have a native interface -> 6618c2ecf20Sopenharmony_ci * yes, use a native interface 6628c2ecf20Sopenharmony_ci * 3) Else use the acpi-video interface 6638c2ecf20Sopenharmony_ci * 6648c2ecf20Sopenharmony_ci * Arguably the native on win8 check should be done first, but that would 6658c2ecf20Sopenharmony_ci * be a behavior change, which may causes issues. 6668c2ecf20Sopenharmony_ci */ 6678c2ecf20Sopenharmony_cienum acpi_backlight_type acpi_video_get_backlight_type(void) 6688c2ecf20Sopenharmony_ci{ 6698c2ecf20Sopenharmony_ci static DEFINE_MUTEX(init_mutex); 6708c2ecf20Sopenharmony_ci static bool init_done; 6718c2ecf20Sopenharmony_ci static long video_caps; 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_ci /* Parse cmdline, dmi and acpi only once */ 6748c2ecf20Sopenharmony_ci mutex_lock(&init_mutex); 6758c2ecf20Sopenharmony_ci if (!init_done) { 6768c2ecf20Sopenharmony_ci acpi_video_parse_cmdline(); 6778c2ecf20Sopenharmony_ci dmi_check_system(video_detect_dmi_table); 6788c2ecf20Sopenharmony_ci acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 6798c2ecf20Sopenharmony_ci ACPI_UINT32_MAX, find_video, NULL, 6808c2ecf20Sopenharmony_ci &video_caps, NULL); 6818c2ecf20Sopenharmony_ci INIT_WORK(&backlight_notify_work, 6828c2ecf20Sopenharmony_ci acpi_video_backlight_notify_work); 6838c2ecf20Sopenharmony_ci backlight_nb.notifier_call = acpi_video_backlight_notify; 6848c2ecf20Sopenharmony_ci backlight_nb.priority = 0; 6858c2ecf20Sopenharmony_ci if (backlight_register_notifier(&backlight_nb) == 0) 6868c2ecf20Sopenharmony_ci backlight_notifier_registered = true; 6878c2ecf20Sopenharmony_ci init_done = true; 6888c2ecf20Sopenharmony_ci } 6898c2ecf20Sopenharmony_ci mutex_unlock(&init_mutex); 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci if (acpi_backlight_cmdline != acpi_backlight_undef) 6928c2ecf20Sopenharmony_ci return acpi_backlight_cmdline; 6938c2ecf20Sopenharmony_ci 6948c2ecf20Sopenharmony_ci if (acpi_backlight_dmi != acpi_backlight_undef) 6958c2ecf20Sopenharmony_ci return acpi_backlight_dmi; 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci if (!(video_caps & ACPI_VIDEO_BACKLIGHT)) 6988c2ecf20Sopenharmony_ci return acpi_backlight_vendor; 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_ci if (acpi_osi_is_win8() && backlight_device_get_by_type(BACKLIGHT_RAW)) 7018c2ecf20Sopenharmony_ci return acpi_backlight_native; 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_ci return acpi_backlight_video; 7048c2ecf20Sopenharmony_ci} 7058c2ecf20Sopenharmony_ciEXPORT_SYMBOL(acpi_video_get_backlight_type); 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_ci/* 7088c2ecf20Sopenharmony_ci * Set the preferred backlight interface type based on DMI info. 7098c2ecf20Sopenharmony_ci * This function allows DMI blacklists to be implemented by external 7108c2ecf20Sopenharmony_ci * platform drivers instead of putting a big blacklist in video_detect.c 7118c2ecf20Sopenharmony_ci */ 7128c2ecf20Sopenharmony_civoid acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) 7138c2ecf20Sopenharmony_ci{ 7148c2ecf20Sopenharmony_ci acpi_backlight_dmi = type; 7158c2ecf20Sopenharmony_ci /* Remove acpi-video backlight interface if it is no longer desired */ 7168c2ecf20Sopenharmony_ci if (acpi_video_get_backlight_type() != acpi_backlight_video) 7178c2ecf20Sopenharmony_ci acpi_video_unregister_backlight(); 7188c2ecf20Sopenharmony_ci} 7198c2ecf20Sopenharmony_ciEXPORT_SYMBOL(acpi_video_set_dmi_backlight_type); 7208c2ecf20Sopenharmony_ci 7218c2ecf20Sopenharmony_civoid __exit acpi_video_detect_exit(void) 7228c2ecf20Sopenharmony_ci{ 7238c2ecf20Sopenharmony_ci if (backlight_notifier_registered) 7248c2ecf20Sopenharmony_ci backlight_unregister_notifier(&backlight_nb); 7258c2ecf20Sopenharmony_ci} 726