summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/imx-spdif.c
diff options
context:
space:
mode:
authorViorel Suman <viorel.suman@nxp.com>2018-08-23 13:18:25 +0300
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:54:22 +0800
commit8e013fb268248049cc221513f6562b90882b4fc8 (patch)
treedce7832e3ad28062a92f73400d20d87ea2107e86 /sound/soc/fsl/imx-spdif.c
parent084c2ca345337bc4a260f33b4561f5c860413381 (diff)
MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
Allow PLL switch for playback stream only and remove PLL switch guard with regard to capture stream as the clock for capture stream is provided externally. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> (cherry picked from commit c8213da5fbcd370acb4d764bef5df5981a517c11)
Diffstat (limited to 'sound/soc/fsl/imx-spdif.c')
-rw-r--r--sound/soc/fsl/imx-spdif.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
index f2d0c6f6193f..1a64302aa595 100644
--- a/sound/soc/fsl/imx-spdif.c
+++ b/sound/soc/fsl/imx-spdif.c
@@ -20,15 +20,17 @@ static int imx_spdif_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct device *dev = rtd->card->dev;
- int ret;
+ int ret = 0;
u64 rate = params_rate(params);
unsigned int freq;
- freq = do_div(rate, 8000) ? CLK_11K_FREQ : CLK_8K_FREQ;
- ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, STC_TXCLK_SPDIF_ROOT,
- freq, SND_SOC_CLOCK_OUT);
- if (ret)
- dev_err(dev, "failed to set cpu sysclk: %d\n", ret);
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ freq = do_div(rate, 8000) ? CLK_11K_FREQ : CLK_8K_FREQ;
+ ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, STC_TXCLK_SPDIF_ROOT,
+ freq, SND_SOC_CLOCK_OUT);
+ if (ret)
+ dev_err(dev, "failed to set cpu sysclk: %d\n", ret);
+ }
return ret;
}