Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'acpi-6.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
"Fix the ACPI backlight override mechanism for the cases when
acpi_backlight=video is set through the kernel command line or a DMI
quirk and add backlight quirks for Apple iMac14,1 and iMac14,2 and
Lenovo ThinkPad W530 (Hans de Goede)"

* tag 'acpi-6.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: video: Add acpi_backlight=video quirk for Lenovo ThinkPad W530
ACPI: video: Add acpi_backlight=video quirk for Apple iMac14,1 and iMac14,2
ACPI: video: Make acpi_backlight=video work independent from GPU driver
ACPI: video: Add auto_detect arg to __acpi_video_get_backlight_type()

+71 -17
+13 -2
drivers/acpi/acpi_video.c
··· 1984 1984 static int acpi_video_bus_add(struct acpi_device *device) 1985 1985 { 1986 1986 struct acpi_video_bus *video; 1987 + bool auto_detect; 1987 1988 int error; 1988 1989 acpi_status status; 1989 1990 ··· 2046 2045 mutex_unlock(&video_list_lock); 2047 2046 2048 2047 /* 2049 - * The userspace visible backlight_device gets registered separately 2050 - * from acpi_video_register_backlight(). 2048 + * If backlight-type auto-detection is used then a native backlight may 2049 + * show up later and this may change the result from video to native. 2050 + * Therefor normally the userspace visible /sys/class/backlight device 2051 + * gets registered separately by the GPU driver calling 2052 + * acpi_video_register_backlight() when an internal panel is detected. 2053 + * Register the backlight now when not using auto-detection, so that 2054 + * when the kernel cmdline or DMI-quirks are used the backlight will 2055 + * get registered even if acpi_video_register_backlight() is not called. 2051 2056 */ 2052 2057 acpi_video_run_bcl_for_osi(video); 2058 + if (__acpi_video_get_backlight_type(false, &auto_detect) == acpi_backlight_video && 2059 + !auto_detect) 2060 + acpi_video_bus_register_backlight(video); 2061 + 2053 2062 acpi_video_bus_add_notify_handler(video); 2054 2063 2055 2064 return 0;
+45 -13
drivers/acpi/video_detect.c
··· 277 277 }, 278 278 279 279 /* 280 + * Models which need acpi_video backlight control where the GPU drivers 281 + * do not call acpi_video_register_backlight() because no internal panel 282 + * is detected. Typically these are all-in-ones (monitors with builtin 283 + * PC) where the panel connection shows up as regular DP instead of eDP. 284 + */ 285 + { 286 + .callback = video_detect_force_video, 287 + /* Apple iMac14,1 */ 288 + .matches = { 289 + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 290 + DMI_MATCH(DMI_PRODUCT_NAME, "iMac14,1"), 291 + }, 292 + }, 293 + { 294 + .callback = video_detect_force_video, 295 + /* Apple iMac14,2 */ 296 + .matches = { 297 + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 298 + DMI_MATCH(DMI_PRODUCT_NAME, "iMac14,2"), 299 + }, 300 + }, 301 + 302 + /* 303 + * Older models with nvidia GPU which need acpi_video backlight 304 + * control and where the old nvidia binary driver series does not 305 + * call acpi_video_register_backlight(). 306 + */ 307 + { 308 + .callback = video_detect_force_video, 309 + /* ThinkPad W530 */ 310 + .matches = { 311 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 312 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W530"), 313 + }, 314 + }, 315 + 316 + /* 280 317 * These models have a working acpi_video backlight control, and using 281 318 * native backlight causes a regression where backlight does not work 282 319 * when userspace is not handling brightness key events. Disable ··· 819 782 * Determine which type of backlight interface to use on this system, 820 783 * First check cmdline, then dmi quirks, then do autodetect. 821 784 */ 822 - static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) 785 + enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto_detect) 823 786 { 824 787 static DEFINE_MUTEX(init_mutex); 825 788 static bool nvidia_wmi_ec_present; ··· 844 807 native_available = true; 845 808 mutex_unlock(&init_mutex); 846 809 810 + if (auto_detect) 811 + *auto_detect = false; 812 + 847 813 /* 848 814 * The below heuristics / detection steps are in order of descending 849 815 * presedence. The commandline takes presedence over anything else. ··· 857 817 /* DMI quirks override any autodetection. */ 858 818 if (acpi_backlight_dmi != acpi_backlight_undef) 859 819 return acpi_backlight_dmi; 820 + 821 + if (auto_detect) 822 + *auto_detect = true; 860 823 861 824 /* Special cases such as nvidia_wmi_ec and apple gmux. */ 862 825 if (nvidia_wmi_ec_present) ··· 880 837 /* No ACPI video/native (old hw), use vendor specific fw methods. */ 881 838 return acpi_backlight_vendor; 882 839 } 883 - 884 - enum acpi_backlight_type acpi_video_get_backlight_type(void) 885 - { 886 - return __acpi_video_get_backlight_type(false); 887 - } 888 - EXPORT_SYMBOL(acpi_video_get_backlight_type); 889 - 890 - bool acpi_video_backlight_use_native(void) 891 - { 892 - return __acpi_video_get_backlight_type(true) == acpi_backlight_native; 893 - } 894 - EXPORT_SYMBOL(acpi_video_backlight_use_native); 840 + EXPORT_SYMBOL(__acpi_video_get_backlight_type);
+13 -2
include/acpi/video.h
··· 59 59 extern void acpi_video_register_backlight(void); 60 60 extern int acpi_video_get_edid(struct acpi_device *device, int type, 61 61 int device_id, void **edid); 62 - extern enum acpi_backlight_type acpi_video_get_backlight_type(void); 63 - extern bool acpi_video_backlight_use_native(void); 64 62 /* 65 63 * Note: The value returned by acpi_video_handles_brightness_key_presses() 66 64 * may change over time and should not be cached. ··· 67 69 extern int acpi_video_get_levels(struct acpi_device *device, 68 70 struct acpi_video_device_brightness **dev_br, 69 71 int *pmax_level); 72 + 73 + extern enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, 74 + bool *auto_detect); 75 + 76 + static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) 77 + { 78 + return __acpi_video_get_backlight_type(false, NULL); 79 + } 80 + 81 + static inline bool acpi_video_backlight_use_native(void) 82 + { 83 + return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native; 84 + } 70 85 #else 71 86 static inline void acpi_video_report_nolcd(void) { return; }; 72 87 static inline int acpi_video_register(void) { return -ENODEV; }