[alsa-devel] [PATCH] ASoC: add RT5640 CODEC driver

Stephen Warren swarren at wwwdotorg.org
Wed Apr 17 18:25:30 CEST 2013

On 04/17/2013 09:28 AM, Mark Brown wrote:
> On Wed, Apr 17, 2013 at 09:18:30AM -0600, Stephen Warren wrote:
>> On 04/17/2013 08:01 AM, Mark Brown wrote:
>>> That said if boards generally don't use external supplies and
>>> use the built in regulators then it's probably best to at least
>>> have the driver assume that by default.
>> So the issue here is that regulators aren't supposed to be
>> optional, right? So if there's a reasonable chance that
>> regulators would ever be needed, we should add them now.
>> With board files, we probably could have just added them later,
>> but with device tree (which is my use-case for this CODEC at
>> least), the DT binding needs to specify which regulator(s) the
>> device requires (if any) right from the start, so that all DTs
>> will include the regulator definitions.
> You can do the same thing with DT as you do with board files -
> make those supplies an optional property and then if the property
> is missing do the default thing.

But then, you end up with an optional regulator, and the driver has to
do things like:

if (!IS_ERR(x->reg_foo))

I thought the whole point of the rule that "if a regulator is ever
needed, it must always be provided, and if there isn't one on the
board, use a 'dummy' fixed-regulator" was to avoid exactly that?

But if that rule is relaxed, and the code above is fine, then indeed
one can do as you say.

More information about the Alsa-devel mailing list