From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lu Guanqun Subject: [PATCH 05/19] ASoC: mrst_machine: enable user to select different output Date: Wed, 04 May 2011 21:45:19 +0800 Message-ID: <20110504134519.32443.90599.stgit@localhost> References: <20110504133756.32443.6282.stgit@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by alsa0.perex.cz (Postfix) with ESMTP id DCBC810381F for ; Wed, 4 May 2011 15:43:56 +0200 (CEST) In-Reply-To: <20110504133756.32443.6282.stgit@localhost> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: ALSA , Lu Guanqun Cc: Takashi Iwai , Koul Vinod , Mark Brown , Liam Girdwood , Wang Xingchao List-Id: alsa-devel@alsa-project.org All these two output device can be enabled and disabled independently. Signed-off-by: Lu Guanqun --- 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 #include +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);