diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-06-15 02:26:08 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-16 07:34:03 -0400 |
commit | 4e2639ff38d28dccdd8e7cf8f60181f0c17e10d3 (patch) | |
tree | 692be55f7163f85193fe78ffd33270ce9838ac77 /sound/soc/sh | |
parent | f501b7a4e7ceb76a5d24cc0f75403072af5e85a0 (diff) |
ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_get_adinr()
Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from rsnd_get_adinr()
and its related function
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/rcar/core.c | 3 | ||||
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 2 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 6 | ||||
-rw-r--r-- | sound/soc/sh/rcar/src.c | 28 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 4 |
5 files changed, 23 insertions, 20 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 424d1a31c471..e1d1b22f324f 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -206,10 +206,9 @@ int rsnd_mod_is_working(struct rsnd_mod *mod) | |||
206 | /* | 206 | /* |
207 | * settting function | 207 | * settting function |
208 | */ | 208 | */ |
209 | u32 rsnd_get_adinr(struct rsnd_mod *mod) | 209 | u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io) |
210 | { | 210 | { |
211 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | 211 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
212 | struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); | ||
213 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 212 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
214 | struct device *dev = rsnd_priv_to_dev(priv); | 213 | struct device *dev = rsnd_priv_to_dev(priv); |
215 | u32 adinr = runtime->channels; | 214 | u32 adinr = runtime->channels; |
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 52e75ebeb5b8..691bc632f0cb 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c | |||
@@ -169,7 +169,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, | |||
169 | 169 | ||
170 | rsnd_mod_write(dvc_mod, DVC_DVUIR, 1); | 170 | rsnd_mod_write(dvc_mod, DVC_DVUIR, 1); |
171 | 171 | ||
172 | rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod)); | 172 | rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io)); |
173 | 173 | ||
174 | /* ch0/ch1 Volume */ | 174 | /* ch0/ch1 Volume */ |
175 | rsnd_dvc_volume_update(dvc_mod); | 175 | rsnd_dvc_volume_update(dvc_mod); |
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index e6aad5e05fad..b40435d08757 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -165,7 +165,7 @@ void rsnd_write(struct rsnd_priv *priv, struct rsnd_mod *mod, | |||
165 | enum rsnd_reg reg, u32 data); | 165 | enum rsnd_reg reg, u32 data); |
166 | void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg, | 166 | void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg, |
167 | u32 mask, u32 data); | 167 | u32 mask, u32 data); |
168 | u32 rsnd_get_adinr(struct rsnd_mod *mod); | 168 | u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io); |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * R-Car DMA | 171 | * R-Car DMA |
@@ -537,8 +537,10 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, | |||
537 | struct rsnd_dai_stream *io, | 537 | struct rsnd_dai_stream *io, |
538 | struct snd_pcm_runtime *runtime); | 538 | struct snd_pcm_runtime *runtime); |
539 | int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, | 539 | int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, |
540 | struct rsnd_dai_stream *io, | ||
540 | int use_busif); | 541 | int use_busif); |
541 | int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod); | 542 | int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod, |
543 | struct rsnd_dai_stream *io); | ||
542 | int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod); | 544 | int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod); |
543 | int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod); | 545 | int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod); |
544 | 546 | ||
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index e28d9f6ddda6..5693bb5c420b 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c | |||
@@ -129,9 +129,9 @@ static struct dma_chan *rsnd_src_dma_req(struct rsnd_mod *mod) | |||
129 | } | 129 | } |
130 | 130 | ||
131 | int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, | 131 | int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, |
132 | struct rsnd_dai_stream *io, | ||
132 | int use_busif) | 133 | int use_busif) |
133 | { | 134 | { |
134 | struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod); | ||
135 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); | 135 | struct rsnd_dai *rdai = rsnd_io_to_rdai(io); |
136 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 136 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
137 | int ssi_id = rsnd_mod_id(ssi_mod); | 137 | int ssi_id = rsnd_mod_id(ssi_mod); |
@@ -174,7 +174,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, | |||
174 | u32 mask = ~0; | 174 | u32 mask = ~0; |
175 | 175 | ||
176 | rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR, | 176 | rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR, |
177 | rsnd_get_adinr(ssi_mod)); | 177 | rsnd_get_adinr(ssi_mod, io)); |
178 | rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE, 1); | 178 | rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE, 1); |
179 | rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1); | 179 | rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1); |
180 | 180 | ||
@@ -196,7 +196,8 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod, | |||
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
198 | 198 | ||
199 | int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod) | 199 | int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod, |
200 | struct rsnd_dai_stream *io) | ||
200 | { | 201 | { |
201 | /* | 202 | /* |
202 | * DMA settings for SSIU | 203 | * DMA settings for SSIU |
@@ -283,9 +284,9 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, | |||
283 | return rate; | 284 | return rate; |
284 | } | 285 | } |
285 | 286 | ||
286 | static int rsnd_src_set_convert_rate(struct rsnd_mod *mod) | 287 | static int rsnd_src_set_convert_rate(struct rsnd_mod *mod, |
288 | struct rsnd_dai_stream *io) | ||
287 | { | 289 | { |
288 | struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); | ||
289 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 290 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
290 | struct rsnd_src *src = rsnd_mod_to_src(mod); | 291 | struct rsnd_src *src = rsnd_mod_to_src(mod); |
291 | u32 convert_rate = rsnd_src_convert_rate(src); | 292 | u32 convert_rate = rsnd_src_convert_rate(src); |
@@ -299,7 +300,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod) | |||
299 | rsnd_mod_write(mod, SRC_SWRSR, 1); | 300 | rsnd_mod_write(mod, SRC_SWRSR, 1); |
300 | 301 | ||
301 | /* Set channel number and output bit length */ | 302 | /* Set channel number and output bit length */ |
302 | rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod)); | 303 | rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io)); |
303 | 304 | ||
304 | /* Enable the initial value of IFS */ | 305 | /* Enable the initial value of IFS */ |
305 | if (fsrate) { | 306 | if (fsrate) { |
@@ -508,12 +509,13 @@ static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod) | |||
508 | return 0; | 509 | return 0; |
509 | } | 510 | } |
510 | 511 | ||
511 | static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod) | 512 | static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod, |
513 | struct rsnd_dai_stream *io) | ||
512 | { | 514 | { |
513 | struct rsnd_src *src = rsnd_mod_to_src(mod); | 515 | struct rsnd_src *src = rsnd_mod_to_src(mod); |
514 | int ret; | 516 | int ret; |
515 | 517 | ||
516 | ret = rsnd_src_set_convert_rate(mod); | 518 | ret = rsnd_src_set_convert_rate(mod, io); |
517 | if (ret < 0) | 519 | if (ret < 0) |
518 | return ret; | 520 | return ret; |
519 | 521 | ||
@@ -547,7 +549,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod, | |||
547 | if (ret < 0) | 549 | if (ret < 0) |
548 | return ret; | 550 | return ret; |
549 | 551 | ||
550 | ret = rsnd_src_set_convert_rate_gen1(mod); | 552 | ret = rsnd_src_set_convert_rate_gen1(mod, io); |
551 | if (ret < 0) | 553 | if (ret < 0) |
552 | return ret; | 554 | return ret; |
553 | 555 | ||
@@ -706,11 +708,11 @@ rsnd_src_interrupt_gen2_out: | |||
706 | return IRQ_HANDLED; | 708 | return IRQ_HANDLED; |
707 | } | 709 | } |
708 | 710 | ||
709 | static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod) | 711 | static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod, |
712 | struct rsnd_dai_stream *io) | ||
710 | { | 713 | { |
711 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | 714 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
712 | struct device *dev = rsnd_priv_to_dev(priv); | 715 | struct device *dev = rsnd_priv_to_dev(priv); |
713 | struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); | ||
714 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 716 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
715 | struct rsnd_src *src = rsnd_mod_to_src(mod); | 717 | struct rsnd_src *src = rsnd_mod_to_src(mod); |
716 | u32 convert_rate = rsnd_src_convert_rate(src); | 718 | u32 convert_rate = rsnd_src_convert_rate(src); |
@@ -731,7 +733,7 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod) | |||
731 | return -EINVAL; | 733 | return -EINVAL; |
732 | } | 734 | } |
733 | 735 | ||
734 | ret = rsnd_src_set_convert_rate(mod); | 736 | ret = rsnd_src_set_convert_rate(mod, io); |
735 | if (ret < 0) | 737 | if (ret < 0) |
736 | return ret; | 738 | return ret; |
737 | 739 | ||
@@ -834,7 +836,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod, | |||
834 | if (ret < 0) | 836 | if (ret < 0) |
835 | return ret; | 837 | return ret; |
836 | 838 | ||
837 | ret = rsnd_src_set_convert_rate_gen2(mod); | 839 | ret = rsnd_src_set_convert_rate_gen2(mod, io); |
838 | if (ret < 0) | 840 | if (ret < 0) |
839 | return ret; | 841 | return ret; |
840 | 842 | ||
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 41ef475c4a57..564e8290375c 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -396,7 +396,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod, | |||
396 | { | 396 | { |
397 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); | 397 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
398 | 398 | ||
399 | rsnd_src_ssiu_start(mod, rsnd_ssi_use_busif(mod)); | 399 | rsnd_src_ssiu_start(mod, io, rsnd_ssi_use_busif(mod)); |
400 | 400 | ||
401 | rsnd_ssi_hw_start(ssi, io); | 401 | rsnd_ssi_hw_start(ssi, io); |
402 | 402 | ||
@@ -417,7 +417,7 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod, | |||
417 | 417 | ||
418 | rsnd_ssi_hw_stop(ssi); | 418 | rsnd_ssi_hw_stop(ssi); |
419 | 419 | ||
420 | rsnd_src_ssiu_stop(mod); | 420 | rsnd_src_ssiu_stop(mod, io); |
421 | 421 | ||
422 | return 0; | 422 | return 0; |
423 | } | 423 | } |