Skip to content

Commit dcc2cd8

Browse files
bardliaobroonie
authored andcommitted
ASoC: Intel: sof_rt5682: use RT5682S_PLL1 if needed
When 96KHz sample rate is used, and MCLK is 24.576MHz, we will need pll_in = 24576000 and pll_out = 49152000 which is not supported by RT5682S_PLL2. Use RT5682S_PLL1 in this case. We don't test sample rate because RT5682S_PLL2 doesn't support 24.576MHz input and in the MCLK = 24.576MHz, sample rate = 48KHz case, i.e. pll_in == pll_out, PLL will not be used at all. Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20240411220347.131267-13-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent ca571e5 commit dcc2cd8

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

sound/soc/intel/boards/sof_rt5682.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,19 @@ static int sof_rt5682_hw_params(struct snd_pcm_substream *substream,
340340
clk_id = RT5682_SCLK_S_PLL1;
341341
break;
342342
case CODEC_RT5682S:
343-
pll_id = RT5682S_PLL2;
344-
clk_id = RT5682S_SCLK_S_PLL2;
343+
/*
344+
* For MCLK = 24.576MHz and sample rate = 96KHz case, use PLL1 We don't test
345+
* pll_out or params_rate() here since rt5682s PLL2 doesn't support 24.576MHz
346+
* input, so we have no choice but to use PLL1. Besides, we will not use PLL at
347+
* all if pll_in == pll_out. ex, MCLK = 24.576Mhz and sample rate = 48KHz
348+
*/
349+
if (pll_in == 24576000) {
350+
pll_id = RT5682S_PLL1;
351+
clk_id = RT5682S_SCLK_S_PLL1;
352+
} else {
353+
pll_id = RT5682S_PLL2;
354+
clk_id = RT5682S_SCLK_S_PLL2;
355+
}
345356
break;
346357
default:
347358
dev_err(rtd->dev, "invalid codec type %d\n", ctx->codec_type);

0 commit comments

Comments
 (0)