aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-26 17:37:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-26 17:37:18 -0400
commit0f746650258187664a7afa1f708618f6599f6d76 (patch)
tree0c34864acddcc9196e17bdef38ddf01b4278144d
parenta9b5f023947a67d430a4db61a1e2bc7fc258aa72 (diff)
parent8e5c2b776ae4c35f54547c017e0a943429f5748a (diff)
Merge tag 'pm+acpi-3.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management fixes from Rafael Wysocki: "These are just two fixes, a revert of the would-be backlight fix that didn't work and an intel_pstate fix for two problems related to maximum P-state selection. Specifics: - Revert of the ACPI video commit that I hoped would help fix backlight problems related to Windows 8 compatibility on some systems. Unfortunately, it turned out to cause problems to happen too. - Fix for two problems in intel_pstate, a possible failure to respond to a load change on a quiet system and a possible failure to select the highest available P-state on some systems. From Dirk Brandewie" * tag 'pm+acpi-3.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: Revert "ACPI / video / i915: No ACPI backlight if firmware expects Windows 8" cpufreq / intel_pstate: Change to scale off of max P-state
-rw-r--r--drivers/acpi/internal.h2
-rw-r--r--drivers/acpi/video.c67
-rw-r--r--drivers/acpi/video_detect.c15
-rw-r--r--drivers/cpufreq/intel_pstate.c12
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c2
-rw-r--r--include/acpi/video.h11
-rw-r--r--include/linux/acpi.h1
7 files changed, 17 insertions, 93 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 227aca77ee1e..5da44e81dd4d 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -169,10 +169,8 @@ int acpi_create_platform_device(struct acpi_device *adev,
169 -------------------------------------------------------------------------- */ 169 -------------------------------------------------------------------------- */
170#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) 170#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
171bool acpi_video_backlight_quirks(void); 171bool acpi_video_backlight_quirks(void);
172bool acpi_video_verify_backlight_support(void);
173#else 172#else
174static inline bool acpi_video_backlight_quirks(void) { return false; } 173static inline bool acpi_video_backlight_quirks(void) { return false; }
175static inline bool acpi_video_verify_backlight_support(void) { return false; }
176#endif 174#endif
177 175
178#endif /* _ACPI_INTERNAL_H_ */ 176#endif /* _ACPI_INTERNAL_H_ */
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{
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 826e52def080..c3397748ba46 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -238,12 +238,7 @@ static void acpi_video_caps_check(void)
238 238
239bool acpi_video_backlight_quirks(void) 239bool acpi_video_backlight_quirks(void)
240{ 240{
241 if (acpi_gbl_osi_data >= ACPI_OSI_WIN_8) { 241 return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
242 acpi_video_caps_check();
243 acpi_video_support |= ACPI_VIDEO_SKIP_BACKLIGHT;
244 return true;
245 }
246 return false;
247} 242}
248EXPORT_SYMBOL(acpi_video_backlight_quirks); 243EXPORT_SYMBOL(acpi_video_backlight_quirks);
249 244
@@ -291,14 +286,6 @@ int acpi_video_backlight_support(void)
291} 286}
292EXPORT_SYMBOL(acpi_video_backlight_support); 287EXPORT_SYMBOL(acpi_video_backlight_support);
293 288
294/* For the ACPI video driver use only. */
295bool acpi_video_verify_backlight_support(void)
296{
297 return (acpi_video_support & ACPI_VIDEO_SKIP_BACKLIGHT) ?
298 false : acpi_video_backlight_support();
299}
300EXPORT_SYMBOL(acpi_video_verify_backlight_support);
301
302/* 289/*
303 * Use acpi_backlight=vendor/video to force that backlight switching 290 * Use acpi_backlight=vendor/video to force that backlight switching
304 * is processed by vendor specific acpi drivers or video.ko driver. 291 * is processed by vendor specific acpi drivers or video.ko driver.
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index b012d7600e1a..7cde885011ed 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -103,10 +103,10 @@ struct pstate_adjust_policy {
103static struct pstate_adjust_policy default_policy = { 103static struct pstate_adjust_policy default_policy = {
104 .sample_rate_ms = 10, 104 .sample_rate_ms = 10,
105 .deadband = 0, 105 .deadband = 0,
106 .setpoint = 109, 106 .setpoint = 97,
107 .p_gain_pct = 17, 107 .p_gain_pct = 20,
108 .d_gain_pct = 0, 108 .d_gain_pct = 0,
109 .i_gain_pct = 4, 109 .i_gain_pct = 0,
110}; 110};
111 111
112struct perf_limits { 112struct perf_limits {
@@ -468,12 +468,12 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu)
468static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu) 468static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu)
469{ 469{
470 int32_t busy_scaled; 470 int32_t busy_scaled;
471 int32_t core_busy, turbo_pstate, current_pstate; 471 int32_t core_busy, max_pstate, current_pstate;
472 472
473 core_busy = int_tofp(cpu->samples[cpu->sample_ptr].core_pct_busy); 473 core_busy = int_tofp(cpu->samples[cpu->sample_ptr].core_pct_busy);
474 turbo_pstate = int_tofp(cpu->pstate.turbo_pstate); 474 max_pstate = int_tofp(cpu->pstate.max_pstate);
475 current_pstate = int_tofp(cpu->pstate.current_pstate); 475 current_pstate = int_tofp(cpu->pstate.current_pstate);
476 busy_scaled = mul_fp(core_busy, div_fp(turbo_pstate, current_pstate)); 476 busy_scaled = mul_fp(core_busy, div_fp(max_pstate, current_pstate));
477 477
478 return fp_toint(busy_scaled); 478 return fp_toint(busy_scaled);
479} 479}
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 67ec54f67afe..abf158da9b30 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1648,7 +1648,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1648 if (INTEL_INFO(dev)->num_pipes) { 1648 if (INTEL_INFO(dev)->num_pipes) {
1649 /* Must be done after probing outputs */ 1649 /* Must be done after probing outputs */
1650 intel_opregion_init(dev); 1650 intel_opregion_init(dev);
1651 acpi_video_register_with_quirks(); 1651 acpi_video_register();
1652 } 1652 }
1653 1653
1654 if (IS_GEN5(dev)) 1654 if (IS_GEN5(dev))
diff --git a/include/acpi/video.h b/include/acpi/video.h
index b26dc4fb7ba8..61109f2609fc 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -17,21 +17,12 @@ struct acpi_device;
17#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 17#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
18 18
19#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 19#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
20extern int __acpi_video_register(bool backlight_quirks); 20extern int acpi_video_register(void);
21static inline int acpi_video_register(void)
22{
23 return __acpi_video_register(false);
24}
25static inline int acpi_video_register_with_quirks(void)
26{
27 return __acpi_video_register(true);
28}
29extern void acpi_video_unregister(void); 21extern void acpi_video_unregister(void);
30extern int acpi_video_get_edid(struct acpi_device *device, int type, 22extern int acpi_video_get_edid(struct acpi_device *device, int type,
31 int device_id, void **edid); 23 int device_id, void **edid);
32#else 24#else
33static inline int acpi_video_register(void) { return 0; } 25static inline int acpi_video_register(void) { return 0; }
34static inline int acpi_video_register_with_quirks(void) { return 0; }
35static inline void acpi_video_unregister(void) { return; } 26static inline void acpi_video_unregister(void) { return; }
36static inline int acpi_video_get_edid(struct acpi_device *device, int type, 27static inline int acpi_video_get_edid(struct acpi_device *device, int type,
37 int device_id, void **edid) 28 int device_id, void **edid)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6ad72f92469c..353ba256f368 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -191,7 +191,6 @@ extern bool wmi_has_guid(const char *guid);
191#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 191#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200
192#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 192#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400
193#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 193#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800
194#define ACPI_VIDEO_SKIP_BACKLIGHT 0x1000
195 194
196#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) 195#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
197 196