[alsa-devel] [PATCH 05/19] ASoC: mrst_machine: enable user to select different output

Lu Guanqun guanqun.lu at intel.com
Wed May 4 15:45:19 CEST 2011


All these two output device can be enabled and disabled independently.

Signed-off-by: Lu Guanqun <guanqun.lu at intel.com>
---
 sound/soc/mid-x86/mrst_machine.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/sound/soc/mid-x86/mrst_machine.c b/sound/soc/mid-x86/mrst_machine.c
index 0bce388..b4d542e 100644
--- a/sound/soc/mid-x86/mrst_machine.c
+++ b/sound/soc/mid-x86/mrst_machine.c
@@ -36,6 +36,11 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 
+static const struct snd_kcontrol_new mrst_snd_controls[] = {
+	SOC_DAPM_PIN_SWITCH("Headphone"),
+	SOC_DAPM_PIN_SWITCH("Speaker"),
+};
+
 /*
  * GPIO pin to power on/off Internal Speaker
  */
@@ -85,13 +90,19 @@ static int mrst_audio_init(struct snd_soc_pcm_runtime *runtime)
 	if (ret)
 		return ret;
 
+	ret = snd_soc_add_controls(codec,
+				   mrst_snd_controls,
+				   ARRAY_SIZE(mrst_snd_controls));
+	if (ret)
+		return ret;
+
 	snd_soc_dapm_nc_pin(dapm, "LINEINL");
 	snd_soc_dapm_nc_pin(dapm, "LINEINR");
 	snd_soc_dapm_nc_pin(dapm, "LINEOUTL");
 	snd_soc_dapm_nc_pin(dapm, "LINEOUTR");
 
-	snd_soc_dapm_enable_pin(dapm, "Headphone");
-	snd_soc_dapm_disable_pin(dapm, "Speaker");
+	snd_soc_dapm_disable_pin(dapm, "Headphone");
+	snd_soc_dapm_enable_pin(dapm, "Speaker");
 
 	snd_soc_dapm_sync(dapm);
 



More information about the Alsa-devel mailing list