summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMallikarjun Kasoju <mkasoju@nvidia.com>2012-07-17 16:04:01 +0530
committerSimone Willett <swillett@nvidia.com>2012-07-18 14:39:33 -0700
commit9d4eeb8ee6eba84d932ab05b7eb6a5b4ddedb288 (patch)
treefbfa4e31779d47786e3a636b842bedecaee250e7 /drivers/regulator
parent79cb5050b1bfbc5a55a53a33d41f6a392befddf5 (diff)
regulator: tps80031: adjust tolerance if req minuV > dev minuV
Adjust the tolerance voltage only when requested minimum voltage is more than the rail's minimum voltage. bug 997415 Change-Id: Ie139c657f8550adba07b74a0cd5d69e2b53d62c2 Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com> Reviewed-on: http://git-master/r/116405 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps80031-regulator.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c
index efc608c936ea..33d4b62e58da 100644
--- a/drivers/regulator/tps80031-regulator.c
+++ b/drivers/regulator/tps80031-regulator.c
@@ -297,10 +297,11 @@ static int __tps80031_dcdc_set_voltage(struct device *parent,
int vsel = 0;
int ret;
- min_uV = min_uV - ri->tolerance_uv;
-
switch (ri->flags) {
case 0:
+ if (min_uV >= (607700 + ri->tolerance_uv))
+ min_uV = min_uV - ri->tolerance_uv;
+
if (min_uV == 0)
vsel = 0;
else if ((min_uV >= 607700) && (min_uV <= 1300000)) {
@@ -328,6 +329,8 @@ static int __tps80031_dcdc_set_voltage(struct device *parent,
break;
case DCDC_OFFSET_EN:
+ if (min_uV >= (700000 + ri->tolerance_uv))
+ min_uV = min_uV - ri->tolerance_uv;
if (min_uV == 0)
vsel = 0;
else if ((min_uV >= 700000) && (min_uV <= 1420000)) {
@@ -355,6 +358,8 @@ static int __tps80031_dcdc_set_voltage(struct device *parent,
break;
case DCDC_EXTENDED_EN:
+ if (min_uV >= (1852000 + ri->tolerance_uv))
+ min_uV = min_uV - ri->tolerance_uv;
if (min_uV == 0)
vsel = 0;
else if ((min_uV >= 1852000) && (max_uV <= 4013600)) {
@@ -366,6 +371,8 @@ static int __tps80031_dcdc_set_voltage(struct device *parent,
break;
case DCDC_OFFSET_EN|DCDC_EXTENDED_EN:
+ if (min_uV >= (2161000 + ri->tolerance_uv))
+ min_uV = min_uV - ri->tolerance_uv;
if (min_uV == 0)
vsel = 0;
else if ((min_uV >= 2161000) && (max_uV <= 4321000)) {