summaryrefslogtreecommitdiff
path: root/drivers/regulator/anatop-regulator.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@freescale.com>2014-06-16 14:11:51 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:23:14 +0800
commit140719046002b102f1f0ff9e4686e900ed4f458a (patch)
treed0526cb9ac1d0627f15b4d9670d411eee799c576 /drivers/regulator/anatop-regulator.c
parent84beebbce2dcf56a5fc11e1729149e547361f79e (diff)
MLK-11407-3: regulator: anatop: force vddpu to use same voltage level as vddsoc
The anatop on i.MX6 requires that vddpu use the same voltage level as vddsoc. It's a quick hacking to force the check whenever vddpu is about to be enabled. Signed-off-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Robin Gong <b38343@freescale.com> Also take into consideration bypass mode when using the vddsoc selector for vddpu. Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r--drivers/regulator/anatop-regulator.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 9c51d1cd0876..1aaf87660659 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -56,6 +56,9 @@ struct anatop_regulator {
u32 enable_bit;
};
+static struct anatop_regulator *vddpu;
+static struct anatop_regulator *vddsoc;
+
static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg,
unsigned int old_sel,
unsigned int new_sel)
@@ -87,6 +90,13 @@ static int anatop_core_regmap_enable(struct regulator_dev *reg)
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
int sel;
+ /*
+ * The vddpu has to stay at the same voltage level as vddsoc
+ * whenever it's about to be enabled.
+ */
+ if (anatop_reg == vddpu && vddsoc)
+ anatop_reg->sel = vddsoc->bypass ? LDO_FET_FULL_ON : vddsoc->sel;
+
sel = anatop_reg->bypass ? LDO_FET_FULL_ON : anatop_reg->sel;
return regulator_set_voltage_sel_regmap(reg, sel);
}
@@ -248,6 +258,11 @@ static int anatop_regulator_probe(struct platform_device *pdev)
initdata->supply_regulator = "vin";
sreg->initdata = initdata;
+ if (strcmp(rdesc->name, "vddpu") == 0)
+ vddpu = sreg;
+ else if (strcmp(rdesc->name, "vddsoc") == 0)
+ vddsoc = sreg;
+
anatop_np = of_get_parent(np);
if (!anatop_np)
return -ENODEV;