rk616 codec:add reset in fun shutdown
author陈金泉 <chenjq@rock-chips.com>
Tue, 4 Jun 2013 03:23:07 +0000 (11:23 +0800)
committer陈金泉 <chenjq@rock-chips.com>
Tue, 4 Jun 2013 03:23:07 +0000 (11:23 +0800)
arch/arm/mach-rk3188/board-rk3188m-tb.c
sound/soc/codecs/rk616_codec.c

index 542e17569386c567d78beb23c73d8e193c012337..297f59b013401d2664a73cb5aa56961e58ce75f0 100644 (file)
@@ -698,25 +698,11 @@ static struct rk610_ctl_platform_data rk610_ctl_pdata = {
 #if defined(CONFIG_MFD_RK616)
 #define RK616_RST_PIN                  RK30_PIN3_PB2
 #define RK616_PWREN_PIN                        RK30_PIN0_PC5
-#define RK616_SPK_CTL2                 RK30_PIN0_PD5
 #define RK616_SCL_RATE                 (80*1000)   //i2c scl rate
 static int rk616_power_on_init(void)
 {
        int ret;
-#if 1
-       if(RK616_SPK_CTL2 != INVALID_GPIO)
-       {
-               ret = gpio_request(RK616_SPK_CTL2, "rk616 spk ctl2");
-               if (ret)
-               {
-                       printk(KERN_ERR "rk616 spk_ctl2 gpio request fail\n");
-               }
-               else 
-               {
-                       gpio_direction_output(RK616_SPK_CTL2,GPIO_HIGH);
-               }
-       }
-#endif
+
        if(RK616_PWREN_PIN != INVALID_GPIO)
        {
                ret = gpio_request(RK616_PWREN_PIN, "rk616 pwren");
index be42b02fd009c453a9e47b20364a82e7faad5c05..689313590ec9971d79be7c40535ef0a7dbdc4c8a 100755 (executable)
@@ -1533,7 +1533,7 @@ static int rk616_hw_params(struct snd_pcm_substream *substream,
                return -EINVAL;
        }
 
-       switch (params_channels(params)) {
+       /*switch (params_channels(params)) {
        case RK616_MONO:
                adc_aif1 |= RK616_ADC_TYPE_MONO;
                break;
@@ -1542,7 +1542,10 @@ static int rk616_hw_params(struct snd_pcm_substream *substream,
                break;
        default:
                return -EINVAL;
-       }
+       }*/
+
+       //MIC1N/P and MIC2N/P can only line to ADCL, so set mono type.
+       adc_aif1 |= RK616_ADC_TYPE_MONO;
 
        adc_aif1 |= RK616_ADC_SWAP_DIS;
        adc_aif2 |= RK616_ADC_RST_DIS;
@@ -2075,6 +2078,19 @@ static int rk616_remove(struct snd_soc_codec *codec)
 {
        DBG("%s\n", __func__);
 
+       if (!rk616_priv) {
+               printk("%s : rk616_priv is NULL\n", __func__);
+               return 0;
+       }
+
+       if (rk616_priv->spk_ctl_gpio != INVALID_GPIO)
+               gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_LOW);
+
+       if (rk616_priv->hp_ctl_gpio != INVALID_GPIO)
+               gpio_set_value(rk616_priv->hp_ctl_gpio, GPIO_LOW);
+
+       mdelay(10);
+
        if (rk616_for_mid)
        {
                cancel_delayed_work_sync(&capture_delayed_work);
@@ -2082,16 +2098,13 @@ static int rk616_remove(struct snd_soc_codec *codec)
                if (rk616_codec_work_capture_type != RK616_CODEC_WORK_NULL) {
                        rk616_codec_work_capture_type = RK616_CODEC_WORK_NULL;
                }
-               rk616_codec_power_down(RK616_CODEC_ALL);
-       }
-       else
-       {
-               snd_soc_write(codec, RK616_RESET, 0xfc);
-               mdelay(10);
-               snd_soc_write(codec, RK616_RESET, 0x3);
-               mdelay(10);
        }
 
+       snd_soc_write(codec, RK616_RESET, 0xfc);
+       mdelay(10);
+       snd_soc_write(codec, RK616_RESET, 0x3);
+       mdelay(10);
+
        if (rk616_priv)
                kfree(rk616_priv);
 
@@ -2163,12 +2176,14 @@ void rk616_platform_shutdown(struct platform_device *pdev)
                if (rk616_codec_work_capture_type != RK616_CODEC_WORK_NULL) {
                        rk616_codec_work_capture_type = RK616_CODEC_WORK_NULL;
                }
-               rk616_codec_power_down(RK616_CODEC_ALL);
-       } else {
-               snd_soc_write(rk616_priv->codec, RK616_RESET, 0xfc);
-               mdelay(10);
-               snd_soc_write(rk616_priv->codec, RK616_RESET, 0x3);
        }
+
+       snd_soc_write(rk616_priv->codec, RK616_RESET, 0xfc);
+       mdelay(10);
+       snd_soc_write(rk616_priv->codec, RK616_RESET, 0x3);
+
+       if (rk616_priv)
+               kfree(rk616_priv);
 }
 
 static struct platform_driver rk616_codec_driver = {