Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5fe85af authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents 89682165 49a9e431
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -268,7 +268,7 @@ situations.
System Power Management Phases
System Power Management Phases
------------------------------
------------------------------
Suspending or resuming the system is done in several phases.  Different phases
Suspending or resuming the system is done in several phases.  Different phases
are used for standby or memory sleep states ("suspend-to-RAM") and the
are used for freeze, standby, and memory sleep states ("suspend-to-RAM") and the
hibernation state ("suspend-to-disk").  Each phase involves executing callbacks
hibernation state ("suspend-to-disk").  Each phase involves executing callbacks
for every device before the next phase begins.  Not all busses or classes
for every device before the next phase begins.  Not all busses or classes
support all these callbacks and not all drivers use all the callbacks.  The
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.


Entering System Suspend
Entering System Suspend
-----------------------
-----------------------
When the system goes into the standby or memory sleep state, the phases are:
When the system goes into the freeze, standby or memory sleep state,
the phases are:


		prepare, suspend, suspend_late, suspend_noirq.
		prepare, suspend, suspend_late, suspend_noirq.


@@ -368,7 +369,7 @@ the devices that were suspended.


Leaving System Suspend
Leaving System Suspend
----------------------
----------------------
When resuming from standby or memory sleep, the phases are:
When resuming from freeze, standby or memory sleep, the phases are:


		resume_noirq, resume_early, resume, complete.
		resume_noirq, resume_early, resume, complete.


@@ -433,8 +434,8 @@ the system log.


Entering Hibernation
Entering Hibernation
--------------------
--------------------
Hibernating the system is more complicated than putting it into the standby or
Hibernating the system is more complicated than putting it into the other
memory sleep state, because it involves creating and saving a system image.
sleep states, because it involves creating and saving a system image.
Therefore there are more phases for hibernation, with a different set of
Therefore there are more phases for hibernation, with a different set of
callbacks.  These phases always run after tasks have been frozen and memory has
callbacks.  These phases always run after tasks have been frozen and memory has
been freed.
been freed.
@@ -485,8 +486,8 @@ image forms an atomic snapshot of the system state.


At this point the system image is saved, and the devices then need to be
At this point the system image is saved, and the devices then need to be
prepared for the upcoming system shutdown.  This is much like suspending them
prepared for the upcoming system shutdown.  This is much like suspending them
before putting the system into the standby or memory sleep state, and the phases
before putting the system into the freeze, standby or memory sleep state,
are similar.
and the phases are similar.


    9.	The prepare phase is discussed above.
    9.	The prepare phase is discussed above.


+2 −2
Original line number Original line Diff line number Diff line
@@ -7,8 +7,8 @@ running. The interface exists in /sys/power/ directory (assuming sysfs
is mounted at /sys). 
is mounted at /sys). 


/sys/power/state controls system power state. Reading from this file
/sys/power/state controls system power state. Reading from this file
returns what states are supported, which is hard-coded to 'standby'
returns what states are supported, which is hard-coded to 'freeze',
(Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
(Suspend-to-Disk). 
(Suspend-to-Disk). 


Writing to this file one of those strings causes the system to
Writing to this file one of those strings causes the system to
+4 −2
Original line number Original line Diff line number Diff line
@@ -15,8 +15,10 @@ A suspend/hibernation notifier may be used for this purpose.
The subsystems or drivers having such needs can register suspend notifiers that
The subsystems or drivers having such needs can register suspend notifiers that
will be called upon the following events by the PM core:
will be called upon the following events by the PM core:


PM_HIBERNATION_PREPARE	The system is going to hibernate or suspend, tasks will
PM_HIBERNATION_PREPARE	The system is going to hibernate, tasks will be frozen
			be frozen immediately.
			immediately. This is different from PM_SUSPEND_PREPARE
			below because here we do additional work between notifiers
			and drivers freezing.


PM_POST_HIBERNATION	The system memory state has been restored from a
PM_POST_HIBERNATION	The system memory state has been restored from a
			hibernation image or an error occurred during
			hibernation image or an error occurred during
+17 −13
Original line number Original line Diff line number Diff line
@@ -2,12 +2,26 @@
System Power Management States
System Power Management States




The kernel supports three power management states generically, though
The kernel supports four power management states generically, though
each is dependent on platform support code to implement the low-level
one is generic and the other three are dependent on platform support
details for each state. This file describes each state, what they are
code to implement the low-level details for each state.
This file describes each state, what they are
commonly called, what ACPI state they map to, and what string to write
commonly called, what ACPI state they map to, and what string to write
to /sys/power/state to enter that state
to /sys/power/state to enter that state


state:		Freeze / Low-Power Idle
ACPI state:	S0
String:		"freeze"

This state is a generic, pure software, light-weight, low-power state.
It allows more energy to be saved relative to idle by freezing user
space and putting all I/O devices into low-power states (possibly
lower-power than available at run time), such that the processors can
spend more time in their idle states.
This state can be used for platforms without Standby/Suspend-to-RAM
support, or it can be used in addition to Suspend-to-RAM (memory sleep)
to provide reduced resume latency.



State:		Standby / Power-On Suspend
State:		Standby / Power-On Suspend
ACPI State:	S1
ACPI State:	S1
@@ -22,9 +36,6 @@ We try to put devices in a low-power state equivalent to D1, which
also offers low power savings, but low resume latency. Not all devices
also offers low power savings, but low resume latency. Not all devices
support D1, and those that don't are left on. 
support D1, and those that don't are left on. 


A transition from Standby to the On state should take about 1-2
seconds. 



State:		Suspend-to-RAM
State:		Suspend-to-RAM
ACPI State:	S3
ACPI State:	S3
@@ -42,9 +53,6 @@ transition back to the On state.
For at least ACPI, STR requires some minimal boot-strapping code to
For at least ACPI, STR requires some minimal boot-strapping code to
resume the system from STR. This may be true on other platforms. 
resume the system from STR. This may be true on other platforms. 


A transition from Suspend-to-RAM to the On state should take about
3-5 seconds. 



State:		Suspend-to-disk
State:		Suspend-to-disk
ACPI State:	S4
ACPI State:	S4
@@ -74,7 +82,3 @@ low-power state (like ACPI S4), or it may simply power down. Powering
down offers greater savings, and allows this mechanism to work on any
down offers greater savings, and allows this mechanism to work on any
system. However, entering a real low-power state allows the user to
system. However, entering a real low-power state allows the user to
trigger wake up events (e.g. pressing a key or opening a laptop lid).
trigger wake up events (e.g. pressing a key or opening a laptop lid).

A transition from Suspend-to-Disk to the On state should take about 30
seconds, though it's typically a bit more with the current
implementation. 
+33 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,8 @@
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/dmi.h>
#include <linux/delay.h>
#ifdef CONFIG_ACPI_PROCFS_POWER
#ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/seq_file.h>
@@ -74,6 +76,8 @@ static int acpi_ac_resume(struct device *dev);
#endif
#endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);


static int ac_sleep_before_get_state_ms;

static struct acpi_driver acpi_ac_driver = {
static struct acpi_driver acpi_ac_driver = {
	.name = "ac",
	.name = "ac",
	.class = ACPI_AC_CLASS,
	.class = ACPI_AC_CLASS,
@@ -252,6 +256,16 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
	case ACPI_AC_NOTIFY_STATUS:
	case ACPI_AC_NOTIFY_STATUS:
	case ACPI_NOTIFY_BUS_CHECK:
	case ACPI_NOTIFY_BUS_CHECK:
	case ACPI_NOTIFY_DEVICE_CHECK:
	case ACPI_NOTIFY_DEVICE_CHECK:
		/*
		 * A buggy BIOS may notify AC first and then sleep for
		 * a specific time before doing actual operations in the
		 * EC event handler (_Qxx). This will cause the AC state
		 * reported by the ACPI event to be incorrect, so wait for a
		 * specific time for the EC event handler to make progress.
		 */
		if (ac_sleep_before_get_state_ms > 0)
			msleep(ac_sleep_before_get_state_ms);

		acpi_ac_get_state(ac);
		acpi_ac_get_state(ac);
		acpi_bus_generate_proc_event(device, event, (u32) ac->state);
		acpi_bus_generate_proc_event(device, event, (u32) ac->state);
		acpi_bus_generate_netlink_event(device->pnp.device_class,
		acpi_bus_generate_netlink_event(device->pnp.device_class,
@@ -264,6 +278,24 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
	return;
	return;
}
}


static int thinkpad_e530_quirk(const struct dmi_system_id *d)
{
	ac_sleep_before_get_state_ms = 1000;
	return 0;
}

static struct dmi_system_id ac_dmi_table[] = {
	{
	.callback = thinkpad_e530_quirk,
	.ident = "thinkpad e530",
	.matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
		DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
		},
	},
	{},
};

static int acpi_ac_add(struct acpi_device *device)
static int acpi_ac_add(struct acpi_device *device)
{
{
	int result = 0;
	int result = 0;
@@ -312,6 +344,7 @@ static int acpi_ac_add(struct acpi_device *device)
		kfree(ac);
		kfree(ac);
	}
	}


	dmi_check_system(ac_dmi_table);
	return result;
	return result;
}
}


Loading