ASoC: rsnd: MIX settings matches to datasheet
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 4 Nov 2015 08:44:32 +0000 (08:44 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 16 Nov 2015 10:09:29 +0000 (10:09 +0000)
Current MIX settings order was rough.
This patch makes it match to datasheet.

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

index bcbd821981a9239500442d096b86c1c028a52be8..2baa2d79bfc024bf208c887d096aae67fdfe00ea 100644 (file)
@@ -31,24 +31,41 @@ static void rsnd_mix_soft_reset(struct rsnd_mod *mod)
        rsnd_mod_write(mod, MIX_SWRSR, 1);
 }
 
-#define rsnd_mix_initialize_lock(mod)  __rsnd_mix_initialize_lock(mod, 1)
-#define rsnd_mix_initialize_unlock(mod)        __rsnd_mix_initialize_lock(mod, 0)
-static void __rsnd_mix_initialize_lock(struct rsnd_mod *mod, u32 enable)
+static void rsnd_mix_volume_parameter(struct rsnd_dai_stream *io,
+                                     struct rsnd_mod *mod)
 {
-       rsnd_mod_write(mod, MIX_MIXIR, enable);
+       rsnd_mod_write(mod, MIX_MDBAR, 0);
+       rsnd_mod_write(mod, MIX_MDBBR, 0);
+       rsnd_mod_write(mod, MIX_MDBCR, 0);
+       rsnd_mod_write(mod, MIX_MDBDR, 0);
+}
+
+static void rsnd_mix_volume_init(struct rsnd_dai_stream *io,
+                                struct rsnd_mod *mod)
+{
+       rsnd_mod_write(mod, MIX_MIXIR, 1);
+
+       /* General Information */
+       rsnd_mod_write(mod, MIX_ADINR, rsnd_get_adinr_chan(mod, io));
+
+       /* volume step */
+       rsnd_mod_write(mod, MIX_MIXMR, 0);
+       rsnd_mod_write(mod, MIX_MVPDR, 0);
+
+       /* common volume parameter */
+       rsnd_mix_volume_parameter(io, mod);
+
+       rsnd_mod_write(mod, MIX_MIXIR, 0);
 }
 
 static void rsnd_mix_volume_update(struct rsnd_dai_stream *io,
                                  struct rsnd_mod *mod)
 {
-
        /* Disable MIX dB setting */
        rsnd_mod_write(mod, MIX_MDBER, 0);
 
-       rsnd_mod_write(mod, MIX_MDBAR, 0);
-       rsnd_mod_write(mod, MIX_MDBBR, 0);
-       rsnd_mod_write(mod, MIX_MDBCR, 0);
-       rsnd_mod_write(mod, MIX_MDBDR, 0);
+       /* common volume parameter */
+       rsnd_mix_volume_parameter(io, mod);
 
        /* Enable MIX dB setting */
        rsnd_mod_write(mod, MIX_MDBER, 1);
@@ -69,18 +86,10 @@ static int rsnd_mix_init(struct rsnd_mod *mod,
 
        rsnd_mix_soft_reset(mod);
 
-       rsnd_mix_initialize_lock(mod);
-
-       rsnd_mod_write(mod, MIX_ADINR, rsnd_get_adinr_chan(mod, io));
-
-       /* volume step */
-       rsnd_mod_write(mod, MIX_MIXMR, 0);
-       rsnd_mod_write(mod, MIX_MVPDR, 0);
+       rsnd_mix_volume_init(io, mod);
 
        rsnd_mix_volume_update(io, mod);
 
-       rsnd_mix_initialize_unlock(mod);
-
        return 0;
 }