8000 Merge tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/ker… · bsd-unix/linux@2481bc7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2481bc7

Browse files
committed
Merge tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI updates from Rafael Wysocki: "These are mostly fixes and cleanups all over, although there are a few items that sort of fall into the new feature category. First off, we have new callbacks for PM domains that should help us to handle some issues related to device initialization in a better way. There also is some consolidation in the unified device properties API area allowing us to use that inferface for accessing data coming from platform initialization code in addition to firmware-provided data. We have some new device/CPU IDs in a few drivers, support for new chips and a new cpufreq driver too. Specifics: - Generic PM domains support update including new PM domain callbacks to handle device initialization better (Russell King, Rafael J Wysocki, Kevin Hilman) - Unified device properties API update including a new mechanism for accessing data provided by platform initialization code (Rafael J Wysocki, Adrian Hunter) - ARM cpuidle update including ARM32/ARM64 handling consolidation (Daniel Lezcano) - intel_idle update including support for the Silvermont Core in the Baytrail SOC and for the Airmont Core in the Cherrytrail and Braswell SOCs (Len Brown, Mathias Krause) - New cpufreq driver for Hisilicon ACPU (Leo Yan) - intel_pstate update including support for the Knights Landing chip (Dasaratharaman Chandramouli, Kristen Carlson Accardi) - QorIQ cpufreq driver update (Tang Yuantian, Arnd Bergmann) - powernv cpufreq driver update (Shilpasri G Bhat) - devfreq update including Tegra support changes (Tomeu Vizoso, MyungJoo Ham, Chanwoo Choi) - powercap RAPL (Running-Average Power Limit) driver update including support for Intel Broadwell server chips (Jacob Pan, Mathias Krause) - ACPI device enumeration update related to the handling of the special PRP0001 device ID allowing DT-style 'compatible' property to be used for ACPI device identification (Rafael J Wysocki) - ACPI EC driver update including limited _DEP support (Lan Tianyu, Lv Zheng) - ACPI backlight driver update including a new mechanism to allow native backlight handling to be forced on non-Windows 8 systems and a new quirk for Lenovo Ideapad Z570 (Aaron Lu, Hans de Goede) - New Windows Vista compatibility quirk for Sony VGN-SR19XN (Chen Yu) - Assorted ACPI fixes and cleanups (Aaron Lu, Martin Kepplinger, Masanari Iida, Mika Westerberg, Nan Li, Rafael J Wysocki) - Fixes related to suspend-to-idle for the iTCO watchdog driver and the ACPI core system suspend/resume code (Rafael J Wysocki, Chen Yu) - PM tracing support for the suspend phase of system suspend/resume transitions (Zhonghui Fu) - Configurable delay for the system suspend/resume testing facility (Brian Norris) - PNP subsystem cleanups (Peter Huewe, Rafael J Wysocki)" * tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (74 commits) ACPI / scan: Fix NULL pointer dereference in acpi_companion_match() ACPI / scan: Rework modalias creation when "compatible" is present intel_idle: mark cpu id array as __initconst powercap / RAPL: mark rapl_ids array as __initconst powercap / RAPL: add ID for Broadwell server intel_pstate: Knights Landing support intel_pstate: remove MSR test cpufreq: fix qoriq uniprocessor build ACPI / scan: Take the PRP0001 position in the list of IDs into account ACPI / scan: Simplify acpi_match_device() ACPI / scan: Generalize of_compatible matching device property: Introduce firmware node type for platform data device property: Make it possible to use secondary firmware nodes PM / watchdog: iTCO: stop watchdog during system suspend cpufreq: hisilicon: add acpu driver ACPI / EC: Call acpi_walk_dep_device_list() after installing EC opregion handler cpufreq: powernv: Report cpu frequency throttling intel_idle: Add support for the Airmont Core in the Cherrytrail and Braswell SOCs intel_idle: Update support for Silvermont Core in Baytrail SOC PM / devfreq: tegra: Register governor on module init ...
2 parents 8691c13 + 518b4e2 commit 2481bc7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1797
-928
lines changed

Documentation/acpi/enumeration.txt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,13 @@ GPIO support
254254
~~~~~~~~~~~~
255255
ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
256256
and GpioInt. These resources are used be used to pass GPIO numbers used by
257-
the device to the driver. For example:
257+
the device to the driver. ACPI 5.1 extended this with _DSD (Device
258+
Specific Data) which made it possible to name the GPIOs among other things.
258259

260+
For example:
261+
262+
Device (DEV)
263+
{
259264
Method (_CRS, 0, NotSerialized)
260265
{
261266
Name (SBUF, ResourceTemplate()
@@ -285,6 +290,18 @@ the device to the driver. For example:
285290
Return (SBUF)
286291
}
287292

293+
// ACPI 5.1 _DSD used for naming the GPIOs
294+
Name (_DSD, Package ()
295+
{
296+
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
297+
Package ()
298+
{
< F438 /td>
299+
Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }},
300+
Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }},
301+
}
302+
})
303+
...
304+
288305
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
289306
specifies the path to the controller. In order to use these GPIOs in Linux
290307
we need to translate them to the corresponding Linux GPIO descriptors.
@@ -300,11 +317,11 @@ a code like this:
300317

301318
struct gpio_desc *irq_desc, *power_desc;
302319

303-
irq_desc = gpiod_get_index(dev, NULL, 1);
320+
irq_desc = gpiod_get(dev, "irq");
304321
if (IS_ERR(irq_desc))
305322
/* handle error */
306323

307-
power_desc = gpiod_get_index(dev, NULL, 0);
324+
power_desc = gpiod_get(dev, "power");
308325
if (IS_ERR(power_desc))
309326
/* handle error */
310327

@@ -313,6 +330,9 @@ a code like this:
313330
There are also devm_* versions of these functions which release the
314331
descriptors once the device is released.
315332

333+
See Documentation/acpi/gpio-properties.txt for more information about the
334+
_DSD binding related to GPIOs.
335+
316336
MFD devices
317337
~~~~~~~~~~~
318338
The MFD devices register their children as platform devices. For the child

Documentation/kernel-parameters.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3477,6 +3477,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
34773477
improve throughput, but will also increase the
34783478
amount of memory reserved for use by the client.
34793479

3480+
suspend.pm_test_delay=
3481+
[SUSPEND]
3482+
Sets the number of seconds to remain in a suspend test
3483+
mode before resuming the system (see
3484+
/sys/power/pm_test). Only available when CONFIG_PM_DEBUG
3485+
is set. Default value is 5.
3486+
34803487
swapaccount=[0|1]
34813488
[KNL] Enable accounting of swap in memory resource
34823489
controller if no parameter or 1 is given or disable

Documentation/power/basic-pm-debugging.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ you should do the following:
7575
# echo platform > /sys/power/disk
7676
# echo disk > /sys/power/state
7777

78-
Then, the kernel will try to freeze processes, suspend devices, wait 5 seconds,
79-
resume devices and thaw processes. If "platform" is written to
78+
Then, the kernel will try to freeze processes, suspend devices, wait a few
79+
seconds (5 by default, but configurable by the suspend.pm_test_delay module
80+
parameter), resume devices and thaw processes. If "platform" is written to
8081
/sys/power/pm_test , then after suspending devices the kernel will additionally
8182
invoke the global control methods (eg. ACPI global control methods) used to
82-
prepare the platform firmware for hibernation. Next, it will wait 5 seconds and
83-
invoke the platform (eg. ACPI) global methods used to cancel hibernation etc.
83+
prepare the platform firmware for hibernation. Next, it will wait a
84+
configurable number of seconds and invoke the platform (eg. ACPI) global
85+
methods used to cancel hibernation etc.
8486

8587
Writing "none" to /sys/power/pm_test causes the kernel to switch to the normal
8688
hibernation/suspend operations. Also, when open for reading, /sys/power/pm_test

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4331,6 +4331,15 @@ S: Supported
43314331
F: drivers/phy/
43324332
F: include/linux/phy/
43334333

4334+
GENERIC PM DOMAINS
4335+
M: "Rafael J. Wysocki" <rjw@rjwysocki.net>
4336+
M: Kevin Hilman <khilman@kernel.org>
4337+
M: Ulf Hansson <ulf.hansson@linaro.org>
4338+
L: linux-pm@vger.kernel.org
4339+
S: Supported
4340+
F: drivers/base/power/domain*.c
4341+
F: include/linux/pm_domain.h
4342+
43344343
GENERIC UIO DRIVER FOR PCI DEVICES
43354344
M: "Michael S. Tsirkin" <mst@redhat.com>
43364345
L: kvm@vger.kernel.org

arch/arm/include/asm/cpuidle.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef __ASM_ARM_CPUIDLE_H
22
#define __ASM_ARM_CPUIDLE_H
33

4+
#include <asm/proc-fns.h>
5+
46
#ifdef CONFIG_CPU_IDLE
57
extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
68
struct cpuidle_driver *drv, int index);
@@ -25,4 +27,25 @@ static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
2527
*/
2628
#define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX)
2729

30+
struct device_node;
31+
32+
struct cpuidle_ops {
33+
int (*suspend)(int cpu, unsigned long arg);
34+
int (*init)(struct device_node *, int cpu);
35+
};
36+
37+
struct of_cpuidle_method {
38+
const char *method;
39+
struct cpuidle_ops *ops;
40+
};
41+
42+
#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
43+
static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
44+
__used __section(__cpuidle_method_of_table) \
45+
= { .method = _method, .ops = _ops }
46+
47+
extern int arm_cpuidle_suspend(int index);
48+
49+
extern int arm_cpuidle_init(int cpu);
50+
2851
#endif

