diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d08abf4e3eb3..16651814ecba 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1949,6 +1949,36 @@ int snd_soc_add_controls(struct snd_soc_codec *codec, | |||
1949 | EXPORT_SYMBOL_GPL(snd_soc_add_controls); | 1949 | EXPORT_SYMBOL_GPL(snd_soc_add_controls); |
1950 | 1950 | ||
1951 | /** | 1951 | /** |
1952 | * snd_soc_add_platform_controls - add an array of controls to a platform. | ||
1953 | * Convienience function to add a list of controls. | ||
1954 | * | ||
1955 | * @platform: platform to add controls to | ||
1956 | * @controls: array of controls to add | ||
1957 | * @num_controls: number of elements in the array | ||
1958 | * | ||
1959 | * Return 0 for success, else error. | ||
1960 | */ | ||
1961 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, | ||
1962 | const struct snd_kcontrol_new *controls, int num_controls) | ||
1963 | { | ||
1964 | struct snd_card *card = platform->card->snd_card; | ||
1965 | int err, i; | ||
1966 | |||
1967 | for (i = 0; i < num_controls; i++) { | ||
1968 | const struct snd_kcontrol_new *control = &controls[i]; | ||
1969 | err = snd_ctl_add(card, snd_soc_cnew(control, platform, | ||
1970 | control->name, NULL)); | ||
1971 | if (err < 0) { | ||
1972 | dev_err(platform->dev, "Failed to add %s %d\n",control->name, err); | ||
1973 | return err; | ||
1974 | } | ||
1975 | } | ||
1976 | |||
1977 | return 0; | ||
1978 | } | ||
1979 | EXPORT_SYMBOL_GPL(snd_soc_add_platform_controls); | ||
1980 | |||
1981 | /** | ||
1952 | * snd_soc_info_enum_double - enumerated double mixer info callback | 1982 | * snd_soc_info_enum_double - enumerated double mixer info callback |
1953 | * @kcontrol: mixer control | 1983 | * @kcontrol: mixer control |
1954 | * @uinfo: control element information | 1984 | * @uinfo: control element information |