diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2013-07-29 08:51:58 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-29 10:39:11 -0400 |
commit | 4fefd69853a4e83040ddaa98d3b6e5e12cc4f97a (patch) | |
tree | 8da73b2d4b774fc256ee5cb3487b33acda617078 /sound/soc/soc-core.c | |
parent | 3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff) |
ASoC: core: Add snd_soc_card_get_kcontrol()
This is useful for drivers who want to grab a pointer to
snd_kcontrol outside of the kcontrol callbacks.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0ec070cf7231..cef714effc1e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -2299,6 +2299,22 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev, | |||
2299 | return 0; | 2299 | return 0; |
2300 | } | 2300 | } |
2301 | 2301 | ||
2302 | struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, | ||
2303 | const char *name) | ||
2304 | { | ||
2305 | struct snd_card *card = soc_card->snd_card; | ||
2306 | struct snd_kcontrol *kctl; | ||
2307 | |||
2308 | if (unlikely(!name)) | ||
2309 | return NULL; | ||
2310 | |||
2311 | list_for_each_entry(kctl, &card->controls, list) | ||
2312 | if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name))) | ||
2313 | return kctl; | ||
2314 | return NULL; | ||
2315 | } | ||
2316 | EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol); | ||
2317 | |||
2302 | /** | 2318 | /** |
2303 | * snd_soc_add_codec_controls - add an array of controls to a codec. | 2319 | * snd_soc_add_codec_controls - add an array of controls to a codec. |
2304 | * Convenience function to add a list of controls. Many codecs were | 2320 | * Convenience function to add a list of controls. Many codecs were |