]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: rsnd: makes volume ramp rate list generic
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Sun, 1 Oct 2017 23:49:03 +0000 (23:49 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 4 Oct 2017 10:50:38 +0000 (11:50 +0100)
DVC is supporting Volume Ramp Rate, and MIX has Volume Ramp
but not yet supported. To support MIX Volume Ramp, we want to
share Rate List since DVC/MIX are using almost same list.
This patch move DVC specific Volume Ramp Rate List to core.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@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 107133297e8dd169855e3953ebcf0ca630ef336a..2d94b3d4519cbef31a4176559194952c0d65f87b 100644 (file)
@@ -1242,6 +1242,33 @@ struct rsnd_kctrl_cfg *rsnd_kctrl_init_s(struct rsnd_kctrl_cfg_s *cfg)
        return &cfg->cfg;
 }
 
+const char * const volume_ramp_rate[] = {
+       "128 dB/1 step",         /* 00000 */
+       "64 dB/1 step",          /* 00001 */
+       "32 dB/1 step",          /* 00010 */
+       "16 dB/1 step",          /* 00011 */
+       "8 dB/1 step",           /* 00100 */
+       "4 dB/1 step",           /* 00101 */
+       "2 dB/1 step",           /* 00110 */
+       "1 dB/1 step",           /* 00111 */
+       "0.5 dB/1 step",         /* 01000 */
+       "0.25 dB/1 step",        /* 01001 */
+       "0.125 dB/1 step",       /* 01010 */
+       "0.125 dB/2 steps",      /* 01011 */
+       "0.125 dB/4 steps",      /* 01100 */
+       "0.125 dB/8 steps",      /* 01101 */
+       "0.125 dB/16 steps",     /* 01110 */
+       "0.125 dB/32 steps",     /* 01111 */
+       "0.125 dB/64 steps",     /* 10000 */
+       "0.125 dB/128 steps",    /* 10001 */
+       "0.125 dB/256 steps",    /* 10010 */
+       "0.125 dB/512 steps",    /* 10011 */
+       "0.125 dB/1024 steps",   /* 10100 */
+       "0.125 dB/2048 steps",   /* 10101 */
+       "0.125 dB/4096 steps",   /* 10110 */
+       "0.125 dB/8192 steps",   /* 10111 = VOLUME_RAMP_MAX_DVC */
+};
+
 int rsnd_kctrl_new(struct rsnd_mod *mod,
                   struct rsnd_dai_stream *io,
                   struct snd_soc_pcm_runtime *rtd,
index bb22850e8fe6fc1fc6984e116b5e6acf5e4c40dd..4ef318ac73d5b77c667dff31cfe16f9aada46c10 100644 (file)
@@ -61,33 +61,6 @@ struct rsnd_dvc {
             ((pos) = (struct rsnd_dvc *)(priv)->dvc + i);      \
             i++)
 
-static const char * const dvc_ramp_rate[] = {
-       "128 dB/1 step",         /* 00000 */
-       "64 dB/1 step",          /* 00001 */
-       "32 dB/1 step",          /* 00010 */
-       "16 dB/1 step",          /* 00011 */
-       "8 dB/1 step",           /* 00100 */
-       "4 dB/1 step",           /* 00101 */
-       "2 dB/1 step",           /* 00110 */
-       "1 dB/1 step",           /* 00111 */
-       "0.5 dB/1 step",         /* 01000 */
-       "0.25 dB/1 step",        /* 01001 */
-       "0.125 dB/1 step",       /* 01010 */
-       "0.125 dB/2 steps",      /* 01011 */
-       "0.125 dB/4 steps",      /* 01100 */
-       "0.125 dB/8 steps",      /* 01101 */
-       "0.125 dB/16 steps",     /* 01110 */
-       "0.125 dB/32 steps",     /* 01111 */
-       "0.125 dB/64 steps",     /* 10000 */
-       "0.125 dB/128 steps",    /* 10001 */
-       "0.125 dB/256 steps",    /* 10010 */
-       "0.125 dB/512 steps",    /* 10011 */
-       "0.125 dB/1024 steps",   /* 10100 */
-       "0.125 dB/2048 steps",   /* 10101 */
-       "0.125 dB/4096 steps",   /* 10110 */
-       "0.125 dB/8192 steps",   /* 10111 */
-};
-
 static void rsnd_dvc_activation(struct rsnd_mod *mod)
 {
        rsnd_mod_write(mod, DVC_SWRSR, 0);
@@ -298,7 +271,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
                        rsnd_kctrl_accept_anytime,
                        rsnd_dvc_volume_update,
                        &dvc->rup,
-                       dvc_ramp_rate);
+                       volume_ramp_rate,
+                       VOLUME_RAMP_MAX_DVC);
        if (ret < 0)
                return ret;
 
@@ -308,7 +282,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
                        rsnd_kctrl_accept_anytime,
                        rsnd_dvc_volume_update,
                        &dvc->rdown,
-                       dvc_ramp_rate);
+                       volume_ramp_rate,
+                       VOLUME_RAMP_MAX_DVC);
 
        if (ret < 0)
                return ret;
index beffbec4240427c0595ea9b4e7276ec605ccaf4e..9d66a15000fa40d0305d0832ebe2ab8c59839eba 100644 (file)
@@ -656,9 +656,12 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,
        rsnd_kctrl_new(mod, io, rtd, name, accept, update, rsnd_kctrl_init_s(cfg), \
                       NULL, 1, max)
 
-#define rsnd_kctrl_new_e(mod, io, rtd, name, accept, update, cfg, texts)       \
+#define rsnd_kctrl_new_e(mod, io, rtd, name, accept, update, cfg, texts, size) \
        rsnd_kctrl_new(mod, io, rtd, name, accept, update, rsnd_kctrl_init_s(cfg), \
-                      texts, 1, ARRAY_SIZE(texts))
+                      texts, 1, size)
+
+extern const char * const volume_ramp_rate[];
+#define VOLUME_RAMP_MAX_DVC    (0x17 + 1)
 
 /*
  *     R-Car SSI