aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2013-12-19 22:28:04 -0500
committerMark Brown <broonie@linaro.org>2013-12-31 08:35:30 -0500
commitaf8a478821345fd264fd2294e80f5b0a28a518bc (patch)
tree16f01103abfea9c420a8d8af73f4828c8a1d46f6 /sound/soc/sh
parent2582718cb6bd620d37a54db885c75bfe4822db45 (diff)
ASoC: rsnd: add rsnd_scu_transfer_start()
Renesas sound has SRC (= Sampling Rate Converter), but, the HW implementation depends on its generation. It was part of SRU on Gen1, and SCU on Gen2. This SCU needs DMA transfer to use it. Current rsnd driver is using it as DMA transfer buffer (= no rate convert), and Gen1 is only supported at this point. This patch cleanup it with focusing about SRC and Gen2 part. SRC_CTRL/BUSIF_MODE are used for transfer start. This patch adds rsnd_scu_transfer_start() and merge these 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/scu.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index 7642ec52b590..3d8b57b1630b 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -106,22 +106,6 @@ static int rsnd_src_set_route_if_gen1(struct rsnd_priv *priv,
106 return 0; 106 return 0;
107} 107}
108 108
109static int rsnd_scu_set_mode(struct rsnd_priv *priv,
110 struct rsnd_mod *mod,
111 struct rsnd_dai *rdai,
112 struct rsnd_dai_stream *io)
113{
114 int id = rsnd_mod_id(mod);
115 u32 val;
116
117 if (rsnd_is_gen1(priv)) {
118 val = (1 << id);
119 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, val, val);
120 }
121
122 return 0;
123}
124
125static int rsnd_scu_set_hpbif(struct rsnd_priv *priv, 109static int rsnd_scu_set_hpbif(struct rsnd_priv *priv,
126 struct rsnd_mod *mod, 110 struct rsnd_mod *mod,
127 struct rsnd_dai *rdai, 111 struct rsnd_dai *rdai,
@@ -141,12 +125,29 @@ static int rsnd_scu_set_hpbif(struct rsnd_priv *priv,
141 return -EIO; 125 return -EIO;
142 } 126 }
143 127
144 rsnd_mod_write(mod, BUSIF_MODE, 1);
145 rsnd_mod_write(mod, SRC_ADINR, adinr); 128 rsnd_mod_write(mod, SRC_ADINR, adinr);
146 129
147 return 0; 130 return 0;
148} 131}
149 132
133static int rsnd_scu_transfer_start(struct rsnd_priv *priv,
134 struct rsnd_mod *mod,
135 struct rsnd_dai *rdai,
136 struct rsnd_dai_stream *io)
137{
138 int id = rsnd_mod_id(mod);
139 u32 val;
140
141 if (rsnd_is_gen1(priv)) {
142 val = (1 << id);
143 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, val, val);
144 }
145
146 rsnd_mod_write(mod, BUSIF_MODE, 1);
147
148 return 0;
149}
150
150bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod) 151bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod)
151{ 152{
152 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 153 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
@@ -180,11 +181,11 @@ static int rsnd_scu_start(struct rsnd_mod *mod,
180 if (ret < 0) 181 if (ret < 0)
181 return ret; 182 return ret;
182 183
183 ret = rsnd_scu_set_mode(priv, mod, rdai, io); 184 ret = rsnd_scu_set_hpbif(priv, mod, rdai, io);
184 if (ret < 0) 185 if (ret < 0)
185 return ret; 186 return ret;
186 187
187 ret = rsnd_scu_set_hpbif(priv, mod, rdai, io); 188 ret = rsnd_scu_transfer_start(priv, mod, rdai, io);
188 if (ret < 0) 189 if (ret < 0)
189 return ret; 190 return ret;
190 191