From 7413e6f89a1bbde7f77986a20a35a8849a4d5c0d Mon Sep 17 00:00:00 2001 From: ChenJQ Date: Wed, 6 Apr 2011 03:34:51 -0700 Subject: [PATCH] =?utf8?q?1=20=E8=A7=A3=E5=86=B3=E5=BC=80=E5=85=B3?= =?utf8?q?=E6=9C=BApop=E9=9F=B3.=202=20=E5=BD=93=E9=9F=B3=E4=B9=90?= =?utf8?q?=E5=81=9C=E6=AD=A2=E6=92=AD=E6=94=BE=E3=80=81=E5=BD=95=E9=9F=B3?= =?utf8?q?=E6=97=B6=E5=85=B3=E9=97=ADcodec=E9=99=8D=E4=BD=8E=E5=8A=9F?= =?utf8?q?=E8=80=97.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sound/soc/codecs/wm8900.c | 43 +++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 1f38361514b4..0bd70dfa6d32 100755 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -1071,6 +1071,40 @@ static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute) return 0; } + +static int wm8900_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_device *socdev = rtd->socdev; + struct snd_soc_card *card = socdev->card; + struct snd_soc_codec *codec = card->codec; + + printk("wm8900_shutdown \n"); + + snd_soc_write(codec, WM8900_REG_RESET, 0); + + //open SPK control GPIO + gpio_request(SPK_CON, NULL); + gpio_direction_output(SPK_CON,GPIO_LOW); + gpio_free(SPK_CON); + + return 0; +} + +static int wm8900_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_device *socdev = rtd->socdev; + struct snd_soc_card *card = socdev->card; + struct snd_soc_codec *codec = card->codec; + + printk("wm8900_prepare \n"); + + wm8900_set_hw(codec); + + return 0; +} + #ifdef CONFIG_MACH_RK29_MALATA static int wm8900_trigger(struct snd_pcm_substream *substream, int trigger) { @@ -1097,6 +1131,8 @@ static struct snd_soc_dai_ops wm8900_dai_ops = { .set_pll = wm8900_set_dai_pll, .set_fmt = wm8900_set_dai_fmt, .digital_mute = wm8900_digital_mute, + .shutdown = wm8900_shutdown, + .prepare = wm8900_prepare, #ifdef CONFIG_MACH_RK29_MALATA .trigger = wm8900_trigger, #endif @@ -1227,7 +1263,7 @@ static int wm8900_suspend(struct platform_device *pdev, pm_message_t state) struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = socdev->card->codec; struct wm8900_priv *wm8900 = codec->private_data; - + int fll_out = wm8900->fll_out; int fll_in = wm8900->fll_in; int ret; @@ -1263,9 +1299,6 @@ static int wm8900_resume(struct platform_device *pdev) struct wm8900_priv *wm8900 = codec->private_data; int ret; - msleep(50); - wm8900_set_hw(codec); - wm8900_set_bias_level(codec, SND_SOC_BIAS_STANDBY); /* Restart the FLL? */ @@ -1465,8 +1498,6 @@ static int wm8900_probe(struct platform_device *pdev) goto card_err; } - wm8900_set_hw(codec); - return ret; card_err: -- 2.34.1