summaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-03-02 23:43:03 -0800
committerMark Brown <broonie@linaro.org>2014-03-04 12:13:49 +0800
commit374e5426377604a94d672650ef22dd2b4285de17 (patch)
treeeedd1f65824d0d1f8ac4bdf7d91299826fb374d2 /sound/soc/sh
parenta126021d144bae88a563db2b57b0ad5eb1ee66d9 (diff)
downloadop-kernel-dev-374e5426377604a94d672650ef22dd2b4285de17.zip
op-kernel-dev-374e5426377604a94d672650ef22dd2b4285de17.tar.gz
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>
Diffstat (limited to 'sound/soc/sh')
-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 7767a8f..cbc38a2 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -192,6 +192,8 @@ struct rsnd_dai_stream {
int byte_per_period;
int next_period_byte;
};
+#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
+#define rsnd_io_to_mod_scu(io) ((io)->mod[RSND_MOD_SCU])
struct rsnd_dai {
char name[RSND_DAI_NAME_SIZE];
@@ -311,7 +313,7 @@ void rsnd_scu_remove(struct platform_device *pdev,
struct rsnd_priv *priv);
struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
- struct rsnd_mod *ssi_mod,
+ struct rsnd_dai_stream *io,
struct snd_pcm_runtime *runtime);
#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 81264ec..1073d35 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,
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
- int id = rsnd_mod_id(mod);
+ struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
+ int ssi_id = rsnd_mod_id(ssi_mod);
u32 convert_rate = rsnd_scu_convert_rate(scu);
if (convert_rate && !rsnd_dai_is_clk_master(rdai)) {
@@ -134,15 +135,15 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
/*
* SSI_MODE0
*/
- rsnd_mod_bset(mod, SSI_MODE0, (1 << id),
- rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << id));
+ rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id),
+ rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id));
/*
* SSI_MODE1
*/
- if (rsnd_ssi_is_pin_sharing(rsnd_ssi_mod_get(priv, id))) {
+ if (rsnd_ssi_is_pin_sharing(ssi_mod)) {
int shift = -1;
- switch (id) {
+ switch (ssi_id) {
case 1:
shift = 0;
break;
@@ -165,14 +166,13 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
}
unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
- struct rsnd_mod *ssi_mod,
+ struct rsnd_dai_stream *io,
struct snd_pcm_runtime *runtime)
{
struct rsnd_scu *scu;
unsigned int rate;
- /* this function is assuming SSI id = SCU id here */
- scu = rsnd_mod_to_scu(rsnd_scu_mod_get(priv, rsnd_mod_id(ssi_mod)));
+ scu = rsnd_mod_to_scu(rsnd_io_to_mod_scu(io));
/*
* return convert rate if SRC is used,
@@ -583,8 +583,10 @@ static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
+ struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
+
/* enable PIO interrupt */
- rsnd_mod_write(mod, INT_ENABLE, 0x0f000000);
+ rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
return 0;
}
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 480dde5..25a7d44 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,
1, 2, 4, 8, 16, 6, 12,
};
unsigned int main_rate;
- unsigned int rate = rsnd_scu_get_ssi_rate(priv, &ssi->mod, runtime);
+ unsigned int rate = rsnd_scu_get_ssi_rate(priv, io, runtime);
/*
* Find best clock, and try to start ADG
OpenPOWER on IntegriCloud