ASoC: rsnd: remove duplicate parameter from rsnd_mod_ops
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 9 May 2014 00:44:29 +0000 (17:44 -0700)
committerMark Brown <broonie@linaro.org>
Tue, 13 May 2014 18:06:16 +0000 (19:06 +0100)
Now, it can get rsnd_dai_stream pointer from rsnd_mod.
Remove duplicate parameter from rsnd_mod_ops

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/rsnd.h
sound/soc/sh/rcar/src.c
sound/soc/sh/rcar/ssi.c

index e47aa53471b1158799404202d361f29aedd2ae8a..86c9b78d8df13899696410f5e6b4727463e67e7c 100644 (file)
@@ -338,19 +338,19 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
 /*
  *     rsnd_dai functions
  */
-#define __rsnd_mod_call(mod, func, rdai, io)                   \
+#define __rsnd_mod_call(mod, func, rdai)                       \
 ({                                                             \
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);         \
        struct device *dev = rsnd_priv_to_dev(priv);            \
        dev_dbg(dev, "%s [%d] %s\n",                            \
                rsnd_mod_name(mod), rsnd_mod_id(mod), #func);   \
-       (mod)->ops->func(mod, rdai, io);                        \
+       (mod)->ops->func(mod, rdai);                            \
 })
 
-#define rsnd_mod_call(mod, func, rdai, io)     \
+#define rsnd_mod_call(mod, func, rdai) \
        (!(mod) ? -ENODEV :                     \
         !((mod)->ops->func) ? 0 :              \
-        __rsnd_mod_call(mod, func, (rdai), (io)))
+        __rsnd_mod_call(mod, func, (rdai)))
 
 #define rsnd_dai_call(rdai, io, fn)                            \
 ({                                                             \
@@ -360,7 +360,7 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
                mod = (io)->mod[i];                             \
                if (!mod)                                       \
                        continue;                               \
-               ret = rsnd_mod_call(mod, fn, (rdai), (io));     \
+               ret = rsnd_mod_call(mod, fn, (rdai));           \
                if (ret < 0)                                    \
                        break;                                  \
        }                                                       \
index fee3ec21aaeb664f28139b8169fd6a993ac2497f..6156ceebd58be9fbac6224f69e295e3ff69ed221 100644 (file)
@@ -172,23 +172,17 @@ enum rsnd_mod_type {
 struct rsnd_mod_ops {
        char *name;
        int (*probe)(struct rsnd_mod *mod,
-                    struct rsnd_dai *rdai,
-                    struct rsnd_dai_stream *io);
+                    struct rsnd_dai *rdai);
        int (*remove)(struct rsnd_mod *mod,
-                     struct rsnd_dai *rdai,
-                     struct rsnd_dai_stream *io);
+                     struct rsnd_dai *rdai);
        int (*init)(struct rsnd_mod *mod,
-                   struct rsnd_dai *rdai,
-                   struct rsnd_dai_stream *io);
+                   struct rsnd_dai *rdai);
        int (*quit)(struct rsnd_mod *mod,
-                   struct rsnd_dai *rdai,
-                   struct rsnd_dai_stream *io);
+                   struct rsnd_dai *rdai);
        int (*start)(struct rsnd_mod *mod,
-                    struct rsnd_dai *rdai,
-                    struct rsnd_dai_stream *io);
+                    struct rsnd_dai *rdai);
        int (*stop)(struct rsnd_mod *mod,
-                   struct rsnd_dai *rdai,
-                   struct rsnd_dai_stream *io);
+                   struct rsnd_dai *rdai);
 };
 
 struct rsnd_dai_stream;
@@ -365,11 +359,9 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
                                   struct rsnd_dai_stream *io,
                                   struct snd_pcm_runtime *runtime);
 int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-                          struct rsnd_dai *rdai,
-                          struct rsnd_dai_stream *io);
+                          struct rsnd_dai *rdai);
 int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
-                           struct rsnd_dai *rdai,
-                           struct rsnd_dai_stream *io);
+                           struct rsnd_dai *rdai);
 
 #define rsnd_src_nr(priv) ((priv)->src_nr)
 
index c90c36d41799f3f059e0b4a4847f0c7b2aecaf67..035eda2de239d731a30d2efcf8e6e0ae9eb0b636 100644 (file)
@@ -105,9 +105,9 @@ struct rsnd_src {
  *             Gen1/Gen2 common functions
  */
 int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-                          struct rsnd_dai *rdai,
-                          struct rsnd_dai_stream *io)
+                          struct rsnd_dai *rdai)
 {
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
        struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
        int ssi_id = rsnd_mod_id(ssi_mod);
 
@@ -145,8 +145,7 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
 }
 
 int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
-                           struct rsnd_dai *rdai,
-                           struct rsnd_dai_stream *io)
+                           struct rsnd_dai *rdai)
 {
        struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
 
@@ -182,9 +181,9 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 }
 
 static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
-                                    struct rsnd_dai *rdai,
-                                    struct rsnd_dai_stream *io)
+                                    struct rsnd_dai *rdai)
 {
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
        struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
        struct rsnd_src *src = rsnd_mod_to_src(mod);
        u32 convert_rate = rsnd_src_convert_rate(src);
@@ -221,8 +220,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_init(struct rsnd_mod *mod,
-                        struct rsnd_dai *rdai,
-                        struct rsnd_dai_stream *io)
+                        struct rsnd_dai *rdai)
 {
        struct rsnd_src *src = rsnd_mod_to_src(mod);
 
@@ -232,8 +230,7 @@ static int rsnd_src_init(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_quit(struct rsnd_mod *mod,
-                        struct rsnd_dai *rdai,
-                        struct rsnd_dai_stream *io)
+                        struct rsnd_dai *rdai)
 {
        struct rsnd_src *src = rsnd_mod_to_src(mod);
 
@@ -243,8 +240,7 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_start(struct rsnd_mod *mod,
-                         struct rsnd_dai *rdai,
-                         struct rsnd_dai_stream *io)
+                         struct rsnd_dai *rdai)
 {
        struct rsnd_src *src = rsnd_mod_to_src(mod);
 
@@ -262,8 +258,7 @@ static int rsnd_src_start(struct rsnd_mod *mod,
 
 
 static int rsnd_src_stop(struct rsnd_mod *mod,
-                        struct rsnd_dai *rdai,
-                        struct rsnd_dai_stream *io)
+                        struct rsnd_dai *rdai)
 {
        struct rsnd_src *src = rsnd_mod_to_src(mod);
 
@@ -281,9 +276,9 @@ static struct rsnd_mod_ops rsnd_src_non_ops = {
  *             Gen1 functions
  */
 static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
-                                  struct rsnd_dai *rdai,
-                                  struct rsnd_dai_stream *io)
+                                  struct rsnd_dai *rdai)
 {
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
        struct src_route_config {
                u32 mask;
                int shift;
@@ -319,9 +314,9 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod,
-                                           struct rsnd_dai *rdai,
-                                           struct rsnd_dai_stream *io)
+                                           struct rsnd_dai *rdai)
 {
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
        struct rsnd_src *src = rsnd_mod_to_src(mod);
        struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
@@ -378,12 +373,11 @@ static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
-                                         struct rsnd_dai *rdai,
-                                         struct rsnd_dai_stream *io)
+                                         struct rsnd_dai *rdai)
 {
        int ret;
 
-       ret = rsnd_src_set_convert_rate(mod, rdai, io);
+       ret = rsnd_src_set_convert_rate(mod, rdai);
        if (ret < 0)
                return ret;
 
@@ -400,24 +394,23 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_init_gen1(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        int ret;
 
-       ret = rsnd_src_init(mod, rdai, io);
+       ret = rsnd_src_init(mod, rdai);
        if (ret < 0)
                return ret;
 
-       ret = rsnd_src_set_route_gen1(mod, rdai, io);
+       ret = rsnd_src_set_route_gen1(mod, rdai);
        if (ret < 0)
                return ret;
 
-       ret = rsnd_src_set_convert_rate_gen1(mod, rdai, io);
+       ret = rsnd_src_set_convert_rate_gen1(mod, rdai);
        if (ret < 0)
                return ret;
 
-       ret = rsnd_src_set_convert_timing_gen1(mod, rdai, io);
+       ret = rsnd_src_set_convert_timing_gen1(mod, rdai);
        if (ret < 0)
                return ret;
 
@@ -425,25 +418,23 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_start_gen1(struct rsnd_mod *mod,
-                              struct rsnd_dai *rdai,
-                              struct rsnd_dai_stream *io)
+                              struct rsnd_dai *rdai)
 {
        int id = rsnd_mod_id(mod);
 
        rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), (1 << id));
 
-       return rsnd_src_start(mod, rdai, io);
+       return rsnd_src_start(mod, rdai);
 }
 
 static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        int id = rsnd_mod_id(mod);
 
        rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), 0);
 
