From 8c3bac9e428468703d58d8458bce6be4172e28b7 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Mon, 16 Jun 2014 14:11:51 +0800 Subject: [PATCH] MLK-11407-3: regulator: anatop: force vddpu to use same voltage level as vddsoc This patch cherry-pick from below: "ENGR00317981: 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 Signed-off-by: Robin Gong (cherry picked from commit ab0c52e019cacc89aec3dbb104360b4715d49796) Conflicts: drivers/regulator/anatop-regulator.c --- drivers/regulator/anatop-regulator.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 5d8bcdd7c2aa..bd33f86f8ed6 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -57,6 +57,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) @@ -88,6 +91,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->sel; + sel = anatop_reg->bypass ? LDO_FET_FULL_ON : anatop_reg->sel; return regulator_set_voltage_sel_regmap(reg, sel); } @@ -241,6 +251,11 @@ static int anatop_regulator_probe(struct platform_device *pdev) initdata->supply_regulator = "vin"; sreg->initdata = initdata; + if (strcmp(sreg->name, "vddpu") == 0) + vddpu = sreg; + else if (strcmp(sreg->name, "vddsoc") == 0) + vddsoc = sreg; + anatop_np = of_get_parent(np); if (!anatop_np) return -ENODEV; -- 2.17.1