diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2011-11-17 12:31:40 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:50:19 -0800 |
commit | 76277d029d1890725dbf6321944baaadfe67b024 (patch) | |
tree | 99e3324f7a62c509a04bd409c5050f0dd0cabca7 /drivers/regulator | |
parent | ecfa0055698c92c4155a03f5dfc2b05c5dea0729 (diff) |
regulator: tps80031: Check configuraton for LDO2-Track mode
Some of the values are not supported in the LDO2 configuration
when using in track mode due to hw issue in tps80031 and
tps80032-ES1.0.
Adding proper check before configuring the LDO2 in this case.
bug 898613
Reviewed-on: http://git-master/r/65441
(cherry picked from commit 58e3672102825b662ea904b46b6c1efbf639365b)
Change-Id: I4e63a932d32c7cb2d13a07611acfa0b7dae649cc
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/66327
Reviewed-by: Lokesh Pathak <lpathak@nvidia.com>
Tested-by: Lokesh Pathak <lpathak@nvidia.com>
Rebase-Id: R8b818dcb4fdaab118426df32144f846a0ab00fb3
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/tps80031-regulator.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index 5cd164a985b1..9ea5cb9725a6 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c @@ -504,11 +504,12 @@ static int tps80031ldo_list_voltage(struct regulator_dev *rdev, unsigned index) return (ri->min_mV + ((index - 1) * 100)) * 1000; } -static int __tps80031_ldo2_set_voltage(struct device *parent, +static int __tps80031_ldo2_set_voltage_track_mode(struct device *parent, struct tps80031_regulator *ri, int min_uV, int max_uV) { int vsel = 0; int ret; + int nvsel; if (min_uV < 600000) { vsel = 0; @@ -522,6 +523,18 @@ static int __tps80031_ldo2_set_voltage(struct device *parent, return -EINVAL; } + /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */ + if ((tps80031_get_chip_info(parent) == TPS80031) || + ((tps80031_get_chip_info(parent) == TPS80032) && + (tps80031_get_pmu_version(parent) == 0x0))) { + nvsel = vsel & 0x1F; + if ((nvsel == 0x0) || (nvsel >= 0x19 && nvsel <= 0x1F)) { + dev_err(ri->dev, "Invalid value for track mode LDO2 " + "configuration for TPS8003x PMU\n"); + return -EINVAL; + } + } + ret = tps80031_write(parent, ri->volt_id, ri->volt_reg, vsel); if (ret < 0) dev_err(ri->dev, "Error in writing the Voltage register\n"); @@ -544,7 +557,8 @@ static int __tps80031_ldo_set_voltage(struct device *parent, if ((ri->desc.id == TPS80031_ID_LDO2) && (ri->flags & TRACK_MODE_ENABLE)) - return __tps80031_ldo2_set_voltage(parent, ri, min_uV, max_uV); + return __tps80031_ldo2_set_voltage_track_mode(parent, ri, + min_uV, max_uV); /* * Use the below formula to calculate vsel |