aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGraeme Gregory <graeme@openmoko.org>2008-04-30 13:27:40 -0400
committerJaroslav Kysela <perex@perex.cz>2008-05-19 07:19:14 -0400
commiteeec12bf7b7d80d1c9cae5aae0dff7e2f928c64b (patch)
tree34757a9cb4cc5f3c9a24699315e586db1668b578
parent54e7e6167d29a4a98207884b2fbd28b0b3fe91f6 (diff)
[ALSA] soc - DAPM - add hook to read state of DAPM widget
This adds a hook to read the power state of a DAPM widget, I use this in the gta02 driver to expose certain DAPM widgets in the mixer for ease of audio routing. Signed-off-by: Graeme Gregory <graeme@openmoko.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--sound/soc/soc-dapm.c23
2 files changed, 25 insertions, 0 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index a105b01e06d5..40cc695b69b6 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -223,6 +223,8 @@ int snd_soc_dapm_sys_add(struct device *dev);
223/* dapm audio endpoint control */ 223/* dapm audio endpoint control */
224int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, 224int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
225 char *pin, int status); 225 char *pin, int status);
226int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec,
227 char *pin);
226int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec); 228int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec);
227 229
228/* dapm widget types */ 230/* dapm widget types */
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index af3326c63504..9fd5ee818e89 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1343,6 +1343,29 @@ int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
1343EXPORT_SYMBOL_GPL(snd_soc_dapm_set_endpoint); 1343EXPORT_SYMBOL_GPL(snd_soc_dapm_set_endpoint);
1344 1344
1345/** 1345/**
1346 * snd_soc_dapm_get_endpoint_status - get audio endpoint status
1347 * @codec: audio codec
1348 * @endpoint: audio signal endpoint (or start point)
1349 *
1350 * Get audio endpoint status - connected or disconnected.
1351 *
1352 * Returns status
1353 */
1354int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec,
1355 char *endpoint)
1356{
1357 struct snd_soc_dapm_widget *w;
1358
1359 list_for_each_entry(w, &codec->dapm_widgets, list) {
1360 if (!strcmp(w->name, endpoint))
1361 return w->connected;
1362 }
1363
1364 return 0;
1365}
1366EXPORT_SYMBOL_GPL(snd_soc_dapm_get_endpoint);
1367
1368/**
1346 * snd_soc_dapm_free - free dapm resources 1369 * snd_soc_dapm_free - free dapm resources
1347 * @socdev: SoC device 1370 * @socdev: SoC device
1348 * 1371 *