From c40224f930f37a9356bc240cf9fe137cbcd08df6 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Tue, 8 Apr 2025 19:39:51 +0800 Subject: [PATCH] ASoC: rockchip: sai: Fix the slot mask bitmap The tx and rx masks use a 1 bit for an active slot as default, and the default active bits are at the LSB of the masks. The explicit masks are given as array of integers, where the first number presents bit-0 (LSB), second presents bit-1, etc. Any non zero number is considered 1 and 0 is 0. So, we need do a XOR to get the masked bitmap. Fixes: e0d4c336d281 ("ASoC: rockchip: sai: Add support for slot mask cfg") Signed-off-by: Sugar Zhang Change-Id: I7f9baea58a4f6bea3e99f97ef9161ac94152a6f5 --- sound/soc/rockchip/rockchip_sai.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/rockchip/rockchip_sai.c b/sound/soc/rockchip/rockchip_sai.c index a226b4e576a7..99faa5890638 100644 --- a/sound/soc/rockchip/rockchip_sai.c +++ b/sound/soc/rockchip/rockchip_sai.c @@ -1081,6 +1081,9 @@ static int rockchip_sai_set_tdm_slot(struct snd_soc_dai *dai, { struct rk_sai_dev *sai = snd_soc_dai_get_drvdata(dai); + tx_mask ^= (BIT(slots) - 1); + rx_mask ^= (BIT(slots) - 1); + pm_runtime_get_sync(dai->dev); regmap_update_bits(sai->regmap, SAI_TXCR, SAI_XCR_SBW_MASK, SAI_XCR_SBW(slot_width));