aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-03-03 23:50:24 -0500
committerMark Brown <broonie@linaro.org>2014-03-05 01:07:52 -0500
commit221bf523e31306c1095b28932e079950108e3887 (patch)
treea8b809798b61db0a68d46f13028ea5e407c28dab
parentb8cc41e9e8cc5beec9dcbe044cfc44aa0325d9e6 (diff)
ASoC: rsnd: call rsnd_scu_ssi_mode_init() from SSI
Current R-Car sound driver is assuming that SCU mod is used even though it is not needed. Because scu.c is controlling SSIU too. (it is Gen1 compatibility) But, SCU mod will be really not used if new platform dai feature was added. Thus, rsnd_scu_ssi_mode_init() is called from SSI directory by this patch. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/sh/rcar/rsnd.h3
-rw-r--r--sound/soc/sh/rcar/scu.c54
-rw-r--r--sound/soc/sh/rcar/ssi.c2
3 files changed, 22 insertions, 37 deletions
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 3b71b77c4fd8..9205f96da2f4 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -353,6 +353,9 @@ struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
353unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, 353unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
354 struct rsnd_dai_stream *io, 354 struct rsnd_dai_stream *io,
355 struct snd_pcm_runtime *runtime); 355 struct snd_pcm_runtime *runtime);
356int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod,
357 struct rsnd_dai *rdai,
358 struct rsnd_dai_stream *io);
356int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod, 359int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod,
357 struct rsnd_dai *rdai, 360 struct rsnd_dai *rdai,
358 struct rsnd_dai_stream *io); 361 struct rsnd_dai_stream *io);
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index 8ce79e855cf0..63e6aeb8c42d 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -115,28 +115,28 @@ struct rsnd_scu {
115/* 115/*
116 * Gen1/Gen2 common functions 116 * Gen1/Gen2 common functions
117 */ 117 */
118static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod, 118int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod,
119 struct rsnd_dai *rdai, 119 struct rsnd_dai *rdai,
120 struct rsnd_dai_stream *io) 120 struct rsnd_dai_stream *io)
121{ 121{
122 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 122 struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
123 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 123 struct rsnd_mod *scu_mod = rsnd_io_to_mod_scu(io);
124 struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io); 124 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
125 int ssi_id = rsnd_mod_id(ssi_mod); 125 int ssi_id = rsnd_mod_id(ssi_mod);
126 u32 convert_rate = rsnd_scu_convert_rate(scu); 126 int has_scu = 0;
127
128 if (convert_rate && !rsnd_dai_is_clk_master(rdai)) {
129 struct device *dev = rsnd_priv_to_dev(priv);
130
131 dev_err(dev, "rsnd should be clk master when you rate convert\n");
132 return -EINVAL;
133 }
134 127
135 /* 128 /*
136 * SSI_MODE0 129 * SSI_MODE0
137 */ 130 */
138 rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id), 131 if (info->dai_info) {
139 rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id)); 132 has_scu = !!scu_mod;
133 } else {
134 struct rsnd_scu *scu = rsnd_mod_to_scu(scu_mod);
135 has_scu = rsnd_scu_hpbif_is_enable(scu);
136 }
137
138 rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
139 has_scu ? 0 : (1 << ssi_id));
140 140
141 /* 141 /*
142 * SSI_MODE1 142 * SSI_MODE1
@@ -156,7 +156,7 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
156 } 156 }
157 157
158 if (shift >= 0) 158 if (shift >= 0)
159 rsnd_mod_bset(mod, SSI_MODE1, 159 rsnd_mod_bset(ssi_mod, SSI_MODE1,
160 0x3 << shift, 160 0x3 << shift,
161 rsnd_dai_is_clk_master(rdai) ? 161 rsnd_dai_is_clk_master(rdai) ?
162 0x2 << shift : 0x1 << shift); 162 0x2 << shift : 0x1 << shift);
@@ -253,14 +253,9 @@ static int rsnd_scu_init(struct rsnd_mod *mod,
253 struct rsnd_dai_stream *io) 253 struct rsnd_dai_stream *io)
254{ 254{
255 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 255 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
256 int ret;
257 256
258 clk_enable(scu->clk); 257 clk_enable(scu->clk);
259 258
260 ret = rsnd_scu_ssi_mode_init(mod, rdai, io);
261 if (ret < 0)
262 return ret;
263
264 return 0; 259 return 0;
265} 260}
266 261
@@ -487,11 +482,6 @@ static struct rsnd_mod_ops rsnd_scu_gen1_ops = {
487 .stop = rsnd_scu_stop_gen1, 482 .stop = rsnd_scu_stop_gen1,
488}; 483};
489 484
490static struct rsnd_mod_ops rsnd_scu_non_gen1_ops = {
491 .name = "non-sru (gen1)",
492 .init = rsnd_scu_ssi_mode_init,
493};
494
495/* 485/*
496 * Gen2 functions 486 * Gen2 functions
497 */ 487 */
@@ -592,11 +582,6 @@ static struct rsnd_mod_ops rsnd_scu_gen2_ops = {
592 .stop = rsnd_scu_stop_gen2, 582 .stop = rsnd_scu_stop_gen2,
593}; 583};
594 584
595static struct rsnd_mod_ops rsnd_scu_non_gen2_ops = {
596 .name = "non-scu (gen2)",
597 .init = rsnd_scu_ssi_mode_init,
598};
599
600struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) 585struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id)
601{ 586{
602 if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv))) 587 if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv)))
@@ -665,11 +650,6 @@ int rsnd_scu_probe(struct platform_device *pdev,
665 650
666 ops = &rsnd_scu_gen2_ops; 651 ops = &rsnd_scu_gen2_ops;
667 } 652 }
668 } else {
669 if (rsnd_is_gen1(priv))
670 ops = &rsnd_scu_non_gen1_ops;
671 if (rsnd_is_gen2(priv))
672 ops = &rsnd_scu_non_gen2_ops;
673 } 653 }
674 654
675 rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i); 655 rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i);
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index a74c7a789b2b..a7df216a46da 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -287,6 +287,8 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
287 ssi->cr_own = cr; 287 ssi->cr_own = cr;
288 ssi->err = -1; /* ignore 1st error */ 288 ssi->err = -1; /* ignore 1st error */
289 289
290 rsnd_scu_ssi_mode_init(mod, rdai, io);
291
290 return 0; 292 return 0;
291} 293}
292 294