On Tue, Sep 17, 2013 at 10:16:06AM +0200, Guennadi Liakhovetski wrote:

*Please* remember to trim context when replying.

> On Tue, 17 Sep 2013, Ulf Hansson wrote:
> 
> > In one of my cases I am also using a regulator, but from a board
> > configuration point of view I know I am the only user on this
> > regulator, thus I can be sure I can switch it off when I want.

> So, do I understand correctly, that if we get a regulator exclusively and 
> it is capable of changing status (REGULATOR_CHANGE_STATUS) and it is not 
> always on, then we can assume, that every call to regulator_enable() / 
> regulator_disable() with a suitable use count _will_ switch power off or 
> on? Maybe then we could adjust mmc_regulator_get_supply() accordingly - 
> first try to get the regulator exclusively, if it fails, try shared. If 
> succeeded and the conditions are satisfied - set the new PWR_CYCLE flag.

This use case is what regulator_get_exclusive() was added for.  The
method you are suggesting there is not a good one, though - if the
supply is shared it will cause the first MMC controller to get the
regulator and the others to fail.  However I think we should probably
fix this by having code in the regulator core which checks if multiple
consumers are mapped and refuses to allow get_exclusive() in that case.

Attachment: signature.asc
Description: Digital signature

Reply via email to