diff options
author | Zidan Wang <zidan.wang@freescale.com> | 2015-03-19 13:01:16 +0800 |
---|---|---|
committer | guoyin.chen <guoyin.chen@freescale.com> | 2015-05-08 17:20:03 +0800 |
commit | 057ecfb8c695e32044a171a6ee30652f4b5a265a (patch) | |
tree | 6c69bcc2ef24eb98e0a58cf22871dfab754f2479 /sound | |
parent | bdb587699b4c30f9c541f0eb3b2028dc3345aad9 (diff) |
MLK-10442 ASoC: imx-wm8960: PLL should be disable only when no stream playback or capture
The second stream will disable PLL, and will affect the first stream.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/imx-wm8960.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sound/soc/fsl/imx-wm8960.c b/sound/soc/fsl/imx-wm8960.c index e0aa9399470a..e41114222d0c 100644 --- a/sound/soc/fsl/imx-wm8960.c +++ b/sound/soc/fsl/imx-wm8960.c @@ -35,6 +35,7 @@ struct imx_wm8960_data { struct clk *codec_clk; unsigned int clk_frequency; bool is_codec_master; + bool stream[2]; }; struct imx_priv { @@ -42,6 +43,7 @@ struct imx_priv { struct platform_device *pdev; struct snd_card *snd_card; }; + static struct imx_priv card_priv; /* -1 for reserved value */ @@ -64,6 +66,7 @@ static int imx_hifi_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_card *card = codec_dai->codec->card; struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card); + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; struct device *dev = card->dev; unsigned int sample_rate = params_rate(params); unsigned int sysclk, pll_out; @@ -73,6 +76,11 @@ static int imx_hifi_hw_params(struct snd_pcm_substream *substream, if (params_channels(params) == 1) bclk *= 2; + data->stream[tx] = true; + + if (data->stream[tx] && data->stream[!tx]) + return 0; + /* set cpu DAI configuration */ ret = snd_soc_dai_set_fmt(cpu_dai, data->dai.dai_fmt); if (ret) { @@ -174,9 +182,12 @@ static int imx_hifi_hw_free(struct snd_pcm_substream *substream) struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_card *card = codec_dai->codec->card; struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card); + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; + + data->stream[tx] = false; /* Power down PLL to save power*/ - if (data->is_codec_master) + if (data->is_codec_master && !data->stream[tx] && !data->stream[!tx]) snd_soc_dai_set_pll(codec_dai, 0, 0, 0, 0); return 0; |