Skip to content

Commit 46dd2e2

Browse files
zywang33broonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 359d9ab commit 46dd2e2

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

sound/soc/rockchip/rockchip_spdif.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,7 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream,
101101
int ret;
102102

103103
srate = params_rate(params);
104-
switch (srate) {
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-
}
104+
mclk = srate * 128;
119105

120106
switch (params_format(params)) {
121107
case SNDRV_PCM_FORMAT_S16_LE:
@@ -139,7 +125,6 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream,
139125
return ret;
140126
}
141127

142-
val |= SPDIF_CFGR_CLK_DIV(mclk/(srate * 256));
143128
ret = regmap_update_bits(spdif->regmap, SPDIF_CFGR,
144129
SPDIF_CFGR_CLK_DIV_MASK | SPDIF_CFGR_HALFWORD_ENABLE |
145130
SDPIF_CFGR_VDW_MASK,

0 commit comments

Comments
 (0)