2013-04-19 03:14:57

by Axel Lin

[permalink] [raw]
Subject: [PATCH RFT] regulator: palmas: Remove wrong voltage setting for enabling LDO8 tracking mode

When SMPS45 is set to off and LDO8 tracking is enabled, LDO8 output can be set
from 0.45 to 1.65V and the steps of voltage change is 25mV.

This is done by setting:
pmic->desc[id].min_uV = 450000;
pmic->desc[id].uV_step = 25000;

I don't see the point of reading vsel register, multiple the register value by
2 and then write back to the register.

Signed-off-by: Axel Lin <[email protected]>
---
Hi Laxman,

Current code looks strange (and wrong) to me.
I don't see the point of reading vsel register, multiple the register value by
2 and then write back to the register.
Can you double check this patch, in case I might misunderstand the code.

Thanks,
Axel

drivers/regulator/palmas-regulator.c | 18 ------------------
1 file changed, 18 deletions(-)

diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 67ed5e5d..f26344e 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -643,24 +643,6 @@ static void palmas_enable_ldo8_track(struct palmas *palmas)
dev_err(palmas->dev, "Error in enabling tracking mode\n");
return;
}
- /*
- * When SMPS45 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 struct of_regulator_match palmas_matches[] = {
--
1.7.10.4



2013-04-19 04:53:28

by Laxman Dewangan

[permalink] [raw]
Subject: Re: [PATCH RFT] regulator: palmas: Remove wrong voltage setting for enabling LDO8 tracking mode

On Friday 19 April 2013 08:44 AM, Axel Lin wrote:
> When SMPS45 is set to off and LDO8 tracking is enabled, LDO8 output can be set
> from 0.45 to 1.65V and the steps of voltage change is 25mV.
>
> This is done by setting:
> pmic->desc[id].min_uV = 450000;
> pmic->desc[id].uV_step = 25000;
>
> I don't see the point of reading vsel register, multiple the register value by
> 2 and then write back to the register.
>
> Signed-off-by: Axel Lin <[email protected]>
> ---
> Hi Laxman,
>
> Current code looks strange (and wrong) to me.
> I don't see the point of reading vsel register, multiple the register value by
> 2 and then write back to the register.
> Can you double check this patch, in case I might misunderstand the code.

When we configure for tracking mode, the equation of voltage out put change:
Vnt = 0.9 + reg*0.05
to
Vt = 0.45 + reg*0.025

So we need to adjust the current register setting to have the same
voltage output when smps45 is OFF.

But however, just doubling the register content is not suffice here. I
did math again and it should be

reg = reg << 2 + 18.

+18 because we need to adjust the Vmin also (18 * 0.25 = 0.45).
So here we need to fix this.