Commit 9b99e9a7 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_dma_xxx()

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from rsnd_dma_xxx()
and related function
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarKeita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4e2639ff
...@@ -137,12 +137,13 @@ char *rsnd_mod_name(struct rsnd_mod *mod) ...@@ -137,12 +137,13 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
return mod->ops->name; return mod->ops->name;
} }
struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod) struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{ {
if (!mod || !mod->ops || !mod->ops->dma_req) if (!mod || !mod->ops || !mod->ops->dma_req)
return NULL; return NULL;
return mod->ops->dma_req(mod); return mod->ops->dma_req(io, mod);
} }
int rsnd_mod_init(struct rsnd_priv *priv, int rsnd_mod_init(struct rsnd_priv *priv,
......
This diff is collapsed.
...@@ -265,7 +265,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -265,7 +265,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return 0; return 0;
} }
static struct dma_chan *rsnd_dvc_dma_req(struct rsnd_mod *mod) static struct dma_chan *rsnd_dvc_dma_req(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{ {
struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
......
...@@ -172,11 +172,11 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io); ...@@ -172,11 +172,11 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
*/ */
struct rsnd_dma; struct rsnd_dma;
struct rsnd_dma_ops { struct rsnd_dma_ops {
void (*start)(struct rsnd_dma *dma); void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
void (*stop)(struct rsnd_dma *dma); void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
int (*init)(struct rsnd_priv *priv, struct rsnd_dma *dma, int id, int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
struct rsnd_mod *mod_from, struct rsnd_mod *mod_to); struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
void (*quit)(struct rsnd_dma *dma); void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
}; };
struct rsnd_dmaen { struct rsnd_dmaen {
...@@ -200,10 +200,10 @@ struct rsnd_dma { ...@@ -200,10 +200,10 @@ struct rsnd_dma {
#define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en) #define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en)
#define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp) #define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp)
void rsnd_dma_start(struct rsnd_dma *dma); void rsnd_dma_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
void rsnd_dma_stop(struct rsnd_dma *dma); void rsnd_dma_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id); int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id);
void rsnd_dma_quit(struct rsnd_dma *dma); void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
int rsnd_dma_probe(struct platform_device *pdev, int rsnd_dma_probe(struct platform_device *pdev,
const struct rsnd_of_data *of_data, const struct rsnd_of_data *of_data,
struct rsnd_priv *priv); struct rsnd_priv *priv);
...@@ -224,7 +224,8 @@ enum rsnd_mod_type { ...@@ -224,7 +224,8 @@ enum rsnd_mod_type {
struct rsnd_mod_ops { struct rsnd_mod_ops {
char *name; char *name;
struct dma_chan* (*dma_req)(struct rsnd_mod *mod); struct dma_chan* (*dma_req)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod);
int (*probe)(struct rsnd_mod *mod, int (*probe)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct rsnd_priv *priv); struct rsnd_priv *priv);
...@@ -326,7 +327,8 @@ int rsnd_mod_init(struct rsnd_priv *priv, ...@@ -326,7 +327,8 @@ int rsnd_mod_init(struct rsnd_priv *priv,
void rsnd_mod_quit(struct rsnd_mod *mod); void rsnd_mod_quit(struct rsnd_mod *mod);
char *rsnd_mod_name(struct rsnd_mod *mod); char *rsnd_mod_name(struct rsnd_mod *mod);
int rsnd_mod_is_working(struct rsnd_mod *mod); int rsnd_mod_is_working(struct rsnd_mod *mod);
struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod); struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
struct rsnd_mod *mod);
void rsnd_mod_interrupt(struct rsnd_mod *mod, void rsnd_mod_interrupt(struct rsnd_mod *mod,
void (*callback)(struct rsnd_mod *mod, void (*callback)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io)); struct rsnd_dai_stream *io));
......
...@@ -117,10 +117,10 @@ struct rsnd_src { ...@@ -117,10 +117,10 @@ struct rsnd_src {
/* /*
* Gen1/Gen2 common functions * Gen1/Gen2 common functions
*/ */
static struct dma_chan *rsnd_src_dma_req(struct rsnd_mod *mod) static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{ {
struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
int is_play = rsnd_io_is_play(io); int is_play = rsnd_io_is_play(io);
return rsnd_dma_request_channel(rsnd_src_of_node(priv), return rsnd_dma_request_channel(rsnd_src_of_node(priv),
...@@ -810,7 +810,7 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod, ...@@ -810,7 +810,7 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
return ret; return ret;
} }
ret = rsnd_dma_init(priv, ret = rsnd_dma_init(io,
rsnd_mod_to_dma(mod), rsnd_mod_to_dma(mod),
src->info->dma_id); src->info->dma_id);
...@@ -821,7 +821,7 @@ static int rsnd_src_remove_gen2(struct rsnd_mod *mod, ...@@ -821,7 +821,7 @@ static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct rsnd_priv *priv) struct rsnd_priv *priv)
{ {
rsnd_dma_quit(rsnd_mod_to_dma(mod)); rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
return 0; return 0;
} }
...@@ -851,7 +851,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod, ...@@ -851,7 +851,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct rsnd_priv *priv) struct rsnd_priv *priv)
{ {
rsnd_dma_start(rsnd_mod_to_dma(mod)); rsnd_dma_start(io, rsnd_mod_to_dma(mod));
return _rsnd_src_start_gen2(mod); return _rsnd_src_start_gen2(mod);
} }
...@@ -864,7 +864,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod, ...@@ -864,7 +864,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
ret = _rsnd_src_stop_gen2(mod); ret = _rsnd_src_stop_gen2(mod);
rsnd_dma_stop(rsnd_mod_to_dma(mod)); rsnd_dma_stop(io, rsnd_mod_to_dma(mod));
return ret; return ret;
} }
......
...@@ -533,7 +533,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, ...@@ -533,7 +533,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
return ret; return ret;
ret = rsnd_dma_init( ret = rsnd_dma_init(
priv, rsnd_mod_to_dma(mod), io, rsnd_mod_to_dma(mod),
dma_id); dma_id);
return ret; return ret;
...@@ -547,7 +547,7 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod, ...@@ -547,7 +547,7 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
int irq = ssi->info->irq; int irq = ssi->info->irq;
rsnd_dma_quit(rsnd_mod_to_dma(mod)); rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
/* PIO will request IRQ again */ /* PIO will request IRQ again */
devm_free_irq(dev, irq, ssi); devm_free_irq(dev, irq, ssi);
...@@ -582,7 +582,7 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod, ...@@ -582,7 +582,7 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
{ {
struct rsnd_dma *dma = rsnd_mod_to_dma(mod); struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
rsnd_dma_start(dma); rsnd_dma_start(io, dma);
rsnd_ssi_start(mod, io, priv); rsnd_ssi_start(mod, io, priv);
...@@ -597,15 +597,15 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod, ...@@ -597,15 +597,15 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
rsnd_ssi_stop(mod, io, priv); rsnd_ssi_stop(mod, io, priv);
rsnd_dma_stop(dma); rsnd_dma_stop(io, dma);
return 0; return 0;
} }
static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_mod *mod) static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{ {
struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
int is_play = rsnd_io_is_play(io); int is_play = rsnd_io_is_play(io);
char *name; char *name;
......
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