History

Merge tag 'pm+acpi-3.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI fixes from Rafael Wysocki: - intel_pstate driver fixes and cleanups from Dirk Brandewie and Wei Yongjun. - cpufreq fixes related to ARM big.LITTLE support and the cpufreq-cpu0 driver from Viresh Kumar. - Assorted cpufreq fixes from Srivatsa S Bhat, Borislav Petkov, Wolfram Sang, Alexander Shiyan, and Nishanth Menon. - Assorted ACPI fixes from Catalin Marinas, Lan Tianyu, Alex Hung, Jan-Simon Möller, and Rafael J Wysocki. - Fix for a kfree() under spinlock in the PM core from Shuah Khan. - PM documentation updates from Borislav Petkov and Zhang Rui. * tag 'pm+acpi-3.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (30 commits) cpufreq: Preserve sysfs files across suspend/resume ACPI / scan: Fix memory leak on acpi_scan_init_hotplug() error path PM / hibernate: Correct documentation PM / Documentation: remove inaccurate suspend/hibernate transition lantency statement PM: Documentation update for freeze state cpufreq / intel_pstate: use vzalloc() instead of vmalloc()/memset(0) cpufreq, ondemand: Remove leftover debug line PM: Avoid calling kfree() under spinlock in dev_pm_put_subsys_data() cpufreq / kirkwood: don't check resource with devm_ioremap_resource cpufreq / intel_pstate: remove #ifdef MODULE compile fence cpufreq / intel_pstate: Remove idle mode PID cpufreq / intel_pstate: fix ffmpeg regression cpufreq / intel_pstate: use lowest requested max performance cpufreq / intel_pstate: remove idle time and duration from sample and calculations cpufreq: Fix incorrect dependecies for ARM SA11xx drivers cpufreq: ARM big LITTLE: Fix Kconfig entries cpufreq: cpufreq-cpu0: Free parent node for error cases cpufreq: cpufreq-cpu0: defer probe when regulator is not ready cpufreq: Issue CPUFREQ_GOV_POLICY_EXIT notifier before dropping policy refcount cpufreq: governors: Fix CPUFREQ_GOV_POLICY_{INIT|EXIT} notifiers ...

Linus Torvalds committed 13 years ago

Commit d5fe85a2 parents 8968216 49a9e4326 files · +190 −195Browse files

Unified · Split

26 files
  1. Documentation/power/devices.txt +8 −7
  2. Documentation/power/interface.txt +2 −2
  3. Documentation/power/notifiers.txt +4 −2
  4. Documentation/power/states.txt +17 −13
  5. drivers/acpi/ac.c +33 −0
  6. drivers/acpi/ec.c +1 −3
  7. drivers/acpi/processor_driver.c +4 −4
  8. drivers/acpi/processor_idle.c +19 −10
  9. drivers/acpi/scan.c +2 −1
  10. drivers/acpi/video.c +8 −0
  11. drivers/base/power/common.c +6 −6
  12. drivers/cpufreq/Kconfig +1 −1
  13. drivers/cpufreq/Kconfig.arm +8 −7
  14. drivers/cpufreq/arm_big_little.c +1 −6
  15. drivers/cpufreq/arm_big_little.h +5 −0
  16. drivers/cpufreq/arm_big_little_dt.c +5 −4
  17. drivers/cpufreq/cpufreq-cpu0.c +20 −7
  18. drivers/cpufreq/cpufreq.c +4 −6
  19. drivers/cpufreq/cpufreq_governor.c +7 −4
  20. drivers/cpufreq/cpufreq_governor.h +1 −0
  21. drivers/cpufreq/cpufreq_ondemand.c +0 −1
  22. drivers/cpufreq/cpufreq_stats.c +4 −3
  23. drivers/cpufreq/intel_pstate.c +21 −101
  24. drivers/cpufreq/kirkwood-cpufreq.c +0 −4
  25. include/acpi/acpiosxf.h +1 −1
  26. include/acpi/processor.h +8 −2
