aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-10 18:35:38 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-10 18:35:38 -0500
commit2d984ad132a87ca2112f81f21039493176a8bca0 (patch)
tree5bcec9039870a698baf6febef19742c1c3622d50 /include
parent327adaedf2218b0e318eb393aa79cf2be64c199f (diff)
PM / QoS: Introcuce latency tolerance device PM QoS type
Add a new latency tolerance device PM QoS type to be use for specifying active state (RPM_ACTIVE) memory access (DMA) latency tolerance requirements for devices. It may be used to prevent hardware from choosing overly aggressive energy-saving operation modes (causing too much latency to appear) for the whole platform. This feature reqiures hardware support, so it only will be available for devices having a new .set_latency_tolerance() callback in struct dev_pm_info populated, in which case the routine pointed to by it should implement whatever is necessary to transfer the effective requirement value to the hardware. Whenever the effective latency tolerance changes for the device, its .set_latency_tolerance() callback will be executed and the effective value will be passed to it. If that value is negative, which means that the list of latency tolerance requirements for the device is empty, the callback is expected to switch the underlying hardware latency tolerance control mechanism to an autonomous mode if available. If that value is PM_QOS_LATENCY_ANY, in turn, and the hardware supports a special "no requirement" setting, the callback is expected to use it. That allows software to prevent the hardware from automatically updating the device's latency tolerance in response to its power state changes (e.g. during transitions from D3cold to D0), which generally may be done in the autonomous latency tolerance control mode. If .set_latency_tolerance() is present for the device, a new pm_qos_latency_tolerance_us attribute will be present in the devivce's power directory in sysfs. Then, user space can use that attribute to specify its latency tolerance requirement for the device, if any. Writing "any" to it means "no requirement, but do not let the hardware control latency tolerance" and writing "auto" to it allows the hardware to be switched to the autonomous mode if there are no other requirements from the kernel side in the device's list. This changeset includes a fix from Mika Westerberg. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/pm.h1
-rw-r--r--include/linux/pm_qos.h12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8c6583a53a06..db2be5f3e030 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -582,6 +582,7 @@ struct dev_pm_info {
582 unsigned long accounting_timestamp; 582 unsigned long accounting_timestamp;
583#endif 583#endif
584 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 584 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
585 void (*set_latency_tolerance)(struct device *, s32);
585 struct dev_pm_qos *qos; 586 struct dev_pm_qos *qos;
586}; 587};
587 588
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 2d8ce50877d8..0b476019be55 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -33,6 +33,9 @@ enum pm_qos_flags_status {
33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
36#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
38#define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1))
36 39
37#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) 40#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
38#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) 41#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1)
@@ -50,6 +53,7 @@ struct pm_qos_flags_request {
50 53
51enum dev_pm_qos_req_type { 54enum dev_pm_qos_req_type {
52 DEV_PM_QOS_RESUME_LATENCY = 1, 55 DEV_PM_QOS_RESUME_LATENCY = 1,
56 DEV_PM_QOS_LATENCY_TOLERANCE,
53 DEV_PM_QOS_FLAGS, 57 DEV_PM_QOS_FLAGS,
54}; 58};
55 59
@@ -89,8 +93,10 @@ struct pm_qos_flags {
89 93
90struct dev_pm_qos { 94struct dev_pm_qos {
91 struct pm_qos_constraints resume_latency; 95 struct pm_qos_constraints resume_latency;
96 struct pm_qos_constraints latency_tolerance;
92 struct pm_qos_flags flags; 97 struct pm_qos_flags flags;
93 struct dev_pm_qos_request *resume_latency_req; 98 struct dev_pm_qos_request *resume_latency_req;
99 struct dev_pm_qos_request *latency_tolerance_req;
94 struct dev_pm_qos_request *flags_req; 100 struct dev_pm_qos_request *flags_req;
95}; 101};
96 102
@@ -196,6 +202,8 @@ void dev_pm_qos_hide_latency_limit(struct device *dev);
196int dev_pm_qos_expose_flags(struct device *dev, s32 value); 202int dev_pm_qos_expose_flags(struct device *dev, s32 value);
197void dev_pm_qos_hide_flags(struct device *dev); 203void dev_pm_qos_hide_flags(struct device *dev);
198int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); 204int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
205s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
206int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
199 207
200static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) 208static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
201{ 209{
@@ -215,6 +223,10 @@ static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value)
215static inline void dev_pm_qos_hide_flags(struct device *dev) {} 223static inline void dev_pm_qos_hide_flags(struct device *dev) {}
216static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set) 224static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set)
217 { return 0; } 225 { return 0; }
226static inline s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev)
227 { return PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; }
228static inline int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val)
229 { return 0; }
218 230
219static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; } 231static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; }
220static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } 232static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; }