[linux-sunxi] Re: [PATCH v3 06/10] regulator: AXP20x: Add support for regulators subsystem

Carlo Caione carlo at caione.org
Sat Mar 29 13:52:01 EDT 2014


On Fri, Mar 28, 2014 at 01:39:34PM +0000, Mark Brown wrote:
> On Thu, Mar 27, 2014 at 10:29:20PM +0100, Carlo Caione wrote:
> 
> > +static int axp20x_set_suspend_voltage(struct regulator_dev *rdev, int uV)
> > +{
> > +	int sel = regulator_map_voltage_iterate(rdev, uV, uV);
> > +
> > +	if (sel < 0)
> > +		return sel;
> > +
> > +	return regulator_set_voltage_sel_regmap(rdev, sel);
> > +}
> 
> This is fairly obviously broken - it's overwriting the normal runtime
> value, this will disrupt the running system if we want the value we use
> on suspend is different to the value we want at runtime.

Ok, silly question: isn't it exactly what we want? Set the voltage for
the regulator when the system is suspended?

> Think about it - if this was a sane thing to do the core would just do
> it without needing driver specific code, we already know how to set the
> voltage for the device.

I thought it was because some regulators can have specific regs for
managing the suspend mode.

BTW, but then what is the difference between my code and (i.e.) the same
routine in da9055-regulator.c?

http://lxr.linux.no/linux+v3.13.5/drivers/regulator/da9055-regulator.c#L276

Thanks,

-- 
Carlo Caione



More information about the linux-arm-kernel mailing list