aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5651.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/rt5651.c')
-rw-r--r--sound/soc/codecs/rt5651.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
index a627a1f9dfcb..ea4b1c652a26 100644
--- a/sound/soc/codecs/rt5651.c
+++ b/sound/soc/codecs/rt5651.c
@@ -1338,21 +1338,6 @@ static const struct snd_soc_dapm_route rt5651_dapm_routes[] = {
1338 {"PDMR", NULL, "PDM R Mux"}, 1338 {"PDMR", NULL, "PDM R Mux"},
1339}; 1339};
1340 1340
1341static int get_clk_info(int sclk, int rate)
1342{
1343 int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16};
1344
1345 if (sclk <= 0 || rate <= 0)
1346 return -EINVAL;
1347
1348 rate = rate << 8;
1349 for (i = 0; i < ARRAY_SIZE(pd); i++)
1350 if (sclk == rate * pd[i])
1351 return i;
1352
1353 return -EINVAL;
1354}
1355
1356static int rt5651_hw_params(struct snd_pcm_substream *substream, 1341static int rt5651_hw_params(struct snd_pcm_substream *substream,
1357 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 1342 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
1358{ 1343{
@@ -1362,7 +1347,7 @@ static int rt5651_hw_params(struct snd_pcm_substream *substream,
1362 int pre_div, bclk_ms, frame_size; 1347 int pre_div, bclk_ms, frame_size;
1363 1348
1364 rt5651->lrck[dai->id] = params_rate(params); 1349 rt5651->lrck[dai->id] = params_rate(params);
1365 pre_div = get_clk_info(rt5651->sysclk, rt5651->lrck[dai->id]); 1350 pre_div = rl6231_get_clk_info(rt5651->sysclk, rt5651->lrck[dai->id]);
1366 1351
1367 if (pre_div < 0) { 1352 if (pre_div < 0) {
1368 dev_err(codec->dev, "Unsupported clock setting\n"); 1353 dev_err(codec->dev, "Unsupported clock setting\n");