2008-08-01 15:37:55 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 SuSE Linux Products GmbH
|
|
|
|
* Thomas Renninger <trenn@suse.de>
|
|
|
|
*
|
|
|
|
* May be copied or modified under the terms of the GNU General Public License
|
|
|
|
*
|
|
|
|
* video_detect.c:
|
|
|
|
* Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c
|
|
|
|
* There a Linux specific (Spec does not provide a HID for video devices) is
|
2009-10-16 13:20:49 +00:00
|
|
|
* assigned
|
2008-08-01 15:37:55 +00:00
|
|
|
*
|
|
|
|
* After PCI devices are glued with ACPI devices
|
2009-06-10 19:56:00 +00:00
|
|
|
* acpi_get_pci_dev() can be called to identify ACPI graphics
|
2008-08-01 15:37:55 +00:00
|
|
|
* devices for which a real graphics card is plugged in
|
|
|
|
*
|
|
|
|
* Now acpi_video_get_capabilities() can be called to check which
|
|
|
|
* capabilities the graphics cards plugged in support. The check for general
|
|
|
|
* video capabilities will be triggered by the first caller of
|
|
|
|
* acpi_video_get_capabilities(NULL); which will happen when the first
|
2010-12-06 07:04:21 +00:00
|
|
|
* backlight switching supporting driver calls:
|
2008-08-01 15:37:55 +00:00
|
|
|
* acpi_video_backlight_support();
|
|
|
|
*
|
|
|
|
* Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B)
|
|
|
|
* are available, video.ko should be used to handle the device.
|
|
|
|
*
|
2011-12-15 07:27:37 +00:00
|
|
|
* Otherwise vendor specific drivers like thinkpad_acpi, asus-laptop,
|
2010-12-06 07:04:21 +00:00
|
|
|
* sony_acpi,... can take care about backlight brightness.
|
2008-08-01 15:37:55 +00:00
|
|
|
*
|
|
|
|
* If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m)
|
|
|
|
* this file will not be compiled, acpi_video_get_capabilities() and
|
|
|
|
* acpi_video_backlight_support() will always return 0 and vendor specific
|
|
|
|
* drivers always can handle backlight.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-10-26 20:22:14 +00:00
|
|
|
#include <linux/export.h>
|
2008-08-01 15:37:55 +00:00
|
|
|
#include <linux/acpi.h>
|
|
|
|
#include <linux/dmi.h>
|
2009-06-10 19:56:00 +00:00
|
|
|
#include <linux/pci.h>
|
2008-08-01 15:37:55 +00:00
|
|
|
|
ACPI / video / i915: No ACPI backlight if firmware expects Windows 8
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".
There's a problem with that approach, however, because simply
avoiding to register the ACPI backlight interface if the firmware
calls _OSI for Windows 8 may not work in the following situations:
(1) The ACPI backlight interface actually works on the given system
and the i915 driver is not loaded (e.g. another graphics driver
is used).
(2) The ACPI backlight interface doesn't work on the given system,
but there is a vendor platform driver that will register its
own, equally broken, backlight interface if not prevented from
doing so by the ACPI subsystem.
Therefore we need to allow the ACPI backlight interface to be
registered until the i915 driver is loaded which then will unregister
it if the firmware has called _OSI for Windows 8 (or will register
the ACPI video driver without backlight support if not already
present).
For this reason, introduce an alternative function for registering
ACPI video, acpi_video_register_with_quirks(), that will check
whether or not the ACPI video driver has already been registered
and whether or not the backlight Windows 8 quirk has to be applied.
If the quirk has to be applied, it will block the ACPI backlight
support and either unregister the backlight interface if the ACPI
video driver has already been registered, or register the ACPI
video driver without the backlight interface otherwise. Make
the i915 driver use acpi_video_register_with_quirks() instead of
acpi_video_register() in i915_driver_load().
This change is based on earlier patches from Matthew Garrett,
Chun-Yi Lee and Seth Forshee and includes a fix from Aaron Lu's.
References: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Tested-by: Aaron Lu <aaron.lu@intel.com>
Tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Tested-by: Yves-Alexis Perez <corsac@debian.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-07-18 00:08:06 +00:00
|
|
|
#include "internal.h"
|
|
|
|
|
2009-07-28 20:45:54 +00:00
|
|
|
#define PREFIX "ACPI: "
|
|
|
|
|
2008-08-01 15:37:55 +00:00
|
|
|
ACPI_MODULE_NAME("video");
|
|
|
|
#define _COMPONENT ACPI_VIDEO_COMPONENT
|
|
|
|
|
|
|
|
static long acpi_video_support;
|
|
|
|
static bool acpi_video_caps_checked;
|
|
|
|
|
|
|
|
static acpi_status
|
|
|
|
acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
|
|
|
|
void **retyurn_value)
|
|
|
|
{
|
|
|
|
long *cap = context;
|
|
|
|
acpi_handle h_dummy;
|
|
|
|
|
|
|
|
if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) &&
|
|
|
|
ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) {
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
|
|
|
|
"support\n"));
|
|
|
|
*cap |= ACPI_VIDEO_BACKLIGHT;
|
2009-03-12 08:57:11 +00:00
|
|
|
if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy)))
|
2010-09-03 02:08:50 +00:00
|
|
|
printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
|
|
|
|
"cannot determine initial brightness\n");
|
2008-08-01 15:37:55 +00:00
|
|
|
/* We have backlight support, no need to scan further */
|
|
|
|
return AE_CTRL_TERMINATE;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-04 21:30:41 +00:00
|
|
|
/* Returns true if the ACPI object is a video device which can be
|
|
|
|
* handled by video.ko.
|
2008-08-01 15:37:55 +00:00
|
|
|
* The device will get a Linux specific CID added in scan.c to
|
|
|
|
* identify the device as an ACPI graphics device
|
|
|
|
* Be aware that the graphics device may not be physically present
|
|
|
|
* Use acpi_video_get_capabilities() to detect general ACPI video
|
|
|
|
* capabilities of present cards
|
|
|
|
*/
|
2013-03-04 21:30:41 +00:00
|
|
|
long acpi_is_video_device(acpi_handle handle)
|
2008-08-01 15:37:55 +00:00
|
|
|
{
|
|
|
|
acpi_handle h_dummy;
|
|
|
|
long video_caps = 0;
|
|
|
|
|
2011-02-12 00:40:16 +00:00
|
|
|
/* Is this device able to support video switching ? */
|
2013-03-04 21:30:41 +00:00
|
|
|
if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) ||
|
|
|
|
ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy)))
|
2011-02-12 00:40:16 +00:00
|
|
|
video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
|
|
|
|
|
2009-10-16 13:20:49 +00:00
|
|
|
/* Is this device able to retrieve a video ROM ? */
|
2013-03-04 21:30:41 +00:00
|
|
|
if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy)))
|
2008-08-01 15:37:55 +00:00
|
|
|
video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
|
|
|
|
|
2009-10-16 13:20:49 +00:00
|
|
|
/* Is this device able to configure which video head to be POSTed ? */
|
2013-03-04 21:30:41 +00:00
|
|
|
if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) &&
|
|
|
|
ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) &&
|
|
|
|
ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy)))
|
2008-08-01 15:37:55 +00:00
|
|
|
video_caps |= ACPI_VIDEO_DEVICE_POSTING;
|
|
|
|
|
|
|
|
/* Only check for backlight functionality if one of the above hit. */
|
|
|
|
if (video_caps)
|
2013-03-04 21:30:41 +00:00
|
|
|
acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
|
2009-11-13 02:06:08 +00:00
|
|
|
ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
|
2008-08-01 15:37:55 +00:00
|
|
|
&video_caps, NULL);
|
|
|
|
|
|
|
|
return video_caps;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_is_video_device);
|
|
|
|
|
|
|
|
static acpi_status
|
|
|
|
find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
|
|
|
|
{
|
|
|
|
long *cap = context;
|
2009-06-10 19:56:00 +00:00
|
|
|
struct pci_dev *dev;
|
2008-08-01 15:37:55 +00:00
|
|
|
struct acpi_device *acpi_dev;
|
|
|
|
|
|
|
|
const struct acpi_device_id video_ids[] = {
|
|
|
|
{ACPI_VIDEO_HID, 0},
|
|
|
|
{"", 0},
|
|
|
|
};
|
|
|
|
if (acpi_bus_get_device(handle, &acpi_dev))
|
|
|
|
return AE_OK;
|
|
|
|
|
|
|
|
if (!acpi_match_device_ids(acpi_dev, video_ids)) {
|
2009-06-10 19:56:00 +00:00
|
|
|
dev = acpi_get_pci_dev(handle);
|
2008-08-01 15:37:55 +00:00
|
|
|
if (!dev)
|
|
|
|
return AE_OK;
|
2009-06-10 19:56:00 +00:00
|
|
|
pci_dev_put(dev);
|
2013-03-04 21:30:41 +00:00
|
|
|
*cap |= acpi_is_video_device(handle);
|
2008-08-01 15:37:55 +00:00
|
|
|
}
|
|
|
|
return AE_OK;
|
|
|
|
}
|
|
|
|
|
2012-06-13 07:32:04 +00:00
|
|
|
/* Force to use vendor driver when the ACPI device is known to be
|
|
|
|
* buggy */
|
|
|
|
static int video_detect_force_vendor(const struct dmi_system_id *d)
|
|
|
|
{
|
|
|
|
acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dmi_system_id video_detect_dmi_table[] = {
|
|
|
|
/* On Samsung X360, the BIOS will set a flag (VDRV) if generic
|
|
|
|
* ACPI backlight device is used. This flag will definitively break
|
|
|
|
* the backlight interface (even the vendor interface) untill next
|
|
|
|
* reboot. It's why we should prevent video.ko from being used here
|
|
|
|
* and we can't rely on a later call to acpi_video_unregister().
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
.callback = video_detect_force_vendor,
|
|
|
|
.ident = "X360",
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
|
|
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
|
|
|
|
DMI_MATCH(DMI_BOARD_NAME, "X360"),
|
|
|
|
},
|
|
|
|
},
|
2012-11-30 12:02:50 +00:00
|
|
|
{
|
|
|
|
.callback = video_detect_force_vendor,
|
|
|
|
.ident = "Asus UL30VT",
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
|
|
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"),
|
|
|
|
},
|
|
|
|
},
|
2013-05-19 11:52:33 +00:00
|
|
|
{
|
|
|
|
.callback = video_detect_force_vendor,
|
|
|
|
.ident = "Asus UL30A",
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
|
|
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
|
|
|
|
},
|
|
|
|
},
|
2012-06-13 07:32:04 +00:00
|
|
|
{ },
|
|
|
|
};
|
|
|
|
|
2008-08-01 15:37:55 +00:00
|
|
|
/*
|
|
|
|
* Returns the video capabilities of a specific ACPI graphics device
|
|
|
|
*
|
|
|
|
* if NULL is passed as argument all ACPI devices are enumerated and
|
|
|
|
* all graphics capabilities of physically present devices are
|
2009-10-16 13:20:49 +00:00
|
|
|
* summarized and returned. This is cached and done only once.
|
2008-08-01 15:37:55 +00:00
|
|
|
*/
|
|
|
|
long acpi_video_get_capabilities(acpi_handle graphics_handle)
|
|
|
|
{
|
|
|
|
long caps = 0;
|
|
|
|
struct acpi_device *tmp_dev;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
if (acpi_video_caps_checked && graphics_handle == NULL)
|
|
|
|
return acpi_video_support;
|
|
|
|
|
|
|
|
if (!graphics_handle) {
|
|
|
|
/* Only do the global walk through all graphics devices once */
|
|
|
|
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
2009-11-13 02:06:08 +00:00
|
|
|
ACPI_UINT32_MAX, find_video, NULL,
|
2008-08-01 15:37:55 +00:00
|
|
|
&caps, NULL);
|
|
|
|
/* There might be boot param flags set already... */
|
|
|
|
acpi_video_support |= caps;
|
|
|
|
acpi_video_caps_checked = 1;
|
|
|
|
/* Add blacklists here. Be careful to use the right *DMI* bits
|
|
|
|
* to still be able to override logic via boot params, e.g.:
|
|
|
|
*
|
|
|
|
* if (dmi_name_in_vendors("XY")) {
|
|
|
|
* acpi_video_support |=
|
|
|
|
* ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
|
|
|
|
*}
|
|
|
|
*/
|
2012-06-13 07:32:04 +00:00
|
|
|
|
|
|
|
dmi_check_system(video_detect_dmi_table);
|
2008-08-01 15:37:55 +00:00
|
|
|
} else {
|
|
|
|
status = acpi_bus_get_device(graphics_handle, &tmp_dev);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_EXCEPTION((AE_INFO, status, "Invalid device"));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
acpi_walk_namespace(ACPI_TYPE_DEVICE, graphics_handle,
|
2009-11-13 02:06:08 +00:00
|
|
|
ACPI_UINT32_MAX, find_video, NULL,
|
2008-08-01 15:37:55 +00:00
|
|
|
&caps, NULL);
|
|
|
|
}
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "We have 0x%lX video support %s %s\n",
|
|
|
|
graphics_handle ? caps : acpi_video_support,
|
|
|
|
graphics_handle ? "on device " : "in general",
|
|
|
|
graphics_handle ? acpi_device_bid(tmp_dev) : ""));
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_video_get_capabilities);
|
|
|
|
|
2012-06-13 07:32:01 +00:00
|
|
|
static void acpi_video_caps_check(void)
|
2008-08-01 15:37:55 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* We must check whether the ACPI graphics device is physically plugged
|
|
|
|
* in. Therefore this must be called after binding PCI and ACPI devices
|
|
|
|
*/
|
|
|
|
if (!acpi_video_caps_checked)
|
|
|
|
acpi_video_get_capabilities(NULL);
|
2012-06-13 07:32:01 +00:00
|
|
|
}
|
|
|
|
|
ACPI / video / i915: No ACPI backlight if firmware expects Windows 8
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".
There's a problem with that approach, however, because simply
avoiding to register the ACPI backlight interface if the firmware
calls _OSI for Windows 8 may not work in the following situations:
(1) The ACPI backlight interface actually works on the given system
and the i915 driver is not loaded (e.g. another graphics driver
is used).
(2) The ACPI backlight interface doesn't work on the given system,
but there is a vendor platform driver that will register its
own, equally broken, backlight interface if not prevented from
doing so by the ACPI subsystem.
Therefore we need to allow the ACPI backlight interface to be
registered until the i915 driver is loaded which then will unregister
it if the firmware has called _OSI for Windows 8 (or will register
the ACPI video driver without backlight support if not already
present).
For this reason, introduce an alternative function for registering
ACPI video, acpi_video_register_with_quirks(), that will check
whether or not the ACPI video driver has already been registered
and whether or not the backlight Windows 8 quirk has to be applied.
If the quirk has to be applied, it will block the ACPI backlight
support and either unregister the backlight interface if the ACPI
video driver has already been registered, or register the ACPI
video driver without the backlight interface otherwise. Make
the i915 driver use acpi_video_register_with_quirks() instead of
acpi_video_register() in i915_driver_load().
This change is based on earlier patches from Matthew Garrett,
Chun-Yi Lee and Seth Forshee and includes a fix from Aaron Lu's.
References: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Tested-by: Aaron Lu <aaron.lu@intel.com>
Tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Tested-by: Yves-Alexis Perez <corsac@debian.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-07-18 00:08:06 +00:00
|
|
|
bool acpi_video_backlight_quirks(void)
|
|
|
|
{
|
|
|
|
if (acpi_gbl_osi_data >= ACPI_OSI_WIN_8) {
|
|
|
|
acpi_video_caps_check();
|
|
|
|
acpi_video_support |= ACPI_VIDEO_SKIP_BACKLIGHT;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_video_backlight_quirks);
|
|
|
|
|
2012-06-13 07:32:01 +00:00
|
|
|
/* Promote the vendor interface instead of the generic video module.
|
|
|
|
* This function allow DMI blacklists to be implemented by externals
|
|
|
|
* platform drivers instead of putting a big blacklist in video_detect.c
|
|
|
|
* After calling this function you will probably want to call
|
|
|
|
* acpi_video_unregister() to make sure the video module is not loaded
|
|
|
|
*/
|
|
|
|
void acpi_video_dmi_promote_vendor(void)
|
|
|
|
{
|
|
|
|
acpi_video_caps_check();
|
|
|
|
acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
|
|
|
|
|
|
|
|
/* To be called when a driver who previously promoted the vendor
|
|
|
|
* interface */
|
|
|
|
void acpi_video_dmi_demote_vendor(void)
|
|
|
|
{
|
|
|
|
acpi_video_caps_check();
|
|
|
|
acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_video_dmi_demote_vendor);
|
|
|
|
|
|
|
|
/* Returns true if video.ko can do backlight switching */
|
|
|
|
int acpi_video_backlight_support(void)
|
|
|
|
{
|
|
|
|
acpi_video_caps_check();
|
2008-08-01 15:37:55 +00:00
|
|
|
|
|
|
|
/* First check for boot param -> highest prio */
|
|
|
|
if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR)
|
|
|
|
return 0;
|
|
|
|
else if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Then check for DMI blacklist -> second highest prio */
|
|
|
|
if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_DMI_VENDOR)
|
|
|
|
return 0;
|
|
|
|
else if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_DMI_VIDEO)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Then go the default way */
|
|
|
|
return acpi_video_support & ACPI_VIDEO_BACKLIGHT;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_video_backlight_support);
|
|
|
|
|
ACPI / video / i915: No ACPI backlight if firmware expects Windows 8
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".
There's a problem with that approach, however, because simply
avoiding to register the ACPI backlight interface if the firmware
calls _OSI for Windows 8 may not work in the following situations:
(1) The ACPI backlight interface actually works on the given system
and the i915 driver is not loaded (e.g. another graphics driver
is used).
(2) The ACPI backlight interface doesn't work on the given system,
but there is a vendor platform driver that will register its
own, equally broken, backlight interface if not prevented from
doing so by the ACPI subsystem.
Therefore we need to allow the ACPI backlight interface to be
registered until the i915 driver is loaded which then will unregister
it if the firmware has called _OSI for Windows 8 (or will register
the ACPI video driver without backlight support if not already
present).
For this reason, introduce an alternative function for registering
ACPI video, acpi_video_register_with_quirks(), that will check
whether or not the ACPI video driver has already been registered
and whether or not the backlight Windows 8 quirk has to be applied.
If the quirk has to be applied, it will block the ACPI backlight
support and either unregister the backlight interface if the ACPI
video driver has already been registered, or register the ACPI
video driver without the backlight interface otherwise. Make
the i915 driver use acpi_video_register_with_quirks() instead of
acpi_video_register() in i915_driver_load().
This change is based on earlier patches from Matthew Garrett,
Chun-Yi Lee and Seth Forshee and includes a fix from Aaron Lu's.
References: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Tested-by: Aaron Lu <aaron.lu@intel.com>
Tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Tested-by: Yves-Alexis Perez <corsac@debian.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-07-18 00:08:06 +00:00
|
|
|
/* For the ACPI video driver use only. */
|
|
|
|
bool acpi_video_verify_backlight_support(void)
|
|
|
|
{
|
|
|
|
return (acpi_video_support & ACPI_VIDEO_SKIP_BACKLIGHT) ?
|
|
|
|
false : acpi_video_backlight_support();
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(acpi_video_verify_backlight_support);
|
|
|
|
|
2008-08-01 15:37:55 +00:00
|
|
|
/*
|
2010-12-06 07:04:21 +00:00
|
|
|
* Use acpi_backlight=vendor/video to force that backlight switching
|
|
|
|
* is processed by vendor specific acpi drivers or video.ko driver.
|
2008-08-01 15:37:55 +00:00
|
|
|
*/
|
2008-12-09 19:45:30 +00:00
|
|
|
static int __init acpi_backlight(char *str)
|
2008-08-01 15:37:55 +00:00
|
|
|
{
|
|
|
|
if (str == NULL || *str == '\0')
|
|
|
|
return 1;
|
|
|
|
else {
|
|
|
|
if (!strcmp("vendor", str))
|
|
|
|
acpi_video_support |=
|
|
|
|
ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR;
|
|
|
|
if (!strcmp("video", str))
|
|
|
|
acpi_video_support |=
|
2010-05-01 19:09:49 +00:00
|
|
|
ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO;
|
2008-08-01 15:37:55 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
__setup("acpi_backlight=", acpi_backlight);
|