[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1659681926-13493-1-git-send-email-shengjiu.wang@nxp.com>
Date: Fri, 5 Aug 2022 14:45:26 +0800
From: Shengjiu Wang <shengjiu.wang@....com>
To: nicoleotsuka@...il.com, Xiubo.Lee@...il.com, festevam@...il.com,
shengjiu.wang@...il.com, lgirdwood@...il.com, broonie@...nel.org,
perex@...ex.cz, tiwai@...e.com, alsa-devel@...a-project.org
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: fsl_sai: Update slots number according to bclk_ratio
The bclk_ratio is set by .set_bclk_ratio API.
bclk_ratio = slots * slot_width
So if slots is not set by .set_tdm_slot, then it can be calculated
by bclk_ratio.
Signed-off-by: Shengjiu Wang <shengjiu.wang@....com>
---
sound/soc/fsl/fsl_sai.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 7523bb944b21..acf76ea21138 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -535,12 +535,14 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
u32 pins, bclk;
int ret, i;
- if (sai->slots)
- slots = sai->slots;
-
if (sai->slot_width)
slot_width = sai->slot_width;
+ if (sai->slots)
+ slots = sai->slots;
+ else if (sai->bclk_ratio)
+ slots = sai->bclk_ratio / slot_width;
+
pins = DIV_ROUND_UP(channels, slots);
/*
--
2.17.1
Powered by blists - more mailing lists