]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: rsnd: get ssi/scu from rsnd_dai_stream
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 3 Mar 2014 07:43:03 +0000 (23:43 -0800)
committerMark Brown <broonie@linaro.org>
Tue, 4 Mar 2014 04:13:49 +0000 (12:13 +0800)
Current driver is assuming that SSI id = SCU id.
But, now, it can get correct SSI/SCU from
rsnd_dai_stream. use it.

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 7767a8f1994ac1c5e46ffdd216d2bfce59816faa..cbc38a2be81c3c93f6ab230e0d3d04230a821bba 100644 (file)
@@ -192,6 +192,8 @@ struct rsnd_dai_stream {
        int byte_per_period;
        int next_period_byte;
 };
+#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
+#define rsnd_io_to_mod_scu(io) ((io)->mod[RSND_MOD_SCU])
 
 struct rsnd_dai {
        char name[RSND_DAI_NAME_SIZE];
@@ -311,7 +313,7 @@ void rsnd_scu_remove(struct platform_device *pdev,
                     struct rsnd_priv *priv);
 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_mod *ssi_mod,
+                                  struct rsnd_dai_stream *io,
                                   struct snd_pcm_runtime *runtime);
 
 #define rsnd_scu_nr(priv) ((priv)->scu_nr)
index 81264ecd82ac7442aae96bf56ea847ae5a155b53..1073d35486e3781858a42a2008568c222e092bcd 100644 (file)
@@ -121,7 +121,8 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
 {
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
        struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
-       int id = rsnd_mod_id(mod);
+       struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
+       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)) {
@@ -134,15 +135,15 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
        /*
         * SSI_MODE0
         */
-       rsnd_mod_bset(mod, SSI_MODE0, (1 << id),
-                     rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << id));
+       rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id),
+                     rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id));
 
        /*
         * SSI_MODE1
         */
-       if (rsnd_ssi_is_pin_sharing(rsnd_ssi_mod_get(priv, id))) {
+       if (rsnd_ssi_is_pin_sharing(ssi_mod)) {
                int shift = -1;
-               switch (id) {
+               switch (ssi_id) {
                case 1:
                        shift = 0;
                        break;
@@ -165,14 +166,13 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
 }
 
 unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
-                                  struct rsnd_mod *ssi_mod,
+                                  struct rsnd_dai_stream *io,
                                   struct snd_pcm_runtime *runtime)
 {
        struct rsnd_scu *scu;
        unsigned int rate;
 
-       /* this function is assuming SSI id = SCU id here */
-       scu = rsnd_mod_to_scu(rsnd_scu_mod_get(priv, rsnd_mod_id(ssi_mod)));
+       scu = rsnd_mod_to_scu(rsnd_io_to_mod_scu(io));
 
        /*
         * return convert rate if SRC is used,
@@ -583,8 +583,10 @@ static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,
                                   struct rsnd_dai *rdai,
                                   struct rsnd_dai_stream *io)
 {
+       struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
+
        /* enable PIO interrupt */
-       rsnd_mod_write(mod, INT_ENABLE, 0x0f000000);
+       rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
 
        return 0;
 }
index 480dde5076b7a3cefab0b311b39f4e63f8d49b9d..25a7d441f8fca536182286600aa1e35f313c1a83 100644 (file)
@@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
                1, 2, 4, 8, 16, 6, 12,
        };
        unsigned int main_rate;
-       unsigned int rate = rsnd_scu_get_ssi_rate(priv, &ssi->mod, runtime);
+       unsigned int rate = rsnd_scu_get_ssi_rate(priv, io, runtime);
 
        /*
         * Find best clock, and try to start ADG