aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-03-03 02:43:03 -0500
committerMark Brown <broonie@linaro.org>2014-03-03 23:13:49 -0500
commit374e5426377604a94d672650ef22dd2b4285de17 (patch)
treeeedd1f65824d0d1f8ac4bdf7d91299826fb374d2
parenta126021d144bae88a563db2b57b0ad5eb1ee66d9 (diff)
ASoC: rsnd: get ssi/scu from rsnd_dai_stream
Current driver is assuming that SSI id = SCU id. But, now, it can get correct SSI/SCU from rsnd_dai_stream. use it. 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.h4
-rw-r--r--sound/soc/sh/rcar/scu.c20
-rw-r--r--sound/soc/sh/rcar/ssi.c2
3 files changed, 15 insertions, 11 deletions
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 7767a8f1994a..cbc38a2be81c 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -192,6 +192,8 @@ struct rsnd_dai_stream {
192 int byte_per_period; 192 int byte_per_period;
193 int next_period_byte; 193 int next_period_byte;
194}; 194};
195#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
196#define rsnd_io_to_mod_scu(io) ((io)->mod[RSND_MOD_SCU])
195 197
196struct rsnd_dai { 198struct rsnd_dai {
197 char name[RSND_DAI_NAME_SIZE]; 199 char name[RSND_DAI_NAME_SIZE];
@@ -311,7 +313,7 @@ void rsnd_scu_remove(struct platform_device *pdev,
311 struct rsnd_priv *priv); 313 struct rsnd_priv *priv);
312struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id); 314struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
313unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, 315unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
314 struct rsnd_mod *ssi_mod, 316 struct rsnd_dai_stream *io,
315 struct snd_pcm_runtime *runtime); 317 struct snd_pcm_runtime *runtime);
316 318
317#define rsnd_scu_nr(priv) ((priv)->scu_nr) 319#define rsnd_scu_nr(priv) ((priv)->scu_nr)
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index 81264ecd82ac..1073d35486e3 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -121,7 +121,8 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
121{ 121{
122 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 122 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
123 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 123 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
124 int id = rsnd_mod_id(mod); 124 struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
125 int ssi_id = rsnd_mod_id(ssi_mod);
125 u32 convert_rate = rsnd_scu_convert_rate(scu); 126 u32 convert_rate = rsnd_scu_convert_rate(scu);
126 127
127 if (convert_rate && !rsnd_dai_is_clk_master(rdai)) { 128 if (convert_rate && !rsnd_dai_is_clk_master(rdai)) {
@@ -134,15 +135,15 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
134 /* 135 /*
135 * SSI_MODE0 136 * SSI_MODE0
136 */ 137 */
137 rsnd_mod_bset(mod, SSI_MODE0, (1 << id), 138 rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id),
138 rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << id)); 139 rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id));
139 140
140 /* 141 /*
141 * SSI_MODE1 142 * SSI_MODE1
142 */ 143 */
143 if (rsnd_ssi_is_pin_sharing(rsnd_ssi_mod_get(priv, id))) { 144 if (rsnd_ssi_is_pin_sharing(ssi_mod)) {
144 int shift = -1; 145 int shift = -1;
145 switch (id) { 146 switch (ssi_id) {
146 case 1: 147 case 1:
147 shift = 0; 148 shift = 0;
148 break; 149 break;
@@ -165,14 +166,13 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
165} 166}
166 167
167unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, 168unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
168 struct rsnd_mod *ssi_mod, 169 struct rsnd_dai_stream *io,
169 struct snd_pcm_runtime *runtime) 170 struct snd_pcm_runtime *runtime)
170{ 171{
171 struct rsnd_scu *scu; 172 struct rsnd_scu *scu;
172 unsigned int rate; 173 unsigned int rate;
173 174
174 /* this function is assuming SSI id = SCU id here */ 175 scu = rsnd_mod_to_scu(rsnd_io_to_mod_scu(io));
175 scu = rsnd_mod_to_scu(rsnd_scu_mod_get(priv, rsnd_mod_id(ssi_mod)));
176 176
177 /* 177 /*
178 * return convert rate if SRC is used, 178 * return convert rate if SRC is used,
@@ -583,8 +583,10 @@ static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,
583 struct rsnd_dai *rdai, 583 struct rsnd_dai *rdai,
584 struct rsnd_dai_stream *io) 584 struct rsnd_dai_stream *io)
585{ 585{
586 struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
587
586 /* enable PIO interrupt */ 588 /* enable PIO interrupt */
587 rsnd_mod_write(mod, INT_ENABLE, 0x0f000000); 589 rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
588 590
589 return 0; 591 return 0;
590} 592}
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 480dde5076b7..25a7d441f8fc 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
121 1, 2, 4, 8, 16, 6, 12, 121 1, 2, 4, 8, 16, 6, 12,
122 }; 122 };
123 unsigned int main_rate; 123 unsigned int main_rate;
124 unsigned int rate = rsnd_scu_get_ssi_rate(priv, &ssi->mod, runtime); 124 unsigned int rate = rsnd_scu_get_ssi_rate(priv, io, runtime);
125 125
126 /* 126 /*
127 * Find best clock, and try to start ADG 127 * Find best clock, and try to start ADG