Documentation/power/devices.txt+8−7
@@ -268,7 +268,7 @@ situations. · 267 unmodified lines
268268 System Power Management Phases
269269 ------------------------------
270270 Suspending or resuming the system is done in several phases. Different phases
271−are used for standby or memory sleep states ("suspend-to-RAM") and the
271+are used for freeze, standby, and memory sleep states ("suspend-to-RAM") and the
272272 hibernation state ("suspend-to-disk"). Each phase involves executing callbacks
273273 for every device before the next phase begins. Not all busses or classes
274274 support all these callbacks and not all drivers use all the callbacks. The
@@ -309,7 +309,8 @@ execute the corresponding method from dev->driver->pm instead if there is one. · 34 unmodified lines
309309
310310 Entering System Suspend
311311 -----------------------
312−When the system goes into the standby or memory sleep state, the phases are:
312+When the system goes into the freeze, standby or memory sleep state,
313+the phases are:
313314
314315 prepare, suspend, suspend_late, suspend_noirq.
315316
@@ -368,7 +369,7 @@ the devices that were suspended. · 52 unmodified lines
368369
369370 Leaving System Suspend
370371 ----------------------
371−When resuming from standby or memory sleep, the phases are:
372+When resuming from freeze, standby or memory sleep, the phases are:
372373
373374 resume_noirq, resume_early, resume, complete.
374375
@@ -433,8 +434,8 @@ the system log. · 58 unmodified lines
433434
434435 Entering Hibernation
435436 --------------------
436−Hibernating the system is more complicated than putting it into the standby or
437−memory sleep state, because it involves creating and saving a system image.
437+Hibernating the system is more complicated than putting it into the other
438+sleep states, because it involves creating and saving a system image.
438439 Therefore there are more phases for hibernation, with a different set of
439440 callbacks. These phases always run after tasks have been frozen and memory has
440441 been freed.
@@ -485,8 +486,8 @@ image forms an atomic snapshot of the system state. · 44 unmodified lines
485486
486487 At this point the system image is saved, and the devices then need to be
487488 prepared for the upcoming system shutdown. This is much like suspending them
488−before putting the system into the standby or memory sleep state, and the phases
489−are similar.
489+before putting the system into the freeze, standby or memory sleep state,
490+and the phases are similar.
490491
491492 9. The prepare phase is discussed above.
492493
Documentation/power/interface.txt+2−2
@@ -7,8 +7,8 @@ running. The interface exists in /sys/power/ directory (assuming sysfs · 6 unmodified lines
77 is mounted at /sys).
88
99 /sys/power/state controls system power state. Reading from this file
10−returns what states are supported, which is hard-coded to 'standby'
11−(Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
10+returns what states are supported, which is hard-coded to 'freeze',
11+'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
1212 (Suspend-to-Disk).
1313
1414 Writing to this file one of those strings causes the system to
Documentation/power/notifiers.txt+4−2
@@ -15,8 +15,10 @@ A suspend/hibernation notifier may be used for this purpose. · 14 unmodified lines
1515 The subsystems or drivers having such needs can register suspend notifiers that
1616 will be called upon the following events by the PM core:
1717
18−PM_HIBERNATION_PREPARE The system is going to hibernate or suspend, tasks will
19− be frozen immediately.
18+PM_HIBERNATION_PREPARE The system is going to hibernate, tasks will be frozen
19+ immediately. This is different from PM_SUSPEND_PREPARE
20+ below because here we do additional work between notifiers
21+ and drivers freezing.
2022
2123 PM_POST_HIBERNATION The system memory state has been restored from a
2224 hibernation image or an error occurred during
Documentation/power/states.txt+17−13
@@ -2,12 +2,26 @@ · 1 unmodified line
22 System Power Management States
33
44
5−The kernel supports three power management states generically, though
6−each is dependent on platform support code to implement the low-level
7−details for each state. This file describes each state, what they are
5+The kernel supports four power management states generically, though
6+one is generic and the other three are dependent on platform support
7+code to implement the low-level details for each state.
8+This file describes each state, what they are
89 commonly called, what ACPI state they map to, and what string to write
910 to /sys/power/state to enter that state
1011
12+state: Freeze / Low-Power Idle
13+ACPI state: S0
14+String: "freeze"
15+
16+This state is a generic, pure software, light-weight, low-power state.
17+It allows more energy to be saved relative to idle by freezing user
18+space and putting all I/O devices into low-power states (possibly
19+lower-power than available at run time), such that the processors can
20+spend more time in their idle states.
21+This state can be used for platforms without Standby/Suspend-to-RAM
22+support, or it can be used in addition to Suspend-to-RAM (memory sleep)
23+to provide reduced resume latency.
24+
1125
1226 State: Standby / Power-On Suspend
1327 ACPI State: S1
@@ -22,9 +36,6 @@ We try to put devices in a low-power state equivalent to D1, which · 8 unmodified lines
2236 also offers low power savings, but low resume latency. Not all devices
2337 support D1, and those that don't are left on.
2438
25−A transition from Standby to the On state should take about 1-2
26−seconds.
27−
2839
2940 State: Suspend-to-RAM
3041 ACPI State: S3
@@ -42,9 +53,6 @@ transition back to the On state. · 11 unmodified lines
4253 For at least ACPI, STR requires some minimal boot-strapping code to
4354 resume the system from STR. This may be true on other platforms.
4455
45−A transition from Suspend-to-RAM to the On state should take about
46−3-5 seconds.
47−
4856
4957 State: Suspend-to-disk
5058 ACPI State: S4
@@ -74,7 +82,3 @@ low-power state (like ACPI S4), or it may simply power down. Powering · 23 unmodified lines
7482 down offers greater savings, and allows this mechanism to work on any
7583 system. However, entering a real low-power state allows the user to
7684 trigger wake up events (e.g. pressing a key or opening a laptop lid).
77−
78−A transition from Suspend-to-Disk to the On state should take about 30
79−seconds, though it's typically a bit more with the current
80−implementation.
drivers/acpi/ac.c+33−0
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828 #include <linux/slab.h>
2929 #include <linux/init.h>
3030 #include <linux/types.h>
31+#include <linux/dmi.h>
32+#include <linux/delay.h>
3133 #ifdef CONFIG_ACPI_PROCFS_POWER
3234 #include <linux/proc_fs.h>
3335 #include <linux/seq_file.h>
@@ -74,6 +76,8 @@ static int acpi_ac_resume(struct device *dev); · 40 unmodified lines
7476 #endif
7577 static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
7678
79+static int ac_sleep_before_get_state_ms;
80+
7781 static struct acpi_driver acpi_ac_driver = {
7882 .name = "ac",
7983 .class = ACPI_AC_CLASS,
@@ -252,6 +256,16 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) · 172 unmodified lines
252256 case ACPI_AC_NOTIFY_STATUS:
253257 case ACPI_NOTIFY_BUS_CHECK:
254258 case ACPI_NOTIFY_DEVICE_CHECK:
259+ /*
260+ * A buggy BIOS may notify AC first and then sleep for
261+ * a specific time before doing actual operations in the
262+ * EC event handler (_Qxx). This will cause the AC state
263+ * reported by the ACPI event to be incorrect, so wait for a
264+ * specific time for the EC event handler to make progress.
265+ */
266+ if (ac_sleep_before_get_state_ms > 0)
267+ msleep(ac_sleep_before_get_state_ms);
268+
255269 acpi_ac_get_state(ac);
256270 acpi_bus_generate_proc_event(device, event, (u32) ac->state);
257271 acpi_bus_generate_netlink_event(device->pnp.device_class,
@@ -264,6 +278,24 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) · 6 unmodified lines
264278 return;
265279 }
266280
281+static int thinkpad_e530_quirk(const struct dmi_system_id *d)
282+{
283+ ac_sleep_before_get_state_ms = 1000;
284+ return 0;
285+}
286+
287+static struct dmi_system_id ac_dmi_table[] = {
288+ {
289+ .callback = thinkpad_e530_quirk,
290+ .ident = "thinkpad e530",
291+ .matches = {
292+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
293+ DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
294+ },
295+ },
296+ {},
297+};
298+
267299 static int acpi_ac_add(struct acpi_device *device)
268300 {
269301 int result = 0;
@@ -312,6 +344,7 @@ static int acpi_ac_add(struct acpi_device *device) · 42 unmodified lines
312344 kfree(ac);
313345 }
314346
347+ dmi_check_system(ac_dmi_table);
315348 return result;
316349 }
317350
drivers/acpi/ec.c+1−3
@@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) · 222 unmodified lines
223223 static int ec_poll(struct acpi_ec *ec)
224224 {
225225 unsigned long flags;
226− int repeat = 2; /* number of command restarts */
226+ int repeat = 5; /* number of command restarts */
227227 while (repeat--) {
228228 unsigned long delay = jiffies +
229229 msecs_to_jiffies(ec_delay);
@@ -241,8 +241,6 @@ static int ec_poll(struct acpi_ec *ec) · 11 unmodified lines
241241 }
242242 advance_transaction(ec, acpi_ec_read_status(ec));
243243 } while (time_before(jiffies, delay));
244− if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
245− break;
246244 pr_debug(PREFIX "controller reset, restart transaction\n");
247245 spin_lock_irqsave(&ec->lock, flags);
248246 start_transaction(ec);
drivers/acpi/processor_driver.c+4−4
@@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = { · 94 unmodified lines
9595 };
9696 MODULE_DEVICE_TABLE(acpi, processor_device_ids);
9797
98−static SIMPLE_DEV_PM_OPS(acpi_processor_pm,
99− acpi_processor_suspend, acpi_processor_resume);
100−
10198 static struct acpi_driver acpi_processor_driver = {
10299 .name = "processor",
103100 .class = ACPI_PROCESSOR_CLASS,
@@ -107,7 +104,6 @@ static struct acpi_driver acpi_processor_driver = { · 3 unmodified lines
107104 .remove = acpi_processor_remove,
108105 .notify = acpi_processor_notify,
109106 },
110− .drv.pm = &acpi_processor_pm,
111107 };
112108
113109 #define INSTALL_NOTIFY_HANDLER 1
@@ -934,6 +930,8 @@ static int __init acpi_processor_init(void) · 820 unmodified lines
934930 if (result < 0)
935931 return result;
936932
933+ acpi_processor_syscore_init();
934+
937935 acpi_processor_install_hotplug_notify();
938936
939937 acpi_thermal_cpufreq_init();
@@ -956,6 +954,8 @@ static void __exit acpi_processor_exit(void) · 16 unmodified lines
956954
957955 acpi_processor_uninstall_hotplug_notify();
958956
957+ acpi_processor_syscore_exit();
958+
959959 acpi_bus_unregister_driver(&acpi_processor_driver);
960960
961961 return;
drivers/acpi/processor_idle.c+19−10
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <linux/sched.h> /* need_resched() */
3535 #include <linux/clockchips.h>
3636 #include <linux/cpuidle.h>
37+#include <linux/syscore_ops.h>
3738
3839 /*
3940 * Include the apic definitions for x86 to have the APIC timer related defines
@@ -210,33 +211,41 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, · 170 unmodified lines
210211
211212 #endif
212213
214+#ifdef CONFIG_PM_SLEEP
213215 static u32 saved_bm_rld;
214216
215−static void acpi_idle_bm_rld_save(void)
217+int acpi_processor_suspend(void)
216218 {
217219 acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld);
220+ return 0;
218221 }
219−static void acpi_idle_bm_rld_restore(void)
222+
223+void acpi_processor_resume(void)
220224 {
221225 u32 resumed_bm_rld;
222226
223227 acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);
228+ if (resumed_bm_rld == saved_bm_rld)
229+ return;
224230
225− if (resumed_bm_rld != saved_bm_rld)
226− acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
231+ acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
227232 }
228233
229−int acpi_processor_suspend(struct device *dev)
234+static struct syscore_ops acpi_processor_syscore_ops = {
235+ .suspend = acpi_processor_suspend,
236+ .resume = acpi_processor_resume,
237+};
238+
239+void acpi_processor_syscore_init(void)
230240 {
231− acpi_idle_bm_rld_save();
232− return 0;
241+ register_syscore_ops(&acpi_processor_syscore_ops);
233242 }
234243
235−int acpi_processor_resume(struct device *dev)
244+void acpi_processor_syscore_exit(void)
236245 {
237− acpi_idle_bm_rld_restore();
238− return 0;
246+ unregister_syscore_ops(&acpi_processor_syscore_ops);
239247 }
248+#endif /* CONFIG_PM_SLEEP */
240249
241250 #if defined(CONFIG_X86)
242251 static void tsc_check_state(int state)
drivers/acpi/scan.c+2−1
@@ -1785,7 +1785,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) · 1784 unmodified lines
17851785 acpi_set_pnp_ids(handle, &pnp, type);
17861786
17871787 if (!pnp.type.hardware_id)
1788− return;
1788+ goto out;
17891789
17901790 /*
17911791 * This relies on the fact that acpi_install_notify_handler() will not
@@ -1800,6 +1800,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) · 8 unmodified lines
18001800 }
18011801 }
18021802
1803+out:
18031804 acpi_free_pnp_ids(&pnp);
18041805 }
18051806
drivers/acpi/video.c+8−0
@@ -456,6 +456,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { · 455 unmodified lines
456456 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"),
457457 },
458458 },
459+ {
460+ .callback = video_ignore_initial_backlight,
461+ .ident = "HP 1000 Notebook PC",
462+ .matches = {
463+ DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
464+ DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"),
465+ },
466+ },
459467 {}
460468 };
461469
drivers/base/power/common.c+6−6
@@ -61,24 +61,24 @@ EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data); · 60 unmodified lines
6161 int dev_pm_put_subsys_data(struct device *dev)
6262 {
6363 struct pm_subsys_data *psd;
64− int ret = 0;
64+ int ret = 1;
6565
6666 spin_lock_irq(&dev->power.lock);
6767
6868 psd = dev_to_psd(dev);
69− if (!psd) {
70− ret = -EINVAL;
69+ if (!psd)
7170 goto out;
72− }
7371
7472 if (--psd->refcount == 0) {
7573 dev->power.subsys_data = NULL;
76− kfree(psd);
77− ret = 1;
74+ } else {
75+ psd = NULL;
76+ ret = 0;
7877 }
7978
8079 out:
8180 spin_unlock_irq(&dev->power.lock);
81+ kfree(psd);
8282
8383 return ret;
8484 }
drivers/cpufreq/Kconfig+1−1
@@ -47,7 +47,7 @@ config CPU_FREQ_STAT_DETAILS · 46 unmodified lines
4747
4848 choice
4949 prompt "Default CPUFreq governor"
50− default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110
50+ default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1100_CPUFREQ || ARM_SA1110_CPUFREQ
5151 default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
5252 help
5353 This option sets which CPUFreq governor shall be loaded at
drivers/cpufreq/Kconfig.arm+8−7
@@ -3,16 +3,17 @@ · 2 unmodified lines
33 #
44
55 config ARM_BIG_LITTLE_CPUFREQ
6− tristate
7− depends on ARM_CPU_TOPOLOGY
6+ tristate "Generic ARM big LITTLE CPUfreq driver"
7+ depends on ARM_CPU_TOPOLOGY && PM_OPP && HAVE_CLK
8+ help
9+ This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
810
911 config ARM_DT_BL_CPUFREQ
10− tristate "Generic ARM big LITTLE CPUfreq driver probed via DT"
11− select ARM_BIG_LITTLE_CPUFREQ
12− depends on OF && HAVE_CLK
12+ tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver"
13+ depends on ARM_BIG_LITTLE_CPUFREQ && OF
1314 help
14− This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
15− This gets frequency tables from DT.
15+ This enables probing via DT for Generic CPUfreq driver for ARM
16+ big.LITTLE platform. This gets frequency tables from DT.
1617
1718 config ARM_EXYNOS_CPUFREQ
1819 bool "SAMSUNG EXYNOS SoCs"
drivers/cpufreq/arm_big_little.c+1−6
@@ -40,11 +40,6 @@ static struct clk *clk[MAX_CLUSTERS]; · 39 unmodified lines
4040 static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS];
4141 static atomic_t cluster_usage[MAX_CLUSTERS] = {ATOMIC_INIT(0), ATOMIC_INIT(0)};
4242
43−static int cpu_to_cluster(int cpu)
44−{
45− return topology_physical_package_id(cpu);
46−}
47−
4843 static unsigned int bL_cpufreq_get(unsigned int cpu)
4944 {
5045 u32 cur_cluster = cpu_to_cluster(cpu);
@@ -192,7 +187,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy) · 141 unmodified lines
192187
193188 cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));
194189
195− dev_info(cpu_dev, "CPU %d initialized\n", policy->cpu);
190+ dev_info(cpu_dev, "%s: CPU %d initialized\n", __func__, policy->cpu);
196191 return 0;
197192 }
198193
drivers/cpufreq/arm_big_little.h+5−0
@@ -34,6 +34,11 @@ struct cpufreq_arm_bL_ops { · 33 unmodified lines
3434 int (*init_opp_table)(struct device *cpu_dev);
3535 };
3636
37+static inline int cpu_to_cluster(int cpu)
38+{
39+ return topology_physical_package_id(cpu);
40+}
41+
3742 int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops);
3843 void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops);
3944
drivers/cpufreq/arm_big_little_dt.c+5−4
@@ -66,8 +66,8 @@ static int dt_get_transition_latency(struct device *cpu_dev) · 65 unmodified lines
6666
6767 parent = of_find_node_by_path("/cpus");
6868 if (!parent) {
69− pr_err("failed to find OF /cpus\n");
70− return -ENOENT;
69+ pr_info("Failed to find OF /cpus. Use CPUFREQ_ETERNAL transition latency\n");
70+ return CPUFREQ_ETERNAL;
7171 }
7272
7373 for_each_child_of_node(parent, np) {
@@ -78,10 +78,11 @@ static int dt_get_transition_latency(struct device *cpu_dev) · 4 unmodified lines
7878 of_node_put(np);
7979 of_node_put(parent);
8080
81− return 0;
81+ return transition_latency;
8282 }
8383
84− return -ENODEV;
84+ pr_info("clock-latency isn't found, use CPUFREQ_ETERNAL transition latency\n");
85+ return CPUFREQ_ETERNAL;
8586 }
8687
8788 static struct cpufreq_arm_bL_ops dt_bL_ops = {
drivers/cpufreq/cpufreq-cpu0.c+20−7
@@ -189,12 +189,29 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) · 188 unmodified lines
189189
190190 if (!np) {
191191 pr_err("failed to find cpu0 node\n");
192− return -ENOENT;
192+ ret = -ENOENT;
193+ goto out_put_parent;
193194 }
194195
195196 cpu_dev = &pdev->dev;
196197 cpu_dev->of_node = np;
197198
199+ cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
200+ if (IS_ERR(cpu_reg)) {
201+ /*
202+ * If cpu0 regulator supply node is present, but regulator is
203+ * not yet registered, we should try defering probe.
204+ */
205+ if (PTR_ERR(cpu_reg) == -EPROBE_DEFER) {
206+ dev_err(cpu_dev, "cpu0 regulator not ready, retry\n");
207+ ret = -EPROBE_DEFER;
208+ goto out_put_node;
209+ }
210+ pr_warn("failed to get cpu0 regulator: %ld\n",
211+ PTR_ERR(cpu_reg));
212+ cpu_reg = NULL;
213+ }
214+
198215 cpu_clk = devm_clk_get(cpu_dev, NULL);
199216 if (IS_ERR(cpu_clk)) {
200217 ret = PTR_ERR(cpu_clk);
@@ -202,12 +219,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) · 1 unmodified line
202219 goto out_put_node;
203220 }
204221
205− cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
206− if (IS_ERR(cpu_reg)) {
207− pr_warn("failed to get cpu0 regulator\n");
208− cpu_reg = NULL;
209− }
210−
211222 ret = of_init_opp_table(cpu_dev);
212223 if (ret) {
213224 pr_err("failed to init OPP table: %d\n", ret);
@@ -264,6 +275,8 @@ out_free_table: · 50 unmodified lines
264275 opp_free_cpufreq_table(cpu_dev, &freq_table);
265276 out_put_node:
266277 of_node_put(np);
278+out_put_parent:
279+ of_node_put(parent);
267280 return ret;
268281 }
269282
drivers/cpufreq/cpufreq.c+4−6
@@ -1075,14 +1075,14 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif · 1074 unmodified lines
10751075 __func__, cpu_dev->id, cpu);
10761076 }
10771077
1078+ if ((cpus == 1) && (cpufreq_driver->target))
1079+ __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
1080+
10781081 pr_debug("%s: removing link, cpu: %d\n", __func__, cpu);
10791082 cpufreq_cpu_put(data);
10801083
10811084 /* If cpu is last user of policy, free policy */
10821085 if (cpus == 1) {
1083− if (cpufreq_driver->target)
1084− __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
1085−
10861086 lock_policy_rwsem_read(cpu);
10871087 kobj = &data->kobj;
10881088 cmp = &data->kobj_unregister;
@@ -1832,15 +1832,13 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, · 743 unmodified lines
18321832 if (dev) {
18331833 switch (action) {
18341834 case CPU_ONLINE:
1835− case CPU_ONLINE_FROZEN:
18361835 cpufreq_add_dev(dev, NULL);
18371836 break;
18381837 case CPU_DOWN_PREPARE:
1839− case CPU_DOWN_PREPARE_FROZEN:
1838+ case CPU_UP_CANCELED_FROZEN:
18401839 __cpufreq_remove_dev(dev, NULL);
18411840 break;
18421841 case CPU_DOWN_FAILED:
1843− case CPU_DOWN_FAILED_FROZEN:
18441842 cpufreq_add_dev(dev, NULL);
18451843 break;
18461844 }
drivers/cpufreq/cpufreq_governor.c+7−4
@@ -255,6 +255,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, · 254 unmodified lines
255255 if (have_governor_per_policy()) {
256256 WARN_ON(dbs_data);
257257 } else if (dbs_data) {
258+ dbs_data->usage_count++;
258259 policy->governor_data = dbs_data;
259260 return 0;
260261 }
@@ -266,6 +267,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, · 5 unmodified lines
266267 }
267268
268269 dbs_data->cdata = cdata;
270+ dbs_data->usage_count = 1;
269271 rc = cdata->init(dbs_data);
270272 if (rc) {
271273 pr_err("%s: POLICY_INIT: init() failed\n", __func__);
@@ -294,7 +296,8 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, · 22 unmodified lines
294296 set_sampling_rate(dbs_data, max(dbs_data->min_sampling_rate,
295297 latency * LATENCY_MULTIPLIER));
296298
297− if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
299+ if ((cdata->governor == GOV_CONSERVATIVE) &&
300+ (!policy->governor->initialized)) {
298301 struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;
299302
300303 cpufreq_register_notifier(cs_ops->notifier_block,
@@ -306,12 +309,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, · 5 unmodified lines
306309
307310 return 0;
308311 case CPUFREQ_GOV_POLICY_EXIT:
309− if ((policy->governor->initialized == 1) ||
310− have_governor_per_policy()) {
312+ if (!--dbs_data->usage_count) {
311313 sysfs_remove_group(get_governor_parent_kobj(policy),
312314 get_sysfs_attr(dbs_data));
313315
314− if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
316+ if ((dbs_data->cdata->governor == GOV_CONSERVATIVE) &&
317+ (policy->governor->initialized == 1)) {
315318 struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;
316319
317320 cpufreq_unregister_notifier(cs_ops->notifier_block,
drivers/cpufreq/cpufreq_governor.h+1−0
@@ -211,6 +211,7 @@ struct common_dbs_data { · 210 unmodified lines
211211 struct dbs_data {
212212 struct common_dbs_data *cdata;
213213 unsigned int min_sampling_rate;
214+ int usage_count;
214215 void *tuners;
215216
216217 /* dbs_mutex protects dbs_enable in governor start/stop */
drivers/cpufreq/cpufreq_ondemand.c+0−1
@@ -547,7 +547,6 @@ static int od_init(struct dbs_data *dbs_data) · 546 unmodified lines
547547 tuners->io_is_busy = should_io_be_busy();
548548
549549 dbs_data->tuners = tuners;
550− pr_info("%s: tuners %p\n", __func__, tuners);
551550 mutex_init(&dbs_data->mutex);
552551 return 0;
553552 }
drivers/cpufreq/cpufreq_stats.c+4−3
@@ -349,15 +349,16 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, · 348 unmodified lines
349349
350350 switch (action) {
351351 case CPU_ONLINE:
352− case CPU_ONLINE_FROZEN:
353352 cpufreq_update_policy(cpu);
354353 break;
355354 case CPU_DOWN_PREPARE:
356− case CPU_DOWN_PREPARE_FROZEN:
357355 cpufreq_stats_free_sysfs(cpu);
358356 break;
359357 case CPU_DEAD:
360− case CPU_DEAD_FROZEN:
358+ cpufreq_stats_free_table(cpu);
359+ break;
360+ case CPU_UP_CANCELED_FROZEN:
361+ cpufreq_stats_free_sysfs(cpu);
361362 cpufreq_stats_free_table(cpu);
362363 break;
363364 }
drivers/cpufreq/intel_pstate.c+21−101
@@ -48,12 +48,7 @@ static inline int32_t div_fp(int32_t x, int32_t y) · 47 unmodified lines
4848 }
4949
5050 struct sample {
51− ktime_t start_time;
52− ktime_t end_time;
5351 int core_pct_busy;
54− int pstate_pct_busy;
55− u64 duration_us;
56− u64 idletime_us;
5752 u64 aperf;
5853 u64 mperf;
5954 int freq;
@@ -86,13 +81,9 @@ struct cpudata { · 26 unmodified lines
8681 struct pstate_adjust_policy *pstate_policy;
8782 struct pstate_data pstate;
8883 struct _pid pid;
89− struct _pid idle_pid;
9084
9185 int min_pstate_count;
92− int idle_mode;
9386
94− ktime_t prev_sample;
95− u64 prev_idle_time_us;
9687 u64 prev_aperf;
9788 u64 prev_mperf;
9889 int sample_ptr;
@@ -124,6 +115,8 @@ struct perf_limits { · 25 unmodified lines
124115 int min_perf_pct;
125116 int32_t max_perf;
126117 int32_t min_perf;
118+ int max_policy_pct;
119+ int max_sysfs_pct;
127120 };
128121
129122 static struct perf_limits limits = {
@@ -132,6 +125,8 @@ static struct perf_limits limits = { · 2 unmodified lines
132125 .max_perf = int_tofp(1),
133126 .min_perf_pct = 0,
134127 .min_perf = 0,
128+ .max_policy_pct = 100,
129+ .max_sysfs_pct = 100,
135130 };
136131
137132 static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
@@ -202,19 +197,6 @@ static inline void intel_pstate_busy_pid_reset(struct cpudata *cpu) · 64 unmodified lines
202197 0);
203198 }
204199
205−static inline void intel_pstate_idle_pid_reset(struct cpudata *cpu)
206−{
207− pid_p_gain_set(&cpu->idle_pid, cpu->pstate_policy->p_gain_pct);
208− pid_d_gain_set(&cpu->idle_pid, cpu->pstate_policy->d_gain_pct);
209− pid_i_gain_set(&cpu->idle_pid, cpu->pstate_policy->i_gain_pct);
210−
211− pid_reset(&cpu->idle_pid,
212− 75,
213− 50,
214− cpu->pstate_policy->deadband,
215− 0);
216−}
217−
218200 static inline void intel_pstate_reset_all_pid(void)
219201 {
220202 unsigned int cpu;
@@ -302,7 +284,8 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, · 81 unmodified lines
302284 if (ret != 1)
303285 return -EINVAL;
304286
305− limits.max_perf_pct = clamp_t(int, input, 0 , 100);
287+ limits.max_sysfs_pct = clamp_t(int, input, 0 , 100);
288+ limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
306289 limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
307290 return count;
308291 }
@@ -408,9 +391,8 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) · 99 unmodified lines
408391 if (pstate == cpu->pstate.current_pstate)
409392 return;
410393
411−#ifndef MODULE
412394 trace_cpu_frequency(pstate * 100000, cpu->cpu);
413−#endif
395+
414396 cpu->pstate.current_pstate = pstate;
415397 wrmsrl(MSR_IA32_PERF_CTL, pstate << 8);
416398
@@ -450,48 +432,26 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu, · 33 unmodified lines
450432 struct sample *sample)
451433 {
452434 u64 core_pct;
453− sample->pstate_pct_busy = 100 - div64_u64(
454− sample->idletime_us * 100,
455− sample->duration_us);
456435 core_pct = div64_u64(sample->aperf * 100, sample->mperf);
457436 sample->freq = cpu->pstate.max_pstate * core_pct * 1000;
458437
459− sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct),
460− 100);
438+ sample->core_pct_busy = core_pct;
461439 }
462440
463441 static inline void intel_pstate_sample(struct cpudata *cpu)
464442 {
465− ktime_t now;
466− u64 idle_time_us;
467443 u64 aperf, mperf;
468444
469− now = ktime_get();
470− idle_time_us = get_cpu_idle_time_us(cpu->cpu, NULL);
471−
472445 rdmsrl(MSR_IA32_APERF, aperf);
473446 rdmsrl(MSR_IA32_MPERF, mperf);
474− /* for the first sample, don't actually record a sample, just
475− * set the baseline */
476− if (cpu->prev_idle_time_us > 0) {
477− cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT;
478− cpu->samples[cpu->sample_ptr].start_time = cpu->prev_sample;
479− cpu->samples[cpu->sample_ptr].end_time = now;
480− cpu->samples[cpu->sample_ptr].duration_us =
481− ktime_us_delta(now, cpu->prev_sample);
482− cpu->samples[cpu->sample_ptr].idletime_us =
483− idle_time_us - cpu->prev_idle_time_us;
484−
485− cpu->samples[cpu->sample_ptr].aperf = aperf;
486− cpu->samples[cpu->sample_ptr].mperf = mperf;
487− cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf;
488− cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf;
489−
490− intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]);
491− }
447+ cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT;
448+ cpu->samples[cpu->sample_ptr].aperf = aperf;
449+ cpu->samples[cpu->sample_ptr].mperf = mperf;
450+ cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf;
451+ cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf;
452+
453+ intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]);
492454
493− cpu->prev_sample = now;
494− cpu->prev_idle_time_us = idle_time_us;
495455 cpu->prev_aperf = aperf;
496456 cpu->prev_mperf = mperf;
497457 }
@@ -505,16 +465,6 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) · 7 unmodified lines
505465 mod_timer_pinned(&cpu->timer, jiffies + delay);
506466 }
507467
508−static inline void intel_pstate_idle_mode(struct cpudata *cpu)
509−{
510− cpu->idle_mode = 1;
511−}
512−
513−static inline void intel_pstate_normal_mode(struct cpudata *cpu)
514−{
515− cpu->idle_mode = 0;
516−}
517−
518468 static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu)
519469 {
520470 int32_t busy_scaled;
@@ -547,50 +497,21 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) · 26 unmodified lines
547497 intel_pstate_pstate_decrease(cpu, steps);
548498 }
549499
550−static inline void intel_pstate_adjust_idle_pstate(struct cpudata *cpu)
551−{
552− int busy_scaled;
553− struct _pid *pid;
554− int ctl = 0;
555− int steps;
556−
557− pid = &cpu->idle_pid;
558−
559− busy_scaled = intel_pstate_get_scaled_busy(cpu);
560−
561− ctl = pid_calc(pid, 100 - busy_scaled);
562−
563− steps = abs(ctl);
564− if (ctl < 0)
565− intel_pstate_pstate_decrease(cpu, steps);
566− else
567− intel_pstate_pstate_increase(cpu, steps);
568−
569− if (cpu->pstate.current_pstate == cpu->pstate.min_pstate)
570− intel_pstate_normal_mode(cpu);
571−}
572−
573500 static void intel_pstate_timer_func(unsigned long __data)
574501 {
575502 struct cpudata *cpu = (struct cpudata *) __data;
576503
577504 intel_pstate_sample(cpu);
505+ intel_pstate_adjust_busy_pstate(cpu);
578506
579− if (!cpu->idle_mode)
580− intel_pstate_adjust_busy_pstate(cpu);
581− else
582− intel_pstate_adjust_idle_pstate(cpu);
583−
584−#if defined(XPERF_FIX)
585507 if (cpu->pstate.current_pstate == cpu->pstate.min_pstate) {
586508 cpu->min_pstate_count++;
587509 if (!(cpu->min_pstate_count % 5)) {
588510 intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
589− intel_pstate_idle_mode(cpu);
590511 }
591512 } else
592513 cpu->min_pstate_count = 0;
593−#endif
514+
594515 intel_pstate_set_sample_time(cpu);
595516 }
596517
@@ -631,7 +552,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum) · 34 unmodified lines
631552 (unsigned long)cpu;
632553 cpu->timer.expires = jiffies + HZ/100;
633554 intel_pstate_busy_pid_reset(cpu);
634− intel_pstate_idle_pid_reset(cpu);
635555 intel_pstate_sample(cpu);
636556 intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
637557
@@ -675,8 +595,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 37 unmodified lines
675595 limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100);
676596 limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
677597
678− limits.max_perf_pct = policy->max * 100 / policy->cpuinfo.max_freq;
679− limits.max_perf_pct = clamp_t(int, limits.max_perf_pct, 0 , 100);
598+ limits.max_policy_pct = policy->max * 100 / policy->cpuinfo.max_freq;
599+ limits.max_policy_pct = clamp_t(int, limits.max_policy_pct, 0 , 100);
600+ limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
680601 limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
681602
682603 return 0;
@@ -788,10 +709,9 @@ static int __init intel_pstate_init(void) · 105 unmodified lines
788709
789710 pr_info("Intel P-state driver initializing.\n");
790711
791− all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus());
712+ all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus());
792713 if (!all_cpu_data)
793714 return -ENOMEM;
794− memset(all_cpu_data, 0, sizeof(void *) * num_possible_cpus());
795715
796716 rc = cpufreq_register_driver(&intel_pstate_driver);
797717 if (rc)
drivers/cpufreq/kirkwood-cpufreq.c+0−4
@@ -171,10 +171,6 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) · 170 unmodified lines
171171 priv.dev = &pdev->dev;
172172
173173 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
174− if (!res) {
175− dev_err(&pdev->dev, "Cannot get memory resource\n");
176− return -ENODEV;
177− }
178174 priv.base = devm_ioremap_resource(&pdev->dev, res);
179175 if (IS_ERR(priv.base))
180176 return PTR_ERR(priv.base);
include/acpi/acpiosxf.h+1−1
@@ -77,7 +77,7 @@ struct acpi_signal_fatal_info { · 76 unmodified lines
7777 /*
7878 * OSL Initialization and shutdown primitives
7979 */
80−acpi_status __initdata acpi_os_initialize(void);
80+acpi_status __init acpi_os_initialize(void);
8181
8282 acpi_status acpi_os_terminate(void);
8383
include/acpi/processor.h+8−2
@@ -329,10 +329,16 @@ int acpi_processor_power_init(struct acpi_processor *pr); · 328 unmodified lines
329329 int acpi_processor_power_exit(struct acpi_processor *pr);
330330 int acpi_processor_cst_has_changed(struct acpi_processor *pr);
331331 int acpi_processor_hotplug(struct acpi_processor *pr);
332−int acpi_processor_suspend(struct device *dev);
333−int acpi_processor_resume(struct device *dev);
334332 extern struct cpuidle_driver acpi_idle_driver;
335333
334+#ifdef CONFIG_PM_SLEEP
335+void acpi_processor_syscore_init(void);
336+void acpi_processor_syscore_exit(void);
337+#else
338+static inline void acpi_processor_syscore_init(void) {}
339+static inline void acpi_processor_syscore_exit(void) {}
340+#endif
341+
336342 /* in processor_thermal.c */
337343 int acpi_processor_get_limit_info(struct acpi_processor *pr);
338344 extern const struct thermal_cooling_device_ops processor_cooling_ops;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t