ASoC: rsnd: tidyup rsnd_ssiu_busif_err_irq_ctrl()

rsnd_ssiu_busif_err_irq_ctrl() has very similar duplicated code.
This patch merge and tidyup the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Message-Id: <87sg28lwxw.wl-kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2021-05-27 11:42:03 +09:00 коммит произвёл Mark Brown
Родитель cfb7b8bf1e
Коммит 0ab000e5e5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 17 добавлений и 21 удалений

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

@ -50,8 +50,8 @@ static const int gen3_id[] = { 0, 8, 16, 24, 32, 40, 41, 42, 43, 44 };
#define rsnd_ssiu_busif_err_irq_disable(mod) rsnd_ssiu_busif_err_irq_ctrl(mod, 0) #define rsnd_ssiu_busif_err_irq_disable(mod) rsnd_ssiu_busif_err_irq_ctrl(mod, 0)
static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable) static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable)
{ {
u32 sys_int_enable = 0;
int id = rsnd_mod_id(mod); int id = rsnd_mod_id(mod);
int shift, offset;
int i; int i;
switch (id) { switch (id) {
@ -60,30 +60,26 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable)
case 2: case 2:
case 3: case 3:
case 4: case 4:
for (i = 0; i < 4; i++) { shift = id;
sys_int_enable = rsnd_mod_read(mod, SSI_SYS_INT_ENABLE(i * 2)); offset = 0;
if (enable)
sys_int_enable |= 0xf << (id * 4);
else
sys_int_enable &= ~(0xf << (id * 4));
rsnd_mod_write(mod,
SSI_SYS_INT_ENABLE(i * 2),
sys_int_enable);
}
break; break;
case 9: case 9:
for (i = 0; i < 4; i++) { shift = 1;
sys_int_enable = rsnd_mod_read(mod, SSI_SYS_INT_ENABLE((i * 2) + 1)); offset = 1;
if (enable)
sys_int_enable |= 0xf << 4;
else
sys_int_enable &= ~(0xf << 4);
rsnd_mod_write(mod,
SSI_SYS_INT_ENABLE((i * 2) + 1),
sys_int_enable);
}
break; break;
} }
for (i = 0; i < 4; i++) {
enum rsnd_reg reg = SSI_SYS_INT_ENABLE((i * 2) + offset);
u32 val = 0xf << (shift * 4);
u32 sys_int_enable = rsnd_mod_read(mod, reg);
if (enable)
sys_int_enable |= val;
else
sys_int_enable &= ~val;
rsnd_mod_write(mod, reg, sys_int_enable);
}
} }
bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod) bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod)