aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-10-01 19:49:03 -0400
committerMark Brown <broonie@kernel.org>2017-10-04 06:50:38 -0400
commitf3c26ac61c09862f0037fe484a98da0364f02ec3 (patch)
tree9d36103736e94371f293dd894f4ec9f62611d9f2
parent99dc79d0600849ff878a38d9884e76f5bebd3228 (diff)
ASoC: rsnd: makes volume ramp rate list generic
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>
-rw-r--r--sound/soc/sh/rcar/core.c27
-rw-r--r--sound/soc/sh/rcar/dvc.c33
-rw-r--r--sound/soc/sh/rcar/rsnd.h7
3 files changed, 36 insertions, 31 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 107133297e8d..2d94b3d4519c 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1242,6 +1242,33 @@ struct rsnd_kctrl_cfg *rsnd_kctrl_init_s(struct rsnd_kctrl_cfg_s *cfg)
1242 return &cfg->cfg; 1242 return &cfg->cfg;
1243} 1243}
1244 1244
1245const char * const volume_ramp_rate[] = {
1246 "128 dB/1 step", /* 00000 */
1247 "64 dB/1 step", /* 00001 */
1248 "32 dB/1 step", /* 00010 */
1249 "16 dB/1 step", /* 00011 */
1250 "8 dB/1 step", /* 00100 */
1251 "4 dB/1 step", /* 00101 */
1252 "2 dB/1 step", /* 00110 */
1253 "1 dB/1 step", /* 00111 */
1254 "0.5 dB/1 step", /* 01000 */
1255 "0.25 dB/1 step", /* 01001 */
1256 "0.125 dB/1 step", /* 01010 */
1257 "0.125 dB/2 steps", /* 01011 */
1258 "0.125 dB/4 steps", /* 01100 */
1259 "0.125 dB/8 steps", /* 01101 */
1260 "0.125 dB/16 steps", /* 01110 */
1261 "0.125 dB/32 steps", /* 01111 */
1262 "0.125 dB/64 steps", /* 10000 */
1263 "0.125 dB/128 steps", /* 10001 */
1264 "0.125 dB/256 steps", /* 10010 */
1265 "0.125 dB/512 steps", /* 10011 */
1266 "0.125 dB/1024 steps", /* 10100 */
1267 "0.125 dB/2048 steps", /* 10101 */
1268 "0.125 dB/4096 steps", /* 10110 */
1269 "0.125 dB/8192 steps", /* 10111 = VOLUME_RAMP_MAX_DVC */
1270};
1271
1245int rsnd_kctrl_new(struct rsnd_mod *mod, 1272int rsnd_kctrl_new(struct rsnd_mod *mod,
1246 struct rsnd_dai_stream *io, 1273 struct rsnd_dai_stream *io,
1247 struct snd_soc_pcm_runtime *rtd, 1274 struct snd_soc_pcm_runtime *rtd,
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index bb22850e8fe6..4ef318ac73d5 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -61,33 +61,6 @@ struct rsnd_dvc {
61 ((pos) = (struct rsnd_dvc *)(priv)->dvc + i); \ 61 ((pos) = (struct rsnd_dvc *)(priv)->dvc + i); \
62 i++) 62 i++)
63 63
64static const char * const dvc_ramp_rate[] = {
65 "128 dB/1 step", /* 00000 */
66 "64 dB/1 step", /* 00001 */
67 "32 dB/1 step", /* 00010 */
68 "16 dB/1 step", /* 00011 */
69 "8 dB/1 step", /* 00100 */
70 "4 dB/1 step", /* 00101 */
71 "2 dB/1 step", /* 00110 */
72 "1 dB/1 step", /* 00111 */
73 "0.5 dB/1 step", /* 01000 */
74 "0.25 dB/1 step", /* 01001 */
75 "0.125 dB/1 step", /* 01010 */
76 "0.125 dB/2 steps", /* 01011 */
77 "0.125 dB/4 steps", /* 01100 */
78 "0.125 dB/8 steps", /* 01101 */
79 "0.125 dB/16 steps", /* 01110 */
80 "0.125 dB/32 steps", /* 01111 */
81 "0.125 dB/64 steps", /* 10000 */
82 "0.125 dB/128 steps", /* 10001 */
83 "0.125 dB/256 steps", /* 10010 */
84 "0.125 dB/512 steps", /* 10011 */
85 "0.125 dB/1024 steps", /* 10100 */
86 "0.125 dB/2048 steps", /* 10101 */
87 "0.125 dB/4096 steps", /* 10110 */
88 "0.125 dB/8192 steps", /* 10111 */
89};
90
91static void rsnd_dvc_activation(struct rsnd_mod *mod) 64static void rsnd_dvc_activation(struct rsnd_mod *mod)
92{ 65{
93 rsnd_mod_write(mod, DVC_SWRSR, 0); 66 rsnd_mod_write(mod, DVC_SWRSR, 0);
@@ -298,7 +271,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
298 rsnd_kctrl_accept_anytime, 271 rsnd_kctrl_accept_anytime,
299 rsnd_dvc_volume_update, 272 rsnd_dvc_volume_update,
300 &dvc->rup, 273 &dvc->rup,
301 dvc_ramp_rate); 274 volume_ramp_rate,
275 VOLUME_RAMP_MAX_DVC);
302 if (ret < 0) 276 if (ret < 0)
303 return ret; 277 return ret;
304 278
@@ -308,7 +282,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
308 rsnd_kctrl_accept_anytime, 282 rsnd_kctrl_accept_anytime,
309 rsnd_dvc_volume_update, 283 rsnd_dvc_volume_update,
310 &dvc->rdown, 284 &dvc->rdown,
311 dvc_ramp_rate); 285 volume_ramp_rate,
286 VOLUME_RAMP_MAX_DVC);
312 287
313 if (ret < 0) 288 if (ret < 0)
314 return ret; 289 return ret;
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index beffbec42404..9d66a15000fa 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -656,9 +656,12 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,
656 rsnd_kctrl_new(mod, io, rtd, name, accept, update, rsnd_kctrl_init_s(cfg), \ 656 rsnd_kctrl_new(mod, io, rtd, name, accept, update, rsnd_kctrl_init_s(cfg), \
657 NULL, 1, max) 657 NULL, 1, max)
658 658
659#define rsnd_kctrl_new_e(mod, io, rtd, name, accept, update, cfg, texts) \ 659#define rsnd_kctrl_new_e(mod, io, rtd, name, accept, update, cfg, texts, size) \
660 rsnd_kctrl_new(mod, io, rtd, name, accept, update, rsnd_kctrl_init_s(cfg), \ 660 rsnd_kctrl_new(mod, io, rtd, name, accept, update, rsnd_kctrl_init_s(cfg), \
661 texts, 1, ARRAY_SIZE(texts)) 661 texts, 1, size)
662
663extern const char * const volume_ramp_rate[];
664#define VOLUME_RAMP_MAX_DVC (0x17 + 1)
662 665
663/* 666/*
664 * R-Car SSI 667 * R-Car SSI