Skip to content

Commit d5fe85a

Browse files
committed
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 ...
2 parents 8968216 + 49a9e43 commit d5fe85a

26 files changed

Lines changed: 190 additions & 195 deletions

‎Documentation/power/devices.txt‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ situations.
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.
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.
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.
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.
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‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ running. The interface exists in /sys/power/ directory (assuming sysfs
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‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ A suspend/hibernation notifier may be used for this purpose.
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‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@
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
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.
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
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‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
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);
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)
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)
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)
312344
kfree(ac);
313345
}
314346

347+
dmi_check_system(ac_dmi_table);
315348
return result;
316349
}
317350

‎drivers/acpi/ec.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
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)
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‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = {
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 = {
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)
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)
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‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
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,
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‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
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)
18001800
}
18011801
}
18021802

1803+
out:
18031804
acpi_free_pnp_ids(&pnp);
18041805
}
18051806

‎drivers/acpi/video.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
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

0 commit comments

Comments
 (0)