Commit 691b379c authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8735w11jso.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a4856e15
...@@ -359,6 +359,55 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod, ...@@ -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, ...@@ -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, ...@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment