ARM: tegra: dvfs: Fix dvfs over-voltage error handling
Alex Frid [Fri, 4 Nov 2011 03:06:10 +0000 (20:06 -0700)]
Record dvfs client voltage rate request only after over-voltage error
is checked (otherwise, after over-voltage error rail goes above the
limit when another client requests voltage change).

(cherry picked from commit 9151f77b545dc5b898ad16ceb695cc57764f94e0)

Signed-off-by: Alex Frid <afrid@nvidia.com>
(cherry picked from commit 40243988e73a13a5c94db410cb0335fa8a9b1e42)

Change-Id: I70769b2ffd7303db6e54bfc3e07b47ea3e67b7b8
Reviewed-on: http://git-master/r/64767
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

Rebase-Id: Re82214f06084d58eed67edb35443f7a72ac4d112

arch/arm/mach-tegra/dvfs.c

index aee4c35..bc2baae 100644 (file)
@@ -265,13 +265,13 @@ __tegra_dvfs_set_rate(struct dvfs *d, unsigned long rate)
                while (i < d->num_freqs && rate > d->freqs[i])
                        i++;
 
-               d->cur_millivolts = d->millivolts[i];
                if ((d->max_millivolts) &&
-                   (d->cur_millivolts > d->max_millivolts)) {
+                   (d->millivolts[i] > d->max_millivolts)) {
                        pr_warn("tegra_dvfs: voltage %d too high for dvfs on"
-                               " %s\n", d->cur_millivolts, d->clk_name);
+                               " %s\n", d->millivolts[i], d->clk_name);
                        return -EINVAL;
                }
+               d->cur_millivolts = d->millivolts[i];
        }
 
        d->cur_rate = rate;