diff options
| -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 | ||
