Re: [PATCH] regulator: Provide a check for dummy regulator

From: Mark Brown
Date: Thu Apr 19 2012 - 12:29:15 EST


On Thu, Apr 19, 2012 at 07:35:03PM +0530, Jassi Brar wrote:

> I am talking about the delay the consumer driver might want after
> enabling the regulator for the end device to, say, initialize itself or
> perform POST or whatever.

> I do realize that such consumer drivers ought to know about the
> presence of the real regulator via platform_data(PD) or DT, but

No! You're *completely* failing to understand the usage model of the
regulator API here, any driver doing this is clearly buggy.

> Another POV is :
> Is a consumer's need, to know if the gotten regulator is a real
> or a dummy one, reasonable ?

Absolutely not, you're completely failing to understand what I said
about abstraction here. *Nothing* about this is anything to do with
dummy regulators in the slightest, it's about supplies which are already
on at the time the driver powers the device up. Doing this for dummy
regulators is not helpful, being enabled isn't in the slightest bit tied
to the fact that the regulator is a dummy regulator and it's silly to
optimise this only in the specific case where a dummy regulator (which
is in the first place only a crutch to keep systems with buggy regulator
setups going) is being used is silly.

I'd suggest checking with regulator_is_enabled() prior to power up, or
adding a notifier for physical enable events and using that.

Attachment: signature.asc
Description: Digital signature