[alsa-devel] What is correct way to put conditional stuff in ASoC codec driver?

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Jul 7 17:49:34 CEST 2011

On Thu, Jul 07, 2011 at 05:20:07PM +0530, Ashish Chavan wrote:
> On Wed, 2011-07-06 at 01:07 +0530, Mark Brown wrote:

> > No, that's not a user visible control that's part of the internal DAPM
> > power management stuff.  You're looking for struct snd_kcontrol_new
> > stuff.

> Oh, that's correct. You may be suggesting something similar to what is
> done in sound/soc/codecs/wm8985.c for "Equalizer Function", i.e. using
> SOC_xxx_EXT version for defining custom control and putting condition
> checks in respective "_put()" function.

Or just writing a control directly.

> > The state of another control is one example of a dynamic source of
> > information.

> Can you point me to any example that shows correct way to inquire
> state/value of a custom control? I guess snd_soc_get_xxx() functions
> need to be used here but I could find only handful of usages of these
> functions in entire sound/soc/codecs dir.

Those functions are used by the core for providing readback of the
controls to userspace.  You need to provide them but your driver can use
whatever it likes to read its own state (providing it's tasteful), it
doesn't need to go through external APIs.  Any driver with a custom
control will have an example of how it chooses to read its own state.

More information about the Alsa-devel mailing list