ASoC: rsnd: add rsnd_ssi_busif_err_status_clear()

Current ssi.c clears BUSIF error status at __rsnd_ssi_interrupt(),
but its code is verbose.
This patch off-load it to rsnd_ssi_busif_err_status_clear().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8735w11jso.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2021-04-08 13:28:55 +09:00 коммит произвёл Mark Brown
Родитель a4856e15e5
Коммит 691b379cbe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 51 добавлений и 46 удалений

Просмотреть файл

@ -359,6 +359,55 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod,
rsnd_adg_ssi_clk_stop(mod); rsnd_adg_ssi_clk_stop(mod);
} }
static bool rsnd_ssi_busif_err_status_clear(struct rsnd_mod *mod)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
u32 status;
bool stop = false;
int id = rsnd_mod_id(mod);
int i;
switch (id) {
case 0:
case 1:
case 2:
case 3:
case 4:
for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod, SSI_SYS_STATUS(i * 2));
status &= 0xf << (id * 4);
if (status) {
rsnd_dbg_irq_status(dev, "%s err status : 0x%08x\n",
rsnd_mod_name(mod), status);
rsnd_mod_write(mod,
SSI_SYS_STATUS(i * 2),
0xf << (id * 4));
stop = true;
}
}
break;
case 9:
for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod, SSI_SYS_STATUS((i * 2) + 1));
status &= 0xf << 4;
if (status) {
rsnd_dbg_irq_status(dev, "%s err status : 0x%08x\n",
rsnd_mod_name(mod), status);
rsnd_mod_write(mod,
SSI_SYS_STATUS((i * 2) + 1),
0xf << 4);
stop = true;
}
}
break;
}
return stop;
}
static void rsnd_ssi_config_init(struct rsnd_mod *mod, static void rsnd_ssi_config_init(struct rsnd_mod *mod,
struct rsnd_dai_stream *io) struct rsnd_dai_stream *io)
{ {
@ -748,8 +797,6 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
u32 status; u32 status;
bool elapsed = false; bool elapsed = false;
bool stop = false; bool stop = false;
int id = rsnd_mod_id(mod);
int i;
int is_tdm, is_tdm_split; int is_tdm, is_tdm_split;
is_tdm = rsnd_runtime_is_tdm(io); is_tdm = rsnd_runtime_is_tdm(io);
@ -775,50 +822,8 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
stop = true; stop = true;
} }
status = 0; if (is_tdm || is_tdm_split)
stop |= rsnd_ssi_busif_err_status_clear(mod);
if (is_tdm || is_tdm_split) {
switch (id) {
case 0:
case 1:
case 2:
case 3:
case 4:
for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod,
SSI_SYS_STATUS(i * 2));
status &= 0xf << (id * 4);
if (status) {
rsnd_dbg_irq_status(dev,
"%s err status : 0x%08x\n",
rsnd_mod_name(mod), status);
rsnd_mod_write(mod,
SSI_SYS_STATUS(i * 2),
0xf << (id * 4));
stop = true;
}
}
break;
case 9:
for (i = 0; i < 4; i++) {
status = rsnd_mod_read(mod,
SSI_SYS_STATUS((i * 2) + 1));
status &= 0xf << 4;
if (status) {
rsnd_dbg_irq_status(dev,
"%s err status : 0x%08x\n",
rsnd_mod_name(mod), status);
rsnd_mod_write(mod,
SSI_SYS_STATUS((i * 2) + 1),
0xf << 4);
stop = true;
}
}
break;
}
}
rsnd_ssi_status_clear(mod); rsnd_ssi_status_clear(mod);
rsnd_ssi_interrupt_out: rsnd_ssi_interrupt_out: