Asoc: ALC5639: ALC5640: Fix HS det. issue in BIAS OFF state
Manoj Gangwal [Wed, 29 Jan 2014 06:44:33 +0000 (11:44 +0530)]
- This is the fix for the IRQ based headset detection
  in BIAS OFF state.
- Change the min codec state to BIAS OFF when it is
  in idle.

Bug 1449567

Change-Id: Ib3e701af106d6be5b005f93ba997021e8c6bfda8
Signed-off-by: Manoj Gangwal <mgangwal@nvidia.com>
Reviewed-on: http://git-master/r/361351
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

sound/soc/codecs/rt5639.c
sound/soc/codecs/rt5640.c

index 441e94e..e69748b 100644 (file)
@@ -57,7 +57,7 @@ static struct rt5639_init_reg init_list[] = {
     {RT5639_PRIV_INDEX  ,0x001B},   //MX6A
     {RT5639_PRIV_DATA   ,0x0200},   //MX6C
 
-       {RT5639_GEN_CTRL1       , 0x3f01},/* fa[12:13] = 1'b;
+       {RT5639_GEN_CTRL1       , 0x3b01},/* fa[12:13] = 1'b;
                                             fa[8~11]=1; fa[0]=1 */
        {RT5639_ADDA_CLK1       , 0x1114},/* 73[2] = 1'b */
        {RT5639_MICBIAS         , 0x3030},/* 93[5:4] = 11'b */
@@ -528,7 +528,7 @@ int rt5639_headset_detect(struct snd_soc_codec *codec, int jack_insert)
                if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) {
                        snd_soc_write(codec, RT5639_PWR_ANLG1, 0xa814);
                        snd_soc_write(codec, RT5639_MICBIAS, 0x3830);
-                       snd_soc_write(codec, RT5639_GEN_CTRL1 , 0x3701);
+                       snd_soc_write(codec, RT5639_GEN_CTRL1 , 0x3b01);
                        sclk_src = snd_soc_read(codec, RT5639_GLB_CLK) &
                                RT5639_SCLK_SRC_MASK;
                        snd_soc_update_bits(codec, RT5639_GLB_CLK,
@@ -2964,7 +2964,7 @@ static int rt5639_set_bias_level(struct snd_soc_codec *codec,
                        snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
                                RT5639_PWR_FV1 | RT5639_PWR_FV2,
                                RT5639_PWR_FV1 | RT5639_PWR_FV2);
-                       snd_soc_write(codec, RT5639_GEN_CTRL1, 0x3701);
+                       snd_soc_write(codec, RT5639_GEN_CTRL1, 0x3b01);
                        codec->cache_only = false;
                        codec->cache_sync = 1;
                        snd_soc_cache_sync(codec);
@@ -2975,7 +2975,7 @@ static int rt5639_set_bias_level(struct snd_soc_codec *codec,
        case SND_SOC_BIAS_OFF:
                snd_soc_write(codec, RT5639_DEPOP_M1, 0x0004);
                snd_soc_write(codec, RT5639_DEPOP_M2, 0x1100);
-               snd_soc_write(codec, RT5639_GEN_CTRL1, 0x3700);
+               snd_soc_write(codec, RT5639_GEN_CTRL1, 0x3b01);
                snd_soc_write(codec, RT5639_PWR_DIG1, 0x0000);
                snd_soc_write(codec, RT5639_PWR_DIG2, 0x0000);
                snd_soc_write(codec, RT5639_PWR_VOL, 0x0000);
@@ -3007,6 +3007,7 @@ static int rt5639_probe(struct snd_soc_codec *codec)
        mutex_lock(&rt5639->lock);
        CHECK_I2C_SHUTDOWN(rt5639, codec)
 
+       codec->dapm.idle_bias_off = 1;
 
        pr_info("Codec driver version %s\n", VERSION);
 
index 94c1ab1..736253a 100644 (file)
@@ -46,7 +46,7 @@ struct rt5640_init_reg {
 };
 
 static struct rt5640_init_reg init_list[] = {
-       {RT5640_GEN_CTRL1       , 0x3701},/*fa[12:13] = 1'b; fa[8~10]=1; fa[0]=1 */
+       {RT5640_GEN_CTRL1       , 0x3b01},/*fa[12:13] = 1'b; fa[8~10]=1; fa[0]=1 */
        {RT5640_DEPOP_M1        , 0x0019},/* 8e[4:3] = 11'b; 8e[0] = 1'b */
        {RT5640_DEPOP_M2        , 0x3100},/* 8f[13] = 1'b */
        {RT5640_ADDA_CLK1       , 0x1114},/* 73[2] = 1'b  */
@@ -496,7 +496,7 @@ int rt5640_headset_detect(struct snd_soc_codec *codec, int jack_insert)
                if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) {
                        snd_soc_write(codec, RT5640_PWR_ANLG1, 0x2004);
                        snd_soc_write(codec, RT5640_MICBIAS, 0x3830);
-                       snd_soc_write(codec, RT5640_GEN_CTRL1 , 0x3701);
+                       snd_soc_write(codec, RT5640_GEN_CTRL1 , 0x3b01);
                }
                sclk_src = snd_soc_read(codec, RT5640_GLB_CLK) &
                        RT5640_SCLK_SRC_MASK;
@@ -2698,7 +2698,7 @@ static int rt5640_set_bias_level(struct snd_soc_codec *codec,
                        snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
                                RT5640_PWR_FV1 | RT5640_PWR_FV2,
                                RT5640_PWR_FV1 | RT5640_PWR_FV2);
-                       snd_soc_write(codec, RT5640_GEN_CTRL1, 0x3701);
+                       snd_soc_write(codec, RT5640_GEN_CTRL1, 0x3b01);
                        codec->cache_only = false;
                        codec->cache_sync = 1;
                        snd_soc_cache_sync(codec);
@@ -2719,7 +2719,7 @@ static int rt5640_set_bias_level(struct snd_soc_codec *codec,
 #endif
                snd_soc_write(codec, RT5640_DEPOP_M1, 0x0004);
                snd_soc_write(codec, RT5640_DEPOP_M2, 0x1100);
-               snd_soc_write(codec, RT5640_GEN_CTRL1, 0x3700);
+               snd_soc_write(codec, RT5640_GEN_CTRL1, 0x3b01);
                snd_soc_write(codec, RT5640_PWR_DIG1, 0x0000);
                snd_soc_write(codec, RT5640_PWR_DIG2, 0x0000);
                snd_soc_write(codec, RT5640_PWR_VOL, 0x0000);