summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_spdif.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2014-09-16 19:18:49 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:54:14 +0800
commit15bbc61393d0543c3259a35dcc18131a0fb20926 (patch)
treee379b5f4ed0ba2f62616525bd3077c4ea11848bb /sound/soc/fsl/fsl_spdif.c
parent219d54332a09e8d8741c1e1982f5eae56099de85 (diff)
MLK-11429-1: ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
cherry-pick below patch from imx_3.14.y ENGR00331799-2 ASoC: fsl_spdif: don't change the root clock rate of spdif in driver The spdif root clock may be used by other module or defined with CLK_SET_RATE_GATE, so we can't change the clock rate in driver. In this patch remove the clk_set_rate and clk_round_rate to protect the clock. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> (cherry picked from commit c77170b2c9a9737f6fd61a5ea85a43b90e8ef02b) [ Aisheng: fix incorrectly removing u64 rate_actual ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_spdif.c')
-rw-r--r--sound/soc/fsl/fsl_spdif.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 7858a5499ac5..b8ddefa763a1 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -2,7 +2,7 @@
//
// Freescale S/PDIF ALSA SoC Digital Audio Interface (DAI) driver
//
-// Copyright (C) 2013 Freescale Semiconductor, Inc.
+// Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
//
// Based on stmp3xxx_spdif_dai.c
// Vladimir Barinov <vbarinov@embeddedalley.com>
@@ -378,7 +378,6 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream,
u32 stc, mask, rate;
u16 sysclk_df;
u8 clk, txclk_df;
- int ret;
switch (sample_rate) {
case 32000:
@@ -420,19 +419,6 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream,
sysclk_df = spdif_priv->sysclk_df[rate];
- /* Don't mess up the clocks from other modules */
- if (clk != STC_TXCLK_SPDIF_ROOT)
- goto clk_set_bypass;
-
- /* The S/PDIF block needs a clock of 64 * fs * txclk_df */
- ret = clk_set_rate(spdif_priv->txclk[rate],
- 64 * sample_rate * txclk_df);
- if (ret) {
- dev_err(&pdev->dev, "failed to set tx clock rate\n");
- return ret;
- }
-
-clk_set_bypass:
dev_dbg(&pdev->dev, "expected clock rate = %d\n",
(64 * sample_rate * txclk_df * sysclk_df));
dev_dbg(&pdev->dev, "actual clock rate = %ld\n",
@@ -1120,11 +1106,8 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
for (sysclk_df = sysclk_dfmin; sysclk_df <= sysclk_dfmax; sysclk_df++) {
for (txclk_df = 1; txclk_df <= 128; txclk_df++) {
- rate_ideal = rate[index] * txclk_df * 64ULL;
- if (round)
- rate_actual = clk_round_rate(clk, rate_ideal);
- else
- rate_actual = clk_get_rate(clk);
+
+ rate_actual = clk_get_rate(clk);
arate = rate_actual / 64;
arate /= txclk_df * sysclk_df;