aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-05-13 14:51:19 +0200
committerJaroslav Kysela <perex@perex.cz>2008-05-19 13:19:18 +0200
commit4ba1327ab8ce179c40862f3dedb4ebaaa491d737 (patch)
tree1f521aa3f9fc27f45df48e6316062ae1d882b5f4 /sound/soc/soc-dapm.c
parentca1f30ad6c3f002d1d9b9355a53b8bbf2fe70588 (diff)
[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: Mark 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: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c60200ccde6..811d6527101 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1234,6 +1234,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
* @stream: stream name