aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_domain.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-05-01 15:34:07 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-05-05 15:51:58 -0400
commit6ff7bb0d02f82968be13937c03e93b6c090229df (patch)
treeac2605f2f2b1602fddb88c4ba33c647608b594e6 /include/linux/pm_domain.h
parentefa6902501ffc87d69bfb10b8a09b7d6ee222d77 (diff)
PM / Domains: Cache device stop and domain power off governor results, v3
The results of the default device stop and domain power off governor functions for generic PM domains, default_stop_ok() and default_power_down_ok(), depend only on the timing data of devices, which are static, and on their PM QoS constraints. Thus, in theory, these functions only need to carry out their computations, which may be time consuming in general, when it is known that the PM QoS constraint of at least one of the devices in question has changed. Use the PM QoS notifiers of devices to implement that. First, introduce new fields, constraint_changed and max_off_time_changed, into struct gpd_timing_data and struct generic_pm_domain, respectively, and register a PM QoS notifier function when adding a device into a domain that will set those fields to 'true' whenever the device's PM QoS constraint is modified. Second, make default_stop_ok() and default_power_down_ok() use those fields to decide whether or not to carry out their computations from scratch. The device and PM domain hierarchies are taken into account in that and the expense is that the changes of PM QoS constraints of suspended devices will not be taken into account immediately, which isn't guaranteed anyway in general. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/pm_domain.h')
-rw-r--r--include/linux/pm_domain.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index e7ada5ccdfc2..1e994eeacdf3 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -14,6 +14,7 @@
14#include <linux/pm.h> 14#include <linux/pm.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/notifier.h>
17 18
18enum gpd_status { 19enum gpd_status {
19 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 20 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -71,6 +72,8 @@ struct generic_pm_domain {
71 s64 power_on_latency_ns; 72 s64 power_on_latency_ns;
72 struct gpd_dev_ops dev_ops; 73 struct gpd_dev_ops dev_ops;
73 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
75 bool max_off_time_changed;
76 bool cached_power_down_ok;
74 struct device_node *of_node; /* Node in device tree */ 77 struct device_node *of_node; /* Node in device tree */
75}; 78};
76 79
@@ -92,12 +95,16 @@ struct gpd_timing_data {
92 s64 save_state_latency_ns; 95 s64 save_state_latency_ns;
93 s64 restore_state_latency_ns; 96 s64 restore_state_latency_ns;
94 s64 effective_constraint_ns; 97 s64 effective_constraint_ns;
98 bool constraint_changed;
99 bool cached_stop_ok;
95}; 100};
96 101
97struct generic_pm_domain_data { 102struct generic_pm_domain_data {
98 struct pm_domain_data base; 103 struct pm_domain_data base;
99 struct gpd_dev_ops ops; 104 struct gpd_dev_ops ops;
100 struct gpd_timing_data td; 105 struct gpd_timing_data td;
106 struct notifier_block nb;
107 struct mutex lock;
101 bool need_restore; 108 bool need_restore;
102 bool always_on; 109 bool always_on;
103}; 110};