summaryrefslogtreecommitdiff
path: root/sound/soc/amd/vangogh
diff options
context:
space:
mode:
authorLucas Tanure <lucas.tanure@collabora.com>2023-02-17 11:08:47 +0000
committerMark Brown <broonie@kernel.org>2023-03-05 23:37:23 +0000
commit9490fbb85be830b9f4078775d678426335e36a64 (patch)
treebd66bb1212eed372068b20db9b9ef63214c6d81b /sound/soc/amd/vangogh
parenta719afe679b1c84413a70132a2de69c36b469144 (diff)
ASoC: amd: vangogh: Check Bit Clock rate before snd_soc_dai_set_pll
Check bit clock is valid before setting it with snd_soc_dai_set_pll Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-7-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/amd/vangogh')
-rw-r--r--sound/soc/amd/vangogh/acp5x-mach.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/amd/vangogh/acp5x-mach.c b/sound/soc/amd/vangogh/acp5x-mach.c
index e7183d8ac3a2..c746605b63a1 100644
--- a/sound/soc/amd/vangogh/acp5x-mach.c
+++ b/sound/soc/amd/vangogh/acp5x-mach.c
@@ -119,13 +119,19 @@ static int acp5x_nau8821_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_card *card = rtd->card;
struct snd_soc_dai *dai = snd_soc_card_get_codec_dai(card, ACP5X_NUVOTON_CODEC_DAI);
- int ret;
+ int ret, bclk;
ret = snd_soc_dai_set_sysclk(dai, NAU8821_CLK_FLL_BLK, 0, SND_SOC_CLOCK_IN);
if (ret < 0)
dev_err(card->dev, "can't set FS clock %d\n", ret);
- ret = snd_soc_dai_set_pll(dai, 0, 0, snd_soc_params_to_bclk(params),
- params_rate(params) * 256);
+
+ bclk = snd_soc_params_to_bclk(params);
+ if (bclk < 0) {
+ dev_err(dai->dev, "Fail to get BCLK rate: %d\n", bclk);
+ return bclk;
+ }
+
+ ret = snd_soc_dai_set_pll(dai, 0, 0, bclk, params_rate(params) * 256);
if (ret < 0)
dev_err(card->dev, "can't set FLL: %d\n", ret);