ASoC: rsnd: set SRC_ROUTE_MODE0 on each rsnd_src_set_convert_rate()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 27 Nov 2014 08:07:07 +0000 (08:07 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 3 Dec 2014 18:51:40 +0000 (18:51 +0000)
Current src.c sets SRC_ROUTE_MODE0 on rsnd_src_start(), but, set it in
rsnd_src_set_convert_rate() is natural.

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

index 6a63f8fcf9919f8b9fe2329bcdc08f4c8d8156a2..0b6b230e339af5475c96f713bc3edc0fcebf1f44 100644 (file)
@@ -302,17 +302,12 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
 static int rsnd_src_start(struct rsnd_mod *mod,
                          struct rsnd_dai *rdai)
 {
-       struct rsnd_src *src = rsnd_mod_to_src(mod);
-
        /*
         * Cancel the initialization and operate the SRC function
         * see rsnd_src_init()
         */
        rsnd_mod_write(mod, SRC_SRCIR, 0);
 
-       if (rsnd_src_convert_rate(src))
-               rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1);
-
        return 0;
 }
 
@@ -320,11 +315,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_src *src = rsnd_mod_to_src(mod);
-
-       if (rsnd_src_convert_rate(src))
-               rsnd_mod_write(mod, SRC_ROUTE_MODE0, 0);
-
+       /* nothing to do */
        return 0;
 }
 
@@ -431,6 +422,7 @@ 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_src *src = rsnd_mod_to_src(mod);
        int ret;
 
        ret = rsnd_src_set_convert_rate(mod, rdai);
@@ -444,6 +436,10 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
        rsnd_mod_write(mod, SRC_MNFSR,
                       rsnd_mod_read(mod, SRC_IFSVR) / 100 * 98);
 
+       /* Gen1/Gen2 are not compatible */
+       if (rsnd_src_convert_rate(src))
+               rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1);
+
        /* no SRC_BFSSR settings, since SRC_SRCCR::BUFMD is 0 */
 
        return 0;
@@ -548,6 +544,11 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
 
        rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
 
+       if (convert_rate) {
+               /* Gen1/Gen2 are not compatible */
+               rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1);
+       }
+
        switch (rsnd_mod_id(mod)) {
        case 5:
        case 6: