Re: [NEW DRIVER V6 1/7] drivers/mfd: DA9058 MFD core driver

From: Mark Brown
Date: Tue Apr 23 2013 - 06:22:14 EST


On Tue, Apr 23, 2013 at 05:08:12AM +0000, Opensource [Anthony Olech] wrote:

> > No, you're totally missing the point here. Your regulator driver needs
> > to be generic and work on any machine using the device. This means you
> > can't specify any constraints, the constraints need to come from the
> > system integration.

> As far as I can see there are two types of constraints:-
> 1) the absolute max/min that the PMIC itself is designed for.
> 2) the max/min that the board is designed for, ie system integration.

> Thus constraints type (1) must come from the driver and constraints type (2)
> must come from the machine driver, which for my testing is the mach-smdk6410.

No, this is not the case. We only have system design constraints in
Linux. This should be clear from the fact that there's no mechanism for
regulator drivers to supply constraints.

> Also, I believe that two further principles apply:
> A) the machine driver should only specify a constraint if it restricts a value from (1) above.

No, this is not the case. As you can see from looking at the code the
regulator API will only change the hardware settings if the system
integration code explicitly enables this.

> B) sensible defaults should be specified in the driver so that a system should have some
> chance of operating in the case that the machine driver provides no constraints/overrides.

No, this is not how the API works. There is no way to safely guess what
operations can be performed so the API defaults to doing nothing at all.

> Thus, in the case of this PMIC, the big BUCK is designed to provide power to the processor,
> so the only possible sensible default can be "boot_on == 1". It then makes sense that if a
> PMIC is to be used in the situation it is designed for, then the number of system integration
> constraints should be almost zero.

You can't know that this is how the device has been used in a particular
system, nor can you tell what voltages are supported by the board.

> From your comment it seems that I have missed a point, but what?

You need to redo this so that it works like other regulator drivers.

Attachment: signature.asc
Description: Digital signature