ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 4 Mar 2014 04:50:24 +0000 (20:50 -0800)
committerMark Brown <broonie@linaro.org>
Wed, 5 Mar 2014 06:07:52 +0000 (14:07 +0800)
Current R-Car sound driver is assuming that
SCU mod is used even though it is not needed.
Because scu.c is controlling SSIU too.
(it is Gen1 compatibility)
But, SCU mod will be really not used if new platform dai
feature was added.
Thus, rsnd_scu_ssi_mode_init() is called from SSI
directory by this patch.

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

index 3b71b77c4fd840dfa47b60d3bffdd9a6b63c66ae..9205f96da2f464a1c89dbb50d8b23d5020cf03cd 100644 (file)
@@ -353,6 +353,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
 unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
                                   struct rsnd_dai_stream *io,
                                   struct snd_pcm_runtime *runtime);
+int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod,
+                          struct rsnd_dai *rdai,
+                          struct rsnd_dai_stream *io);
 int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod,
                            struct rsnd_dai *rdai,
                            struct rsnd_dai_stream *io);
index 8ce79e855cf060a5d718dae5a118655bf85d2b1e..63e6aeb8c42d252ec44eb77518c242ac878ce813 100644 (file)
@@ -115,28 +115,28 @@ struct rsnd_scu {
 /*
  *             Gen1/Gen2 common functions
  */
-static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
-                                 struct rsnd_dai *rdai,
-                                 struct rsnd_dai_stream *io)
+int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod,
+                          struct rsnd_dai *rdai,
+                          struct rsnd_dai_stream *io)
 {
-       struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-       struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
-       struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
+       struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
+       struct rsnd_mod *scu_mod = rsnd_io_to_mod_scu(io);
+       struct rcar_snd_info *info = rsnd_priv_to_info(priv);
        int ssi_id = rsnd_mod_id(ssi_mod);
-       u32 convert_rate = rsnd_scu_convert_rate(scu);
-
-       if (convert_rate && !rsnd_dai_is_clk_master(rdai)) {
-               struct device *dev = rsnd_priv_to_dev(priv);
-
-               dev_err(dev, "rsnd should be clk master when you rate convert\n");
-               return -EINVAL;
-       }
+       int has_scu = 0;
 
        /*
         * SSI_MODE0
         */
-       rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id),
-                     rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id));
+       if (info->dai_info) {
+               has_scu = !!scu_mod;
+       } else {
+               struct rsnd_scu *scu = rsnd_mod_to_scu(scu_mod);
+               has_scu = rsnd_scu_hpbif_is_enable(scu);
+       }
+
+       rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
+                     has_scu ? 0 : (1 << ssi_id));
 
        /*
         * SSI_MODE1
@@ -156,7 +156,7 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
                }
 
                if (shift >= 0)
-                       rsnd_mod_bset(mod, SSI_MODE1,
+                       rsnd_mod_bset(ssi_mod, SSI_MODE1,
                                      0x3 << shift,
                                      rsnd_dai_is_clk_master(rdai) ?
                                      0x2 << shift : 0x1 << shift);
@@ -253,14 +253,9 @@ static int rsnd_scu_init(struct rsnd_mod *mod,
                         struct rsnd_dai_stream *io)
 {
        struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
-       int ret;
 
        clk_enable(scu->clk);
 
-       ret = rsnd_scu_ssi_mode_init(mod, rdai, io);
-       if (ret < 0)
-               return ret;
-
        return 0;
 }
 
@@ -487,11 +482,6 @@ static struct rsnd_mod_ops rsnd_scu_gen1_ops = {
        .stop   = rsnd_scu_stop_gen1,
 };
 
-static struct rsnd_mod_ops rsnd_scu_non_gen1_ops = {
-       .name   = "non-sru (gen1)",
-       .init   = rsnd_scu_ssi_mode_init,
-};
-
 /*
  *             Gen2 functions
  */
@@ -592,11 +582,6 @@ static struct rsnd_mod_ops rsnd_scu_gen2_ops = {
        .stop   = rsnd_scu_stop_gen2,
 };
 
-static struct rsnd_mod_ops rsnd_scu_non_gen2_ops = {
-       .name   = "non-scu (gen2)",
-       .init   = rsnd_scu_ssi_mode_init,
-};
-
 struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id)
 {
        if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv)))
@@ -665,11 +650,6 @@ int rsnd_scu_probe(struct platform_device *pdev,
 
                                ops = &rsnd_scu_gen2_ops;
                        }
-               } else {
-                       if (rsnd_is_gen1(priv))
-                               ops = &rsnd_scu_non_gen1_ops;
-                       if (rsnd_is_gen2(priv))
-                               ops = &rsnd_scu_non_gen2_ops;
                }
 
                rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i);
index a74c7a789b2b7e1d46102d826e40d633df2cebe9..a7df216a46dabf2ecfa78590522a06664afb6224 100644 (file)
@@ -287,6 +287,8 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
        ssi->cr_own     = cr;
        ssi->err        = -1; /* ignore 1st error */
 
+       rsnd_scu_ssi_mode_init(mod, rdai, io);
+
        return 0;
 }
 
This page took 0.041383 seconds and 5 git commands to generate.