Skip to content

Commit 40c2819

Browse files
committed
Merge branches 'pm-misc' and 'pm-tools'
Merge miscellaneous power management updates and cpupower utility updates for 6.17-rc1: - Update contact information in the PM ABI docs and maintainer information in the power domains DT binding (Rafael Wysocki) - Update PM header inclusions to follow the IWYU (Include What You Use) principle (Andy Shevchenko) - Add flags to specify power on attach/detach for PM domains, make the driver core detach PM domains in device_unbind_cleanup(), and drop the dev_pm_domain_detach() call from the platform bus type (Claudiu Beznea) - Improve Python binding's Makefile for cpupower (John B. Wyatt IV) - Fix printing of CORE, CPU fields in cpupower-monitor (Gautham Shenoy) * pm-misc: PM: docs: Use my kernel.org address in ABI docs and DT bindings driver core: platform: Drop dev_pm_domain_detach() call PM: domains: Detach on device_unbind_cleanup() PM: domains: Add flags to specify power on attach/detach PM: Don't use "proxy" headers * pm-tools: cpupower: Improve Python binding's Makefile pm: cpupower: Fix printing of CORE, CPU fields in cpupower-monitor pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop()
3 parents 3b4d4c9 + ebf266d + b109246 commit 40c2819

File tree

21 files changed

+77
-69
lines changed

21 files changed

+77
-69
lines changed

Documentation/ABI/testing/sysfs-devices-power

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
What: /sys/devices/.../power/
22
Date: January 2009
3-
Contact: Rafael J. Wysocki <[email protected]>
3+
Contact: Rafael J. Wysocki <[email protected]>
44
Description:
55
The /sys/devices/.../power directory contains attributes
66
allowing the user space to check and modify some power
77
management related properties of given device.
88

99
What: /sys/devices/.../power/wakeup
1010
Date: January 2009
11-
Contact: Rafael J. Wysocki <[email protected]>
11+
Contact: Rafael J. Wysocki <[email protected]>
1212
Description:
1313
The /sys/devices/.../power/wakeup attribute allows the user
1414
space to check if the device is enabled to wake up the system
@@ -34,7 +34,7 @@ Description:
3434

3535
What: /sys/devices/.../power/control
3636
Date: January 2009
37-
Contact: Rafael J. Wysocki <[email protected]>
37+
Contact: Rafael J. Wysocki <[email protected]>
3838
Description:
3939
The /sys/devices/.../power/control attribute allows the user
4040
space to control the run-time power management of the device.
@@ -53,7 +53,7 @@ Description:
5353

5454
What: /sys/devices/.../power/async
5555
Date: January 2009
56-
Contact: Rafael J. Wysocki <[email protected]>
56+
Contact: Rafael J. Wysocki <[email protected]>
5757
Description:
5858
The /sys/devices/.../async attribute allows the user space to
5959
enable or disable the device's suspend and resume callbacks to
@@ -79,7 +79,7 @@ Description:
7979

8080
What: /sys/devices/.../power/wakeup_count
8181
Date: September 2010
82-
Contact: Rafael J. Wysocki <[email protected]>
82+
Contact: Rafael J. Wysocki <[email protected]>
8383
Description:
8484
The /sys/devices/.../wakeup_count attribute contains the number
8585
of signaled wakeup events associated with the device. This
@@ -90,7 +90,7 @@ Description:
9090

9191
What: /sys/devices/.../power/wakeup_active_count
9292
Date: September 2010
93-
Contact: Rafael J. Wysocki <[email protected]>
93+
Contact: Rafael J. Wysocki <[email protected]>
9494
Description:
9595
The /sys/devices/.../wakeup_active_count attribute contains the
9696
number of times the processing of wakeup events associated with
@@ -102,7 +102,7 @@ Description:
102102

