mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
ACPI fixes for 6.3-rc6
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). -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmQv+q4SHHJqd0Byand5 c29ja2kubmV0AAoJEILEb/54YlRxQeAP/14udLf94euOjp9rtifUmP+QAmPlh9Pk l4lDldB2AUEvgqsr8pSeB2l69suFW2VtcPsxv8sKQ77YkcMZKFkfN3CRmFtur90+ 5aiKizwA1+SazTlOfzYtSH1bgKAJ1FJ/KRcD9TLwPBk7DEf4E8Y9kYuoH1mheN3H KveEmRdBXhwKEN4c9wDmRRLLcupRTxYrg3SKkRaPKNMpPHxxgR8tN9rAnQbFQxHy bl2hfcZSDYB5hYuOGxaeutEAkoGAJiBMfixhGb+hpSawALvOFO7ygpW/+wV2uHcV 54YQdeaRvP2xjFB9whHYk6WrvQWiEIqTpAsX9MepanoGK597k1UzcpnNx4boxrs2 iNg1GD8e6nm06e5Keh1ZarpB5QjoiOTeVvzSReIVKjjlHx0v75k5YcfDyebyb0K5 KFYPuJQWtWYRTIqCvC49CLipM4eeqVCnhgH+gcwQGjXOG0Umr467djrPfsO/12cq saiZlVF934UImBVYeJbUo6JFLNYiPYfLaC2YzrnbXuBQZWpQyMX21SLysDsfipas lKEsvIKkPYLoSHgEfjOFH514yAOSycHGKTACVk88DpnZ4qrMaYHTb9MGn9hmSTB9 zcoEtuI6yyiU66zkSRT3glTtNCunDpMqJSm3zDlxg8kWkS1Ec71B9o3b4lMmN06B Bw4/JnxQ4bab =NpWd -----END PGP SIGNATURE----- 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()
This commit is contained in:
commit
c9797dba13
@ -1984,6 +1984,7 @@ static int instance;
|
||||
static int acpi_video_bus_add(struct acpi_device *device)
|
||||
{
|
||||
struct acpi_video_bus *video;
|
||||
bool auto_detect;
|
||||
int error;
|
||||
acpi_status status;
|
||||
|
||||
@ -2045,10 +2046,20 @@ static int acpi_video_bus_add(struct acpi_device *device)
|
||||
mutex_unlock(&video_list_lock);
|
||||
|
||||
/*
|
||||
* The userspace visible backlight_device gets registered separately
|
||||
* from acpi_video_register_backlight().
|
||||
* If backlight-type auto-detection is used then a native backlight may
|
||||
* show up later and this may change the result from video to native.
|
||||
* Therefor normally the userspace visible /sys/class/backlight device
|
||||
* gets registered separately by the GPU driver calling
|
||||
* acpi_video_register_backlight() when an internal panel is detected.
|
||||
* Register the backlight now when not using auto-detection, so that
|
||||
* when the kernel cmdline or DMI-quirks are used the backlight will
|
||||
* get registered even if acpi_video_register_backlight() is not called.
|
||||
*/
|
||||
acpi_video_run_bcl_for_osi(video);
|
||||
if (__acpi_video_get_backlight_type(false, &auto_detect) == acpi_backlight_video &&
|
||||
!auto_detect)
|
||||
acpi_video_bus_register_backlight(video);
|
||||
|
||||
acpi_video_bus_add_notify_handler(video);
|
||||
|
||||
return 0;
|
||||
|
@ -276,6 +276,43 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
|
||||
},
|
||||
},
|
||||
|
||||
/*
|
||||
* Models which need acpi_video backlight control where the GPU drivers
|
||||
* do not call acpi_video_register_backlight() because no internal panel
|
||||
* is detected. Typically these are all-in-ones (monitors with builtin
|
||||
* PC) where the panel connection shows up as regular DP instead of eDP.
|
||||
*/
|
||||
{
|
||||
.callback = video_detect_force_video,
|
||||
/* Apple iMac14,1 */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "iMac14,1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.callback = video_detect_force_video,
|
||||
/* Apple iMac14,2 */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "iMac14,2"),
|
||||
},
|
||||
},
|
||||
|
||||
/*
|
||||
* Older models with nvidia GPU which need acpi_video backlight
|
||||
* control and where the old nvidia binary driver series does not
|
||||
* call acpi_video_register_backlight().
|
||||
*/
|
||||
{
|
||||
.callback = video_detect_force_video,
|
||||
/* ThinkPad W530 */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W530"),
|
||||
},
|
||||
},
|
||||
|
||||
/*
|
||||
* These models have a working acpi_video backlight control, and using
|
||||
* native backlight causes a regression where backlight does not work
|
||||
@ -782,7 +819,7 @@ static bool prefer_native_over_acpi_video(void)
|
||||
* Determine which type of backlight interface to use on this system,
|
||||
* First check cmdline, then dmi quirks, then do autodetect.
|
||||
*/
|
||||
static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
|
||||
enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto_detect)
|
||||
{
|
||||
static DEFINE_MUTEX(init_mutex);
|
||||
static bool nvidia_wmi_ec_present;
|
||||
@ -807,6 +844,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
|
||||
native_available = true;
|
||||
mutex_unlock(&init_mutex);
|
||||
|
||||
if (auto_detect)
|
||||
*auto_detect = false;
|
||||
|
||||
/*
|
||||
* The below heuristics / detection steps are in order of descending
|
||||
* presedence. The commandline takes presedence over anything else.
|
||||
@ -818,6 +858,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
|
||||
if (acpi_backlight_dmi != acpi_backlight_undef)
|
||||
return acpi_backlight_dmi;
|
||||
|
||||
if (auto_detect)
|
||||
*auto_detect = true;
|
||||
|
||||
/* Special cases such as nvidia_wmi_ec and apple gmux. */
|
||||
if (nvidia_wmi_ec_present)
|
||||
return acpi_backlight_nvidia_wmi_ec;
|
||||
@ -837,15 +880,4 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
|
||||
/* No ACPI video/native (old hw), use vendor specific fw methods. */
|
||||
return acpi_backlight_vendor;
|
||||
}
|
||||
|
||||
enum acpi_backlight_type acpi_video_get_backlight_type(void)
|
||||
{
|
||||
return __acpi_video_get_backlight_type(false);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_video_get_backlight_type);
|
||||
|
||||
bool acpi_video_backlight_use_native(void)
|
||||
{
|
||||
return __acpi_video_get_backlight_type(true) == acpi_backlight_native;
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_video_backlight_use_native);
|
||||
EXPORT_SYMBOL(__acpi_video_get_backlight_type);
|
||||
|
@ -59,8 +59,6 @@ extern void acpi_video_unregister(void);
|
||||
extern void acpi_video_register_backlight(void);
|
||||
extern int acpi_video_get_edid(struct acpi_device *device, int type,
|
||||
int device_id, void **edid);
|
||||
extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
|
||||
extern bool acpi_video_backlight_use_native(void);
|
||||
/*
|
||||
* Note: The value returned by acpi_video_handles_brightness_key_presses()
|
||||
* may change over time and should not be cached.
|
||||
@ -69,6 +67,19 @@ extern bool acpi_video_handles_brightness_key_presses(void);
|
||||
extern int acpi_video_get_levels(struct acpi_device *device,
|
||||
struct acpi_video_device_brightness **dev_br,
|
||||
int *pmax_level);
|
||||
|
||||
extern enum acpi_backlight_type __acpi_video_get_backlight_type(bool native,
|
||||
bool *auto_detect);
|
||||
|
||||
static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
|
||||
{
|
||||
return __acpi_video_get_backlight_type(false, NULL);
|
||||
}
|
||||
|
||||
static inline bool acpi_video_backlight_use_native(void)
|
||||
{
|
||||
return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native;
|
||||
}
|
||||
#else
|
||||
static inline void acpi_video_report_nolcd(void) { return; };
|
||||
static inline int acpi_video_register(void) { return -ENODEV; }
|
||||
|
Loading…
Reference in New Issue
Block a user