1
0
Fork 0

MLK-13793-6 regulator: anatop: fix min dropout for bypass mode

In bypass mode, the anatop digital regulators do not have any minimum
dropout value (the input voltage is equal to the output voltage according
to documentation).

Having a min dropout value of 125mV will lead to an increased voltage
for PMIC supplies.

Only set minimum dropout value for ldo enabled mode.

Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 9092e24ba0dce713e5478c0f925168b00e9e83cb)
5.4-rM2-2.2.x-imx-squashed
Irina Tirdea 2017-02-12 21:07:31 +02:00 committed by Robin Gong
parent 1af687d87a
commit e169cf3592
1 changed files with 28 additions and 2 deletions

View File

@ -22,6 +22,8 @@
#define LDO_POWER_GATE 0x00
#define LDO_FET_FULL_ON 0x1f
#define LDO_MIN_DROPOUT_UV 125000
struct anatop_regulator {
u32 delay_reg;
int delay_bit_shift;
@ -31,6 +33,9 @@ struct anatop_regulator {
int sel;
};
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)
@ -62,6 +67,17 @@ static int anatop_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;
anatop_reg->bypass = vddsoc->bypass;
if (anatop_reg->bypass)
anatop_reg->rdesc.min_dropout_uV = 0;
}
sel = anatop_reg->bypass ? LDO_FET_FULL_ON : anatop_reg->sel;
return regulator_set_voltage_sel_regmap(reg, sel);
}
@ -128,6 +144,10 @@ static int anatop_regmap_set_bypass(struct regulator_dev *reg, bool enable)
sel = enable ? LDO_FET_FULL_ON : anatop_reg->sel;
anatop_reg->bypass = enable;
if (anatop_reg->bypass)
anatop_reg->rdesc.min_dropout_uV = 0;
else
anatop_reg->rdesc.min_dropout_uV = LDO_MIN_DROPOUT_UV;
return regulator_set_voltage_sel_regmap(reg, sel);
}
@ -246,7 +266,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
rdesc->linear_min_sel = min_bit_val;
rdesc->vsel_reg = control_reg;
rdesc->vsel_mask = ((1 << vol_bit_width) - 1) << vol_bit_shift;
rdesc->min_dropout_uV = 125000;
rdesc->min_dropout_uV = LDO_MIN_DROPOUT_UV;
config.dev = &pdev->dev;
config.init_data = initdata;
@ -268,6 +288,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
if (sreg->sel == LDO_FET_FULL_ON) {
sreg->sel = 0;
sreg->bypass = true;
rdesc->min_dropout_uV = 0;
}
/*
@ -275,13 +296,18 @@ static int anatop_regulator_probe(struct platform_device *pdev)
* a sane default until imx6-cpufreq was probed and changes the
* voltage to the correct value. In this case we set 1.25V.
*/
if (!sreg->sel && !strcmp(rdesc->name, "vddpu"))
if (!sreg->sel && !strcmp(rdesc->name, "vddpu")) {
sreg->sel = 22;
vddpu = sreg;
}
/* set the default voltage of the pcie phy to be 1.100v */
if (!sreg->sel && !strcmp(rdesc->name, "vddpcie"))
sreg->sel = 0x10;
if (!strcmp(rdesc->name, "vddsoc"))
vddsoc = sreg;
if (!sreg->bypass && !sreg->sel) {
dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
return -EINVAL;