summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSimon Je <sje@nvidia.com>2013-08-02 09:59:57 +0900
committerGabby Lee <galee@nvidia.com>2013-10-06 22:40:16 -0700
commit258b9267be53985236452406a403c2a42025ab1e (patch)
tree088981102d0716ceae72e1973d7962be0fe77ab8 /sound
parent13c6329f60ed8c629e14da52830bdb0debd29bee (diff)
asoc: codecs: rt5639: switch codec system clock
We need to switch the codec system clock to internal clock only when bias level is OFF when plugggin earjack. Bug 1340840 Change-Id: I01ad0ccff952c1f811d24cb22fde70192753d77e Signed-off-by: Simon Je <sje@nvidia.com> (cherry picked from commit a438685c653c1cd79d1edb057a678276f2dc7cfe) Reviewed-on: http://git-master/r/281660 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson <speterson@nvidia.com> Reviewed-by: Gabby Lee <galee@nvidia.com> Tested-by: Gabby Lee <galee@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5639.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/soc/codecs/rt5639.c b/sound/soc/codecs/rt5639.c
index 1e8351ce30d6..2059385ec29b 100644
--- a/sound/soc/codecs/rt5639.c
+++ b/sound/soc/codecs/rt5639.c
@@ -507,7 +507,7 @@ static void DC_Calibrate(struct snd_soc_codec *codec)
int rt5639_headset_detect(struct snd_soc_codec *codec, int jack_insert)
{
int jack_type;
- int sclk_src;
+ int sclk_src = 0;
int reg63, reg64;
if (jack_insert) {
@@ -517,11 +517,12 @@ int rt5639_headset_detect(struct snd_soc_codec *codec, int jack_insert)
snd_soc_write(codec, RT5639_PWR_ANLG1, 0xa814);
snd_soc_write(codec, RT5639_MICBIAS, 0x3830);
snd_soc_write(codec, RT5639_GEN_CTRL1 , 0x3701);
+ sclk_src = snd_soc_read(codec, RT5639_GLB_CLK) &
+ RT5639_SCLK_SRC_MASK;
+ snd_soc_update_bits(codec, RT5639_GLB_CLK,
+ RT5639_SCLK_SRC_MASK,
+ 0x3 << RT5639_SCLK_SRC_SFT);
}
- sclk_src = snd_soc_read(codec, RT5639_GLB_CLK) &
- RT5639_SCLK_SRC_MASK;
- snd_soc_update_bits(codec, RT5639_GLB_CLK,
- RT5639_SCLK_SRC_MASK, 0x3 << RT5639_SCLK_SRC_SFT);
snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
RT5639_PWR_LDO2, RT5639_PWR_LDO2);
snd_soc_update_bits(codec, RT5639_PWR_ANLG2,
@@ -548,8 +549,9 @@ int rt5639_headset_detect(struct snd_soc_codec *codec, int jack_insert)
jack_type = RT5639_HEADSET_DET;
snd_soc_update_bits(codec, RT5639_IRQ_CTRL2,
RT5639_MB1_OC_CLR, 0);
- snd_soc_update_bits(codec, RT5639_GLB_CLK,
- RT5639_SCLK_SRC_MASK, sclk_src);
+ if (SND_SOC_BIAS_OFF == codec->dapm.bias_level)
+ snd_soc_update_bits(codec, RT5639_GLB_CLK,
+ RT5639_SCLK_SRC_MASK, sclk_src);
snd_soc_write(codec, RT5639_PWR_ANLG1, reg63);
snd_soc_write(codec, RT5639_PWR_ANLG2, reg64);
} else {