Commit 10ea76cc authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: fsi: IRQ related process had be united

Signed-off-by: default avatarKuninori Morimoto <morimoto.kuninori@renesas.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent feb58cff
...@@ -322,7 +322,7 @@ static int fsi_get_fifo_residue(struct fsi_priv *fsi, int is_play) ...@@ -322,7 +322,7 @@ static int fsi_get_fifo_residue(struct fsi_priv *fsi, int is_play)
/************************************************************************ /************************************************************************
ctrl function irq function
************************************************************************/ ************************************************************************/
...@@ -344,6 +344,35 @@ static void fsi_irq_disable(struct fsi_priv *fsi, int is_play) ...@@ -344,6 +344,35 @@ static void fsi_irq_disable(struct fsi_priv *fsi, int is_play)
fsi_master_mask_set(master, IEMSK, data, 0); fsi_master_mask_set(master, IEMSK, data, 0);
} }
static u32 fsi_irq_get_status(struct fsi_master *master)
{
return fsi_master_read(master, INT_ST);
}
static void fsi_irq_clear_all_status(struct fsi_master *master)
{
fsi_master_write(master, INT_ST, 0x0000000);
}
static void fsi_irq_clear_status(struct fsi_priv *fsi)
{
u32 data = 0;
struct fsi_master *master = fsi_get_master(fsi);
data |= fsi_port_ab_io_bit(fsi, 0);
data |= fsi_port_ab_io_bit(fsi, 1);
/* clear interrupt factor */
fsi_master_mask_set(master, INT_ST, data, 0);
}
/************************************************************************
ctrl function
************************************************************************/
static void fsi_clk_ctrl(struct fsi_priv *fsi, int enable) static void fsi_clk_ctrl(struct fsi_priv *fsi, int enable)
{ {
u32 val = fsi_is_port_a(fsi) ? (1 << 0) : (1 << 4); u32 val = fsi_is_port_a(fsi) ? (1 << 0) : (1 << 4);
...@@ -355,25 +384,17 @@ static void fsi_clk_ctrl(struct fsi_priv *fsi, int enable) ...@@ -355,25 +384,17 @@ static void fsi_clk_ctrl(struct fsi_priv *fsi, int enable)
fsi_master_mask_set(master, CLK_RST, val, 0); fsi_master_mask_set(master, CLK_RST, val, 0);
} }
static void fsi_irq_init(struct fsi_priv *fsi, int is_play) static void fsi_fifo_init(struct fsi_priv *fsi, int is_play)
{ {
u32 data;
u32 ctrl; u32 ctrl;
data = fsi_port_ab_io_bit(fsi, is_play);
ctrl = is_play ? DOFF_CTL : DIFF_CTL; ctrl = is_play ? DOFF_CTL : DIFF_CTL;
/* set IMSK */
fsi_irq_disable(fsi, is_play);
/* set interrupt generation factor */ /* set interrupt generation factor */
fsi_reg_write(fsi, ctrl, IRQ_HALF); fsi_reg_write(fsi, ctrl, IRQ_HALF);
/* clear FIFO */ /* clear FIFO */
fsi_reg_mask_set(fsi, ctrl, FIFO_CLR, FIFO_CLR); fsi_reg_mask_set(fsi, ctrl, FIFO_CLR, FIFO_CLR);
/* clear interrupt factor */
fsi_master_mask_set(fsi_get_master(fsi), INT_ST, data, 0);
} }
static void fsi_soft_all_reset(struct fsi_master *master) static void fsi_soft_all_reset(struct fsi_master *master)
...@@ -559,7 +580,7 @@ static int fsi_data_pop(struct fsi_priv *fsi, int startup) ...@@ -559,7 +580,7 @@ static int fsi_data_pop(struct fsi_priv *fsi, int startup)
static irqreturn_t fsi_interrupt(int irq, void *data) static irqreturn_t fsi_interrupt(int irq, void *data)
{ {
struct fsi_master *master = data; struct fsi_master *master = data;
u32 int_st = fsi_master_read(master, INT_ST); u32 int_st = fsi_irq_get_status(master);
/* clear irq status */ /* clear irq status */
fsi_master_mask_set(master, SOFT_RST, IR, 0); fsi_master_mask_set(master, SOFT_RST, IR, 0);
...@@ -574,7 +595,7 @@ static irqreturn_t fsi_interrupt(int irq, void *data) ...@@ -574,7 +595,7 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
if (int_st & INT_B_IN) if (int_st & INT_B_IN)
fsi_data_pop(&master->fsib, 0); fsi_data_pop(&master->fsib, 0);
fsi_master_write(master, INT_ST, 0x0000000); fsi_irq_clear_all_status(master);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -699,8 +720,12 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream, ...@@ -699,8 +720,12 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
if (is_master) if (is_master)
fsi_clk_ctrl(fsi, 1); fsi_clk_ctrl(fsi, 1);
/* irq setting */ /* irq clear */
fsi_irq_init(fsi, is_play); fsi_irq_disable(fsi, is_play);
fsi_irq_clear_status(fsi);
/* fifo init */
fsi_fifo_init(fsi, is_play);
return ret; return ret;
} }
......
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