arch/arm/kernel/cpuidle.c

Lines changed: 132 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,143 @@
1010
*/
1111

1212
#include <linux/cpuidle.h>
13-
#include <asm/proc-fns.h>
13+
#include <linux/of.h>
14+
#include <linux/of_device.h>
15+
#include <asm/cpuidle.h>
1416

17+
extern struct of_cpuidle_method __cpuidle_method_of_table[];
18+
19+
static const struct of_cpuidle_method __cpuidle_method_of_table_sentinel
20+
__used __section(__cpuidle_method_of_table_end);
21+
22+
static struct cpuidle_ops cpuidle_ops[NR_CPUS];
23+
24+
/**
25+
* arm_cpuidle_simple_enter() - a wrapper to cpu_do_idle()
26+
* @dev: not used
27+
* @drv: not used
28+
* @index: not used
29+
*
30+
* A trivial wrapper to allow the cpu_do_idle function to be assigned as a
31+
* cpuidle callback by matching the function signature.
32+
*
33+
* Returns the index passed as parameter
34+
*/
1535
int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
1636
struct cpuidle_driver *drv, int index)
1737
{
1838
cpu_do_idle();
1939

2040
return index;
2141
}
42+
43+
/**
44+
* arm_cpuidle_suspend() - function to enter low power idle states
45+
* @index: an integer used as an identifier for the low level PM callbacks
46+
*
47+
* This function calls the underlying arch specific low level PM code as
48+
* registered at the init time.
49+
*
50+
* Returns -EOPNOTSUPP if no suspend callback is defined, the result of the
51+
* callback otherwise.
52+
*/
53+
int arm_cpuidle_suspend(int index)
54+
{
55+
int ret = -EOPNOTSUPP;
56+
int cpu = smp_processor_id();
57+
58+
if (cpuidle_ops[cpu].suspend)
59+
ret = cpuidle_ops[cpu].suspend(cpu, index);
60+
61+
return ret;
62+
}
63+
64+
/**
65+
* arm_cpuidle_get_ops() - find a registered cpuidle_ops by name
66+
* @method: the method name
67+
*
68+
* Search in the __cpuidle_method_of_table array the cpuidle ops matching the
69+
* method name.
70+
*
71+
* Returns a struct cpuidle_ops pointer, NULL if not found.
72+
*/
73+
static struct cpuidle_ops *__init arm_cpuidle_get_ops(const char *method)
74+
{
75+
struct of_cpuidle_method *m = __cpuidle_method_of_table;
76+
77+
for (; m->method; m++)
78+
if (!strcmp(m->method, method))
79+
return m->ops;
80+
81+
return NULL;
82+
}
83+
84+
/**
85+
* arm_cpuidle_read_ops() - Initialize the cpuidle ops with the device tree
86+
* @dn: a pointer to a struct device node corresponding to a cpu node
87+
* @cpu: the cpu identifier
88+
*
89+
* Get the method name defined in the 'enable-method' property, retrieve the
90+
* associated cpuidle_ops and do a struct copy. This copy is needed because all
91+
* cpuidle_ops are tagged __initdata and will be unloaded after the init
92+
* process.
93+
*
94+
* Return 0 on sucess, -ENOENT if no 'enable-method' is defined, -EOPNOTSUPP if
95+
* no cpuidle_ops is registered for the 'enable-method'.
96+
*/
97+
static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu)
98+
{
99+
const char *enable_method;
100+
struct cpuidle_ops *ops;
101+
102+
enable_method = of_get_property(dn, "enable-method", NULL);
103+
if (!enable_method)
104+
return -ENOENT;
105+
106+
ops = arm_cpuidle_get_ops(enable_method);
107+
if (!ops) {
108+
pr_warn("%s: unsupported enable-method property: %s\n",
109+
dn->full_name, enable_method);
110+
return -EOPNOTSUPP;
111+
}
112+
113+
cpuidle_ops[cpu] = *ops; /* structure copy */
114+
115+
pr_notice("cpuidle: enable-method property '%s'"
116+
" found operations\n", enable_method);
117+
118+
return 0;
119+
}
120+
121+
/**
122+
* arm_cpuidle_init() - Initialize cpuidle_ops for a specific cpu
123+
* @cpu: the cpu to be initialized
124+
*
125+
* Initialize the cpuidle ops with the device for the cpu and then call
126+
* the cpu's idle initialization callback. This may fail if the underlying HW
127+
* is not operational.
128+
*
129+
* Returns:
130+
* 0 on success,
131+
* -ENODEV if it fails to find the cpu node in the device tree,
132+
* -EOPNOTSUPP if it does not find a registered cpuidle_ops for this cpu,
133+
* -ENOENT if it fails to find an 'enable-method' property,
134+
* -ENXIO if the HW reports a failure or a misconfiguration,
135+
* -ENOMEM if the HW report an memory allocation failure
136+
*/
137+
int __init arm_cpuidle_init(int cpu)
138+
{
139+
struct device_node *cpu_node = of_cpu_device_node_get(cpu);
140+
int ret;
141+
142+
if (!cpu_node)
143+
return -ENODEV;
144+
145+
ret = arm_cpuidle_read_ops(cpu_node, cpu);
146+
if (!ret && cpuidle_ops[cpu].init)
147+
ret = cpuidle_ops[cpu].init(cpu_node, cpu);
148+
149+
of_node_put(cpu_node);
150+
151+
return ret;
152+
}

