aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorAfzal Mohammed <afzal@ti.com>2012-02-23 08:49:24 -0500
committerKevin Hilman <khilman@ti.com>2012-03-02 16:55:57 -0500
commit42daffd2d6c665716d442d518022ecaad17ddf64 (patch)
tree7caa90a291f0c9eea522cafe2f6a7b419fb71438 /drivers/cpufreq
parent53dfe8a884e6f85d73379f84cffa72225cd52ad6 (diff)
cpufreq: OMAP: specify range for voltage scaling
Specify voltage in ranges for regulator. Range used is tolerance specified for OPP. This helps to achieve DVFS with a wider range of regulators. Cc: Kevin Hilman <khilman@ti.com> Cc: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Afzal Mohammed <afzal@ti.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/omap-cpufreq.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 9f5d6368766e..67bbb06d0460 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -38,6 +38,9 @@
38 38
39#include <mach/hardware.h> 39#include <mach/hardware.h>
40 40
41/* OPP tolerance in percentage */
42#define OPP_TOLERANCE 4
43
41#ifdef CONFIG_SMP 44#ifdef CONFIG_SMP
42struct lpj_info { 45struct lpj_info {
43 unsigned long ref; 46 unsigned long ref;
@@ -81,7 +84,7 @@ static int omap_target(struct cpufreq_policy *policy,
81 int r, ret = 0; 84 int r, ret = 0;
82 struct cpufreq_freqs freqs; 85 struct cpufreq_freqs freqs;
83 struct opp *opp; 86 struct opp *opp;
84 unsigned long freq, volt = 0, volt_old = 0; 87 unsigned long freq, volt = 0, volt_old = 0, tol = 0;
85 88
86 if (!freq_table) { 89 if (!freq_table) {
87 dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__, 90 dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__,
@@ -125,6 +128,7 @@ static int omap_target(struct cpufreq_policy *policy,
125 return -EINVAL; 128 return -EINVAL;
126 } 129 }
127 volt = opp_get_voltage(opp); 130 volt = opp_get_voltage(opp);
131 tol = volt * OPP_TOLERANCE / 100;
128 volt_old = regulator_get_voltage(mpu_reg); 132 volt_old = regulator_get_voltage(mpu_reg);
129 } 133 }
130 134
@@ -134,7 +138,7 @@ static int omap_target(struct cpufreq_policy *policy,
134 138
135 /* scaling up? scale voltage before frequency */ 139 /* scaling up? scale voltage before frequency */
136 if (mpu_reg && (freqs.new > freqs.old)) { 140 if (mpu_reg && (freqs.new > freqs.old)) {
137 r = regulator_set_voltage(mpu_reg, volt, volt); 141 r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
138 if (r < 0) { 142 if (r < 0) {
139 dev_warn(mpu_dev, "%s: unable to scale voltage up.\n", 143 dev_warn(mpu_dev, "%s: unable to scale voltage up.\n",
140 __func__); 144 __func__);
@@ -147,7 +151,7 @@ static int omap_target(struct cpufreq_policy *policy,
147 151
148 /* scaling down? scale voltage after frequency */ 152 /* scaling down? scale voltage after frequency */
149 if (mpu_reg && (freqs.new < freqs.old)) { 153 if (mpu_reg && (freqs.new < freqs.old)) {
150 r = regulator_set_voltage(mpu_reg, volt, volt); 154 r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
151 if (r < 0) { 155 if (r < 0) {
152 dev_warn(mpu_dev, "%s: unable to scale voltage down.\n", 156 dev_warn(mpu_dev, "%s: unable to scale voltage down.\n",
153 __func__); 157 __func__);