Commit 4ba1327a authored by Mark Brown's avatar Mark Brown Committed by Jaroslav Kysela

[ALSA] soc - DAPM - Add bulk control registration

Most SoC drivers cut'n'paste a loop iterating over an array to register
their DAPM controls.  Provide a function they can call instead.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Graeme Gregory <graeme@openmoko.org>
Cc: Frank Mandarino <fmandarino@endrelia.com>
Cc: Jarkko Nikula <jarkko.nikula@nokia.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent ca1f30ad
......@@ -205,6 +205,9 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
const struct snd_soc_dapm_widget *widget);
int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
const struct snd_soc_dapm_widget *widget,
int num);
/* dapm path setup */
int snd_soc_dapm_connect_input(struct snd_soc_codec *codec,
......
......@@ -1233,6 +1233,33 @@ int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_new_control);
/**
* snd_soc_dapm_new_controls - create new dapm controls
* @codec: audio codec
* @widget: widget array
* @num: number of widgets
*
* Creates new DAPM controls based upon the templates.
*
* Returns 0 for success else error.
*/
int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
const struct snd_soc_dapm_widget *widget,
int num)
{
int i, ret;
for (i = 0; i < num; i++) {
ret = snd_soc_dapm_new_control(codec, widget);
if (ret < 0)
return ret;
widget++;
}
return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls);
/**
* snd_soc_dapm_stream_event - send a stream event to the dapm core
* @codec: audio codec
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment