diff options
| author | Nishanth Menon <nm@ti.com> | 2013-09-19 17:03:50 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rjw@rjwysocki.net> | 2013-10-25 16:33:23 -0400 |
| commit | 5d4879cda67b09f086807821cf594ee079d6dfbe (patch) | |
| tree | 58532256e9bff42902510175e7cb7c727a89280b | |
| parent | 31d141e3a666269a3b6fcccddb0351caf7454240 (diff) | |
PM / OPP: rename functions to dev_pm_opp*
Since Operating Performance Points (OPP) functions are specific to
device specific power management, be specific and rename opp_*
accessors in OPP library with dev_pm_opp_* equivalent.
Affected functions are:
opp_get_voltage
opp_get_freq
opp_get_opp_count
opp_find_freq_exact
opp_find_freq_floor
opp_find_freq_ceil
opp_add
opp_enable
opp_disable
opp_get_notifier
opp_init_cpufreq_table
opp_free_cpufreq_table
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| -rw-r--r-- | Documentation/power/opp.txt | 102 | ||||
| -rw-r--r-- | arch/arm/mach-imx/mach-imx6q.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 8 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/opp.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/pm.c | 4 | ||||
| -rw-r--r-- | drivers/base/power/opp.c | 82 | ||||
| -rw-r--r-- | drivers/cpufreq/arm_big_little.c | 6 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq-cpu0.c | 18 | ||||
| -rw-r--r-- | drivers/cpufreq/exynos5440-cpufreq.c | 13 | ||||
| -rw-r--r-- | drivers/cpufreq/imx6q-cpufreq.c | 20 | ||||
| -rw-r--r-- | drivers/cpufreq/omap-cpufreq.c | 8 | ||||
| -rw-r--r-- | drivers/devfreq/devfreq.c | 14 | ||||
| -rw-r--r-- | drivers/devfreq/exynos/exynos4_bus.c | 21 | ||||
| -rw-r--r-- | drivers/devfreq/exynos/exynos5_bus.c | 18 | ||||
| -rw-r--r-- | include/linux/opp.h | 50 |
15 files changed, 187 insertions, 183 deletions
diff --git a/Documentation/power/opp.txt b/Documentation/power/opp.txt index 425c51d56aef..185367b1848f 100644 --- a/Documentation/power/opp.txt +++ b/Documentation/power/opp.txt | |||
| @@ -71,14 +71,14 @@ operations until that OPP could be re-enabled if possible. | |||
| 71 | 71 | ||
| 72 | OPP library facilitates this concept in it's implementation. The following | 72 | OPP library facilitates this concept in it's implementation. The following |
| 73 | operational functions operate only on available opps: | 73 | operational functions operate only on available opps: |
| 74 | opp_find_freq_{ceil, floor}, opp_get_voltage, opp_get_freq, opp_get_opp_count | 74 | opp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq, dev_pm_opp_get_opp_count |
| 75 | and opp_init_cpufreq_table | 75 | and dev_pm_opp_init_cpufreq_table |
| 76 | 76 | ||
| 77 | opp_find_freq_exact is meant to be used to find the opp pointer which can then | 77 | dev_pm_opp_find_freq_exact is meant to be used to find the opp pointer which can then |
| 78 | be used for opp_enable/disable functions to make an opp available as required. | 78 | be used for dev_pm_opp_enable/disable functions to make an opp available as required. |
| 79 | 79 | ||
| 80 | WARNING: Users of OPP library should refresh their availability count using | 80 | WARNING: Users of OPP library should refresh their availability count using |
| 81 | get_opp_count if opp_enable/disable functions are invoked for a device, the | 81 | get_opp_count if dev_pm_opp_enable/disable functions are invoked for a device, the |
| 82 | exact mechanism to trigger these or the notification mechanism to other | 82 | exact mechanism to trigger these or the notification mechanism to other |
| 83 | dependent subsystems such as cpufreq are left to the discretion of the SoC | 83 | dependent subsystems such as cpufreq are left to the discretion of the SoC |
| 84 | specific framework which uses the OPP library. Similar care needs to be taken | 84 | specific framework which uses the OPP library. Similar care needs to be taken |
| @@ -96,24 +96,24 @@ using RCU read locks. The opp_find_freq_{exact,ceil,floor}, | |||
| 96 | opp_get_{voltage, freq, opp_count} fall into this category. | 96 | opp_get_{voltage, freq, opp_count} fall into this category. |
| 97 | 97 | ||
| 98 | opp_{add,enable,disable} are updaters which use mutex and implement it's own | 98 | opp_{add,enable,disable} are updaters which use mutex and implement it's own |
| 99 | RCU locking mechanisms. opp_init_cpufreq_table acts as an updater and uses | 99 | RCU locking mechanisms. dev_pm_opp_init_cpufreq_table acts as an updater and uses |
| 100 | mutex to implment RCU updater strategy. These functions should *NOT* be called | 100 | mutex to implment RCU updater strategy. These functions should *NOT* be called |
| 101 | under RCU locks and other contexts that prevent blocking functions in RCU or | 101 | under RCU locks and other contexts that prevent blocking functions in RCU or |
| 102 | mutex operations from working. | 102 | mutex operations from working. |
| 103 | 103 | ||
| 104 | 2. Initial OPP List Registration | 104 | 2. Initial OPP List Registration |
| 105 | ================================ | 105 | ================================ |
| 106 | The SoC implementation calls opp_add function iteratively to add OPPs per | 106 | The SoC implementation calls dev_pm_opp_add function iteratively to add OPPs per |
| 107 | device. It is expected that the SoC framework will register the OPP entries | 107 | device. It is expected that the SoC framework will register the OPP entries |
| 108 | optimally- typical numbers range to be less than 5. The list generated by | 108 | optimally- typical numbers range to be less than 5. The list generated by |
| 109 | registering the OPPs is maintained by OPP library throughout the device | 109 | registering the OPPs is maintained by OPP library throughout the device |
| 110 | operation. The SoC framework can subsequently control the availability of the | 110 | operation. The SoC framework can subsequently control the availability of the |
| 111 | OPPs dynamically using the opp_enable / disable functions. | 111 | OPPs dynamically using the dev_pm_opp_enable / disable functions. |
| 112 | 112 | ||
| 113 | opp_add - Add a new OPP for a specific domain represented by the device pointer. | 113 | dev_pm_opp_add - Add a new OPP for a specific domain represented by the device pointer. |
| 114 | The OPP is defined using the frequency and voltage. Once added, the OPP | 114 | The OPP is defined using the frequency and voltage. Once added, the OPP |
| 115 | is assumed to be available and control of it's availability can be done | 115 | is assumed to be available and control of it's availability can be done |
| 116 | with the opp_enable/disable functions. OPP library internally stores | 116 | with the dev_pm_opp_enable/disable functions. OPP library internally stores |
| 117 | and manages this information in the opp struct. This function may be | 117 | and manages this information in the opp struct. This function may be |
| 118 | used by SoC framework to define a optimal list as per the demands of | 118 | used by SoC framework to define a optimal list as per the demands of |
| 119 | SoC usage environment. | 119 | SoC usage environment. |
| @@ -124,7 +124,7 @@ opp_add - Add a new OPP for a specific domain represented by the device pointer. | |||
| 124 | soc_pm_init() | 124 | soc_pm_init() |
| 125 | { | 125 | { |
| 126 | /* Do things */ | 126 | /* Do things */ |
| 127 | r = opp_add(mpu_dev, 1000000, 900000); | 127 | r = dev_pm_opp_add(mpu_dev, 1000000, 900000); |
| 128 | if (!r) { | 128 | if (!r) { |
| 129 | pr_err("%s: unable to register mpu opp(%d)\n", r); | 129 | pr_err("%s: unable to register mpu opp(%d)\n", r); |
| 130 | goto no_cpufreq; | 130 | goto no_cpufreq; |
| @@ -143,44 +143,44 @@ functions return the matching pointer representing the opp if a match is | |||
| 143 | found, else returns error. These errors are expected to be handled by standard | 143 | found, else returns error. These errors are expected to be handled by standard |
| 144 | error checks such as IS_ERR() and appropriate actions taken by the caller. | 144 | error checks such as IS_ERR() and appropriate actions taken by the caller. |
| 145 | 145 | ||
| 146 | opp_find_freq_exact - Search for an OPP based on an *exact* frequency and | 146 | dev_pm_opp_find_freq_exact - Search for an OPP based on an *exact* frequency and |
| 147 | availability. This function is especially useful to enable an OPP which | 147 | availability. This function is especially useful to enable an OPP which |
| 148 | is not available by default. | 148 | is not available by default. |
| 149 | Example: In a case when SoC framework detects a situation where a | 149 | Example: In a case when SoC framework detects a situation where a |
| 150 | higher frequency could be made available, it can use this function to | 150 | higher frequency could be made available, it can use this function to |
| 151 | find the OPP prior to call the opp_enable to actually make it available. | 151 | find the OPP prior to call the dev_pm_opp_enable to actually make it available. |
| 152 | rcu_read_lock(); | 152 | rcu_read_lock(); |
| 153 | opp = opp_find_freq_exact(dev, 1000000000, false); | 153 | opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false); |
| 154 | rcu_read_unlock(); | 154 | rcu_read_unlock(); |
| 155 | /* dont operate on the pointer.. just do a sanity check.. */ | 155 | /* dont operate on the pointer.. just do a sanity check.. */ |
| 156 | if (IS_ERR(opp)) { | 156 | if (IS_ERR(opp)) { |
| 157 | pr_err("frequency not disabled!\n"); | 157 | pr_err("frequency not disabled!\n"); |
| 158 | /* trigger appropriate actions.. */ | 158 | /* trigger appropriate actions.. */ |
| 159 | } else { | 159 | } else { |
| 160 | opp_enable(dev,1000000000); | 160 | dev_pm_opp_enable(dev,1000000000); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | NOTE: This is the only search function that operates on OPPs which are | 163 | NOTE: This is the only search function that operates on OPPs which are |
| 164 | not available. | 164 | not available. |
| 165 | 165 | ||
| 166 | opp_find_freq_floor - Search for an available OPP which is *at most* the | 166 | dev_pm_opp_find_freq_floor - Search for an available OPP which is *at most* the |
| 167 | provided frequency. This function is useful while searching for a lesser | 167 | provided frequency. This function is useful while searching for a lesser |
| 168 | match OR operating on OPP information in the order of decreasing | 168 | match OR operating on OPP information in the order of decreasing |
| 169 | frequency. | 169 | frequency. |
| 170 | Example: To find the highest opp for a device: | 170 | Example: To find the highest opp for a device: |
| 171 | freq = ULONG_MAX; | 171 | freq = ULONG_MAX; |
| 172 | rcu_read_lock(); | 172 | rcu_read_lock(); |
| 173 | opp_find_freq_floor(dev, &freq); | 173 | dev_pm_opp_find_freq_floor(dev, &freq); |
| 174 | rcu_read_unlock(); | 174 | rcu_read_unlock(); |
| 175 | 175 | ||
| 176 | opp_find_freq_ceil - Search for an available OPP which is *at least* the | 176 | dev_pm_opp_find_freq_ceil - Search for an available OPP which is *at least* the |
| 177 | provided frequency. This function is useful while searching for a | 177 | provided frequency. This function is useful while searching for a |
| 178 | higher match OR operating on OPP information in the order of increasing | 178 | higher match OR operating on OPP information in the order of increasing |
| 179 | frequency. | 179 | frequency. |
| 180 | Example 1: To find the lowest opp for a device: | 180 | Example 1: To find the lowest opp for a device: |
| 181 | freq = 0; | 181 | freq = 0; |
| 182 | rcu_read_lock(); | 182 | rcu_read_lock(); |
| 183 | opp_find_freq_ceil(dev, &freq); | 183 | dev_pm_opp_find_freq_ceil(dev, &freq); |
| 184 | rcu_read_unlock(); | 184 | rcu_read_unlock(); |
| 185 | Example 2: A simplified implementation of a SoC cpufreq_driver->target: | 185 | Example 2: A simplified implementation of a SoC cpufreq_driver->target: |
| 186 | soc_cpufreq_target(..) | 186 | soc_cpufreq_target(..) |
| @@ -188,7 +188,7 @@ opp_find_freq_ceil - Search for an available OPP which is *at least* the | |||
| 188 | /* Do stuff like policy checks etc. */ | 188 | /* Do stuff like policy checks etc. */ |
| 189 | /* Find the best frequency match for the req */ | 189 | /* Find the best frequency match for the req */ |
| 190 | rcu_read_lock(); | 190 | rcu_read_lock(); |
| 191 | opp = opp_find_freq_ceil(dev, &freq); | 191 | opp = dev_pm_opp_find_freq_ceil(dev, &freq); |
| 192 | rcu_read_unlock(); | 192 | rcu_read_unlock(); |
| 193 | if (!IS_ERR(opp)) | 193 | if (!IS_ERR(opp)) |
| 194 | soc_switch_to_freq_voltage(freq); | 194 | soc_switch_to_freq_voltage(freq); |
| @@ -208,34 +208,34 @@ as thermal considerations (e.g. don't use OPPx until the temperature drops). | |||
| 208 | 208 | ||
| 209 | WARNING: Do not use these functions in interrupt context. | 209 | WARNING: Do not use these functions in interrupt context. |
| 210 | 210 | ||
| 211 | opp_enable - Make a OPP available for operation. | 211 | dev_pm_opp_enable - Make a OPP available for operation. |
| 212 | Example: Lets say that 1GHz OPP is to be made available only if the | 212 | Example: Lets say that 1GHz OPP is to be made available only if the |
| 213 | SoC temperature is lower than a certain threshold. The SoC framework | 213 | SoC temperature is lower than a certain threshold. The SoC framework |
| 214 | implementation might choose to do something as follows: | 214 | implementation might choose to do something as follows: |
| 215 | if (cur_temp < temp_low_thresh) { | 215 | if (cur_temp < temp_low_thresh) { |
| 216 | /* Enable 1GHz if it was disabled */ | 216 | /* Enable 1GHz if it was disabled */ |
| 217 | rcu_read_lock(); | 217 | rcu_read_lock(); |
| 218 | opp = opp_find_freq_exact(dev, 1000000000, false); | 218 | opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false); |
| 219 | rcu_read_unlock(); | 219 | rcu_read_unlock(); |
| 220 | /* just error check */ | 220 | /* just error check */ |
| 221 | if (!IS_ERR(opp)) | 221 | if (!IS_ERR(opp)) |
| 222 | ret = opp_enable(dev, 1000000000); | 222 | ret = dev_pm_opp_enable(dev, 1000000000); |
| 223 | else | 223 | else |
| 224 | goto try_something_else; | 224 | goto try_something_else; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | opp_disable - Make an OPP to be not available for operation | 227 | dev_pm_opp_disable - Make an OPP to be not available for operation |
| 228 | Example: Lets say that 1GHz OPP is to be disabled if the temperature | 228 | Example: Lets say that 1GHz OPP is to be disabled if the temperature |
| 229 | exceeds a threshold value. The SoC framework implementation might | 229 | exceeds a threshold value. The SoC framework implementation might |
| 230 | choose to do something as follows: | 230 | choose to do something as follows: |
| 231 | if (cur_temp > temp_high_thresh) { | 231 | if (cur_temp > temp_high_thresh) { |
| 232 | /* Disable 1GHz if it was enabled */ | 232 | /* Disable 1GHz if it was enabled */ |
| 233 | rcu_read_lock(); | 233 | rcu_read_lock(); |
| 234 | opp = opp_find_freq_exact(dev, 1000000000, true); | 234 | opp = dev_pm_opp_find_freq_exact(dev, 1000000000, true); |
| 235 | rcu_read_unlock(); | 235 | rcu_read_unlock(); |
| 236 | /* just error check */ | 236 | /* just error check */ |
| 237 | if (!IS_ERR(opp)) | 237 | if (!IS_ERR(opp)) |
| 238 | ret = opp_disable(dev, 1000000000); | 238 | ret = dev_pm_opp_disable(dev, 1000000000); |
| 239 | else | 239 | else |
| 240 | goto try_something_else; | 240 | goto try_something_else; |
| 241 | } | 241 | } |
| @@ -247,7 +247,7 @@ information from the OPP structure is necessary. Once an OPP pointer is | |||
| 247 | retrieved using the search functions, the following functions can be used by SoC | 247 | retrieved using the search functions, the following functions can be used by SoC |
| 248 | framework to retrieve the information represented inside the OPP layer. | 248 | framework to retrieve the information represented inside the OPP layer. |
| 249 | 249 | ||
| 250 | opp_get_voltage - Retrieve the voltage represented by the opp pointer. | 250 | dev_pm_opp_get_voltage - Retrieve the voltage represented by the opp pointer. |
| 251 | Example: At a cpufreq transition to a different frequency, SoC | 251 | Example: At a cpufreq transition to a different frequency, SoC |
| 252 | framework requires to set the voltage represented by the OPP using | 252 | framework requires to set the voltage represented by the OPP using |
| 253 | the regulator framework to the Power Management chip providing the | 253 | the regulator framework to the Power Management chip providing the |
| @@ -256,15 +256,15 @@ opp_get_voltage - Retrieve the voltage represented by the opp pointer. | |||
| 256 | { | 256 | { |
| 257 | /* do things */ | 257 | /* do things */ |
| 258 | rcu_read_lock(); | 258 | rcu_read_lock(); |
| 259 | opp = opp_find_freq_ceil(dev, &freq); | 259 | opp = dev_pm_opp_find_freq_ceil(dev, &freq); |
| 260 | v = opp_get_voltage(opp); | 260 | v = dev_pm_opp_get_voltage(opp); |
| 261 | rcu_read_unlock(); | 261 | rcu_read_unlock(); |
| 262 | if (v) | 262 | if (v) |
| 263 | regulator_set_voltage(.., v); | 263 | regulator_set_voltage(.., v); |
| 264 | /* do other things */ | 264 | /* do other things */ |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | opp_get_freq - Retrieve the freq represented by the opp pointer. | 267 | dev_pm_opp_get_freq - Retrieve the freq represented by the opp pointer. |
| 268 | Example: Lets say the SoC framework uses a couple of helper functions | 268 | Example: Lets say the SoC framework uses a couple of helper functions |
| 269 | we could pass opp pointers instead of doing additional parameters to | 269 | we could pass opp pointers instead of doing additional parameters to |
| 270 | handle quiet a bit of data parameters. | 270 | handle quiet a bit of data parameters. |
| @@ -273,8 +273,8 @@ opp_get_freq - Retrieve the freq represented by the opp pointer. | |||
| 273 | /* do things.. */ | 273 | /* do things.. */ |
| 274 | max_freq = ULONG_MAX; | 274 | max_freq = ULONG_MAX; |
| 275 | rcu_read_lock(); | 275 | rcu_read_lock(); |
| 276 | max_opp = opp_find_freq_floor(dev,&max_freq); | 276 | max_opp = dev_pm_opp_find_freq_floor(dev,&max_freq); |
| 277 | requested_opp = opp_find_freq_ceil(dev,&freq); | 277 | requested_opp = dev_pm_opp_find_freq_ceil(dev,&freq); |
| 278 | if (!IS_ERR(max_opp) && !IS_ERR(requested_opp)) | 278 | if (!IS_ERR(max_opp) && !IS_ERR(requested_opp)) |
| 279 | r = soc_test_validity(max_opp, requested_opp); | 279 | r = soc_test_validity(max_opp, requested_opp); |
| 280 | rcu_read_unlock(); | 280 | rcu_read_unlock(); |
| @@ -282,25 +282,25 @@ opp_get_freq - Retrieve the freq represented by the opp pointer. | |||
| 282 | } | 282 | } |
| 283 | soc_test_validity(..) | 283 | soc_test_validity(..) |
| 284 | { | 284 | { |
| 285 | if(opp_get_voltage(max_opp) < opp_get_voltage(requested_opp)) | 285 | if(dev_pm_opp_get_voltage(max_opp) < dev_pm_opp_get_voltage(requested_opp)) |
| 286 | return -EINVAL; | 286 | return -EINVAL; |
| 287 | if(opp_get_freq(max_opp) < opp_get_freq(requested_opp)) | 287 | if(dev_pm_opp_get_freq(max_opp) < dev_pm_opp_get_freq(requested_opp)) |
| 288 | return -EINVAL; | 288 | return -EINVAL; |
| 289 | /* do things.. */ | 289 | /* do things.. */ |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | opp_get_opp_count - Retrieve the number of available opps for a device | 292 | dev_pm_opp_get_opp_count - Retrieve the number of available opps for a device |
| 293 | Example: Lets say a co-processor in the SoC needs to know the available | 293 | Example: Lets say a co-processor in the SoC needs to know the available |
| 294 | frequencies in a table, the main processor can notify as following: | 294 | frequencies in a table, the main processor can notify as following: |
| 295 | soc_notify_coproc_available_frequencies() | 295 | soc_notify_coproc_available_frequencies() |
| 296 | { | 296 | { |
| 297 | /* Do things */ | 297 | /* Do things */ |
| 298 | rcu_read_lock(); | 298 | rcu_read_lock(); |
| 299 | num_available = opp_get_opp_count(dev); | 299 | num_available = dev_pm_opp_get_opp_count(dev); |
| 300 | speeds = kzalloc(sizeof(u32) * num_available, GFP_KERNEL); | 300 | speeds = kzalloc(sizeof(u32) * num_available, GFP_KERNEL); |
| 301 | /* populate the table in increasing order */ | 301 | /* populate the table in increasing order */ |
| 302 | freq = 0; | 302 | freq = 0; |
| 303 | while (!IS_ERR(opp = opp_find_freq_ceil(dev, &freq))) { | 303 | while (!IS_ERR(opp = dev_pm_opp_find_freq_ceil(dev, &freq))) { |
| 304 | speeds[i] = freq; | 304 | speeds[i] = freq; |
| 305 | freq++; | 305 | freq++; |
| 306 | i++; | 306 | i++; |
| @@ -313,7 +313,7 @@ opp_get_opp_count - Retrieve the number of available opps for a device | |||
| 313 | 313 | ||
| 314 | 6. Cpufreq Table Generation | 314 | 6. Cpufreq Table Generation |
| 315 | =========================== | 315 | =========================== |
| 316 | opp_init_cpufreq_table - cpufreq framework typically is initialized with | 316 | dev_pm_opp_init_cpufreq_table - cpufreq framework typically is initialized with |
| 317 | cpufreq_frequency_table_cpuinfo which is provided with the list of | 317 | cpufreq_frequency_table_cpuinfo which is provided with the list of |
| 318 | frequencies that are available for operation. This function provides | 318 | frequencies that are available for operation. This function provides |
| 319 | a ready to use conversion routine to translate the OPP layer's internal | 319 | a ready to use conversion routine to translate the OPP layer's internal |
| @@ -326,7 +326,7 @@ opp_init_cpufreq_table - cpufreq framework typically is initialized with | |||
| 326 | soc_pm_init() | 326 | soc_pm_init() |
| 327 | { | 327 | { |
| 328 | /* Do things */ | 328 | /* Do things */ |
| 329 | r = opp_init_cpufreq_table(dev, &freq_table); | 329 | r = dev_pm_opp_init_cpufreq_table(dev, &freq_table); |
| 330 | if (!r) | 330 | if (!r) |
| 331 | cpufreq_frequency_table_cpuinfo(policy, freq_table); | 331 | cpufreq_frequency_table_cpuinfo(policy, freq_table); |
| 332 | /* Do other things */ | 332 | /* Do other things */ |
| @@ -336,7 +336,7 @@ opp_init_cpufreq_table - cpufreq framework typically is initialized with | |||
| 336 | addition to CONFIG_PM as power management feature is required to | 336 | addition to CONFIG_PM as power management feature is required to |
| 337 | dynamically scale voltage and frequency in a system. | 337 | dynamically scale voltage and frequency in a system. |
| 338 | 338 | ||
| 339 | opp_free_cpufreq_table - Free up the table allocated by opp_init_cpufreq_table | 339 | dev_pm_opp_free_cpufreq_table - Free up the table allocated by dev_pm_opp_init_cpufreq_table |
| 340 | 340 | ||
| 341 | 7. Data Structures | 341 | 7. Data Structures |
| 342 | ================== | 342 | ================== |
| @@ -366,8 +366,8 @@ struct opp - The internal data structure of OPP library which is used to | |||
| 366 | identifier for OPP in the interactions with OPP layer. | 366 | identifier for OPP in the interactions with OPP layer. |
| 367 | 367 | ||
| 368 | WARNING: The struct opp pointer should not be parsed or modified by the | 368 | WARNING: The struct opp pointer should not be parsed or modified by the |
| 369 | users. The defaults of for an instance is populated by opp_add, but the | 369 | users. The defaults of for an instance is populated by dev_pm_opp_add, but the |
| 370 | availability of the OPP can be modified by opp_enable/disable functions. | 370 | availability of the OPP can be modified by dev_pm_opp_enable/disable functions. |
| 371 | 371 | ||
| 372 | struct device - This is used to identify a domain to the OPP layer. The | 372 | struct device - This is used to identify a domain to the OPP layer. The |
| 373 | nature of the device and it's implementation is left to the user of | 373 | nature of the device and it's implementation is left to the user of |
| @@ -377,19 +377,19 @@ Overall, in a simplistic view, the data structure operations is represented as | |||
| 377 | following: | 377 | following: |
| 378 | 378 | ||
| 379 | Initialization / modification: | 379 | Initialization / modification: |
| 380 | +-----+ /- opp_enable | 380 | +-----+ /- dev_pm_opp_enable |
| 381 | opp_add --> | opp | <------- | 381 | dev_pm_opp_add --> | opp | <------- |
| 382 | | +-----+ \- opp_disable | 382 | | +-----+ \- dev_pm_opp_disable |
| 383 | \-------> domain_info(device) | 383 | \-------> domain_info(device) |
| 384 | 384 | ||
| 385 | Search functions: | 385 | Search functions: |
| 386 | /-- opp_find_freq_ceil ---\ +-----+ | 386 | /-- dev_pm_opp_find_freq_ceil ---\ +-----+ |
| 387 | domain_info<---- opp_find_freq_exact -----> | opp | | 387 | domain_info<---- dev_pm_opp_find_freq_exact -----> | opp | |
| 388 | \-- opp_find_freq_floor ---/ +-----+ | 388 | \-- dev_pm_opp_find_freq_floor ---/ +-----+ |
| 389 | 389 | ||
| 390 | Retrieval functions: | 390 | Retrieval functions: |
| 391 | +-----+ /- opp_get_voltage | 391 | +-----+ /- dev_pm_opp_get_voltage |
| 392 | | opp | <--- | 392 | | opp | <--- |
| 393 | +-----+ \- opp_get_freq | 393 | +-----+ \- dev_pm_opp_get_freq |
| 394 | 394 | ||
| 395 | domain_info <- opp_get_opp_count | 395 | domain_info <- dev_pm_opp_get_opp_count |
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 90372a21087f..d7ecc90e6bba 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
| @@ -226,7 +226,7 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev) | |||
| 226 | val = readl_relaxed(base + OCOTP_CFG3); | 226 | val = readl_relaxed(base + OCOTP_CFG3); |
| 227 | val >>= OCOTP_CFG3_SPEED_SHIFT; | 227 | val >>= OCOTP_CFG3_SPEED_SHIFT; |
| 228 | if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) | 228 | if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) |
| 229 | if (opp_disable(cpu_dev, 1200000000)) | 229 | if (dev_pm_opp_disable(cpu_dev, 1200000000)) |
| 230 | pr_warn("failed to disable 1.2 GHz OPP\n"); | 230 | pr_warn("failed to disable 1.2 GHz OPP\n"); |
| 231 | 231 | ||
| 232 | put_node: | 232 | put_node: |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index f26918467efc..33969e5a149f 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
| @@ -522,11 +522,11 @@ static int __init beagle_opp_init(void) | |||
| 522 | return -ENODEV; | 522 | return -ENODEV; |
| 523 | } | 523 | } |
| 524 | /* Enable MPU 1GHz and lower opps */ | 524 | /* Enable MPU 1GHz and lower opps */ |
| 525 | r = opp_enable(mpu_dev, 800000000); | 525 | r = dev_pm_opp_enable(mpu_dev, 800000000); |
| 526 | /* TODO: MPU 1GHz needs SR and ABB */ | 526 | /* TODO: MPU 1GHz needs SR and ABB */ |
| 527 | 527 | ||
| 528 | /* Enable IVA 800MHz and lower opps */ | 528 | /* Enable IVA 800MHz and lower opps */ |
| 529 | r |= opp_enable(iva_dev, 660000000); | 529 | r |= dev_pm_opp_enable(iva_dev, 660000000); |
| 530 | /* TODO: DSP 800MHz needs SR and ABB */ | 530 | /* TODO: DSP 800MHz needs SR and ABB */ |
| 531 | if (r) { | 531 | if (r) { |
| 532 | pr_err("%s: failed to enable higher opp %d\n", | 532 | pr_err("%s: failed to enable higher opp %d\n", |
| @@ -535,8 +535,8 @@ static int __init beagle_opp_init(void) | |||
| 535 | * Cleanup - disable the higher freqs - we dont care | 535 | * Cleanup - disable the higher freqs - we dont care |
| 536 | * about the results | 536 | * about the results |
| 537 | */ | 537 | */ |
| 538 | opp_disable(mpu_dev, 800000000); | 538 | dev_pm_opp_disable(mpu_dev, 800000000); |
| 539 | opp_disable(iva_dev, 660000000); | 539 | dev_pm_opp_disable(iva_dev, 660000000); |
| 540 | } | 540 | } |
| 541 | } | 541 | } |
| 542 | return 0; | 542 | return 0; |
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c index bd41d59a7cab..7b04637b13cb 100644 --- a/arch/arm/mach-omap2/opp.c +++ b/arch/arm/mach-omap2/opp.c | |||
| @@ -81,14 +81,14 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, | |||
| 81 | dev = &oh->od->pdev->dev; | 81 | dev = &oh->od->pdev->dev; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | r = opp_add(dev, opp_def->freq, opp_def->u_volt); | 84 | r = dev_pm_opp_add(dev, opp_def->freq, opp_def->u_volt); |
| 85 | if (r) { | 85 | if (r) { |
| 86 | dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n", | 86 | dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n", |
| 87 | __func__, opp_def->freq, | 87 | __func__, opp_def->freq, |
| 88 | opp_def->hwmod_name, i, r); | 88 | opp_def->hwmod_name, i, r); |
| 89 | } else { | 89 | } else { |
| 90 | if (!opp_def->default_available) | 90 | if (!opp_def->default_available) |
| 91 | r = opp_disable(dev, opp_def->freq); | 91 | r = dev_pm_opp_disable(dev, opp_def->freq); |
| 92 | if (r) | 92 | if (r) |
| 93 | dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n", | 93 | dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n", |
| 94 | __func__, opp_def->freq, | 94 | __func__, opp_def->freq, |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index e742118fcfd2..937744c3679d 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
| @@ -172,7 +172,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |||
| 172 | clk_put(clk); | 172 | clk_put(clk); |
| 173 | 173 | ||
| 174 | rcu_read_lock(); | 174 | rcu_read_lock(); |
| 175 | opp = opp_find_freq_ceil(dev, &freq); | 175 | opp = dev_pm_opp_find_freq_ceil(dev, &freq); |
| 176 | if (IS_ERR(opp)) { | 176 | if (IS_ERR(opp)) { |
| 177 | rcu_read_unlock(); | 177 | rcu_read_unlock(); |
| 178 | pr_err("%s: unable to find boot up OPP for vdd_%s\n", | 178 | pr_err("%s: unable to find boot up OPP for vdd_%s\n", |
| @@ -180,7 +180,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |||
| 180 | goto exit; | 180 | goto exit; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | bootup_volt = opp_get_voltage(opp); | 183 | bootup_volt = dev_pm_opp_get_voltage(opp); |
| 184 | rcu_read_unlock(); | 184 | rcu_read_unlock(); |
| 185 | if (!bootup_volt) { | 185 | if (!bootup_volt) { |
| 186 | pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", | 186 | pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", |
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index ef89897c6043..00c6a449cdeb 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c | |||
| @@ -136,7 +136,7 @@ static struct device_opp *find_device_opp(struct device *dev) | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /** | 138 | /** |
| 139 | * opp_get_voltage() - Gets the voltage corresponding to an available opp | 139 | * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an available opp |
| 140 | * @opp: opp for which voltage has to be returned for | 140 | * @opp: opp for which voltage has to be returned for |
| 141 | * | 141 | * |
| 142 | * Return voltage in micro volt corresponding to the opp, else | 142 | * Return voltage in micro volt corresponding to the opp, else |
| @@ -150,7 +150,7 @@ static struct device_opp *find_device_opp(struct device *dev) | |||
| 150 | * prior to unlocking with rcu_read_unlock() to maintain the integrity of the | 150 | * prior to unlocking with rcu_read_unlock() to maintain the integrity of the |
| 151 | * pointer. | 151 | * pointer. |
| 152 | */ | 152 | */ |
| 153 | unsigned long opp_get_voltage(struct opp *opp) | 153 | unsigned long dev_pm_opp_get_voltage(struct opp *opp) |
| 154 | { | 154 | { |
| 155 | struct opp *tmp_opp; | 155 | struct opp *tmp_opp; |
| 156 | unsigned long v = 0; | 156 | unsigned long v = 0; |
| @@ -163,10 +163,10 @@ unsigned long opp_get_voltage(struct opp *opp) | |||
| 163 | 163 | ||
| 164 | return v; | 164 | return v; |
| 165 | } | 165 | } |
| 166 | EXPORT_SYMBOL_GPL(opp_get_voltage); | 166 | EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage); |
| 167 | 167 | ||
| 168 | /** | 168 | /** |
| 169 | * opp_get_freq() - Gets the frequency corresponding to an available opp | 169 | * dev_pm_opp_get_freq() - Gets the frequency corresponding to an available opp |
| 170 | * @opp: opp for which frequency has to be returned for | 170 | * @opp: opp for which frequency has to be returned for |
| 171 | * | 171 | * |
| 172 | * Return frequency in hertz corresponding to the opp, else | 172 | * Return frequency in hertz corresponding to the opp, else |
| @@ -180,7 +180,7 @@ EXPORT_SYMBOL_GPL(opp_get_voltage); | |||
| 180 | * prior to unlocking with rcu_read_unlock() to maintain the integrity of the | 180 | * prior to unlocking with rcu_read_unlock() to maintain the integrity of the |
| 181 | * pointer. | 181 | * pointer. |
| 182 | */ | 182 | */ |
| 183 | unsigned long opp_get_freq(struct opp *opp) | 183 | unsigned long dev_pm_opp_get_freq(struct opp *opp) |
| 184 | { | 184 | { |
| 185 | struct opp *tmp_opp; | 185 | struct opp *tmp_opp; |
| 186 | unsigned long f = 0; | 186 | unsigned long f = 0; |
| @@ -193,10 +193,10 @@ unsigned long opp_get_freq(struct opp *opp) | |||
| 193 | 193 | ||
| 194 | return f; | 194 | return f; |
| 195 | } | 195 | } |
| 196 | EXPORT_SYMBOL_GPL(opp_get_freq); | 196 | EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); |
| 197 | 197 | ||
| 198 | /** | 198 | /** |
| 199 | * opp_get_opp_count() - Get number of opps available in the opp list | 199 | * dev_pm_opp_get_opp_count() - Get number of opps available in the opp list |
| 200 | * @dev: device for which we do this operation | 200 | * @dev: device for which we do this operation |
| 201 | * | 201 | * |
| 202 | * This function returns the number of available opps if there are any, | 202 | * This function returns the number of available opps if there are any, |
| @@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(opp_get_freq); | |||
| 206 | * internally references two RCU protected structures: device_opp and opp which | 206 | * internally references two RCU protected structures: device_opp and opp which |
| 207 | * are safe as long as we are under a common RCU locked section. | 207 | * are safe as long as we are under a common RCU locked section. |
| 208 | */ | 208 | */ |
| 209 | int opp_get_opp_count(struct device *dev) | 209 | int dev_pm_opp_get_opp_count(struct device *dev) |
| 210 | { | 210 | { |
| 211 | struct device_opp *dev_opp; | 211 | struct device_opp *dev_opp; |
| 212 | struct opp *temp_opp; | 212 | struct opp *temp_opp; |
| @@ -226,10 +226,10 @@ int opp_get_opp_count(struct device *dev) | |||
| 226 | 226 | ||
| 227 | return count; | 227 | return count; |
| 228 | } | 228 | } |
| 229 | EXPORT_SYMBOL_GPL(opp_get_opp_count); | 229 | EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count); |
| 230 | 230 | ||
| 231 | /** | 231 | /** |
| 232 | * opp_find_freq_exact() - search for an exact frequency | 232 | * dev_pm_opp_find_freq_exact() - search for an exact frequency |
| 233 | * @dev: device for which we do this operation | 233 | * @dev: device for which we do this operation |
| 234 | * @freq: frequency to search for | 234 | * @freq: frequency to search for |
| 235 | * @available: true/false - match for available opp | 235 | * @available: true/false - match for available opp |
| @@ -254,7 +254,7 @@ EXPORT_SYMBOL_GPL(opp_get_opp_count); | |||
| 254 | * under the locked area. The pointer returned must be used prior to unlocking | 254 | * under the locked area. The pointer returned must be used prior to unlocking |
| 255 | * with rcu_read_unlock() to maintain the integrity of the pointer. | 255 | * with rcu_read_unlock() to maintain the integrity of the pointer. |
| 256 | */ | 256 | */ |
| 257 | struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq, | 257 | struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq, |
| 258 | bool available) | 258 | bool available) |
| 259 | { | 259 | { |
| 260 | struct device_opp *dev_opp; | 260 | struct device_opp *dev_opp; |
| @@ -277,10 +277,10 @@ struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq, | |||
| 277 | 277 | ||
| 278 | return opp; | 278 | return opp; |
| 279 | } | 279 | } |
| 280 | EXPORT_SYMBOL_GPL(opp_find_freq_exact); | 280 | EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact); |
| 281 | 281 | ||
| 282 | /** | 282 | /** |
| 283 | * opp_find_freq_ceil() - Search for an rounded ceil freq | 283 | * dev_pm_opp_find_freq_ceil() - Search for an rounded ceil freq |
| 284 | * @dev: device for which we do this operation | 284 | * @dev: device for which we do this operation |
| 285 | * @freq: Start frequency | 285 | * @freq: Start frequency |
| 286 | * | 286 | * |
| @@ -300,7 +300,7 @@ EXPORT_SYMBOL_GPL(opp_find_freq_exact); | |||
| 300 | * under the locked area. The pointer returned must be used prior to unlocking | 300 | * under the locked area. The pointer returned must be used prior to unlocking |
| 301 | * with rcu_read_unlock() to maintain the integrity of the pointer. | 301 | * with rcu_read_unlock() to maintain the integrity of the pointer. |
| 302 | */ | 302 | */ |
| 303 | struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq) | 303 | struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq) |
| 304 | { | 304 | { |
| 305 | struct device_opp *dev_opp; | 305 | struct device_opp *dev_opp; |
| 306 | struct opp *temp_opp, *opp = ERR_PTR(-ERANGE); | 306 | struct opp *temp_opp, *opp = ERR_PTR(-ERANGE); |
| @@ -324,10 +324,10 @@ struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq) | |||
| 324 | 324 | ||
| 325 | return opp; | 325 | return opp; |
| 326 | } | 326 | } |
| 327 | EXPORT_SYMBOL_GPL(opp_find_freq_ceil); | 327 | EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil); |
| 328 | 328 | ||
| 329 | /** | 329 | /** |
| 330 | * opp_find_freq_floor() - Search for a rounded floor freq | 330 | * dev_pm_opp_find_freq_floor() - Search for a rounded floor freq |
| 331 | * @dev: device for which we do this operation | 331 | * @dev: device for which we do this operation |
| 332 | * @freq: Start frequency | 332 | * @freq: Start frequency |
| 333 | * | 333 | * |
| @@ -347,7 +347,7 @@ EXPORT_SYMBOL_GPL(opp_find_freq_ceil); | |||
| 347 | * under the locked area. The pointer returned must be used prior to unlocking | 347 | * under the locked area. The pointer returned must be used prior to unlocking |
| 348 | * with rcu_read_unlock() to maintain the integrity of the pointer. | 348 | * with rcu_read_unlock() to maintain the integrity of the pointer. |
| 349 | */ | 349 | */ |
| 350 | struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq) | 350 | struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq) |
| 351 | { | 351 | { |
| 352 | struct device_opp *dev_opp; | 352 | struct device_opp *dev_opp; |
| 353 | struct opp *temp_opp, *opp = ERR_PTR(-ERANGE); | 353 | struct opp *temp_opp, *opp = ERR_PTR(-ERANGE); |
| @@ -375,17 +375,17 @@ struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq) | |||
| 375 | 375 | ||
| 376 | return opp; | 376 | return opp; |
| 377 | } | 377 | } |
| 378 | EXPORT_SYMBOL_GPL(opp_find_freq_floor); | 378 | EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor); |
| 379 | 379 | ||
| 380 | /** | 380 | /** |
| 381 | * opp_add() - Add an OPP table from a table definitions | 381 | * dev_pm_opp_add() - Add an OPP table from a table definitions |
| 382 | * @dev: device for which we do this operation | 382 | * @dev: device for which we do this operation |
| 383 | * @freq: Frequency in Hz for this OPP | 383 | * @freq: Frequency in Hz for this OPP |
| 384 | * @u_volt: Voltage in uVolts for this OPP | 384 | * @u_volt: Voltage in uVolts for this OPP |
| 385 | * | 385 | * |
| 386 | * This function adds an opp definition to the opp list and returns status. | 386 | * This function adds an opp definition to the opp list and returns status. |
| 387 | * The opp is made available by default and it can be controlled using | 387 | * The opp is made available by default and it can be controlled using |
| 388 | * opp_enable/disable functions. | 388 | * dev_pm_opp_enable/disable functions. |
| 389 | * | 389 | * |
| 390 | * Locking: The internal device_opp and opp structures are RCU protected. | 390 | * Locking: The internal device_opp and opp structures are RCU protected. |
| 391 | * Hence this function internally uses RCU updater strategy with mutex locks | 391 | * Hence this function internally uses RCU updater strategy with mutex locks |
| @@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(opp_find_freq_floor); | |||
| 393 | * that this function is *NOT* called under RCU protection or in contexts where | 393 | * that this function is *NOT* called under RCU protection or in contexts where |
| 394 | * mutex cannot be locked. | 394 | * mutex cannot be locked. |
| 395 | */ | 395 | */ |
| 396 | int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | 396 | int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) |
| 397 | { | 397 | { |
| 398 | struct device_opp *dev_opp = NULL; | 398 | struct device_opp *dev_opp = NULL; |
| 399 | struct opp *opp, *new_opp; | 399 | struct opp *opp, *new_opp; |
| @@ -460,7 +460,7 @@ int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | |||
| 460 | srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_ADD, new_opp); | 460 | srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_ADD, new_opp); |
| 461 | return 0; | 461 | return 0; |
| 462 | } | 462 | } |
| 463 | EXPORT_SYMBOL_GPL(opp_add); | 463 | EXPORT_SYMBOL_GPL(dev_pm_opp_add); |
| 464 | 464 | ||
| 465 | /** | 465 | /** |
| 466 | * opp_set_availability() - helper to set the availability of an opp | 466 | * opp_set_availability() - helper to set the availability of an opp |
| @@ -552,13 +552,13 @@ unlock: | |||
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | /** | 554 | /** |
| 555 | * opp_enable() - Enable a specific OPP | 555 | * dev_pm_opp_enable() - Enable a specific OPP |
| 556 | * @dev: device for which we do this operation | 556 | * @dev: device for which we do this operation |
| 557 | * @freq: OPP frequency to enable | 557 | * @freq: OPP frequency to enable |
| 558 | * | 558 | * |
| 559 | * Enables a provided opp. If the operation is valid, this returns 0, else the | 559 | * Enables a provided opp. If the operation is valid, this returns 0, else the |
| 560 | * corresponding error value. It is meant to be used for users an OPP available | 560 | * corresponding error value. It is meant to be used for users an OPP available |
| 561 | * after being temporarily made unavailable with opp_disable. | 561 | * after being temporarily made unavailable with dev_pm_opp_disable. |
| 562 | * | 562 | * |
| 563 | * Locking: The internal device_opp and opp structures are RCU protected. | 563 | * Locking: The internal device_opp and opp structures are RCU protected. |
| 564 | * Hence this function indirectly uses RCU and mutex locks to keep the | 564 | * Hence this function indirectly uses RCU and mutex locks to keep the |
| @@ -566,21 +566,21 @@ unlock: | |||
| 566 | * this function is *NOT* called under RCU protection or in contexts where | 566 | * this function is *NOT* called under RCU protection or in contexts where |
| 567 | * mutex locking or synchronize_rcu() blocking calls cannot be used. | 567 | * mutex locking or synchronize_rcu() blocking calls cannot be used. |
| 568 | */ | 568 | */ |
| 569 | int opp_enable(struct device *dev, unsigned long freq) | 569 | int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
| 570 | { | 570 | { |
| 571 | return opp_set_availability(dev, freq, true); | 571 | return opp_set_availability(dev, freq, true); |
| 572 | } | 572 | } |
| 573 | EXPORT_SYMBOL_GPL(opp_enable); | 573 | EXPORT_SYMBOL_GPL(dev_pm_opp_enable); |
| 574 | 574 | ||
| 575 | /** | 575 | /** |
| 576 | * opp_disable() - Disable a specific OPP | 576 | * dev_pm_opp_disable() - Disable a specific OPP |
| 577 | * @dev: device for which we do this operation | 577 | * @dev: device for which we do this operation |
| 578 | * @freq: OPP frequency to disable | 578 | * @freq: OPP frequency to disable |
| 579 | * | 579 | * |
| 580 | * Disables a provided opp. If the operation is valid, this returns | 580 | * Disables a provided opp. If the operation is valid, this returns |
| 581 | * 0, else the corresponding error value. It is meant to be a temporary | 581 | * 0, else the corresponding error value. It is meant to be a temporary |
| 582 | * control by users to make this OPP not available until the circumstances are | 582 | * control by users to make this OPP not available until the circumstances are |
| 583 | * right to make it available again (with a call to opp_enable). | 583 | * right to make it available again (with a call to dev_pm_opp_enable). |
| 584 | * | 584 | * |
| 585 | * Locking: The internal device_opp and opp structures are RCU protected. | 585 | * Locking: The internal device_opp and opp structures are RCU protected. |
| 586 | * Hence this function indirectly uses RCU and mutex locks to keep the | 586 | * Hence this function indirectly uses RCU and mutex locks to keep the |
| @@ -588,15 +588,15 @@ EXPORT_SYMBOL_GPL(opp_enable); | |||
| 588 | * this function is *NOT* called under RCU protection or in contexts where | 588 | * this function is *NOT* called under RCU protection or in contexts where |
| 589 | * mutex locking or synchronize_rcu() blocking calls cannot be used. | 589 | * mutex locking or synchronize_rcu() blocking calls cannot be used. |
| 590 | */ | 590 | */ |
| 591 | int opp_disable(struct device *dev, unsigned long freq) | 591 | int dev_pm_opp_disable(struct device *dev, unsigned long freq) |
| 592 | { | 592 | { |
| 593 | return opp_set_availability(dev, freq, false); | 593 | return opp_set_availability(dev, freq, false); |
| 594 | } | 594 | } |
| 595 | EXPORT_SYMBOL_GPL(opp_disable); | 595 | EXPORT_SYMBOL_GPL(dev_pm_opp_disable); |
| 596 | 596 | ||
| 597 | #ifdef CONFIG_CPU_FREQ | 597 | #ifdef CONFIG_CPU_FREQ |
| 598 | /** | 598 | /** |
| 599 | * opp_init_cpufreq_table() - create a cpufreq table for a device | 599 | * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device |
| 600 | * @dev: device for which we do this operation | 600 | * @dev: device for which we do this operation |
| 601 | * @table: Cpufreq table returned back to caller | 601 | * @table: Cpufreq table returned back to caller |
| 602 | * | 602 | * |
| @@ -619,7 +619,7 @@ EXPORT_SYMBOL_GPL(opp_disable); | |||
| 619 | * Callers should ensure that this function is *NOT* called under RCU protection | 619 | * Callers should ensure that this function is *NOT* called under RCU protection |
| 620 | * or in contexts where mutex locking cannot be used. | 620 | * or in contexts where mutex locking cannot be used. |
| 621 | */ | 621 | */ |
| 622 | int opp_init_cpufreq_table(struct device *dev, | 622 | int dev_pm_opp_init_cpufreq_table(struct device *dev, |
| 623 | struct cpufreq_frequency_table **table) | 623 | struct cpufreq_frequency_table **table) |
| 624 | { | 624 | { |
| 625 | struct device_opp *dev_opp; | 625 | struct device_opp *dev_opp; |
| @@ -639,7 +639,7 @@ int opp_init_cpufreq_table(struct device *dev, | |||
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * | 641 | freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * |
| 642 | (opp_get_opp_count(dev) + 1), GFP_KERNEL); | 642 | (dev_pm_opp_get_opp_count(dev) + 1), GFP_KERNEL); |
| 643 | if (!freq_table) { | 643 | if (!freq_table) { |
| 644 | mutex_unlock(&dev_opp_list_lock); | 644 | mutex_unlock(&dev_opp_list_lock); |
| 645 | dev_warn(dev, "%s: Unable to allocate frequency table\n", | 645 | dev_warn(dev, "%s: Unable to allocate frequency table\n", |
| @@ -663,16 +663,16 @@ int opp_init_cpufreq_table(struct device *dev, | |||
| 663 | 663 | ||
| 664 | return 0; | 664 | return 0; |
| 665 | } | 665 | } |
| 666 | EXPORT_SYMBOL_GPL(opp_init_cpufreq_table); | 666 | EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table); |
| 667 | 667 | ||
| 668 | /** | 668 | /** |
| 669 | * opp_free_cpufreq_table() - free the cpufreq table | 669 | * dev_pm_opp_free_cpufreq_table() - free the cpufreq table |
| 670 | * @dev: device for which we do this operation | 670 | * @dev: device for which we do this operation |
| 671 | * @table: table to free | 671 | * @table: table to free |
| 672 | * | 672 | * |
| 673 | * Free up the table allocated by opp_init_cpufreq_table | 673 | * Free up the table allocated by dev_pm_opp_init_cpufreq_table |
| 674 | */ | 674 | */ |
| 675 | void opp_free_cpufreq_table(struct device *dev, | 675 | void dev_pm_opp_free_cpufreq_table(struct device *dev, |
| 676 | struct cpufreq_frequency_table **table) | 676 | struct cpufreq_frequency_table **table) |
| 677 | { | 677 | { |
| 678 | if (!table) | 678 | if (!table) |
| @@ -681,14 +681,14 @@ void opp_free_cpufreq_table(struct device *dev, | |||
| 681 | kfree(*table); | 681 | kfree(*table); |
| 682 | *table = NULL; | 682 | *table = NULL; |
| 683 | } | 683 | } |
| 684 | EXPORT_SYMBOL_GPL(opp_free_cpufreq_table); | 684 | EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); |
| 685 | #endif /* CONFIG_CPU_FREQ */ | 685 | #endif /* CONFIG_CPU_FREQ */ |
| 686 | 686 | ||
| 687 | /** | 687 | /** |
| 688 | * opp_get_notifier() - find notifier_head of the device with opp | 688 | * dev_pm_opp_get_notifier() - find notifier_head of the device with opp |
| 689 | * @dev: device pointer used to lookup device OPPs. | 689 | * @dev: device pointer used to lookup device OPPs. |
| 690 | */ | 690 | */ |
| 691 | struct srcu_notifier_head *opp_get_notifier(struct device *dev) | 691 | struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev) |
| 692 | { | 692 | { |
| 693 | struct device_opp *dev_opp = find_device_opp(dev); | 693 | struct device_opp *dev_opp = find_device_opp(dev); |
| 694 | 694 | ||
| @@ -732,7 +732,7 @@ int of_init_opp_table(struct device *dev) | |||
| 732 | unsigned long freq = be32_to_cpup(val++) * 1000; | 732 | unsigned long freq = be32_to_cpup(val++) * 1000; |
| 733 | unsigned long volt = be32_to_cpup(val++); | 733 | unsigned long volt = be32_to_cpup(val++); |
| 734 | 734 | ||
| 735 | if (opp_add(dev, freq, volt)) { | 735 | if (dev_pm_opp_add(dev, freq, volt)) { |
| 736 | dev_warn(dev, "%s: Failed to add OPP %ld\n", | 736 | dev_warn(dev, "%s: Failed to add OPP %ld\n", |
| 737 | __func__, freq); | 737 | __func__, freq); |
| 738 | continue; | 738 | continue; |
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index 3549f0784af1..9e82a9d5df77 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c | |||
| @@ -98,7 +98,7 @@ static void put_cluster_clk_and_freq_table(struct device *cpu_dev) | |||
| 98 | 98 | ||
| 99 | if (!atomic_dec_return(&cluster_usage[cluster])) { | 99 | if (!atomic_dec_return(&cluster_usage[cluster])) { |
| 100 | clk_put(clk[cluster]); | 100 | clk_put(clk[cluster]); |
| 101 | opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]); | 101 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]); |
| 102 | dev_dbg(cpu_dev, "%s: cluster: %d\n", __func__, cluster); | 102 | dev_dbg(cpu_dev, "%s: cluster: %d\n", __func__, cluster); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| @@ -119,7 +119,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev) | |||
| 119 | goto atomic_dec; | 119 | goto atomic_dec; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | ret = opp_init_cpufreq_table(cpu_dev, &freq_table[cluster]); | 122 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table[cluster]); |
| 123 | if (ret) { | 123 | if (ret) { |
| 124 | dev_err(cpu_dev, "%s: failed to init cpufreq table, cpu: %d, err: %d\n", | 124 | dev_err(cpu_dev, "%s: failed to init cpufreq table, cpu: %d, err: %d\n", |
| 125 | __func__, cpu_dev->id, ret); | 125 | __func__, cpu_dev->id, ret); |
| @@ -138,7 +138,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev) | |||
| 138 | dev_err(cpu_dev, "%s: Failed to get clk for cpu: %d, cluster: %d\n", | 138 | dev_err(cpu_dev, "%s: Failed to get clk for cpu: %d, cluster: %d\n", |
| 139 | __func__, cpu_dev->id, cluster); | 139 | __func__, cpu_dev->id, cluster); |
| 140 | ret = PTR_ERR(clk[cluster]); | 140 | ret = PTR_ERR(clk[cluster]); |
| 141 | opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]); | 141 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]); |
| 142 | 142 | ||
| 143 | atomic_dec: | 143 | atomic_dec: |
| 144 | atomic_dec(&cluster_usage[cluster]); | 144 | atomic_dec(&cluster_usage[cluster]); |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index c522a95c0e16..af951a9cea78 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
| @@ -72,7 +72,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
| 72 | 72 | ||
| 73 | if (!IS_ERR(cpu_reg)) { | 73 | if (!IS_ERR(cpu_reg)) { |
| 74 | rcu_read_lock(); | 74 | rcu_read_lock(); |
| 75 | opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); | 75 | opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz); |
| 76 | if (IS_ERR(opp)) { | 76 | if (IS_ERR(opp)) { |
| 77 | rcu_read_unlock(); | 77 | rcu_read_unlock(); |
| 78 | pr_err("failed to find OPP for %ld\n", freq_Hz); | 78 | pr_err("failed to find OPP for %ld\n", freq_Hz); |
| @@ -80,7 +80,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
| 80 | ret = PTR_ERR(opp); | 80 | ret = PTR_ERR(opp); |
| 81 | goto post_notify; | 81 | goto post_notify; |
| 82 | } | 82 | } |
| 83 | volt = opp_get_voltage(opp); | 83 | volt = dev_pm_opp_get_voltage(opp); |
| 84 | rcu_read_unlock(); | 84 | rcu_read_unlock(); |
| 85 | tol = volt * voltage_tolerance / 100; | 85 | tol = volt * voltage_tolerance / 100; |
| 86 | volt_old = regulator_get_voltage(cpu_reg); | 86 | volt_old = regulator_get_voltage(cpu_reg); |
| @@ -218,7 +218,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
| 218 | goto out_put_node; | 218 | goto out_put_node; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | ret = opp_init_cpufreq_table(cpu_dev, &freq_table); | 221 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); |
| 222 | if (ret) { | 222 | if (ret) { |
| 223 | pr_err("failed to init cpufreq table: %d\n", ret); | 223 | pr_err("failed to init cpufreq table: %d\n", ret); |
| 224 | goto out_put_node; | 224 | goto out_put_node; |
| @@ -242,12 +242,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
| 242 | for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) | 242 | for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) |
| 243 | ; | 243 | ; |
| 244 | rcu_read_lock(); | 244 | rcu_read_lock(); |
| 245 | opp = opp_find_freq_exact(cpu_dev, | 245 | opp = dev_pm_opp_find_freq_exact(cpu_dev, |
| 246 | freq_table[0].frequency * 1000, true); | 246 | freq_table[0].frequency * 1000, true); |
| 247 | min_uV = opp_get_voltage(opp); | 247 | min_uV = dev_pm_opp_get_voltage(opp); |
| 248 | opp = opp_find_freq_exact(cpu_dev, | 248 | opp = dev_pm_opp_find_freq_exact(cpu_dev, |
| 249 | freq_table[i-1].frequency * 1000, true); | 249 | freq_table[i-1].frequency * 1000, true); |
| 250 | max_uV = opp_get_voltage(opp); | 250 | max_uV = dev_pm_opp_get_voltage(opp); |
| 251 | rcu_read_unlock(); | 251 | rcu_read_unlock(); |
| 252 | ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); | 252 | ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); |
| 253 | if (ret > 0) | 253 | if (ret > 0) |
| @@ -264,7 +264,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
| 264 | return 0; | 264 | return 0; |
| 265 | 265 | ||
| 266 | out_free_table: | 266 | out_free_table: |
| 267 | opp_free_cpufreq_table(cpu_dev, &freq_table); | 267 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
| 268 | out_put_node: | 268 | out_put_node: |
| 269 | of_node_put(np); | 269 | of_node_put(np); |
| 270 | return ret; | 270 | return ret; |
| @@ -273,7 +273,7 @@ out_put_node: | |||
| 273 | static int cpu0_cpufreq_remove(struct platform_device *pdev) | 273 | static int cpu0_cpufreq_remove(struct platform_device *pdev) |
| 274 | { | 274 | { |
| 275 | cpufreq_unregister_driver(&cpu0_cpufreq_driver); | 275 | cpufreq_unregister_driver(&cpu0_cpufreq_driver); |
| 276 | opp_free_cpufreq_table(cpu_dev, &freq_table); | 276 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
| 277 | 277 | ||
| 278 | return 0; | 278 | return 0; |
| 279 | } | 279 | } |
diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index be5380ecdcd4..444eca74d3c2 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c | |||
| @@ -123,7 +123,7 @@ static int init_div_table(void) | |||
| 123 | rcu_read_lock(); | 123 | rcu_read_lock(); |
| 124 | for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { | 124 | for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { |
| 125 | 125 | ||
| 126 | opp = opp_find_freq_exact(dvfs_info->dev, | 126 | opp = dev_pm_opp_find_freq_exact(dvfs_info->dev, |
| 127 | freq_tbl[i].frequency * 1000, true); | 127 | freq_tbl[i].frequency * 1000, true); |
| 128 | if (IS_ERR(opp)) { | 128 | if (IS_ERR(opp)) { |
| 129 | rcu_read_unlock(); | 129 | rcu_read_unlock(); |
| @@ -142,7 +142,7 @@ static int init_div_table(void) | |||
| 142 | << P0_7_CSCLKDEV_SHIFT; | 142 | << P0_7_CSCLKDEV_SHIFT; |
| 143 | 143 | ||
| 144 | /* Calculate EMA */ | 144 | /* Calculate EMA */ |
| 145 | volt_id = opp_get_voltage(opp); | 145 | volt_id = dev_pm_opp_get_voltage(opp); |
| 146 | volt_id = (MAX_VOLTAGE - volt_id) / VOLTAGE_STEP; | 146 | volt_id = (MAX_VOLTAGE - volt_id) / VOLTAGE_STEP; |
| 147 | if (volt_id < PMIC_HIGH_VOLT) { | 147 | if (volt_id < PMIC_HIGH_VOLT) { |
| 148 | ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) | | 148 | ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) | |
| @@ -399,13 +399,14 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
| 399 | goto err_put_node; | 399 | goto err_put_node; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | ret = opp_init_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); | 402 | ret = dev_pm_opp_init_cpufreq_table(dvfs_info->dev, |
| 403 | &dvfs_info->freq_table); | ||
| 403 | if (ret) { | 404 | if (ret) { |
| 404 | dev_err(dvfs_info->dev, | 405 | dev_err(dvfs_info->dev, |
| 405 | "failed to init cpufreq table: %d\n", ret); | 406 | "failed to init cpufreq table: %d\n", ret); |
| 406 | goto err_put_node; | 407 | goto err_put_node; |
| 407 | } | 408 | } |
| 408 | dvfs_info->freq_count = opp_get_opp_count(dvfs_info->dev); | 409 | dvfs_info->freq_count = dev_pm_opp_get_opp_count(dvfs_info->dev); |
| 409 | exynos_sort_descend_freq_table(); | 410 | exynos_sort_descend_freq_table(); |
| 410 | 411 | ||
| 411 | if (of_property_read_u32(np, "clock-latency", &dvfs_info->latency)) | 412 | if (of_property_read_u32(np, "clock-latency", &dvfs_info->latency)) |
| @@ -454,7 +455,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
| 454 | return 0; | 455 | return 0; |
| 455 | 456 | ||
| 456 | err_free_table: | 457 | err_free_table: |
| 457 | opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); | 458 | dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); |
| 458 | err_put_node: | 459 | err_put_node: |
| 459 | of_node_put(np); | 460 | of_node_put(np); |
| 460 | dev_err(&pdev->dev, "%s: failed initialization\n", __func__); | 461 | dev_err(&pdev->dev, "%s: failed initialization\n", __func__); |
| @@ -464,7 +465,7 @@ err_put_node: | |||
| 464 | static int exynos_cpufreq_remove(struct platform_device *pdev) | 465 | static int exynos_cpufreq_remove(struct platform_device *pdev) |
| 465 | { | 466 | { |
| 466 | cpufreq_unregister_driver(&exynos_driver); | 467 | cpufreq_unregister_driver(&exynos_driver); |
| 467 | opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); | 468 | dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); |
| 468 | return 0; | 469 | return 0; |
| 469 | } | 470 | } |
| 470 | 471 | ||
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index c3fd2a101ca0..b360549e7715 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c | |||
| @@ -70,14 +70,14 @@ static int imx6q_set_target(struct cpufreq_policy *policy, | |||
| 70 | return 0; | 70 | return 0; |
| 71 | 71 | ||
| 72 | rcu_read_lock(); | 72 | rcu_read_lock(); |
| 73 | opp = opp_find_freq_ceil(cpu_dev, &freq_hz); | 73 | opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz); |
| 74 | if (IS_ERR(opp)) { | 74 | if (IS_ERR(opp)) { |
| 75 | rcu_read_unlock(); | 75 | rcu_read_unlock(); |
| 76 | dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz); | 76 | dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz); |
| 77 | return PTR_ERR(opp); | 77 | return PTR_ERR(opp); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | volt = opp_get_voltage(opp); | 80 | volt = dev_pm_opp_get_voltage(opp); |
| 81 | rcu_read_unlock(); | 81 | rcu_read_unlock(); |
| 82 | volt_old = regulator_get_voltage(arm_reg); | 82 | volt_old = regulator_get_voltage(arm_reg); |
| 83 | 83 | ||
| @@ -237,14 +237,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) | |||
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | /* We expect an OPP table supplied by platform */ | 239 | /* We expect an OPP table supplied by platform */ |
| 240 | num = opp_get_opp_count(cpu_dev); | 240 | num = dev_pm_opp_get_opp_count(cpu_dev); |
| 241 | if (num < 0) { | 241 | if (num < 0) { |
| 242 | ret = num; | 242 | ret = num; |
| 243 | dev_err(cpu_dev, "no OPP table is found: %d\n", ret); | 243 | dev_err(cpu_dev, "no OPP table is found: %d\n", ret); |
| 244 | goto put_node; | 244 | goto put_node; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | ret = opp_init_cpufreq_table(cpu_dev, &freq_table); | 247 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); |
| 248 | if (ret) { | 248 | if (ret) { |
| 249 | dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); | 249 | dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); |
| 250 | goto put_node; | 250 | goto put_node; |
| @@ -259,12 +259,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) | |||
| 259 | * same order. | 259 | * same order. |
| 260 | */ | 260 | */ |
| 261 | rcu_read_lock(); | 261 | rcu_read_lock(); |
| 262 | opp = opp_find_freq_exact(cpu_dev, | 262 | opp = dev_pm_opp_find_freq_exact(cpu_dev, |
| 263 | freq_table[0].frequency * 1000, true); | 263 | freq_table[0].frequency * 1000, true); |
| 264 | min_volt = opp_get_voltage(opp); | 264 | min_volt = dev_pm_opp_get_voltage(opp); |
| 265 | opp = opp_find_freq_exact(cpu_dev, | 265 | opp = dev_pm_opp_find_freq_exact(cpu_dev, |
| 266 | freq_table[--num].frequency * 1000, true); | 266 | freq_table[--num].frequency * 1000, true); |
| 267 | max_volt = opp_get_voltage(opp); | 267 | max_volt = dev_pm_opp_get_voltage(opp); |
| 268 | rcu_read_unlock(); | 268 | rcu_read_unlock(); |
| 269 | ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt); | 269 | ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt); |
| 270 | if (ret > 0) | 270 | if (ret > 0) |
| @@ -292,7 +292,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) | |||
| 292 | return 0; | 292 | return 0; |
| 293 | 293 | ||
| 294 | free_freq_table: | 294 | free_freq_table: |
| 295 | opp_free_cpufreq_table(cpu_dev, &freq_table); | 295 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
| 296 | put_node: | 296 | put_node: |
| 297 | of_node_put(np); | 297 | of_node_put(np); |
| 298 | return ret; | 298 | return ret; |
| @@ -301,7 +301,7 @@ put_node: | |||
| 301 | static int imx6q_cpufreq_remove(struct platform_device *pdev) | 301 | static int imx6q_cpufreq_remove(struct platform_device *pdev) |
| 302 | { | 302 | { |
| 303 | cpufreq_unregister_driver(&imx6q_cpufreq_driver); | 303 | cpufreq_unregister_driver(&imx6q_cpufreq_driver); |
| 304 | opp_free_cpufreq_table(cpu_dev, &freq_table); | 304 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
| 305 | 305 | ||
| 306 | return 0; | 306 | return 0; |
| 307 | } | 307 | } |
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index f31fcfcad514..c5e31d296607 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c | |||
| @@ -105,14 +105,14 @@ static int omap_target(struct cpufreq_policy *policy, | |||
| 105 | 105 | ||
| 106 | if (mpu_reg) { | 106 | if (mpu_reg) { |
| 107 | rcu_read_lock(); | 107 | rcu_read_lock(); |
| 108 | opp = opp_find_freq_ceil(mpu_dev, &freq); | 108 | opp = dev_pm_opp_find_freq_ceil(mpu_dev, &freq); |
| 109 | if (IS_ERR(opp)) { | 109 | if (IS_ERR(opp)) { |
| 110 | rcu_read_unlock(); | 110 | rcu_read_unlock(); |
| 111 | dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n", | 111 | dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n", |
| 112 | __func__, freqs.new); | 112 | __func__, freqs.new); |
| 113 | return -EINVAL; | 113 | return -EINVAL; |
| 114 | } | 114 | } |
| 115 | volt = opp_get_voltage(opp); | 115 | volt = dev_pm_opp_get_voltage(opp); |
| 116 | rcu_read_unlock(); | 116 | rcu_read_unlock(); |
| 117 | tol = volt * OPP_TOLERANCE / 100; | 117 | tol = volt * OPP_TOLERANCE / 100; |
| 118 | volt_old = regulator_get_voltage(mpu_reg); | 118 | volt_old = regulator_get_voltage(mpu_reg); |
| @@ -162,7 +162,7 @@ done: | |||
| 162 | static inline void freq_table_free(void) | 162 | static inline void freq_table_free(void) |
| 163 | { | 163 | { |
| 164 | if (atomic_dec_and_test(&freq_table_users)) | 164 | if (atomic_dec_and_test(&freq_table_users)) |
| 165 | opp_free_cpufreq_table(mpu_dev, &freq_table); | 165 | dev_pm_opp_free_cpufreq_table(mpu_dev, &freq_table); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | static int omap_cpu_init(struct cpufreq_policy *policy) | 168 | static int omap_cpu_init(struct cpufreq_policy *policy) |
| @@ -181,7 +181,7 @@ static int omap_cpu_init(struct cpufreq_policy *policy) | |||
| 181 | policy->cur = omap_getspeed(policy->cpu); | 181 | policy->cur = omap_getspeed(policy->cpu); |
| 182 | 182 | ||
| 183 | if (!freq_table) | 183 | if (!freq_table) |
| 184 | result = opp_init_cpufreq_table(mpu_dev, &freq_table); | 184 | result = dev_pm_opp_init_cpufreq_table(mpu_dev, &freq_table); |
| 185 | 185 | ||
| 186 | if (result) { | 186 | if (result) { |
| 187 | dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", | 187 | dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", |
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index c99c00d35d34..f798edcb910d 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
| @@ -908,7 +908,7 @@ static ssize_t available_frequencies_show(struct device *d, | |||
| 908 | 908 | ||
| 909 | rcu_read_lock(); | 909 | rcu_read_lock(); |
| 910 | do { | 910 | do { |
| 911 | opp = opp_find_freq_ceil(dev, &freq); | 911 | opp = dev_pm_opp_find_freq_ceil(dev, &freq); |
| 912 | if (IS_ERR(opp)) | 912 | if (IS_ERR(opp)) |
| 913 | break; | 913 | break; |
| 914 | 914 | ||
| @@ -1036,18 +1036,18 @@ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, | |||
| 1036 | 1036 | ||
| 1037 | if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) { | 1037 | if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) { |
| 1038 | /* The freq is an upper bound. opp should be lower */ | 1038 | /* The freq is an upper bound. opp should be lower */ |
| 1039 | opp = opp_find_freq_floor(dev, freq); | 1039 | opp = dev_pm_opp_find_freq_floor(dev, freq); |
| 1040 | 1040 | ||
| 1041 | /* If not available, use the closest opp */ | 1041 | /* If not available, use the closest opp */ |
| 1042 | if (opp == ERR_PTR(-ERANGE)) | 1042 | if (opp == ERR_PTR(-ERANGE)) |
| 1043 | opp = opp_find_freq_ceil(dev, freq); | 1043 | opp = dev_pm_opp_find_freq_ceil(dev, freq); |
| 1044 | } else { | 1044 | } else { |
| 1045 | /* The freq is an lower bound. opp should be higher */ | 1045 | /* The freq is an lower bound. opp should be higher */ |
| 1046 | opp = opp_find_freq_ceil(dev, freq); | 1046 | opp = dev_pm_opp_find_freq_ceil(dev, freq); |
| 1047 | 1047 | ||
| 1048 | /* If not available, use the closest opp */ | 1048 | /* If not available, use the closest opp */ |
| 1049 | if (opp == ERR_PTR(-ERANGE)) | 1049 | if (opp == ERR_PTR(-ERANGE)) |
| 1050 | opp = opp_find_freq_floor(dev, freq); | 1050 | opp = dev_pm_opp_find_freq_floor(dev, freq); |
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | return opp; | 1053 | return opp; |
| @@ -1066,7 +1066,7 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) | |||
| 1066 | int ret = 0; | 1066 | int ret = 0; |
| 1067 | 1067 | ||
| 1068 | rcu_read_lock(); | 1068 | rcu_read_lock(); |
| 1069 | nh = opp_get_notifier(dev); | 1069 | nh = dev_pm_opp_get_notifier(dev); |
| 1070 | if (IS_ERR(nh)) | 1070 | if (IS_ERR(nh)) |
| 1071 | ret = PTR_ERR(nh); | 1071 | ret = PTR_ERR(nh); |
| 1072 | rcu_read_unlock(); | 1072 | rcu_read_unlock(); |
| @@ -1092,7 +1092,7 @@ int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) | |||
| 1092 | int ret = 0; | 1092 | int ret = 0; |
| 1093 | 1093 | ||
| 1094 | rcu_read_lock(); | 1094 | rcu_read_lock(); |
| 1095 | nh = opp_get_notifier(dev); | 1095 | nh = dev_pm_opp_get_notifier(dev); |
| 1096 | if (IS_ERR(nh)) | 1096 | if (IS_ERR(nh)) |
| 1097 | ret = PTR_ERR(nh); | 1097 | ret = PTR_ERR(nh); |
| 1098 | rcu_read_unlock(); | 1098 | rcu_read_unlock(); |
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c index c5f86d8caca3..33c0e05a5ff1 100644 --- a/drivers/devfreq/exynos/exynos4_bus.c +++ b/drivers/devfreq/exynos/exynos4_bus.c | |||
| @@ -650,8 +650,8 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq, | |||
| 650 | rcu_read_unlock(); | 650 | rcu_read_unlock(); |
| 651 | return PTR_ERR(opp); | 651 | return PTR_ERR(opp); |
| 652 | } | 652 | } |
| 653 | new_oppinfo.rate = opp_get_freq(opp); | 653 | new_oppinfo.rate = dev_pm_opp_get_freq(opp); |
| 654 | new_oppinfo.volt = opp_get_voltage(opp); | 654 | new_oppinfo.volt = dev_pm_opp_get_voltage(opp); |
| 655 | rcu_read_unlock(); | 655 | rcu_read_unlock(); |
| 656 | freq = new_oppinfo.rate; | 656 | freq = new_oppinfo.rate; |
| 657 | 657 | ||
| @@ -873,7 +873,7 @@ static int exynos4210_init_tables(struct busfreq_data *data) | |||
| 873 | exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i]; | 873 | exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i]; |
| 874 | 874 | ||
| 875 | for (i = LV_0; i < EX4210_LV_NUM; i++) { | 875 | for (i = LV_0; i < EX4210_LV_NUM; i++) { |
| 876 | err = opp_add(data->dev, exynos4210_busclk_table[i].clk, | 876 | err = dev_pm_opp_add(data->dev, exynos4210_busclk_table[i].clk, |
| 877 | exynos4210_busclk_table[i].volt); | 877 | exynos4210_busclk_table[i].volt); |
| 878 | if (err) { | 878 | if (err) { |
| 879 | dev_err(data->dev, "Cannot add opp entries.\n"); | 879 | dev_err(data->dev, "Cannot add opp entries.\n"); |
| @@ -940,7 +940,7 @@ static int exynos4x12_init_tables(struct busfreq_data *data) | |||
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | for (i = 0; i < EX4x12_LV_NUM; i++) { | 942 | for (i = 0; i < EX4x12_LV_NUM; i++) { |
| 943 | ret = opp_add(data->dev, exynos4x12_mifclk_table[i].clk, | 943 | ret = dev_pm_opp_add(data->dev, exynos4x12_mifclk_table[i].clk, |
| 944 | exynos4x12_mifclk_table[i].volt); | 944 | exynos4x12_mifclk_table[i].volt); |
| 945 | if (ret) { | 945 | if (ret) { |
| 946 | dev_err(data->dev, "Fail to add opp entries.\n"); | 946 | dev_err(data->dev, "Fail to add opp entries.\n"); |
| @@ -969,7 +969,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, | |||
| 969 | data->disabled = true; | 969 | data->disabled = true; |
| 970 | 970 | ||
| 971 | rcu_read_lock(); | 971 | rcu_read_lock(); |
| 972 | opp = opp_find_freq_floor(data->dev, &maxfreq); | 972 | opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq); |
| 973 | if (IS_ERR(opp)) { | 973 | if (IS_ERR(opp)) { |
| 974 | rcu_read_unlock(); | 974 | rcu_read_unlock(); |
| 975 | dev_err(data->dev, "%s: unable to find a min freq\n", | 975 | dev_err(data->dev, "%s: unable to find a min freq\n", |
| @@ -977,8 +977,8 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, | |||
| 977 | mutex_unlock(&data->lock); | 977 | mutex_unlock(&data->lock); |
| 978 | return PTR_ERR(opp); | 978 | return PTR_ERR(opp); |
| 979 | } | 979 | } |
| 980 | new_oppinfo.rate = opp_get_freq(opp); | 980 | new_oppinfo.rate = dev_pm_opp_get_freq(opp); |
| 981 | new_oppinfo.volt = opp_get_voltage(opp); | 981 | new_oppinfo.volt = dev_pm_opp_get_voltage(opp); |
| 982 | rcu_read_unlock(); | 982 | rcu_read_unlock(); |
| 983 | 983 | ||
| 984 | err = exynos4_bus_setvolt(data, &new_oppinfo, | 984 | err = exynos4_bus_setvolt(data, &new_oppinfo, |
| @@ -1065,15 +1065,16 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) | |||
| 1065 | } | 1065 | } |
| 1066 | 1066 | ||
| 1067 | rcu_read_lock(); | 1067 | rcu_read_lock(); |
| 1068 | opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq); | 1068 | opp = dev_pm_opp_find_freq_floor(dev, |
| 1069 | &exynos4_devfreq_profile.initial_freq); | ||
| 1069 | if (IS_ERR(opp)) { | 1070 | if (IS_ERR(opp)) { |
| 1070 | rcu_read_unlock(); | 1071 | rcu_read_unlock(); |
| 1071 | dev_err(dev, "Invalid initial frequency %lu kHz.\n", | 1072 | dev_err(dev, "Invalid initial frequency %lu kHz.\n", |
| 1072 | exynos4_devfreq_profile.initial_freq); | 1073 | exynos4_devfreq_profile.initial_freq); |
| 1073 | return PTR_ERR(opp); | 1074 | return PTR_ERR(opp); |
| 1074 | } | 1075 | } |
| 1075 | data->curr_oppinfo.rate = opp_get_freq(opp); | 1076 | data->curr_oppinfo.rate = dev_pm_opp_get_freq(opp); |
| 1076 | data->curr_oppinfo.volt = opp_get_voltage(opp); | 1077 | data->curr_oppinfo.volt = dev_pm_opp_get_voltage(opp); |
| 1077 | rcu_read_unlock(); | 1078 | rcu_read_unlock(); |
| 1078 | 1079 | ||
| 1079 | platform_set_drvdata(pdev, data); | 1080 | platform_set_drvdata(pdev, data); |
diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c index 574b16b59be5..b0e45925505b 100644 --- a/drivers/devfreq/exynos/exynos5_bus.c +++ b/drivers/devfreq/exynos/exynos5_bus.c | |||
| @@ -144,8 +144,8 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq, | |||
| 144 | return PTR_ERR(opp); | 144 | return PTR_ERR(opp); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | freq = opp_get_freq(opp); | 147 | freq = dev_pm_opp_get_freq(opp); |
| 148 | volt = opp_get_voltage(opp); | 148 | volt = dev_pm_opp_get_voltage(opp); |
| 149 | rcu_read_unlock(); | 149 | rcu_read_unlock(); |
| 150 | 150 | ||
| 151 | old_freq = data->curr_freq; | 151 | old_freq = data->curr_freq; |
| @@ -246,7 +246,7 @@ static int exynos5250_init_int_tables(struct busfreq_data_int *data) | |||
| 246 | int i, err = 0; | 246 | int i, err = 0; |
| 247 | 247 | ||
| 248 | for (i = LV_0; i < _LV_END; i++) { | 248 | for (i = LV_0; i < _LV_END; i++) { |
| 249 | err = opp_add(data->dev, exynos5_int_opp_table[i].clk, | 249 | err = dev_pm_opp_add(data->dev, exynos5_int_opp_table[i].clk, |
| 250 | exynos5_int_opp_table[i].volt); | 250 | exynos5_int_opp_table[i].volt); |
| 251 | if (err) { | 251 | if (err) { |
| 252 | dev_err(data->dev, "Cannot add opp entries.\n"); | 252 | dev_err(data->dev, "Cannot add opp entries.\n"); |
| @@ -276,14 +276,14 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this, | |||
| 276 | data->disabled = true; | 276 | data->disabled = true; |
| 277 | 277 | ||
| 278 | rcu_read_lock(); | 278 | rcu_read_lock(); |
| 279 | opp = opp_find_freq_floor(data->dev, &maxfreq); | 279 | opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq); |
| 280 | if (IS_ERR(opp)) { | 280 | if (IS_ERR(opp)) { |
| 281 | rcu_read_unlock(); | 281 | rcu_read_unlock(); |
| 282 | err = PTR_ERR(opp); | 282 | err = PTR_ERR(opp); |
| 283 | goto unlock; | 283 | goto unlock; |
| 284 | } | 284 | } |
| 285 | freq = opp_get_freq(opp); | 285 | freq = dev_pm_opp_get_freq(opp); |
| 286 | volt = opp_get_voltage(opp); | 286 | volt = dev_pm_opp_get_voltage(opp); |
| 287 | rcu_read_unlock(); | 287 | rcu_read_unlock(); |
| 288 | 288 | ||
| 289 | err = exynos5_int_setvolt(data, volt); | 289 | err = exynos5_int_setvolt(data, volt); |
| @@ -368,7 +368,7 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | rcu_read_lock(); | 370 | rcu_read_lock(); |
| 371 | opp = opp_find_freq_floor(dev, | 371 | opp = dev_pm_opp_find_freq_floor(dev, |
| 372 | &exynos5_devfreq_int_profile.initial_freq); | 372 | &exynos5_devfreq_int_profile.initial_freq); |
| 373 | if (IS_ERR(opp)) { | 373 | if (IS_ERR(opp)) { |
| 374 | rcu_read_unlock(); | 374 | rcu_read_unlock(); |
| @@ -377,8 +377,8 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) | |||
| 377 | err = PTR_ERR(opp); | 377 | err = PTR_ERR(opp); |
| 378 | goto err_opp_add; | 378 | goto err_opp_add; |
| 379 | } | 379 | } |
| 380 | initial_freq = opp_get_freq(opp); | 380 | initial_freq = dev_pm_opp_get_freq(opp); |
| 381 | initial_volt = opp_get_voltage(opp); | 381 | initial_volt = dev_pm_opp_get_voltage(opp); |
| 382 | rcu_read_unlock(); | 382 | rcu_read_unlock(); |
| 383 | data->curr_freq = initial_freq; | 383 | data->curr_freq = initial_freq; |
| 384 | 384 | ||
diff --git a/include/linux/opp.h b/include/linux/opp.h index 3aca2b8def33..2066ae5880c6 100644 --- a/include/linux/opp.h +++ b/include/linux/opp.h | |||
| @@ -27,77 +27,79 @@ enum opp_event { | |||
| 27 | 27 | ||
| 28 | #if defined(CONFIG_PM_OPP) | 28 | #if defined(CONFIG_PM_OPP) |
| 29 | 29 | ||
| 30 | unsigned long opp_get_voltage(struct opp *opp); | 30 | unsigned long dev_pm_opp_get_voltage(struct opp *opp); |
| 31 | 31 | ||
| 32 | unsigned long opp_get_freq(struct opp *opp); | 32 | unsigned long dev_pm_opp_get_freq(struct opp *opp); |
| 33 | 33 | ||
| 34 | int opp_get_opp_count(struct device *dev); | 34 | int dev_pm_opp_get_opp_count(struct device *dev); |
| 35 | 35 | ||
| 36 | struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq, | 36 | struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq, |
| 37 | bool available); | 37 | bool available); |
| 38 | 38 | ||
| 39 | struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq); | 39 | struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq); |
| 40 | 40 | ||
| 41 | struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq); | 41 | struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq); |
| 42 | 42 | ||
| 43 | int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt); | 43 | int dev_pm_opp_add(struct device *dev, unsigned long freq, |
| 44 | unsigned long u_volt); | ||
| 44 | 45 | ||
| 45 | int opp_enable(struct device *dev, unsigned long freq); | 46 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); |
| 46 | 47 | ||
| 47 | int opp_disable(struct device *dev, unsigned long freq); | 48 | int dev_pm_opp_disable(struct device *dev, unsigned long freq); |
| 48 | 49 | ||
| 49 | struct srcu_notifier_head *opp_get_notifier(struct device *dev); | 50 | struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev); |
| 50 | #else | 51 | #else |
| 51 | static inline unsigned long opp_get_voltage(struct opp *opp) | 52 | static inline unsigned long dev_pm_opp_get_voltage(struct opp *opp) |
| 52 | { | 53 | { |
| 53 | return 0; | 54 | return 0; |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | static inline unsigned long opp_get_freq(struct opp *opp) | 57 | static inline unsigned long dev_pm_opp_get_freq(struct opp *opp) |
| 57 | { | 58 | { |
| 58 | return 0; | 59 | return 0; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | static inline int opp_get_opp_count(struct device *dev) | 62 | static inline int dev_pm_opp_get_opp_count(struct device *dev) |
| 62 | { | 63 | { |
| 63 | return 0; | 64 | return 0; |
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | static inline struct opp *opp_find_freq_exact(struct device *dev, | 67 | static inline struct opp *dev_pm_opp_find_freq_exact(struct device *dev, |
| 67 | unsigned long freq, bool available) | 68 | unsigned long freq, bool available) |
| 68 | { | 69 | { |
| 69 | return ERR_PTR(-EINVAL); | 70 | return ERR_PTR(-EINVAL); |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | static inline struct opp *opp_find_freq_floor(struct device *dev, | 73 | static inline struct opp *dev_pm_opp_find_freq_floor(struct device *dev, |
| 73 | unsigned long *freq) | 74 | unsigned long *freq) |
| 74 | { | 75 | { |
| 75 | return ERR_PTR(-EINVAL); | 76 | return ERR_PTR(-EINVAL); |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | static inline struct opp *opp_find_freq_ceil(struct device *dev, | 79 | static inline struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, |
| 79 | unsigned long *freq) | 80 | unsigned long *freq) |
| 80 | { | 81 | { |
| 81 | return ERR_PTR(-EINVAL); | 82 | return ERR_PTR(-EINVAL); |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | static inline int opp_add(struct device *dev, unsigned long freq, | 85 | static inline int dev_pm_opp_add(struct device *dev, unsigned long freq, |
| 85 | unsigned long u_volt) | 86 | unsigned long u_volt) |
| 86 | { | 87 | { |
| 87 | return -EINVAL; | 88 | return -EINVAL; |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | static inline int opp_enable(struct device *dev, unsigned long freq) | 91 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
| 91 | { | 92 | { |
| 92 | return 0; | 93 | return 0; |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | static inline int opp_disable(struct device *dev, unsigned long freq) | 96 | static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq) |
| 96 | { | 97 | { |
| 97 | return 0; | 98 | return 0; |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | static inline struct srcu_notifier_head *opp_get_notifier(struct device *dev) | 101 | static inline struct srcu_notifier_head *dev_pm_opp_get_notifier( |
| 102 | struct device *dev) | ||
| 101 | { | 103 | { |
| 102 | return ERR_PTR(-EINVAL); | 104 | return ERR_PTR(-EINVAL); |
| 103 | } | 105 | } |
| @@ -113,19 +115,19 @@ static inline int of_init_opp_table(struct device *dev) | |||
| 113 | #endif | 115 | #endif |
| 114 | 116 | ||
| 115 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) | 117 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) |
| 116 | int opp_init_cpufreq_table(struct device *dev, | 118 | int dev_pm_opp_init_cpufreq_table(struct device *dev, |
| 117 | struct cpufreq_frequency_table **table); | 119 | struct cpufreq_frequency_table **table); |
| 118 | void opp_free_cpufreq_table(struct device *dev, | 120 | void dev_pm_opp_free_cpufreq_table(struct device *dev, |
| 119 | struct cpufreq_frequency_table **table); | 121 | struct cpufreq_frequency_table **table); |
| 120 | #else | 122 | #else |
| 121 | static inline int opp_init_cpufreq_table(struct device *dev, | 123 | static inline int dev_pm_opp_init_cpufreq_table(struct device *dev, |
| 122 | struct cpufreq_frequency_table **table) | 124 | struct cpufreq_frequency_table **table) |
| 123 | { | 125 | { |
| 124 | return -EINVAL; | 126 | return -EINVAL; |
| 125 | } | 127 | } |
| 126 | 128 | ||
| 127 | static inline | 129 | static inline |
| 128 | void opp_free_cpufreq_table(struct device *dev, | 130 | void dev_pm_opp_free_cpufreq_table(struct device *dev, |
| 129 | struct cpufreq_frequency_table **table) | 131 | struct cpufreq_frequency_table **table) |
| 130 | { | 132 | { |
| 131 | } | 133 | } |
