diff options
author | Chris Zhong <zyw@rock-chips.com> | 2016-07-18 10:34:34 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-07-18 10:38:28 -0400 |
commit | 46dd2e28a90e48fbf1b7e253933fa3b7242e9b1b (patch) | |
tree | 4bf92522aeb261947955bd1b6ab2330132f9e1c5 | |
parent | 359d9abdc208c662d8c9ff2966a7c6014124f715 (diff) |
ASoC: rockchip: correct the spdif clk
The spdif mclk should be 128 times of sample rate, and there is a
internal divider, the real rate of spdif mclk is mclk / (div + 1).
Hence, the original driver always get the good frequency for
48000/96000/44100/192000. But for 32000, the mclk is incorrect,
it should be 32000*128, but get 48000*128. Do not use the internal
divider here, just set all mclk to 128 * sample rate directly.
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/rockchip/rockchip_spdif.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c index 100781e37848..4ca265737eda 100644 --- a/sound/soc/rockchip/rockchip_spdif.c +++ b/sound/soc/rockchip/rockchip_spdif.c | |||
@@ -101,21 +101,7 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream, | |||
101 | int ret; | 101 | int ret; |
102 | 102 | ||
103 | srate = params_rate(params); | 103 | srate = params_rate(params); |
104 | switch (srate) { | 104 | mclk = srate * 128; |
105 | case 32000: | ||
106 | case 48000: | ||
107 | case 96000: | ||
108 | mclk = 96000 * 128; /* 12288000 hz */ | ||
109 | break; | ||
110 | case 44100: | ||
111 | mclk = 44100 * 256; /* 11289600 hz */ | ||
112 | break; | ||
113 | case 192000: | ||
114 | mclk = 192000 * 128; /* 24576000 hz */ | ||
115 | break; | ||
116 | default: | ||
117 | return -EINVAL; | ||
118 | } | ||
119 | 105 | ||
120 | switch (params_format(params)) { | 106 | switch (params_format(params)) { |
121 | case SNDRV_PCM_FORMAT_S16_LE: | 107 | case SNDRV_PCM_FORMAT_S16_LE: |
@@ -139,7 +125,6 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream, | |||
139 | return ret; | 125 | return ret; |
140 | } | 126 | } |
141 | 127 | ||
142 | val |= SPDIF_CFGR_CLK_DIV(mclk/(srate * 256)); | ||
143 | ret = regmap_update_bits(spdif->regmap, SPDIF_CFGR, | 128 | ret = regmap_update_bits(spdif->regmap, SPDIF_CFGR, |
144 | SPDIF_CFGR_CLK_DIV_MASK | SPDIF_CFGR_HALFWORD_ENABLE | | 129 | SPDIF_CFGR_CLK_DIV_MASK | SPDIF_CFGR_HALFWORD_ENABLE | |
145 | SDPIF_CFGR_VDW_MASK, | 130 | SDPIF_CFGR_VDW_MASK, |