arch/arm/mach-davinci/cpuidle.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/cpuidle.h>
1818
#include <linux/io.h>
1919
#include <linux/export.h>
20-
#include <asm/proc-fns.h>
2120
#include <asm/cpuidle.h>
2221

2322
#include <mach/cpuidle.h>

arch/arm/mach-imx/cpuidle-imx6q.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <linux/cpuidle.h>
1010
#include <linux/module.h>
1111
#include <asm/cpuidle.h>
12-
#include <asm/proc-fns.h>
1312

1413
#include "common.h"
1514
#include "cpuidle.h"

arch/arm/mach-imx/cpuidle-imx6sl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <linux/cpuidle.h>
1010
#include <linux/module.h>
1111
#include <asm/cpuidle.h>
12-
#include <asm/proc-fns.h>
1312

1413
#include "common.h"
1514
#include "cpuidle.h"

arch/arm/mach-imx/cpuidle-imx6sx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/cpu_pm.h>
1111
#include <linux/module.h>
1212
#include <asm/cpuidle.h>
13-
#include <asm/proc-fns.h>
1413
#include <asm/suspend.h>
1514

1615
#include "common.h"

arch/arm/mach-omap2/cpuidle44xx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/tick.h>
1818

1919
#include <asm/cpuidle.h>
20-
#include <asm/proc-fns.h>
2120

2221
#include "common.h"
2322
#include "pm.h"

arch/arm/mach-s3c64xx/cpuidle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/export.h>
1717
#include <linux/time.h>
1818

19-
#include <asm/proc-fns.h>
19+
#include <asm/cpuidle.h>
2020

2121
#include <mach/map.h>
2222

arch/arm/mach-tegra/cpuidle-tegra20.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <linux/module.h>
2828

2929
#include <asm/cpuidle.h>
30-
#include <asm/proc-fns.h>
3130
#include <asm/smp_plat.h>
3231
#include <asm/suspend.h>
3332

arch/arm/mach-tegra/cpuidle-tegra30.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <linux/module.h>
2828

2929
#include <asm/cpuidle.h>
30-
#include <asm/proc-fns.h>
3130
#include <asm/smp_plat.h>
3231
#include <asm/suspend.h>
3332

arch/arm64/configs/defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CONFIG_CMDLINE="console=ttyAMA0"
4848
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
4949
CONFIG_COMPAT=y
5050
CONFIG_CPU_IDLE=y
51-
CONFIG_ARM64_CPUIDLE=y
51+
CONFIG_ARM_CPUIDLE=y
5252
CONFIG_NET=y
5353
CONFIG_PACKET=y
5454
CONFIG_UNIX=y

arch/arm64/include/asm/cpuidle.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include <asm/proc-fns.h>
55

66
#ifdef CONFIG_CPU_IDLE
7-
extern int cpu_init_idle(unsigned int cpu);
7+
extern int arm_cpuidle_init(unsigned int cpu);
88
extern int cpu_suspend(unsigned long arg);
99
#else
10-
static inline int cpu_init_idle(unsigned int cpu)
10+
static inline int arm_cpuidle_init(unsigned int cpu)
1111
{
1212
return -EOPNOTSUPP;
1313
}
@@ -17,5 +17,8 @@ static inline int cpu_suspend(unsigned long arg)
1717
return -EOPNOTSUPP;
1818
}
1919
#endif
20-
20+
static inline int arm_cpuidle_suspend(int index)
21+
{
22+
return cpu_suspend(index);
23+
}
2124
#endif

arch/arm64/kernel/cpuidle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <asm/cpuidle.h>
1616
#include <asm/cpu_ops.h>
1717

18-
int cpu_init_idle(unsigned int cpu)
18+
int arm_cpuidle_init(unsigned int cpu)
1919
{
2020
int ret = -EOPNOTSUPP;
2121
struct device_node *cpu_node = of_cpu_device_node_get(cpu);

0 commit comments

Comments
 (0)
0