aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-07-26 18:34:34 -0400
committerPaul Walmsley <paul@pwsan.com>2010-07-26 18:34:34 -0400
commit564889c1c02698d66db76764ee4e0a5e86903971 (patch)
treeb6bc890e1e7910a96c004b8be5fc825178bd290b /arch/arm/plat-omap
parent887adeac28a3e354ebb3f9aeca6fc2296c105267 (diff)
OMAP: PM constraints: add return values; add requesting device param to omap_pm_set_max_dev_wakeup_lat()
Add return values to the PM constraint functions. This allows the PM core to provide feedback to the caller if a constraint is not possible. Update the one upstream user of omap_pm_set_max_mpu_wakeup_lat() to add a compatibility wrapper, needed until the driver is changed. Update some of the documentation to conform more closely to kerneldoc style. Add an additional device parameter to omap_pm_set_max_dev_wakeup_lat() to identify the device requesting the constraint. This is so repeated calls to omap_pm_set_max_dev_wakeup_lat() with the same requesting device can override the device's previously-set constraint. Also, it allows the PM core to make a decision as to whether or not the constraint should be satisfied, based on the caller's identity. Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/i2c.c12
-rw-r--r--arch/arm/plat-omap/include/plat/omap-pm.h69
-rw-r--r--arch/arm/plat-omap/omap-pm-noop.c34
3 files changed, 71 insertions, 44 deletions
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index eec2b4993c69..a5ce4f0aad35 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -138,6 +138,16 @@ static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)
138 return platform_device_register(pdev); 138 return platform_device_register(pdev);
139} 139}
140 140
141/*
142 * XXX This function is a temporary compatibility wrapper - only
143 * needed until the I2C driver can be converted to call
144 * omap_pm_set_max_dev_wakeup_lat() and handle a return code.
145 */
146static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
147{
148 omap_pm_set_max_mpu_wakeup_lat(dev, t);
149}
150
141static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id) 151static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id)
142{ 152{
143 struct resource *res; 153 struct resource *res;
@@ -168,7 +178,7 @@ static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id)
168 struct omap_i2c_bus_platform_data *pd; 178 struct omap_i2c_bus_platform_data *pd;
169 179
170 pd = pdev->dev.platform_data; 180 pd = pdev->dev.platform_data;
171 pd->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat; 181 pd->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
172 } 182 }
173 183
174 return platform_device_register(pdev); 184 return platform_device_register(pdev);
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h
index 3ee41d711492..3d468bafe918 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/plat-omap/include/plat/omap-pm.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * omap-pm.h - OMAP power management interface 2 * omap-pm.h - OMAP power management interface
3 * 3 *
4 * Copyright (C) 2008-2009 Texas Instruments, Inc. 4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2009 Nokia Corporation 5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
8 * Interface developed by (in alphabetical order): Karthik Dasu, Jouni 8 * Interface developed by (in alphabetical order): Karthik Dasu, Jouni
@@ -89,7 +89,7 @@ void omap_pm_if_exit(void);
89 * @t: maximum MPU wakeup latency in microseconds 89 * @t: maximum MPU wakeup latency in microseconds
90 * 90 *
91 * Request that the maximum interrupt latency for the MPU to be no 91 * Request that the maximum interrupt latency for the MPU to be no
92 * greater than 't' microseconds. "Interrupt latency" in this case is 92 * greater than @t microseconds. "Interrupt latency" in this case is
93 * defined as the elapsed time from the occurrence of a hardware or 93 * defined as the elapsed time from the occurrence of a hardware or
94 * timer interrupt to the time when the device driver's interrupt 94 * timer interrupt to the time when the device driver's interrupt
95 * service routine has been entered by the MPU. 95 * service routine has been entered by the MPU.
@@ -105,15 +105,19 @@ void omap_pm_if_exit(void);
105 * elapsed from when a device driver enables a hardware device with 105 * elapsed from when a device driver enables a hardware device with
106 * clk_enable(), to when the device is ready for register access or 106 * clk_enable(), to when the device is ready for register access or
107 * other use. To control this device wakeup latency, use 107 * other use. To control this device wakeup latency, use
108 * set_max_dev_wakeup_lat() 108 * omap_pm_set_max_dev_wakeup_lat()
109 * 109 *
110 * Multiple calls to set_max_mpu_wakeup_lat() will replace the 110 * Multiple calls to omap_pm_set_max_mpu_wakeup_lat() will replace the
111 * previous t value. To remove the latency target for the MPU, call 111 * previous t value. To remove the latency target for the MPU, call
112 * with t = -1. 112 * with t = -1.
113 * 113 *
114 * No return value. 114 * XXX This constraint will be deprecated soon in favor of the more
115 * general omap_pm_set_max_dev_wakeup_lat()
116 *
117 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
118 * is not satisfiable, or 0 upon success.
115 */ 119 */
116void omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t); 120int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
117 121
118 122
119/** 123/**
@@ -123,8 +127,8 @@ void omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
123 * @r: minimum throughput (in KiB/s) 127 * @r: minimum throughput (in KiB/s)
124 * 128 *
125 * Request that the minimum data throughput on the OCP interconnect 129 * Request that the minimum data throughput on the OCP interconnect
126 * attached to device 'dev' interconnect agent 'tbus_id' be no less 130 * attached to device @dev interconnect agent @tbus_id be no less
127 * than 'r' KiB/s. 131 * than @r KiB/s.
128 * 132 *
129 * It is expected that the OMAP PM or bus code will use this 133 * It is expected that the OMAP PM or bus code will use this
130 * information to set the interconnect clock to run at the lowest 134 * information to set the interconnect clock to run at the lowest
@@ -138,40 +142,44 @@ void omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
138 * code will also need to add an minimum L3 interconnect speed 142 * code will also need to add an minimum L3 interconnect speed
139 * constraint, 143 * constraint,
140 * 144 *
141 * Multiple calls to set_min_bus_tput() will replace the previous rate 145 * Multiple calls to omap_pm_set_min_bus_tput() will replace the
142 * value for this device. To remove the interconnect throughput 146 * previous rate value for this device. To remove the interconnect
143 * restriction for this device, call with r = 0. 147 * throughput restriction for this device, call with r = 0.
144 * 148 *
145 * No return value. 149 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
150 * is not satisfiable, or 0 upon success.
146 */ 151 */
147void omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r); 152int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r);
148 153
149 154
150/** 155/**
151 * omap_pm_set_max_dev_wakeup_lat - set the maximum device enable latency 156 * omap_pm_set_max_dev_wakeup_lat - set the maximum device enable latency
152 * @dev: struct device * 157 * @req_dev: struct device * requesting the constraint, or NULL if none
158 * @dev: struct device * to set the constraint one
153 * @t: maximum device wakeup latency in microseconds 159 * @t: maximum device wakeup latency in microseconds
154 * 160 *
155 * Request that the maximum amount of time necessary for a device to 161 * Request that the maximum amount of time necessary for a device @dev
156 * become accessible after its clocks are enabled should be no greater 162 * to become accessible after its clocks are enabled should be no
157 * than 't' microseconds. Specifically, this represents the time from 163 * greater than @t microseconds. Specifically, this represents the
158 * when a device driver enables device clocks with clk_enable(), to 164 * time from when a device driver enables device clocks with
159 * when the register reads and writes on the device will succeed. 165 * clk_enable(), to when the register reads and writes on the device
160 * This function should be called before clk_disable() is called, 166 * will succeed. This function should be called before clk_disable()
161 * since the power state transition decision may be made during 167 * is called, since the power state transition decision may be made
162 * clk_disable(). 168 * during clk_disable().
163 * 169 *
164 * It is intended that underlying PM code will use this information to 170 * It is intended that underlying PM code will use this information to
165 * determine what power state to put the powerdomain enclosing this 171 * determine what power state to put the powerdomain enclosing this
166 * device into. 172 * device into.
167 * 173 *
168 * Multiple calls to set_max_dev_wakeup_lat() will replace the 174 * Multiple calls to omap_pm_set_max_dev_wakeup_lat() will replace the
169 * previous wakeup latency values for this device. To remove the wakeup 175 * previous wakeup latency values for this device. To remove the
170 * latency restriction for this device, call with t = -1. 176 * wakeup latency restriction for this device, call with t = -1.
171 * 177 *
172 * No return value. 178 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
179 * is not satisfiable, or 0 upon success.
173 */ 180 */
174void omap_pm_set_max_dev_wakeup_lat(struct device *dev, long t); 181int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
182 long t);
175 183
176 184
177/** 185/**
@@ -198,9 +206,10 @@ void omap_pm_set_max_dev_wakeup_lat(struct device *dev, long t);
198 * value for this device. To remove the maximum DMA latency for this 206 * value for this device. To remove the maximum DMA latency for this
199 * device, call with t = -1. 207 * device, call with t = -1.
200 * 208 *
201 * No return value. 209 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
210 * is not satisfiable, or 0 upon success.
202 */ 211 */
203void omap_pm_set_max_sdma_lat(struct device *dev, long t); 212int omap_pm_set_max_sdma_lat(struct device *dev, long t);
204 213
205 214
206/* 215/*
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c
index 186bca82cfab..b0414f90c6e3 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/plat-omap/omap-pm-noop.c
@@ -34,11 +34,11 @@ struct omap_opp *l3_opps;
34 * Device-driver-originated constraints (via board-*.c files) 34 * Device-driver-originated constraints (via board-*.c files)
35 */ 35 */
36 36
37void omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t) 37int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)
38{ 38{
39 if (!dev || t < -1) { 39 if (!dev || t < -1) {
40 WARN_ON(1); 40 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
41 return; 41 return -EINVAL;
42 }; 42 };
43 43
44 if (t == -1) 44 if (t == -1)
@@ -58,14 +58,16 @@ void omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)
58 * 58 *
59 * TI CDP code can call constraint_set here. 59 * TI CDP code can call constraint_set here.
60 */ 60 */
61
62 return 0;
61} 63}
62 64
63void omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r) 65int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r)
64{ 66{
65 if (!dev || (agent_id != OCP_INITIATOR_AGENT && 67 if (!dev || (agent_id != OCP_INITIATOR_AGENT &&
66 agent_id != OCP_TARGET_AGENT)) { 68 agent_id != OCP_TARGET_AGENT)) {
67 WARN_ON(1); 69 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
68 return; 70 return -EINVAL;
69 }; 71 };
70 72
71 if (r == 0) 73 if (r == 0)
@@ -83,13 +85,16 @@ void omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r)
83 * 85 *
84 * TI CDP code can call constraint_set here on the VDD2 OPP. 86 * TI CDP code can call constraint_set here on the VDD2 OPP.
85 */ 87 */
88
89 return 0;
86} 90}
87 91
88void omap_pm_set_max_dev_wakeup_lat(struct device *dev, long t) 92int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
93 long t)
89{ 94{
90 if (!dev || t < -1) { 95 if (!req_dev || !dev || t < -1) {
91 WARN_ON(1); 96 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
92 return; 97 return -EINVAL;
93 }; 98 };
94 99
95 if (t == -1) 100 if (t == -1)
@@ -111,13 +116,15 @@ void omap_pm_set_max_dev_wakeup_lat(struct device *dev, long t)
111 * 116 *
112 * TI CDP code can call constraint_set here. 117 * TI CDP code can call constraint_set here.
113 */ 118 */
119
120 return 0;
114} 121}
115 122
116void omap_pm_set_max_sdma_lat(struct device *dev, long t) 123int omap_pm_set_max_sdma_lat(struct device *dev, long t)
117{ 124{
118 if (!dev || t < -1) { 125 if (!dev || t < -1) {
119 WARN_ON(1); 126 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
120 return; 127 return -EINVAL;
121 }; 128 };
122 129
123 if (t == -1) 130 if (t == -1)
@@ -139,6 +146,7 @@ void omap_pm_set_max_sdma_lat(struct device *dev, long t)
139 * TI CDP code can call constraint_set here. 146 * TI CDP code can call constraint_set here.
140 */ 147 */
141 148
149 return 0;
142} 150}
143 151
144 152