ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_ssi_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_ssi_xxx()
and related function.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2015-06-15 06:26:56 +00:00 committed by Mark Brown
parent 9b99e9a7c5
commit bfc0cfe6b7
3 changed files with 20 additions and 16 deletions

View File

@ -455,7 +455,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
dev_err(dev, "DVC is selected without SRC\n"); dev_err(dev, "DVC is selected without SRC\n");
/* use SSIU or SSI ? */ /* use SSIU or SSI ? */
if (is_ssi && rsnd_ssi_use_busif(mod)) if (is_ssi && rsnd_ssi_use_busif(io, mod))
is_ssi++; is_ssi++;
return (is_from) ? return (is_from) ?

View File

@ -559,7 +559,7 @@ void rsnd_ssi_remove(struct platform_device *pdev,
struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod); int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
int rsnd_ssi_use_busif(struct rsnd_mod *mod); int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
/* /*
* R-Car DVC * R-Car DVC

View File

@ -87,10 +87,9 @@ struct rsnd_ssi {
#define rsnd_ssi_of_node(priv) \ #define rsnd_ssi_of_node(priv) \
of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi") of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi")
int rsnd_ssi_use_busif(struct rsnd_mod *mod) int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod)
{ {
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
int use_busif = 0; int use_busif = 0;
if (!rsnd_ssi_is_dma_mode(mod)) if (!rsnd_ssi_is_dma_mode(mod))
@ -226,10 +225,9 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
rsnd_mod_name(&ssi->mod), rsnd_mod_id(&ssi->mod)); rsnd_mod_name(&ssi->mod), rsnd_mod_id(&ssi->mod));
} }
static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi) static void rsnd_ssi_hw_stop(struct rsnd_dai_stream *io, struct rsnd_ssi *ssi)
{ {
struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod); struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(&ssi->mod);
struct rsnd_dai *rdai = rsnd_io_to_rdai(io); struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
u32 cr; u32 cr;
@ -263,7 +261,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi); struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi);
if (ssi_parent) if (ssi_parent)
rsnd_ssi_hw_stop(ssi_parent); rsnd_ssi_hw_stop(io, ssi_parent);
else else
rsnd_ssi_master_clk_stop(ssi); rsnd_ssi_master_clk_stop(ssi);
} }
@ -396,7 +394,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
{ {
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
rsnd_src_ssiu_start(mod, io, rsnd_ssi_use_busif(mod)); rsnd_src_ssiu_start(mod, io, rsnd_ssi_use_busif(io, mod));
rsnd_ssi_hw_start(ssi, io); rsnd_ssi_hw_start(ssi, io);
@ -415,19 +413,18 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
rsnd_ssi_record_error(ssi, rsnd_mod_read(mod, SSISR)); rsnd_ssi_record_error(ssi, rsnd_mod_read(mod, SSISR));
rsnd_ssi_hw_stop(ssi); rsnd_ssi_hw_stop(io, ssi);
rsnd_src_ssiu_stop(mod, io); rsnd_src_ssiu_stop(mod, io);
return 0; return 0;
} }
static irqreturn_t rsnd_ssi_interrupt(int irq, void *data) static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
struct rsnd_dai_stream *io)
{ {
struct rsnd_ssi *ssi = data; struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_mod *mod = &ssi->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_dma = rsnd_ssi_is_dma_mode(mod); int is_dma = rsnd_ssi_is_dma_mode(mod);
u32 status; u32 status;
bool elapsed = false; bool elapsed = false;
@ -483,6 +480,13 @@ rsnd_ssi_interrupt_out:
if (elapsed) if (elapsed)
rsnd_dai_period_elapsed(io); rsnd_dai_period_elapsed(io);
}
static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
{
struct rsnd_mod *mod = data;
rsnd_mod_interrupt(mod, __rsnd_ssi_interrupt);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -501,7 +505,7 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
ret = devm_request_irq(dev, ssi->info->irq, ret = devm_request_irq(dev, ssi->info->irq,
rsnd_ssi_interrupt, rsnd_ssi_interrupt,
IRQF_SHARED, IRQF_SHARED,
dev_name(dev), ssi); dev_name(dev), mod);
return ret; return ret;
} }
@ -528,7 +532,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
ret = devm_request_irq(dev, ssi->info->irq, ret = devm_request_irq(dev, ssi->info->irq,
rsnd_ssi_interrupt, rsnd_ssi_interrupt,
IRQF_SHARED, IRQF_SHARED,
dev_name(dev), ssi); dev_name(dev), mod);
if (ret) if (ret)
return ret; return ret;
@ -609,7 +613,7 @@ static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
int is_play = rsnd_io_is_play(io); int is_play = rsnd_io_is_play(io);
char *name; char *name;
if (rsnd_ssi_use_busif(mod)) if (rsnd_ssi_use_busif(io, mod))
name = is_play ? "rxu" : "txu"; name = is_play ? "rxu" : "txu";
else else
name = is_play ? "rx" : "tx"; name = is_play ? "rx" : "tx";