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

ACPI / video: Do not register backlight if win8 and native interface exists

According to Matthew Garrett, "Windows 8 leaves backlight control up
to individual graphics drivers rather than making ACPI calls itself.
There's plenty of evidence to suggest that the Intel driver for
Windows [8] doesn't use the ACPI interface, including the fact that
it's broken on a bunch of machines when the OS claims to support
Windows 8.  The simplest thing to do appears to be to disable the
ACPI backlight interface on these systems".

So for Win8 systems, if there is native backlight control interface
registered by GPU driver, ACPI video does not need to register its own.
Since there are systems that don't work well with this approach, a
parameter for video module named use_native_backlight is introduced and
has the value of false by default. For users who have a broken ACPI
video backlight interface, video.use_native_backlight=1 is needed in
kernel cmdline.
Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 67b662e1
...@@ -169,9 +169,7 @@ int acpi_create_platform_device(struct acpi_device *adev, ...@@ -169,9 +169,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
Video Video
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
bool acpi_video_backlight_quirks(void); bool acpi_osi_is_win8(void);
#else
static inline bool acpi_video_backlight_quirks(void) { return false; }
#endif #endif
#endif /* _ACPI_INTERNAL_H_ */ #endif /* _ACPI_INTERNAL_H_ */
...@@ -88,6 +88,13 @@ module_param(allow_duplicates, bool, 0644); ...@@ -88,6 +88,13 @@ module_param(allow_duplicates, bool, 0644);
static bool use_bios_initial_backlight = 1; static bool use_bios_initial_backlight = 1;
module_param(use_bios_initial_backlight, bool, 0644); module_param(use_bios_initial_backlight, bool, 0644);
/*
* For Windows 8 systems: if set ture and the GPU driver has
* registered a backlight interface, skip registering ACPI video's.
*/
static bool use_native_backlight = false;
module_param(use_native_backlight, bool, 0644);
static int register_count; static int register_count;
static struct mutex video_list_lock; static struct mutex video_list_lock;
static struct list_head video_bus_head; static struct list_head video_bus_head;
...@@ -232,6 +239,14 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, ...@@ -232,6 +239,14 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
static int acpi_video_switch_brightness(struct acpi_video_device *device, static int acpi_video_switch_brightness(struct acpi_video_device *device,
int event); int event);
static bool acpi_video_verify_backlight_support(void)
{
if (acpi_osi_is_win8() && use_native_backlight &&
backlight_device_registered(BACKLIGHT_RAW))
return false;
return acpi_video_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)
{ {
...@@ -1256,8 +1271,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) ...@@ -1256,8 +1271,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
unsigned long long level_current, level_next; unsigned long long level_current, level_next;
int result = -EINVAL; int result = -EINVAL;
/* no warning message if acpi_backlight=vendor is used */ /* no warning message if acpi_backlight=vendor or a quirk is used */
if (!acpi_video_backlight_support()) if (!acpi_video_verify_backlight_support())
return 0; return 0;
if (!device->brightness) if (!device->brightness)
...@@ -1386,13 +1401,13 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, ...@@ -1386,13 +1401,13 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
static int acpi_video_bus_start_devices(struct acpi_video_bus *video) static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
{ {
return acpi_video_bus_DOS(video, 0, return acpi_video_bus_DOS(video, 0,
acpi_video_backlight_quirks() ? 1 : 0); acpi_osi_is_win8() ? 1 : 0);
} }
static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
{ {
return acpi_video_bus_DOS(video, 0, return acpi_video_bus_DOS(video, 0,
acpi_video_backlight_quirks() ? 0 : 1); acpi_osi_is_win8() ? 0 : 1);
} }
static void acpi_video_bus_notify(struct acpi_device *device, u32 event) static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
...@@ -1558,7 +1573,7 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context, ...@@ -1558,7 +1573,7 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
static void acpi_video_dev_register_backlight(struct acpi_video_device *device) static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
{ {
if (acpi_video_backlight_support()) { if (acpi_video_verify_backlight_support()) {
struct backlight_properties props; struct backlight_properties props;
struct pci_dev *pdev; struct pci_dev *pdev;
acpi_handle acpi_parent; acpi_handle acpi_parent;
......
...@@ -233,11 +233,11 @@ static void acpi_video_caps_check(void) ...@@ -233,11 +233,11 @@ static void acpi_video_caps_check(void)
acpi_video_get_capabilities(NULL); acpi_video_get_capabilities(NULL);
} }
bool acpi_video_backlight_quirks(void) bool acpi_osi_is_win8(void)
{ {
return acpi_gbl_osi_data >= ACPI_OSI_WIN_8; return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
} }
EXPORT_SYMBOL(acpi_video_backlight_quirks); EXPORT_SYMBOL(acpi_osi_is_win8);
/* Promote the vendor interface instead of the generic video module. /* Promote the vendor interface instead of the generic video module.
* This function allow DMI blacklists to be implemented by externals * This function allow DMI blacklists to be implemented by externals
......
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