Commit 8e5c2b77 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Revert "ACPI / video / i915: No ACPI backlight if firmware expects Windows 8"

We attempted to address a regression introduced by commit a57f7f91
(ACPICA: Add Windows8/Server2012 string for _OSI method.) after which
ACPI video backlight support doesn't work on a number of systems,
because the relevant AML methods in the ACPI tables in their BIOSes
become useless after the BIOS has been told that the OS is compatible
with Windows 8.  That problem is tracked by the bug entry at:

https://bugzilla.kernel.org/show_bug.cgi?id=51231

Commit 8c5bd7ad (ACPI / video / i915: No ACPI backlight if firmware
expects Windows 8) introduced for this purpose essentially prevented
the ACPI backlight support from being used if the BIOS had been told
that the OS was compatible with Windows 8 and the i915 driver was
loaded, in which case the backlight would always be handled by i915.
Unfortunately, however, that turned out to cause problems with
backlight to appear on multiple systems with symptoms indicating that
i915 was unable to control the backlight on those systems as
expected.

For this reason, revert commit 8c5bd7ad, but leave the function
acpi_video_backlight_quirks() introduced by it, because another
commit on top of it uses that function.

References: https://lkml.org/lkml/2013/7/21/119
References: https://lkml.org/lkml/2013/7/22/261
References: https://lkml.org/lkml/2013/7/23/429
References: https://lkml.org/lkml/2013/7/23/459
References: https://lkml.org/lkml/2013/7/23/81
References: https://lkml.org/lkml/2013/7/24/27Reported-and-tested-by: default avatarJames Hogan <james@albanarts.com>
Reported-and-tested-by: default avatarKamal Mostafa <kamal@canonical.com>
Reported-and-tested-by: default avatarJörg Otte <jrg.otte@gmail.com>
Reported-and-tested-by: default avatarSteven Newbury <steve@snewbury.org.uk>
Reported-by: default avatarMartin Steigerwald <Martin@lichtvoll.de>
Reported-by: default avatarKalle Valo <kvalo@adurom.com>
Tested-by: default avatarJoerg Platte <jplatte@naasa.net>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2134ed4d
...@@ -169,10 +169,8 @@ int acpi_create_platform_device(struct acpi_device *adev, ...@@ -169,10 +169,8 @@ int acpi_create_platform_device(struct acpi_device *adev,
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#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_video_backlight_quirks(void);
bool acpi_video_verify_backlight_support(void);
#else #else
static inline bool acpi_video_backlight_quirks(void) { return false; } static inline bool acpi_video_backlight_quirks(void) { return false; }
static inline bool acpi_video_verify_backlight_support(void) { return false; }
#endif #endif
#endif /* _ACPI_INTERNAL_H_ */ #endif /* _ACPI_INTERNAL_H_ */
...@@ -911,7 +911,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) ...@@ -911,7 +911,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
if (acpi_video_init_brightness(device)) if (acpi_video_init_brightness(device))
return; return;
if (acpi_video_verify_backlight_support()) { if (acpi_video_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;
...@@ -1366,8 +1366,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) ...@@ -1366,8 +1366,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 or a quirk is used */ /* no warning message if acpi_backlight=vendor is used */
if (!acpi_video_verify_backlight_support()) if (!acpi_video_backlight_support())
return 0; return 0;
if (!device->brightness) if (!device->brightness)
...@@ -1875,46 +1875,6 @@ static int acpi_video_bus_remove(struct acpi_device *device) ...@@ -1875,46 +1875,6 @@ static int acpi_video_bus_remove(struct acpi_device *device)
return 0; return 0;
} }
static acpi_status video_unregister_backlight(acpi_handle handle, u32 lvl,
void *context, void **rv)
{
struct acpi_device *acpi_dev;
struct acpi_video_bus *video;
struct acpi_video_device *dev, *next;
if (acpi_bus_get_device(handle, &acpi_dev))
return AE_OK;
if (acpi_match_device_ids(acpi_dev, video_device_ids))
return AE_OK;
video = acpi_driver_data(acpi_dev);
if (!video)
return AE_OK;
acpi_video_bus_stop_devices(video);
mutex_lock(&video->device_list_lock);
list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
if (dev->backlight) {
backlight_device_unregister(dev->backlight);
dev->backlight = NULL;
kfree(dev->brightness->levels);
kfree(dev->brightness);
}
if (dev->cooling_dev) {
sysfs_remove_link(&dev->dev->dev.kobj,
"thermal_cooling");
sysfs_remove_link(&dev->cooling_dev->device.kobj,
"device");
thermal_cooling_device_unregister(dev->cooling_dev);
dev->cooling_dev = NULL;
}
}
mutex_unlock(&video->device_list_lock);
acpi_video_bus_start_devices(video);
return AE_OK;
}
static int __init is_i740(struct pci_dev *dev) static int __init is_i740(struct pci_dev *dev)
{ {
if (dev->device == 0x00D1) if (dev->device == 0x00D1)
...@@ -1946,25 +1906,14 @@ static int __init intel_opregion_present(void) ...@@ -1946,25 +1906,14 @@ static int __init intel_opregion_present(void)
return opregion; return opregion;
} }
int __acpi_video_register(bool backlight_quirks) int acpi_video_register(void)
{ {
bool no_backlight; int result = 0;
int result;
no_backlight = backlight_quirks ? acpi_video_backlight_quirks() : false;
if (register_count) { if (register_count) {
/* /*
* If acpi_video_register() has been called already, don't try * if the function of acpi_video_register is already called,
* to register acpi_video_bus, but unregister backlight devices * don't register the acpi_vide_bus again and return no error.
* if no backlight support is requested.
*/ */
if (no_backlight)
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
video_unregister_backlight,
NULL, NULL, NULL);
return 0; return 0;
} }
...@@ -1980,7 +1929,7 @@ int __acpi_video_register(bool backlight_quirks) ...@@ -1980,7 +1929,7 @@ int __acpi_video_register(bool backlight_quirks)
return 0; return 0;
} }
EXPORT_SYMBOL(__acpi_video_register); EXPORT_SYMBOL(acpi_video_register);
void acpi_video_unregister(void) void acpi_video_unregister(void)
{ {
......
...@@ -238,12 +238,7 @@ static void acpi_video_caps_check(void) ...@@ -238,12 +238,7 @@ static void acpi_video_caps_check(void)
bool acpi_video_backlight_quirks(void) bool acpi_video_backlight_quirks(void)
{ {
if (acpi_gbl_osi_data >= ACPI_OSI_WIN_8) { return 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); EXPORT_SYMBOL(acpi_video_backlight_quirks);
...@@ -291,14 +286,6 @@ int acpi_video_backlight_support(void) ...@@ -291,14 +286,6 @@ int acpi_video_backlight_support(void)
} }
EXPORT_SYMBOL(acpi_video_backlight_support); EXPORT_SYMBOL(acpi_video_backlight_support);
/* 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);
/* /*
* Use acpi_backlight=vendor/video to force that backlight switching * Use acpi_backlight=vendor/video to force that backlight switching
* is processed by vendor specific acpi drivers or video.ko driver. * is processed by vendor specific acpi drivers or video.ko driver.
......
...@@ -1648,7 +1648,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1648,7 +1648,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
if (INTEL_INFO(dev)->num_pipes) { if (INTEL_INFO(dev)->num_pipes) {
/* Must be done after probing outputs */ /* Must be done after probing outputs */
intel_opregion_init(dev); intel_opregion_init(dev);
acpi_video_register_with_quirks(); acpi_video_register();
} }
if (IS_GEN5(dev)) if (IS_GEN5(dev))
......
...@@ -17,21 +17,12 @@ struct acpi_device; ...@@ -17,21 +17,12 @@ struct acpi_device;
#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 #define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
extern int __acpi_video_register(bool backlight_quirks); extern int acpi_video_register(void);
static inline int acpi_video_register(void)
{
return __acpi_video_register(false);
}
static inline int acpi_video_register_with_quirks(void)
{
return __acpi_video_register(true);
}
extern void acpi_video_unregister(void); extern void acpi_video_unregister(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);
#else #else
static inline int acpi_video_register(void) { return 0; } static inline int acpi_video_register(void) { return 0; }
static inline int acpi_video_register_with_quirks(void) { return 0; }
static inline void acpi_video_unregister(void) { return; } static inline void acpi_video_unregister(void) { return; }
static inline int acpi_video_get_edid(struct acpi_device *device, int type, static inline int acpi_video_get_edid(struct acpi_device *device, int type,
int device_id, void **edid) int device_id, void **edid)
......
...@@ -191,7 +191,6 @@ extern bool wmi_has_guid(const char *guid); ...@@ -191,7 +191,6 @@ extern bool wmi_has_guid(const char *guid);
#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800
#define ACPI_VIDEO_SKIP_BACKLIGHT 0x1000
#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
......
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