103103
What: /sys/devices/.../power/wakeup_abort_count
104104
Date: February 2012
105-
Contact: Rafael J. Wysocki <[email protected]>
105+
Contact: Rafael J. Wysocki <[email protected]>
106106
Description:
107107
The /sys/devices/.../wakeup_abort_count attribute contains the
108108
number of times the processing of a wakeup event associated with
@@ -114,7 +114,7 @@ Description:
114114

115115
What: /sys/devices/.../power/wakeup_expire_count
116116
Date: February 2012
117-
Contact: Rafael J. Wysocki <[email protected]>
117+
Contact: Rafael J. Wysocki <[email protected]>
118118
Description:
119119
The /sys/devices/.../wakeup_expire_count attribute contains the
120120
number of times a wakeup event associated with the device has
@@ -126,7 +126,7 @@ Description:
126126

127127
What: /sys/devices/.../power/wakeup_active
128128
Date: September 2010
129-
Contact: Rafael J. Wysocki <[email protected]>
129+
Contact: Rafael J. Wysocki <[email protected]>
130130
Description:
131131
The /sys/devices/.../wakeup_active attribute contains either 1,
132132
or 0, depending on whether or not a wakeup event associated with
@@ -138,7 +138,7 @@ Description:
138138

139139
What: /sys/devices/.../power/wakeup_total_time_ms
140140
Date: September 2010
141-
Contact: Rafael J. Wysocki <[email protected]>
141+
Contact: Rafael J. Wysocki <[email protected]>
142142
Description:
143143
The /sys/devices/.../wakeup_total_time_ms attribute contains
144144
the total time of processing wakeup events associated with the
@@ -149,7 +149,7 @@ Description:
149149

150150
What: /sys/devices/.../power/wakeup_max_time_ms
151151
Date: September 2010
152-
Contact: Rafael J. Wysocki <[email protected]>
152+
Contact: Rafael J. Wysocki <[email protected]>
153153
Description:
154154
The /sys/devices/.../wakeup_max_time_ms attribute contains
155155
the maximum time of processing a single wakeup event associated
@@ -161,7 +161,7 @@ Description:
161161

162162
What: /sys/devices/.../power/wakeup_last_time_ms
163163
Date: September 2010
164-
Contact: Rafael J. Wysocki <[email protected]>
164+
Contact: Rafael J. Wysocki <[email protected]>
165165
Description:
166166
The /sys/devices/.../wakeup_last_time_ms attribute contains
167167
the value of the monotonic clock corresponding to the time of
@@ -173,7 +173,7 @@ Description:
173173

174174
What: /sys/devices/.../power/wakeup_prevent_sleep_time_ms
175175
Date: February 2012
176-
Contact: Rafael J. Wysocki <[email protected]>
176+
Contact: Rafael J. Wysocki <[email protected]>
177177
Description:
178178
The /sys/devices/.../wakeup_prevent_sleep_time_ms attribute
179179
contains the total time the device has been preventing
@@ -203,7 +203,7 @@ Description:
203203

204204
What: /sys/devices/.../power/pm_qos_resume_latency_us
205205
Date: March 2012
206-
Contact: Rafael J. Wysocki <[email protected]>
206+
Contact: Rafael J. Wysocki <[email protected]>
207207
Description:
208208
The /sys/devices/.../power/pm_qos_resume_latency_us attribute
209209
contains the PM QoS resume latency limit for the given device,
@@ -223,7 +223,7 @@ Description:
223223

224224
What: /sys/devices/.../power/pm_qos_latency_tolerance_us
225225
Date: January 2014
226-
Contact: Rafael J. Wysocki <[email protected]>
226+
Contact: Rafael J. Wysocki <[email protected]>
227227
Description:
228228
The /sys/devices/.../power/pm_qos_latency_tolerance_us attribute
229229
contains the PM QoS active state latency tolerance limit for the
@@ -248,7 +248,7 @@ Description:
248248

