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

From: Jassi Brar
Date: Fri Apr 20 2012 - 03:32:07 EST


On 19 April 2012 21:59, Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, Apr 19, 2012 at 07:35:03PM +0530, Jassi Brar wrote:
>
>> 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.
>
Sorry for being slow.
How would you suggest one works out the following arrangement ?

Say, an audio CODEC chip has a simple PLL1 run by main voltage
domain(Vmain). PLL1 can only support 11025x sample rates.
Another PLL2 on the chip, powered by optional supply Vaux, could
provide 8000x sample rates. Obviously low-end platforms could choose
to not provide Vaux.

The platform has some other drivers that need to have dummy regulator
support enabled.

How is the CODEC driver supposed to know if 'vaux' is actually present?
Because if it isn't present, the driver wouldn't declare support for
8000x rates.
regulator_get() would always succeed, and regulator_is_enabled() would
always return 1, even if the vaux is not supplied.

Thanks,
-Jassi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/