From c9a94ee42d1894f0be0947e36d5d3a8c48d5c698 Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Mon, 20 Aug 2012 18:40:47 +0800 Subject: [PATCH] rk2928 codec: add speaker control. --- sound/soc/codecs/rk2928_codec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sound/soc/codecs/rk2928_codec.c b/sound/soc/codecs/rk2928_codec.c index 5a2fe5dc4d33..54a75a2ec61c 100755 --- a/sound/soc/codecs/rk2928_codec.c +++ b/sound/soc/codecs/rk2928_codec.c @@ -41,6 +41,8 @@ #include "rk2928_codec.h" +#define SPK_CTL RK2928_PIN1_PA0 + static struct rk2928_codec_data { struct device *dev; int regbase; @@ -147,6 +149,9 @@ static int rk2928_audio_trigger(struct snd_pcm_substream *substream, int cmd, if(!rk2928_data.hdmi_enable) rk2928_write(codec, CODEC_REG_DAC_MUTE, v_MUTE_DAC(0)); rk2928_data.mute = 0; + if(SPK_CTL != INVALID_GPIO) { + gpio_direction_output(SPK_CTL, GPIO_HIGH); + } } else { rk2928_write(codec, CODEC_REG_ADC_PGA_GAIN, 0xFF); @@ -158,6 +163,9 @@ static int rk2928_audio_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if(SPK_CTL != INVALID_GPIO) { + gpio_direction_output(SPK_CTL, GPIO_LOW); + } rk2928_write(codec, CODEC_REG_DAC_MUTE, v_MUTE_DAC(1)); rk2928_data.mute = 1; } @@ -241,6 +249,14 @@ static int rk2928_probe(struct snd_soc_codec *codec) // Select SDI input from internal audio codec writel(0x04000400, RK2928_GRF_BASE + GRF_SOC_CON0); + if(SPK_CTL != INVALID_GPIO) { + ret = gpio_request(SPK_CTL, NULL); + if (ret != 0) { + gpio_free(SPK_CTL); + } + else + gpio_direction_output(SPK_CTL, GPIO_LOW); + } // Mute and Power off codec rk2928_write(codec, CODEC_REG_DAC_MUTE, v_MUTE_DAC(1)); rk2928_set_bias_level(codec, SND_SOC_BIAS_OFF); -- 2.34.1