249249
What: /sys/devices/.../power/pm_qos_no_power_off
250250
Date: September 2012
251-
Contact: Rafael J. Wysocki <[email protected]>
251+
Contact: Rafael J. Wysocki <[email protected]>
252252
Description:
253253
The /sys/devices/.../power/pm_qos_no_power_off attribute
254254
is used for manipulating the PM QoS "no power off" flag. If
@@ -263,7 +263,7 @@ Description:
263263

264264
What: /sys/devices/.../power/runtime_status
265265
Date: April 2010
266-
Contact: Rafael J. Wysocki <[email protected]>
266+
Contact: Rafael J. Wysocki <[email protected]>
267267
Description:
268268
The /sys/devices/.../power/runtime_status attribute contains
269269
the current runtime PM status of the device, which may be

Documentation/ABI/testing/sysfs-power

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
What: /sys/power/
22
Date: August 2006
3-
Contact: Rafael J. Wysocki <[email protected]>
3+
Contact: Rafael J. Wysocki <[email protected]>
44
Description:
55
The /sys/power directory will contain files that will
66
provide a unified interface to the power management
77
subsystem.
88

99
What: /sys/power/state
1010
Date: November 2016
11-
Contact: Rafael J. Wysocki <[email protected]>
11+
Contact: Rafael J. Wysocki <[email protected]>
1212
Description:
1313
The /sys/power/state file controls system sleep states.
1414
Reading from this file returns the available sleep state
@@ -23,7 +23,7 @@ Description:
2323

2424
What: /sys/power/mem_sleep
2525
Date: November 2016
26-
Contact: Rafael J. Wysocki <[email protected]>
26+
Contact: Rafael J. Wysocki <[email protected]>
2727
Description:
2828
The /sys/power/mem_sleep file controls the operating mode of
2929
system suspend. Reading from it returns the available modes
@@ -41,7 +41,7 @@ Description:
4141

4242
What: /sys/power/disk
4343
Date: September 2006
44-
Contact: Rafael J. Wysocki <[email protected]>
44+
Contact: Rafael J. Wysocki <[email protected]>
4545
Description:
4646
The /sys/power/disk file controls the operating mode of the
4747
suspend-to-disk mechanism. Reading from this file returns
@@ -90,7 +90,7 @@ Description:
9090

9191
What: /sys/power/image_size
9292
Date: August 2006
93-
Contact: Rafael J. Wysocki <[email protected]>
93+
Contact: Rafael J. Wysocki <[email protected]>
9494
Description:
9595
The /sys/power/image_size file controls the size of the image
9696
created by the suspend-to-disk mechanism. It can be written a
@@ -107,7 +107,7 @@ Description:
107107

108108
What: /sys/power/pm_trace
109109
Date: August 2006
110-
Contact: Rafael J. Wysocki <[email protected]>
110+
Contact: Rafael J. Wysocki <[email protected]>
111111
Description:
112112
The /sys/power/pm_trace file controls the code which saves the
113113
last PM event point in the RTC across reboots, so that you can
@@ -156,7 +156,7 @@ Description:
156156

157157
What: /sys/power/pm_async
158158
Date: January 2009
159-
Contact: Rafael J. Wysocki <[email protected]>
159+
Contact: Rafael J. Wysocki <[email protected]>
160160
Description:
161161
The /sys/power/pm_async file controls the switch allowing the
162162
user space to enable or disable asynchronous suspend and resume
@@ -169,7 +169,7 @@ Description:
169169

170170
What: /sys/power/wakeup_count
171171
Date: July 2010
172-
Contact: Rafael J. Wysocki <[email protected]>
172+
Contact: Rafael J. Wysocki <[email protected]>
173173
Description:
174174
The /sys/power/wakeup_count file allows user space to put the
175175
system into a sleep state while taking into account the
@@ -184,7 +184,7 @@ Description:
184184

