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

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Apr 17 20:52:08 CEST 2013

On Wed, Apr 17, 2013 at 10:25:30AM -0600, Stephen Warren wrote:
> On 04/17/2013 09:28 AM, Mark Brown wrote:

> > 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))
> 	regulator_enable(x->reg_foo);

Not if you do it at the other end - do it during device registration.
If nothing is set up then feed the regulator API whatever the default
configuration is for the device, otherwise use what you were given.
The consumer side can't tell where the configuration came from and will
always have one.

This does mean you need to do the regulator driver if you support
non-default configurations but that's no bad thing.

More information about the Alsa-devel mailing list