-       return rsnd_src_stop(mod, rdai, io);
+       return rsnd_src_stop(mod, rdai);
 }
 
 static struct rsnd_mod_ops rsnd_src_gen1_ops = {
@@ -458,12 +449,11 @@ static struct rsnd_mod_ops rsnd_src_gen1_ops = {
  *             Gen2 functions
  */
 static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
-                                         struct rsnd_dai *rdai,
-                                         struct rsnd_dai_stream *io)
+                                         struct rsnd_dai *rdai)
 {
        int ret;
 
-       ret = rsnd_src_set_convert_rate(mod, rdai, io);
+       ret = rsnd_src_set_convert_rate(mod, rdai);
        if (ret < 0)
                return ret;
 
@@ -479,9 +469,9 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod,
-                                           struct rsnd_dai *rdai,
-                                           struct rsnd_dai_stream *io)
+                                           struct rsnd_dai *rdai)
 {
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
        struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
        struct rsnd_src *src = rsnd_mod_to_src(mod);
        u32 convert_rate = rsnd_src_convert_rate(src);
@@ -498,8 +488,7 @@ static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
-                              struct rsnd_dai *rdai,
-                              struct rsnd_dai_stream *io)
+                              struct rsnd_dai *rdai)
 {
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
        struct rsnd_src *src = rsnd_mod_to_src(mod);
@@ -517,8 +506,7 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
-                               struct rsnd_dai *rdai,
-                               struct rsnd_dai_stream *io)
+                               struct rsnd_dai *rdai)
 {
        rsnd_dma_quit(rsnd_mod_to_priv(mod), rsnd_mod_to_dma(mod));
 
@@ -526,20 +514,19 @@ static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_init_gen2(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        int ret;
 
-       ret = rsnd_src_init(mod, rdai, io);
+       ret = rsnd_src_init(mod, rdai);
        if (ret < 0)
                return ret;
 
-       ret = rsnd_src_set_convert_rate_gen2(mod, rdai, io);
+       ret = rsnd_src_set_convert_rate_gen2(mod, rdai);
        if (ret < 0)
                return ret;
 
-       ret = rsnd_src_set_convert_timing_gen2(mod, rdai, io);
+       ret = rsnd_src_set_convert_timing_gen2(mod, rdai);
        if (ret < 0)
                return ret;
 
@@ -547,8 +534,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod,
 }
 
 static int rsnd_src_start_gen2(struct rsnd_mod *mod,
-                              struct rsnd_dai *rdai,
-                              struct rsnd_dai_stream *io)
+                              struct rsnd_dai *rdai)
 {
        struct rsnd_src *src = rsnd_mod_to_src(mod);
 
@@ -557,12 +543,11 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
        rsnd_mod_write(mod, SSI_CTRL, 0x1);
        rsnd_mod_write(mod, SRC_CTRL, 0x11);
 
-       return rsnd_src_start(mod, rdai, io);
+       return rsnd_src_start(mod, rdai);
 }
 
 static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        struct rsnd_src *src = rsnd_mod_to_src(mod);
 
@@ -571,7 +556,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
 
        rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
 
-       return rsnd_src_stop(mod, rdai, io);
+       return rsnd_src_stop(mod, rdai);
 }
 
 static struct rsnd_mod_ops rsnd_src_gen2_ops = {
index 77b7b60325c1caf063d72e7f3e1dd51816cc2631..4b13edb26c4aef9b59fd9eee3b60f171a681d0c8 100644 (file)
@@ -240,10 +240,10 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi,
  *     SSI mod common functions
  */
 static int rsnd_ssi_init(struct rsnd_mod *mod,
-                        struct rsnd_dai *rdai,
-                        struct rsnd_dai_stream *io)
+                        struct rsnd_dai *rdai)
 {
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
        struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
        u32 cr;
 
@@ -287,14 +287,13 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
        ssi->cr_own     = cr;
        ssi->err        = -1; /* ignore 1st error */
 
-       rsnd_src_ssi_mode_init(mod, rdai, io);
+       rsnd_src_ssi_mode_init(mod, rdai);
 
        return 0;
 }
 
 static int rsnd_ssi_quit(struct rsnd_mod *mod,
-                        struct rsnd_dai *rdai,
-                        struct rsnd_dai_stream *io)
+                        struct rsnd_dai *rdai)
 {
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
@@ -359,8 +358,7 @@ static irqreturn_t rsnd_ssi_pio_interrupt(int irq, void *data)
 }
 
 static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
        struct device *dev = rsnd_priv_to_dev(priv);
@@ -379,15 +377,15 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
 }
 
 static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
 
        /* enable PIO IRQ */
        ssi->cr_etc = UIEN | OIEN | DIEN;
 
-       rsnd_src_enable_ssi_irq(mod, rdai, io);
+       rsnd_src_enable_ssi_irq(mod, rdai);
 
        rsnd_ssi_hw_start(ssi, rdai, io);
 
@@ -395,8 +393,7 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
 }
 
 static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
-                            struct rsnd_dai *rdai,
-                            struct rsnd_dai_stream *io)
+                            struct rsnd_dai *rdai)
 {
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
 
@@ -417,8 +414,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
 };
 
 static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
-                         struct rsnd_dai *rdai,
-                         struct rsnd_dai_stream *io)
+                         struct rsnd_dai *rdai)
 {
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
@@ -438,8 +434,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
 }
 
 static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
-                              struct rsnd_dai *rdai,
-                              struct rsnd_dai_stream *io)
+                              struct rsnd_dai *rdai)
 {
        rsnd_dma_quit(rsnd_mod_to_priv(mod), rsnd_mod_to_dma(mod));
 
@@ -447,11 +442,11 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
 }
 
 static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
-                             struct rsnd_dai *rdai,
-                             struct rsnd_dai_stream *io)
+                             struct rsnd_dai *rdai)
 {
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
        struct rsnd_dma *dma = rsnd_mod_to_dma(&ssi->mod);
+       struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
 
        /* enable DMA transfer */
        ssi->cr_etc = DMEN;
@@ -468,8 +463,7 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
 }
 
 static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
-                            struct rsnd_dai *rdai,
-                            struct rsnd_dai_stream *io)
+                            struct rsnd_dai *rdai)
 {
        struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
        struct rsnd_dma *dma = rsnd_mod_to_dma(&ssi->mod);