[PATCH 1/5] ASoC: amd: acp: Refactor i2s bclk calculation

Venkata Prasad Potturu venkataprasad.potturu at amd.com
Tue Dec 20 08:27:01 CET 2022


Refactor i2s bclk value based on hw_params.

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu at amd.com>
---
 sound/soc/amd/acp/acp-mach-common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index a78cf29387a7..016110fd6ad8 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -352,8 +352,11 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream,
 	struct acp_card_drvdata *drvdata = card->drvdata;
 	struct snd_soc_dai *codec_dai;
 	int srate, i, ret = 0;
+	unsigned int ch, format;
 
 	srate = params_rate(params);
+	ch = params_channels(params);
+	format = 8 * params_format(params);
 
 	if (drvdata->amp_codec_id != RT1019)
 		return -EINVAL;
@@ -363,7 +366,7 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream,
 			continue;
 
 		ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK,
-					  64 * srate, 256 * srate);
+					  ch * format * srate, 256 * srate);
 		if (ret < 0)
 			return ret;
 
-- 
2.25.1



More information about the Alsa-devel mailing list