diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2022-08-05 09:45:26 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-08-23 21:52:36 +0300 |
commit | 837b40293de66a5b96f883f540512ec5c3867610 (patch) | |
tree | 73ec46f0211d04279b8fb0db6bd20334a84bf7b1 /sound/soc/fsl/fsl_sai.c | |
parent | d4a9fd829285e488c522853faf30aca6097c2b40 (diff) | |
download | linux-837b40293de66a5b96f883f540512ec5c3867610.tar.xz |
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@nxp.com>
Link: https://lore.kernel.org/r/1659681926-13493-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl/fsl_sai.c')
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 0f92906d7a29..81f89f6767a2 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -530,12 +530,14 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, u32 watermark; 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); /* |