ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 15 Jul 2015 07:13:10 +0000 (07:13 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 16 Jul 2015 21:29:21 +0000 (22:29 +0100)
Current sound data route settings is done in dvc.c, and it doesn't care
about CTU/MIX at this poinnt, but we need to care about these.
OTOH, rsnd driver already has rsnd_path_xxx() functions for data path which
are good match for CTU/MIX/DVC path selectio.
This patch adds new rsnd_path_parse() to select sound data route which will
care about CTU/MIX/DVC path.

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/core.c
sound/soc/sh/rcar/dvc.c
sound/soc/sh/rcar/rsnd.h

index 93fed5031c69631bcb3e75e5f82b9bc81bb1b956..cb82067212834e06009691c0b082fbd48637268c 100644 (file)
@@ -537,6 +537,28 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
        }                                                       \
 }
 
+void rsnd_path_parse(struct rsnd_priv *priv,
+                    struct rsnd_dai_stream *io)
+{
+       struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+       struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
+       int src_id = rsnd_mod_id(src);
+       u32 path[] = {
+               [0] = 0x30000,
+               [1] = 0x30001,
+               [2] = 0x40000,
+               [3] = 0x10000,
+               [4] = 0x20000,
+               [5] = 0x40100
+       };
+
+       /* Gen1 is not supported */
+       if (rsnd_is_gen1(priv))
+               return;
+
+       rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
+}
+
 static int rsnd_path_init(struct rsnd_priv *priv,
                          struct rsnd_dai *rdai,
                          struct rsnd_dai_stream *io)
index 24d07634c7499fcd9c31cd2bedc790ae3bef547c..9392507b5651f742de855d0e749897b3814db288 100644 (file)
@@ -142,48 +142,26 @@ static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
        return 0;
 }
 
-static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
+static int rsnd_dvc_init(struct rsnd_mod *mod,
                         struct rsnd_dai_stream *io,
                         struct rsnd_priv *priv)
 {
-       struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
-       struct device *dev = rsnd_priv_to_dev(priv);
-       int dvc_id = rsnd_mod_id(dvc_mod);
-       int src_id = rsnd_mod_id(src_mod);
-       u32 route[] = {
-               [0] = 0x30000,
-               [1] = 0x30001,
-               [2] = 0x40000,
-               [3] = 0x10000,
-               [4] = 0x20000,
-               [5] = 0x40100
-       };
-
-       if (src_id >= ARRAY_SIZE(route)) {
-               dev_err(dev, "DVC%d isn't connected to SRC%d\n", dvc_id, src_id);
-               return -EINVAL;
-       }
-
-       rsnd_mod_hw_start(dvc_mod);
+       rsnd_mod_hw_start(mod);
 
-       rsnd_dvc_soft_reset(dvc_mod);
+       rsnd_dvc_soft_reset(mod);
 
-       /*
-        * fixme
-        * it doesn't support CTU/MIX
-        */
-       rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
+       rsnd_path_parse(priv, io);
 
-       rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
+       rsnd_mod_write(mod, DVC_DVUIR, 1);
 
-       rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
+       rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
 
        /* ch0/ch1 Volume */
-       rsnd_dvc_volume_update(io, dvc_mod);
+       rsnd_dvc_volume_update(io, mod);
 
-       rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
+       rsnd_mod_write(mod, DVC_DVUIR, 0);
 
-       rsnd_adg_set_cmd_timsel_gen2(dvc_mod, io);
+       rsnd_adg_set_cmd_timsel_gen2(mod, io);
 
        return 0;
 }
index c8d202939e258ae8aa22518c5aa6cdbbc8436e4d..6a877578791914d1979c0c199dfefce08831da3f 100644 (file)
@@ -170,6 +170,8 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
                    u32 mask, u32 data);
 u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+void rsnd_path_parse(struct rsnd_priv *priv,
+                    struct rsnd_dai_stream *io);
 
 /*
  *     R-Car DMA