[ALSA] soc - DAPM - add hook to read state of DAPM widget
authorGraeme Gregory <graeme@openmoko.org>
Wed, 30 Apr 2008 17:27:40 +0000 (19:27 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 19 May 2008 11:19:14 +0000 (13:19 +0200)
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>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index a105b01e06d50dc3ccb8b8bcb527d64ea9b7cbe8..40cc695b69b63fd07071b8a0f0e9a8ac9d8515ce 100644 (file)
@@ -223,6 +223,8 @@ int snd_soc_dapm_sys_add(struct device *dev);
 /* dapm audio endpoint control */
 int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
        char *pin, int status);
+int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec,
+       char *pin);
 int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec);
 
 /* dapm widget types */
index af3326c635041da0c852ecc0ca11ea91212484f1..9fd5ee818e896d7bb5572ff893a2c5917e5270b7 100644 (file)
@@ -1342,6 +1342,29 @@ int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_set_endpoint);
 
+/**
+ * snd_soc_dapm_get_endpoint_status - get audio endpoint status
+ * @codec: audio codec
+ * @endpoint: audio signal endpoint (or start point)
+ *
+ * Get audio endpoint status - connected or disconnected.
+ *
+ * Returns status
+ */
+int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec,
+       char *endpoint)
+{
+       struct snd_soc_dapm_widget *w;
+
+       list_for_each_entry(w, &codec->dapm_widgets, list) {
+               if (!strcmp(w->name, endpoint))
+                       return w->connected;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_get_endpoint);
+
 /**
  * snd_soc_dapm_free - free dapm resources
  * @socdev: SoC device