aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-25 15:43:39 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-26 08:59:20 -0400
commit8e5c2b776ae4c35f54547c017e0a943429f5748a (patch)
treef653dcb55a48408b87224f1515ddb39129a8e9ef /drivers/acpi/video.c
parent2134ed4d614349b2b4e8d7bb593baa9179b8dd1e (diff)
Revert "ACPI / video / i915: No ACPI backlight if firmware expects Windows 8"
We attempted to address a regression introduced by commit a57f7f9 (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 8c5bd7a (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 8c5bd7a, 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/27 Reported-and-tested-by: James Hogan <james@albanarts.com> Reported-and-tested-by: Kamal Mostafa <kamal@canonical.com> Reported-and-tested-by: Jörg Otte <jrg.otte@gmail.com> Reported-and-tested-by: Steven Newbury <steve@snewbury.org.uk> Reported-by: Martin Steigerwald <Martin@lichtvoll.de> Reported-by: Kalle Valo <kvalo@adurom.com> Tested-by: Joerg Platte <jplatte@naasa.net> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c67
1 files changed, 8 insertions, 59 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 6dd237e79b4f..0ec434d2586d 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -911,7 +911,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
911 if (acpi_video_init_brightness(device)) 911 if (acpi_video_init_brightness(device))
912 return; 912 return;
913 913
914 if (acpi_video_verify_backlight_support()) { 914 if (acpi_video_backlight_support()) {
915 struct backlight_properties props; 915 struct backlight_properties props;
916 struct pci_dev *pdev; 916 struct pci_dev *pdev;
917 acpi_handle acpi_parent; 917 acpi_handle acpi_parent;
@@ -1366,8 +1366,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
1366 unsigned long long level_current, level_next; 1366 unsigned long long level_current, level_next;
1367 int result = -EINVAL; 1367 int result = -EINVAL;
1368 1368
1369 /* no warning message if acpi_backlight=vendor or a quirk is used */ 1369 /* no warning message if acpi_backlight=vendor is used */
1370 if (!acpi_video_verify_backlight_support()) 1370 if (!acpi_video_backlight_support())
1371 return 0; 1371 return 0;
1372 1372
1373 if (!device->brightness) 1373 if (!device->brightness)
@@ -1875,46 +1875,6 @@ static int acpi_video_bus_remove(struct acpi_device *device)
1875 return 0; 1875 return 0;
1876} 1876}
1877 1877
1878static acpi_status video_unregister_backlight(acpi_handle handle, u32 lvl,
1879 void *context, void **rv)
1880{
1881 struct acpi_device *acpi_dev;
1882 struct acpi_video_bus *video;
1883 struct acpi_video_device *dev, *next;
1884
1885 if (acpi_bus_get_device(handle, &acpi_dev))
1886 return AE_OK;
1887
1888 if (acpi_match_device_ids(acpi_dev, video_device_ids))
1889 return AE_OK;
1890
1891 video = acpi_driver_data(acpi_dev);
1892 if (!video)
1893 return AE_OK;
1894
1895 acpi_video_bus_stop_devices(video);
1896 mutex_lock(&video->device_list_lock);
1897 list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
1898 if (dev->backlight) {
1899 backlight_device_unregister(dev->backlight);
1900 dev->backlight = NULL;
1901 kfree(dev->brightness->levels);
1902 kfree(dev->brightness);
1903 }
1904 if (dev->cooling_dev) {
1905 sysfs_remove_link(&dev->dev->dev.kobj,
1906 "thermal_cooling");
1907 sysfs_remove_link(&dev->cooling_dev->device.kobj,
1908 "device");
1909 thermal_cooling_device_unregister(dev->cooling_dev);
1910 dev->cooling_dev = NULL;
1911 }
1912 }
1913 mutex_unlock(&video->device_list_lock);
1914 acpi_video_bus_start_devices(video);
1915 return AE_OK;
1916}
1917
1918static int __init is_i740(struct pci_dev *dev) 1878static int __init is_i740(struct pci_dev *dev)
1919{ 1879{
1920 if (dev->device == 0x00D1) 1880 if (dev->device == 0x00D1)
@@ -1946,25 +1906,14 @@ static int __init intel_opregion_present(void)
1946 return opregion; 1906 return opregion;
1947} 1907}
1948 1908
1949int __acpi_video_register(bool backlight_quirks) 1909int acpi_video_register(void)
1950{ 1910{
1951 bool no_backlight; 1911 int result = 0;
1952 int result;
1953
1954 no_backlight = backlight_quirks ? acpi_video_backlight_quirks() : false;
1955
1956 if (register_count) { 1912 if (register_count) {
1957 /* 1913 /*
1958 * If acpi_video_register() has been called already, don't try 1914 * if the function of acpi_video_register is already called,
1959 * to register acpi_video_bus, but unregister backlight devices 1915 * don't register the acpi_vide_bus again and return no error.
1960 * if no backlight support is requested.
1961 */ 1916 */
1962 if (no_backlight)
1963 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1964 ACPI_UINT32_MAX,
1965 video_unregister_backlight,
1966 NULL, NULL, NULL);
1967
1968 return 0; 1917 return 0;
1969 } 1918 }
1970 1919
@@ -1980,7 +1929,7 @@ int __acpi_video_register(bool backlight_quirks)
1980 1929
1981 return 0; 1930 return 0;
1982} 1931}
1983EXPORT_SYMBOL(__acpi_video_register); 1932EXPORT_SYMBOL(acpi_video_register);
1984 1933
1985void acpi_video_unregister(void) 1934void acpi_video_unregister(void)
1986{ 1935{