summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-05-06 16:56:44 +0800
committerNitin Garg <nitin.garg@freescale.com>2015-09-17 09:22:58 -0500
commita338fca9b0720c9096b6ae2dc8383bebb2e48a6f (patch)
tree7c14580f7de0e1c919317208c373cf3cc999939b /sound
parent995fcba1b033a1749fffb9c239321dde1c7d30e4 (diff)
MLK-10830 ASoC: imx-wm8960: audio mclk should be enabled early to avoid jack detect error
Audio mclk should be enabled early to avoid jack detect error. It will playback from speaker in the first 2 seconds, then switch to headphone. Steps to reproduce this issue: 1. plug out headphone and playback a wav. 2. stop playback and wait for at least 5 seconds, then plug in headphone and playback a wav. And set TOCLKSEL (bit1 R23) to get faster jack detect response. Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-wm8960.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/soc/fsl/imx-wm8960.c b/sound/soc/fsl/imx-wm8960.c
index 46249fecb63c..51eb9fbdfcb0 100644
--- a/sound/soc/fsl/imx-wm8960.c
+++ b/sound/soc/fsl/imx-wm8960.c
@@ -226,7 +226,7 @@ static void wm8960_init(struct snd_soc_dai *codec_dai)
snd_soc_update_bits(codec, WM8960_ADDCTL2, 1<<6, 1<<6);
snd_soc_update_bits(codec, WM8960_ADDCTL2, 1<<5, data->hp_det[1]<<5);
snd_soc_update_bits(codec, WM8960_ADDCTL4, 3<<2, data->hp_det[0]<<2);
- snd_soc_update_bits(codec, WM8960_ADDCTL1, 1, 1);
+ snd_soc_update_bits(codec, WM8960_ADDCTL1, 3, 3);
/*
* route left channel to right channel in default.
@@ -422,6 +422,12 @@ static int imx_hifi_startup(struct snd_pcm_substream *substream)
return ret;
}
+ ret = clk_prepare_enable(data->codec_clk);
+ if (ret) {
+ dev_err(card->dev, "Failed to enable MCLK: %d\n", ret);
+ return ret;
+ }
+
return ret;
}
@@ -433,6 +439,8 @@ static void imx_hifi_shutdown(struct snd_pcm_substream *substream)
struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ clk_disable_unprepare(data->codec_clk);
+
data->is_stream_opened[tx] = false;
}