summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-05-06 16:56:44 +0800
committerJason Liu <r64343@freescale.com>2015-05-08 16:36:19 +0800
commitd5262d723c4df8af0d57fae1038c0ce42839029f (patch)
treefff1a0c6032b5c48a55186a71d3b758e6770c683 /sound
parent96d877da57665885e05d630207a55e1597d08321 (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;
}