185185
What: /sys/power/reserved_size
186186
Date: May 2011
187-
Contact: Rafael J. Wysocki <[email protected]>
187+
Contact: Rafael J. Wysocki <[email protected]>
188188
Description:
189189
The /sys/power/reserved_size file allows user space to control
190190
the amount of memory reserved for allocations made by device
@@ -198,7 +198,7 @@ Description:
198198

199199
What: /sys/power/autosleep
200200
Date: April 2012
201-
Contact: Rafael J. Wysocki <[email protected]>
201+
Contact: Rafael J. Wysocki <[email protected]>
202202
Description:
203203
The /sys/power/autosleep file can be written one of the strings
204204
returned by reads from /sys/power/state. If that happens, a
@@ -215,7 +215,7 @@ Description:
215215

216216
What: /sys/power/wake_lock
217217
Date: February 2012
218-
Contact: Rafael J. Wysocki <[email protected]>
218+
Contact: Rafael J. Wysocki <[email protected]>
219219
Description:
220220
The /sys/power/wake_lock file allows user space to create
221221
wakeup source objects and activate them on demand (if one of
@@ -242,7 +242,7 @@ Description:
242242

243243
What: /sys/power/wake_unlock
244244
Date: February 2012
245-
Contact: Rafael J. Wysocki <[email protected]>
245+
Contact: Rafael J. Wysocki <[email protected]>
246246
Description:
247247
The /sys/power/wake_unlock file allows user space to deactivate
248248
wakeup sources created with the help of /sys/power/wake_lock.
@@ -283,7 +283,7 @@ Description:
283283

284284
What: /sys/power/pm_debug_messages
285285
Date: July 2017
286-
Contact: Rafael J. Wysocki <[email protected]>
286+
Contact: Rafael J. Wysocki <[email protected]>
287287
Description:
288288
The /sys/power/pm_debug_messages file controls the printing
289289
of debug messages from the system suspend/hiberbation

Documentation/devicetree/bindings/power/power-domain.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
77
title: Generic PM domains
88

99
maintainers:
10-
- Rafael J. Wysocki <[email protected]>
10+
- Rafael J. Wysocki <[email protected]>
1111
- Kevin Hilman <[email protected]>
1212
- Ulf Hansson <[email protected]>
1313

drivers/amba/bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static int amba_read_periphid(struct amba_device *dev)
138138
void __iomem *tmp;
139139
int i, ret;
140140

141-
ret = dev_pm_domain_attach(&dev->dev, true);
141+
ret = dev_pm_domain_attach(&dev->dev, PD_FLAG_ATTACH_POWER_ON);
142142
if (ret) {
143143
dev_dbg(&dev->dev, "can't get PM domain: %d\n", ret);
144144
goto err_out;
@@ -291,7 +291,7 @@ static int amba_probe(struct device *dev)
291291
if (ret < 0)
292292
break;
293293

294-
ret = dev_pm_domain_attach(dev, true);
294+
ret = dev_pm_domain_attach(dev, PD_FLAG_ATTACH_POWER_ON);
295295
if (ret)
296296
break;
297297

drivers/base/auxiliary.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int auxiliary_bus_probe(struct device *dev)
217217
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
218218
int ret;
219219

220-
ret = dev_pm_domain_attach(dev, true);
220+
ret = dev_pm_domain_attach(dev, PD_FLAG_ATTACH_POWER_ON);
221221
if (ret) {
222222
dev_warn(dev, "Failed to attach to PM Domain : %d\n", ret);
223223
return ret;

drivers/base/dd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/kthread.h>
2626
#include <linux/wait.h>
2727
#include <linux/async.h>
28+
#include <linux/pm_domain.h>
2829
#include <linux/pm_runtime.h>
2930
#include <linux/pinctrl/devinfo.h>
3031
#include <linux/slab.h>
@@ -552,6 +553,7 @@ static void device_unbind_cleanup(struct device *dev)
552553
dev->dma_range_map = NULL;
553554
device_set_driver(dev, NULL);
554555
dev_set_drvdata(dev, NULL);
556+
dev_pm_domain_detach(dev, dev->power.detach_power_off);
555557
if (dev->pm_domain && dev->pm_domain->dismiss)
556558
dev->pm_domain->dismiss(dev);
557559
pm_runtime_reinit(dev);

drivers/base/platform.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,15 +1396,13 @@ static int platform_probe(struct device *_dev)
13961396
if (ret < 0)
13971397
return ret;
13981398

1399-
ret = dev_pm_domain_attach(_dev, true);
1399+
ret = dev_pm_domain_attach(_dev, PD_FLAG_ATTACH_POWER_ON |
1400+
PD_FLAG_DETACH_POWER_OFF);
14001401
if (ret)
14011402
goto out;
14021403

1403-
if (drv->probe) {
1404+
if (drv->probe)
14041405
ret = drv->probe(dev);
1405-
if (ret)
1406-
dev_pm_domain_detach(_dev, true);
1407-
}
14081406

14091407
out:
14101408
if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -1422,7 +1420,6 @@ static void platform_remove(struct device *_dev)
14221420

14231421
if (drv->remove)
14241422
drv->remove(dev);
1425-
dev_pm_domain_detach(_dev, true);
14261423
}
14271424

14281425
static void platform_shutdown(struct device *_dev)

drivers/base/power/common.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
8383
/**
8484
* dev_pm_domain_attach - Attach a device to its PM domain.
8585
* @dev: Device to attach.
86-
* @power_on: Used to indicate whether we should power on the device.
86+
* @flags: indicate whether we should power on/off the device on attach/detach
8787
*
8888
* The @dev may only be attached to a single PM domain. By iterating through
8989
* the available alternatives we try to find a valid PM domain for the device.
@@ -100,17 +100,20 @@ EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
100100
* Returns 0 on successfully attached PM domain, or when it is found that the
101101
* device doesn't need a PM domain, else a negative error code.
102102
*/
103-
int dev_pm_domain_attach(struct device *dev, bool power_on)
103+
int dev_pm_domain_attach(struct device *dev, u32 flags)
104104
{
105105
int ret;
106106

107107
if (dev->pm_domain)
108108
return 0;
109109

110-
ret = acpi_dev_pm_attach(dev, power_on);
110+
ret = acpi_dev_pm_attach(dev, !!(flags & PD_FLAG_ATTACH_POWER_ON));
111111
if (!ret)
112112
ret = genpd_dev_pm_attach(dev);
113113

114+
if (dev->pm_domain)
115+
dev->power.detach_power_off = !!(flags & PD_FLAG_DETACH_POWER_OFF);
116+
114117
return ret < 0 ? ret : 0;
115118
}
116119
EXPORT_SYMBOL_GPL(dev_pm_domain_attach);

drivers/clk/qcom/apcs-sdx55.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int qcom_apcs_sdx55_clk_probe(struct platform_device *pdev)
111111
* driver, there seems to be no better place to do this. So do it here!
112112
*/
113113
cpu_dev = get_cpu_device(0);
114-
ret = dev_pm_domain_attach(cpu_dev, true);
114+
ret = dev_pm_domain_attach(cpu_dev, PD_FLAG_ATTACH_POWER_ON);
115115
if (ret) {
116116
dev_err_probe(dev, ret, "can't get PM domain: %d\n", ret);
117117
goto err;

drivers/gpu/drm/display/drm_dp_aux_bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static int dp_aux_ep_probe(struct device *dev)
5757
container_of(aux_ep, struct dp_aux_ep_device_with_data, aux_ep);
5858
int ret;
5959

60-
ret = dev_pm_domain_attach(dev, true);
60+
ret = dev_pm_domain_attach(dev, PD_FLAG_ATTACH_POWER_ON);
6161
if (ret)
6262
return dev_err_probe(dev, ret, "Failed to attach to PM Domain\n");
6363

0 commit comments

Comments
 (0)