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: c003b7fd8a ("ASoC: rockchip: i2s-tdm: Fix FIFO Clear failed on SLAVE mode sometimes")

Change-Id: Ia3ae2d9b008b07addcfcec38d4e970c376dae1e7
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
Jianqun Xu
2023-06-01 15:43:52 +08:00
committed by Tao Huang
parent b221622157
commit 7aaa4bb7a2

View File

@@ -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:
*