Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257570
b: refs/heads/master
c: a491a5c
h: refs/heads/master
v: v3
  • Loading branch information
Liam Girdwood authored and Mark Brown committed Jul 5, 2011
1 parent b1c1585 commit 9432df4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a27bd9a33187a10c5157434b2274487f6679e49
refs/heads/master: a491a5c84f34febfebd4cb0b8c9add97977efa97
2 changes: 2 additions & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
const char *prefix);
int snd_soc_add_controls(struct snd_soc_codec *codec,
const struct snd_kcontrol_new *controls, int num_controls);
int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
const struct snd_kcontrol_new *controls, int num_controls);
int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
Expand Down
30 changes: 30 additions & 0 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,36 @@ int snd_soc_add_controls(struct snd_soc_codec *codec,
}
EXPORT_SYMBOL_GPL(snd_soc_add_controls);

/**
* snd_soc_add_platform_controls - add an array of controls to a platform.
* Convienience function to add a list of controls.
*
* @platform: platform to add controls to
* @controls: array of controls to add
* @num_controls: number of elements in the array
*
* Return 0 for success, else error.
*/
int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
const struct snd_kcontrol_new *controls, int num_controls)
{
struct snd_card *card = platform->card->snd_card;
int err, i;

for (i = 0; i < num_controls; i++) {
const struct snd_kcontrol_new *control = &controls[i];
err = snd_ctl_add(card, snd_soc_cnew(control, platform,
control->name, NULL));
if (err < 0) {
dev_err(platform->dev, "Failed to add %s %d\n",control->name, err);
return err;
}
}

return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_add_platform_controls);

/**
* snd_soc_info_enum_double - enumerated double mixer info callback
* @kcontrol: mixer control
Expand Down

0 comments on commit 9432df4

Please sign in to comment.