ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_ssi_xxx()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 15 Jun 2015 06:26:56 +0000 (06:26 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 16 Jun 2015 11:34:04 +0000 (12:34 +0100)
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>
sound/soc/sh/rcar/dma.c
sound/soc/sh/rcar/rsnd.h
sound/soc/sh/rcar/ssi.c

index bdd99f582bb1f87e9718850088b87d3bc4b11eda..6ee34fcc0d684a6e9e59098b27cd820a404b86af 100644 (file)
@@ -455,7 +455,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
                dev_err(dev, "DVC is selected without SRC\n");
 
        /* use SSIU or SSI ? */
-       if (is_ssi && rsnd_ssi_use_busif(mod))
+       if (is_ssi && rsnd_ssi_use_busif(io, mod))
                is_ssi++;
 
        return (is_from) ?
index 19d0d8b2b9af32cd27c7058da974b08ade3dc281..ac03d2008ee828d11283a09247a534258b83c454 100644 (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);
 int rsnd_ssi_is_pin_sharing(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
index 0a32544d6f758191de7750c0e2fdde00e1791967..fa1f2e5b9070d93b0eaf26a2f98f88f604624a97 100644 (file)
@@ -87,10 +87,9 @@ struct rsnd_ssi {
 #define rsnd_ssi_of_node(priv) \
        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_dai_stream *io = rsnd_mod_to_io(mod);
        int use_busif = 0;
 
        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));
 }
 
-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_dai_stream *io = rsnd_mod_to_io(&ssi->mod);
        struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
        struct device *dev = rsnd_priv_to_dev(priv);
        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);
 
                        if (ssi_parent)
-                               rsnd_ssi_hw_stop(ssi_parent);
+                               rsnd_ssi_hw_stop(io, ssi_parent);
                        else
                                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);
 
-       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);
 
@@ -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_hw_stop(ssi);
+       rsnd_ssi_hw_stop(io, ssi);
 
        rsnd_src_ssiu_stop(mod, io);
 
        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_mod *mod = &ssi->mod;
+       struct rsnd_ssi *ssi = rsnd_mod_to_ssi(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);
        u32 status;
        bool elapsed = false;
@@ -483,6 +480,13 @@ rsnd_ssi_interrupt_out:
 
        if (elapsed)
                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;
 }
@@ -501,7 +505,7 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
        ret = devm_request_irq(dev, ssi->info->irq,
                               rsnd_ssi_interrupt,
                               IRQF_SHARED,
-                              dev_name(dev), ssi);
+                              dev_name(dev), mod);
 
        return ret;
 }
@@ -528,7 +532,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
        ret = devm_request_irq(dev, ssi->info->irq,
                               rsnd_ssi_interrupt,
                               IRQF_SHARED,
-                              dev_name(dev), ssi);
+                              dev_name(dev), mod);
        if (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);
        char *name;
 
-       if (rsnd_ssi_use_busif(mod))
+       if (rsnd_ssi_use_busif(io, mod))
                name = is_play ? "rxu" : "txu";
        else
                name = is_play ? "rx" : "tx";