Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295416
b: refs/heads/master
c: 42daffd
h: refs/heads/master
v: v3
  • Loading branch information
Afzal Mohammed authored and Kevin Hilman committed Mar 2, 2012
1 parent 3ddd79e commit 1405c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53dfe8a884e6f85d73379f84cffa72225cd52ad6
refs/heads/master: 42daffd2d6c665716d442d518022ecaad17ddf64
10 changes: 7 additions & 3 deletions trunk/drivers/cpufreq/omap-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@

#include <mach/hardware.h>

/* OPP tolerance in percentage */
#define OPP_TOLERANCE 4

#ifdef CONFIG_SMP
struct lpj_info {
unsigned long ref;
Expand Down Expand Up @@ -81,7 +84,7 @@ static int omap_target(struct cpufreq_policy *policy,
int r, ret = 0;
struct cpufreq_freqs freqs;
struct opp *opp;
unsigned long freq, volt = 0, volt_old = 0;
unsigned long freq, volt = 0, volt_old = 0, tol = 0;

if (!freq_table) {
dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__,
Expand Down Expand Up @@ -125,6 +128,7 @@ static int omap_target(struct cpufreq_policy *policy,
return -EINVAL;
}
volt = opp_get_voltage(opp);
tol = volt * OPP_TOLERANCE / 100;
volt_old = regulator_get_voltage(mpu_reg);
}

Expand All @@ -134,7 +138,7 @@ static int omap_target(struct cpufreq_policy *policy,

/* scaling up? scale voltage before frequency */
if (mpu_reg && (freqs.new > freqs.old)) {
r = regulator_set_voltage(mpu_reg, volt, volt);
r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
if (r < 0) {
dev_warn(mpu_dev, "%s: unable to scale voltage up.\n",
__func__);
Expand All @@ -147,7 +151,7 @@ static int omap_target(struct cpufreq_policy *policy,

/* scaling down? scale voltage after frequency */
if (mpu_reg && (freqs.new < freqs.old)) {
r = regulator_set_voltage(mpu_reg, volt, volt);
r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
if (r < 0) {
dev_warn(mpu_dev, "%s: unable to scale voltage down.\n",
__func__);
Expand Down

0 comments on commit 1405c4a

Please sign in to comment.