Re: [PATCH 1/2] twl6030: regulator: Fix vsel calculations in set/get voltage apis

Mark Brown
2010-02-17T16:15:13Z

On Wed, Feb 17, 2010 at 08:54:14PM +0530, Rajendra Nayak wrote:

> /* use the first in-range value */
> - if (min_uV <= uV && uV <= max_uV)
> + if (min_uV <= uV && uV <= max_uV) {
> + if (twl_class_is_6030())
> + /*
> + * Use the below formula to calculate vsel
> + * mV = 1000mv + 100mv * (vsel - 1)
> + */
> + vsel = (LDO_MV(mV) - 1000)/100 + 1;
> return twlreg_write(info, TWL_MODULE_PM_RECEIVER,
> VREG_VOLTAGE, vsel);

This looks wrong - this code is inside a loop over vsel->voltage
mappings, if that mapping is wrong and needs to be ignored (which is
what this code is doing) then we shouldn't be looking at it at all.