summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/clock.c
diff options
context:
space:
mode:
authorHoang Pham <hopham@nvidia.com>2013-11-25 22:52:22 -0800
committerYu-Huan Hsu <yhsu@nvidia.com>2014-01-07 17:17:02 -0800
commit13dd24c4baea08787571eaa2f0ce06955463b25c (patch)
treef8ab6a95b9432e94d53242b0699b144756f76ef9 /arch/arm/mach-tegra/clock.c
parent3b54dd64a94393028b5218b6630b500e4a34573a (diff)
ARM: clock: Fix _max_set routine
Bug 1409249 Change-Id: I265ee117d22902a8998b267d5f559faeb9f9f5b4 Signed-off-by: Hoang Pham <hopham@nvidia.com> Reviewed-on: http://git-master/r/335457 Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r--arch/arm/mach-tegra/clock.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index a138f8cc6d69..c9941f2ebaee 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -1603,14 +1603,22 @@ DEFINE_SIMPLE_ATTRIBUTE(state_fops, state_get, state_set, "%llu\n");
static int _max_set(struct clk *c, unsigned long val)
{
int i;
-
+ bool found = false;
c->max_rate = val;
if (c->dvfs && c->dvfs->max_millivolts) {
+ /* Walk through dvfs freqs table and set freq of ith item to
+ * max_rate if found its dvfs voltage equals to max dvfs voltage
+ * otherwise set freq of last item to max_rate
+ */
for (i = 0; i < c->dvfs->num_freqs; i++) {
- if (c->dvfs->millivolts[i] == c->dvfs->max_millivolts)
+ if (c->dvfs->millivolts[i] == c->dvfs->max_millivolts) {
c->dvfs->freqs[i] = c->max_rate;
+ found = true;
+ }
}
+ if (!found)
+ c->dvfs->freqs[i-1] = c->max_rate;
}
return 0;
}