Commit 0b9f7d93 authored by Aaron Lu's avatar Aaron Lu Committed by Rafael J. Wysocki

ACPI / i915: ignore firmware requests for backlight change

Some Thinkpad laptops' firmware will initiate a backlight level change
request through operation region on the events of AC plug/unplug, but
since we are not using firmware's interface to do the backlight setting
on these affected laptops, we do not want the firmware to use some
arbitrary value from its ASL variable to set the backlight level on
AC plug/unplug either.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=76491
Link: https://bugzilla.kernel.org/show_bug.cgi?id=77091Reported-and-tested-by: default avatarIgor Gnatenko <i.gnatenko.brain@gmail.com>
Reported-and-tested-by: default avatarAnton Gubarkov <anton.gubarkov@gmail.com>
Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent cd3de83f
...@@ -241,13 +241,14 @@ static bool acpi_video_use_native_backlight(void) ...@@ -241,13 +241,14 @@ static bool acpi_video_use_native_backlight(void)
return use_native_backlight_dmi; return use_native_backlight_dmi;
} }
static bool acpi_video_verify_backlight_support(void) bool acpi_video_verify_backlight_support(void)
{ {
if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
backlight_device_registered(BACKLIGHT_RAW)) backlight_device_registered(BACKLIGHT_RAW))
return false; return false;
return acpi_video_backlight_support(); return acpi_video_backlight_support();
} }
EXPORT_SYMBOL_GPL(acpi_video_verify_backlight_support);
/* backlight device sysfs support */ /* backlight device sysfs support */
static int acpi_video_get_brightness(struct backlight_device *bd) static int acpi_video_get_brightness(struct backlight_device *bd)
......
...@@ -403,6 +403,15 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) ...@@ -403,6 +403,15 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
/*
* If the acpi_video interface is not supposed to be used, don't
* bother processing backlight level change requests from firmware.
*/
if (!acpi_video_verify_backlight_support()) {
DRM_DEBUG_KMS("opregion backlight request ignored\n");
return 0;
}
if (!(bclp & ASLE_BCLP_VALID)) if (!(bclp & ASLE_BCLP_VALID))
return ASLC_BACKLIGHT_FAILED; return ASLC_BACKLIGHT_FAILED;
......
...@@ -22,6 +22,7 @@ extern void acpi_video_unregister(void); ...@@ -22,6 +22,7 @@ extern void acpi_video_unregister(void);
extern void acpi_video_unregister_backlight(void); extern void acpi_video_unregister_backlight(void);
extern int acpi_video_get_edid(struct acpi_device *device, int type, extern int acpi_video_get_edid(struct acpi_device *device, int type,
int device_id, void **edid); int device_id, void **edid);
extern bool acpi_video_verify_backlight_support(void);
#else #else
static inline int acpi_video_register(void) { return 0; } static inline int acpi_video_register(void) { return 0; }
static inline void acpi_video_unregister(void) { return; } static inline void acpi_video_unregister(void) { return; }
...@@ -31,6 +32,7 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type, ...@@ -31,6 +32,7 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type,
{ {
return -ENODEV; return -ENODEV;
} }
static inline bool acpi_video_verify_backlight_support(void) { return false; }
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment