diff options
author | Viorel Suman <viorel.suman@nxp.com> | 2018-08-23 13:18:25 +0300 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 13:04:10 +0300 |
commit | 0e633504f21f0e40d6223eb03bf4e6db890047e9 (patch) | |
tree | 66e9a7dc0b8c5f913e4c25f74d123352ddb43152 /sound | |
parent | 262bdc4f2e481a5bdec508a7c93f6341b90e919e (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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_spdif.c | 23 | ||||
-rw-r--r-- | sound/soc/fsl/imx-spdif.c | 14 |
2 files changed, 13 insertions, 24 deletions
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index bb5713f8c4fe..a7a3639e50b2 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -131,7 +131,6 @@ struct fsl_spdif_priv { u32 regcache_srpc; struct clk *pll8k_clk; struct clk *pll11k_clk; - u8 streams; }; static struct fsl_spdif_soc_data fsl_spdif_vf610 = { @@ -638,9 +637,6 @@ static int fsl_spdif_hw_params(struct snd_pcm_substream *substream, ret = spdif_set_rx_clksrc(spdif_priv, SPDIF_DEFAULT_GAINSEL, 1); } - if (!ret) - spdif_priv->streams |= BIT(substream->stream); - return ret; } @@ -683,8 +679,6 @@ static int fsl_spdif_hw_free(struct snd_pcm_substream *substream, if (spdif_priv->soc->dma_workaround) clear_gpt_dma(substream, spdif_priv->dma_info); - spdif_priv->streams &= ~BIT(substream->stream); - return 0; } @@ -827,18 +821,11 @@ static int fsl_spdif_set_dai_sysclk(struct snd_soc_dai *cpu_dai, if (pll) { npll = (do_div(ratio, 8000) ? data->pll11k_clk : data->pll8k_clk); if (!clk_is_match(pll, npll)) { - if (!data->streams) { - ret = clk_set_parent(p, npll); - if (ret < 0) - dev_warn(cpu_dai->dev, - "failed to set parent %s: %d\n", - __clk_get_name(npll), ret); - } else { - dev_err(cpu_dai->dev, - "PLL %s is in use by a running stream.\n", - __clk_get_name(pll)); - return -EINVAL; - } + ret = clk_set_parent(p, npll); + if (ret < 0) + dev_warn(cpu_dai->dev, + "failed to set parent %s: %d\n", + __clk_get_name(npll), ret); } } diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c index 440f7cd72d42..80a2dbdf272b 100644 --- a/sound/soc/fsl/imx-spdif.c +++ b/sound/soc/fsl/imx-spdif.c @@ -27,15 +27,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; } |