Commit b5b442ab authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: add .irq callback

Current rsnd driver has .init/.start/.stop/.quit callbacks,
and it needs many IPs (SRC/CTU/MUX/DVC/CMD/SSIU/SSI).
Because of these relationship, it might get unnecessary
error IRQ when start/stop.
This patch adds new .irq callback and control IRQ enable/disable
timing to avoid it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6a25c8da
...@@ -568,9 +568,16 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -568,9 +568,16 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
ret = rsnd_dai_call(start, io, priv); ret = rsnd_dai_call(start, io, priv);
if (ret < 0) if (ret < 0)
goto dai_trigger_end; goto dai_trigger_end;
ret = rsnd_dai_call(irq, io, priv, 1);
if (ret < 0)
goto dai_trigger_end;
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
ret = rsnd_dai_call(stop, io, priv); ret = rsnd_dai_call(irq, io, priv, 0);
ret |= rsnd_dai_call(stop, io, priv);
ret |= rsnd_dai_call(quit, io, priv); ret |= rsnd_dai_call(quit, io, priv);
......
...@@ -249,6 +249,9 @@ struct rsnd_mod_ops { ...@@ -249,6 +249,9 @@ struct rsnd_mod_ops {
int (*stop)(struct rsnd_mod *mod, int (*stop)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct rsnd_priv *priv); struct rsnd_priv *priv);
int (*irq)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv, int enable);
int (*pcm_new)(struct rsnd_mod *mod, int (*pcm_new)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd); struct snd_soc_pcm_runtime *rtd);
...@@ -293,6 +296,7 @@ struct rsnd_mod { ...@@ -293,6 +296,7 @@ struct rsnd_mod {
#define __rsnd_mod_shift_stop 8 #define __rsnd_mod_shift_stop 8
#define __rsnd_mod_shift_probe 28 /* always called */ #define __rsnd_mod_shift_probe 28 /* always called */
#define __rsnd_mod_shift_remove 28 /* always called */ #define __rsnd_mod_shift_remove 28 /* always called */
#define __rsnd_mod_shift_irq 28 /* always called */
#define __rsnd_mod_shift_pcm_new 28 /* always called */ #define __rsnd_mod_shift_pcm_new 28 /* always called */
#define __rsnd_mod_shift_fallback 28 /* always called */ #define __rsnd_mod_shift_fallback 28 /* always called */
#define __rsnd_mod_shift_hw_params 28 /* always called */ #define __rsnd_mod_shift_hw_params 28 /* always called */
...@@ -303,6 +307,7 @@ struct rsnd_mod { ...@@ -303,6 +307,7 @@ struct rsnd_mod {
#define __rsnd_mod_add_quit -1 #define __rsnd_mod_add_quit -1
#define __rsnd_mod_add_start 1 #define __rsnd_mod_add_start 1
#define __rsnd_mod_add_stop -1 #define __rsnd_mod_add_stop -1
#define __rsnd_mod_add_irq 0
#define __rsnd_mod_add_pcm_new 0 #define __rsnd_mod_add_pcm_new 0
#define __rsnd_mod_add_fallback 0 #define __rsnd_mod_add_fallback 0
#define __rsnd_mod_add_hw_params 0 #define __rsnd_mod_add_hw_params 0
...@@ -313,6 +318,7 @@ struct rsnd_mod { ...@@ -313,6 +318,7 @@ struct rsnd_mod {
#define __rsnd_mod_call_quit 1 #define __rsnd_mod_call_quit 1
#define __rsnd_mod_call_start 0 #define __rsnd_mod_call_start 0
#define __rsnd_mod_call_stop 1 #define __rsnd_mod_call_stop 1
#define __rsnd_mod_call_irq 0
#define __rsnd_mod_call_pcm_new 0 #define __rsnd_mod_call_pcm_new 0
#define __rsnd_mod_call_fallback 0 #define __rsnd_mod_call_fallback 0
#define __rsnd_mod_call_hw_params 0 #define __rsnd_mod_call_hw_params 0
......
...@@ -271,9 +271,10 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, ...@@ -271,9 +271,10 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,
rsnd_adg_set_convert_timing_gen2(mod, io); rsnd_adg_set_convert_timing_gen2(mod, io);
} }
#define rsnd_src_irq_enable(mod) rsnd_src_irq_ctrol(mod, 1) static int rsnd_src_irq(struct rsnd_mod *mod,
#define rsnd_src_irq_disable(mod) rsnd_src_irq_ctrol(mod, 0) struct rsnd_dai_stream *io,
static void rsnd_src_irq_ctrol(struct rsnd_mod *mod, int enable) struct rsnd_priv *priv,
int enable)
{ {
struct rsnd_src *src = rsnd_mod_to_src(mod); struct rsnd_src *src = rsnd_mod_to_src(mod);
u32 sys_int_val, int_val, sys_int_mask; u32 sys_int_val, int_val, sys_int_mask;
...@@ -305,6 +306,8 @@ static void rsnd_src_irq_ctrol(struct rsnd_mod *mod, int enable) ...@@ -305,6 +306,8 @@ static void rsnd_src_irq_ctrol(struct rsnd_mod *mod, int enable)
rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val); rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val);
rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val); rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val);
rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val); rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val);
return 0;
} }
static void rsnd_src_status_clear(struct rsnd_mod *mod) static void rsnd_src_status_clear(struct rsnd_mod *mod)
...@@ -381,8 +384,6 @@ static int rsnd_src_init(struct rsnd_mod *mod, ...@@ -381,8 +384,6 @@ static int rsnd_src_init(struct rsnd_mod *mod,
rsnd_src_status_clear(mod); rsnd_src_status_clear(mod);
rsnd_src_irq_enable(mod);
/* reset sync convert_rate */ /* reset sync convert_rate */
src->sync.val = 0; src->sync.val = 0;
...@@ -395,8 +396,6 @@ static int rsnd_src_quit(struct rsnd_mod *mod, ...@@ -395,8 +396,6 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
{ {
struct rsnd_src *src = rsnd_mod_to_src(mod); struct rsnd_src *src = rsnd_mod_to_src(mod);
rsnd_src_irq_disable(mod);
rsnd_src_halt(mod); rsnd_src_halt(mod);
rsnd_mod_power_off(mod); rsnd_mod_power_off(mod);
...@@ -455,7 +454,7 @@ static int rsnd_src_probe_(struct rsnd_mod *mod, ...@@ -455,7 +454,7 @@ static int rsnd_src_probe_(struct rsnd_mod *mod,
/* /*
* IRQ is not supported on non-DT * IRQ is not supported on non-DT
* see * see
* rsnd_src_irq_enable() * rsnd_src_irq()
*/ */
ret = devm_request_irq(dev, irq, ret = devm_request_irq(dev, irq,
rsnd_src_interrupt, rsnd_src_interrupt,
...@@ -518,6 +517,7 @@ static struct rsnd_mod_ops rsnd_src_ops = { ...@@ -518,6 +517,7 @@ static struct rsnd_mod_ops rsnd_src_ops = {
.quit = rsnd_src_quit, .quit = rsnd_src_quit,
.start = rsnd_src_start, .start = rsnd_src_start,
.stop = rsnd_src_stop, .stop = rsnd_src_stop,
.irq = rsnd_src_irq,
.hw_params = rsnd_src_hw_params, .hw_params = rsnd_src_hw_params,
.pcm_new = rsnd_src_pcm_new, .pcm_new = rsnd_src_pcm_new,
}; };
......
...@@ -142,30 +142,24 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod, ...@@ -142,30 +142,24 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod,
dev_warn(dev, "status check failed\n"); dev_warn(dev, "status check failed\n");
} }
static int rsnd_ssi_irq_enable(struct rsnd_mod *ssi_mod) static int rsnd_ssi_irq(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv,
int enable)
{ {
struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
u32 val = 0;
if (rsnd_is_gen1(priv)) if (rsnd_is_gen1(priv))
return 0; return 0;
/* enable SSI interrupt if Gen2 */ if (ssi->usrcnt != 1)
rsnd_mod_write(ssi_mod, SSI_INT_ENABLE,
rsnd_ssi_is_dma_mode(ssi_mod) ?
0x0e000000 : 0x0f000000);
return 0; return 0;
}
static int rsnd_ssi_irq_disable(struct rsnd_mod *ssi_mod) if (enable)
{ val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000;
struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
if (rsnd_is_gen1(priv)) rsnd_mod_write(mod, SSI_INT_ENABLE, val);
return 0;
/* disable SSI interrupt if Gen2 */
rsnd_mod_write(ssi_mod, SSI_INT_ENABLE, 0x00000000);
return 0; return 0;
} }
...@@ -387,8 +381,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ...@@ -387,8 +381,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
/* clear error status */ /* clear error status */
rsnd_ssi_status_clear(mod); rsnd_ssi_status_clear(mod);
rsnd_ssi_irq_enable(mod);
return 0; return 0;
} }
...@@ -405,12 +397,9 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, ...@@ -405,12 +397,9 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,
return -EIO; return -EIO;
} }
if (!rsnd_ssi_is_parent(mod, io)) { if (!rsnd_ssi_is_parent(mod, io))
ssi->cr_own = 0; ssi->cr_own = 0;
rsnd_ssi_irq_disable(mod);
}
rsnd_ssi_master_clk_stop(ssi, io); rsnd_ssi_master_clk_stop(ssi, io);
rsnd_mod_power_off(mod); rsnd_mod_power_off(mod);
...@@ -627,6 +616,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = { ...@@ -627,6 +616,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
.quit = rsnd_ssi_quit, .quit = rsnd_ssi_quit,
.start = rsnd_ssi_start, .start = rsnd_ssi_start,
.stop = rsnd_ssi_stop, .stop = rsnd_ssi_stop,
.irq = rsnd_ssi_irq,
.hw_params = rsnd_ssi_hw_params, .hw_params = rsnd_ssi_hw_params,
}; };
......
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