From 7aaa4bb7a27f1e4649b1a1eb5ccbc1a562c8aab8 Mon Sep 17 00:00:00 2001 From: Jianqun Xu Date: Thu, 1 Jun 2023 15:43:52 +0800 Subject: [PATCH] ASoC: rockchip: i2s-tdm: try normal clear before switch master mode As mind by sugar, sometimes the master device will exit unexpectly, stop the sclk before the slave device to do stop trigger, for example the bt module, which not act as a codec driver, is replaced by a dummy codec. This patch adds a normal clear for i2s tdm before force switch to master. Fixes: c003b7fd8a44 ("ASoC: rockchip: i2s-tdm: Fix FIFO Clear failed on SLAVE mode sometimes") Change-Id: Ia3ae2d9b008b07addcfcec38d4e970c376dae1e7 Signed-off-by: Jianqun Xu --- sound/soc/rockchip/rockchip_i2s_tdm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index 2ff2b9c4a020..a8da138200ad 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -397,6 +397,12 @@ static int rockchip_i2s_tdm_clear(struct rk_i2s_tdm_dev *i2s_tdm, return -EINVAL; } + regmap_update_bits(i2s_tdm->regmap, I2S_CLR, clr, clr); + ret = regmap_read_poll_timeout_atomic(i2s_tdm->regmap, I2S_CLR, val, + !(val & clr), 10, 100); + if (ret == 0) + return 0; + /* * Workaround for FIFO clear on SLAVE mode: *