From 6b4391575ba57bbd47f7c1f3cfcc6de17fab7602 Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Fri, 2 Mar 2012 14:08:57 -0800 Subject: [PATCH] --- yaml --- r: 303359 b: refs/heads/master c: c15f1d84bb3ddd668593e9bca53221a2f82e9e99 h: refs/heads/master i: 303357: 3d870a74263d5942265c717e98a99443e16a4261 303355: be785eca0eb6096051fc930790ed03867ab463b4 303351: 98a0d0f631353d1d9511036c1b6c6a191af14023 303343: f8a10ff91e86484e9295ca1ffec35e90fcc3f1a2 303327: 791f2c9c26fb77a18c928cbc52dc54ff5647c0f4 303295: 1e7b2cf9a54ab0a7b692cee907ad614f9f861cb5 303231: 3f8fc7f0b30637d00b4e8b7a2c4939b7a2a1d2c5 303103: 9f474f7c6cfc3ab1a97e9cdc0b28bb05351a865d v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-omap2/voltage.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 416e138bc7c7..076da217c770 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e160dda0f49f54deddd62e943e449a13430c2e8b +refs/heads/master: c15f1d84bb3ddd668593e9bca53221a2f82e9e99 diff --git a/trunk/arch/arm/mach-omap2/voltage.c b/trunk/arch/arm/mach-omap2/voltage.c index 8a36342e60d2..4dc60e83e00d 100644 --- a/trunk/arch/arm/mach-omap2/voltage.c +++ b/trunk/arch/arm/mach-omap2/voltage.c @@ -73,7 +73,8 @@ unsigned long voltdm_get_voltage(struct voltagedomain *voltdm) int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt) { - int ret; + int ret, i; + unsigned long volt = 0; if (!voltdm || IS_ERR(voltdm)) { pr_warning("%s: VDD specified does not exist!\n", __func__); @@ -86,9 +87,23 @@ int voltdm_scale(struct voltagedomain *voltdm, return -ENODATA; } - ret = voltdm->scale(voltdm, target_volt); + /* Adjust voltage to the exact voltage from the OPP table */ + for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) { + if (voltdm->volt_data[i].volt_nominal >= target_volt) { + volt = voltdm->volt_data[i].volt_nominal; + break; + } + } + + if (!volt) { + pr_warning("%s: not scaling. OPP voltage for %lu, not found.\n", + __func__, target_volt); + return -EINVAL; + } + + ret = voltdm->scale(voltdm, volt); if (!ret) - voltdm->nominal_volt = target_volt; + voltdm->nominal_volt = volt; return ret; }