MLK-11407-3: regulator: anatop: force vddpu to use same voltage level as vddsoc
authorShawn Guo <shawn.guo@freescale.com>
Mon, 16 Jun 2014 06:11:51 +0000 (14:11 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:37 +0000 (14:48 -0500)
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 <shawn.guo@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit ab0c52e019cacc89aec3dbb104360b4715d49796)

Conflicts:
drivers/regulator/anatop-regulator.c

drivers/regulator/anatop-regulator.c

index 5d8bcdd..bd33f86 100644 (file)
@@ -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;