summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-09-11 21:08:28 +0530
committerSimone Willett <swillett@nvidia.com>2012-09-12 10:20:45 -0700
commit323dafcae1574e923f7baff5a86b2e7ed3dc647a (patch)
tree0b4df20246db4a73a25fb0bafcf3de99f8cd6b9e /drivers/regulator
parentc2970639a7ec5e3b22126a6534ee25e9b586acc7 (diff)
regulator: palmas: support ldo8 tracking mode
LDO8 is having tracking mode where it can track for SMPS45. Add support for configuring this mode. Change-Id: I19195ff8b8c4ad1dab8d233f8380c481493b6829 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/131459 Tested-by: Mallikarjun Kasoju <mkasoju@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/palmas-regulator.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index a405ab796606..27911c2a5e52 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -813,6 +813,46 @@ static int palmas_extreg_init(struct palmas *palmas, int id,
return 0;
}
+static void palmas_enable_ldo8_track(struct palmas *palmas)
+{
+ unsigned int reg;
+ unsigned int addr;
+ int ret;
+
+ addr = palmas_regs_info[PALMAS_REG_LDO8].ctrl_addr;
+
+ ret = palmas_ldo_read(palmas, addr, &reg);
+ if (ret) {
+ dev_err(palmas->dev, "Error in reading ldo8 control reg\n");
+ return;
+ }
+
+ reg |= PALMAS_LDO8_CTRL_LDO_TRACKING_EN;
+ ret = palmas_ldo_write(palmas, addr, reg);
+ if (ret < 0) {
+ dev_err(palmas->dev, "Error in enabling tracking mode\n");
+ return;
+ }
+ /*
+ * When SMPS4&5 is set to off and LDO8 tracking is enabled, the LDO8
+ * output is defined by the LDO8_VOLTAGE.VSEL register divided by two,
+ * and can be set from 0.45 to 1.65 V.
+ */
+ addr = palmas_regs_info[PALMAS_REG_LDO8].vsel_addr;
+ ret = palmas_ldo_read(palmas, addr, &reg);
+ if (ret) {
+ dev_err(palmas->dev, "Error in reading ldo8 voltage reg\n");
+ return;
+ }
+
+ reg = (reg << 1) & PALMAS_LDO8_VOLTAGE_VSEL_MASK;
+ ret = palmas_ldo_write(palmas, addr, reg);
+ if (ret < 0)
+ dev_err(palmas->dev, "Error in setting ldo8 voltage reg\n");
+
+ return;
+}
+
static __devinit int palmas_probe(struct platform_device *pdev)
{
struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
@@ -990,6 +1030,10 @@ static __devinit int palmas_probe(struct platform_device *pdev)
}
}
+ /* Check if LDO8 is in tracking mode or not */
+ if (pdata->enable_ldo8_tracking)
+ palmas_enable_ldo8_track(palmas);
+
return 0;
err_unregister_regulator: