diff options
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/rcar/core.c | 87 | ||||
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 20 | ||||
-rw-r--r-- | sound/soc/sh/rcar/gen.c | 95 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 10 | ||||
-rw-r--r-- | sound/soc/sh/rcar/src.c | 50 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 28 |
6 files changed, 259 insertions, 31 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 964463dada87..91880156e1ae 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -255,11 +255,81 @@ int rsnd_dma_available(struct rsnd_dma *dma) | |||
255 | return !!dma->chan; | 255 | return !!dma->chan; |
256 | } | 256 | } |
257 | 257 | ||
258 | #define DMA_NAME_SIZE 16 | ||
259 | #define MOD_MAX 4 /* MEM/SSI/SRC/DVC */ | ||
260 | static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod) | ||
261 | { | ||
262 | if (mod) | ||
263 | return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d", | ||
264 | rsnd_mod_name(mod), rsnd_mod_id(mod)); | ||
265 | else | ||
266 | return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem"); | ||
267 | |||
268 | } | ||
269 | |||
270 | static void rsnd_dma_of_name(struct rsnd_dma *dma, | ||
271 | int is_play, char *dma_name) | ||
272 | { | ||
273 | struct rsnd_mod *this = rsnd_dma_to_mod(dma); | ||
274 | struct rsnd_dai_stream *io = rsnd_mod_to_io(this); | ||
275 | struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io); | ||
276 | struct rsnd_mod *src = rsnd_io_to_mod_src(io); | ||
277 | struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); | ||
278 | struct rsnd_mod *mod[MOD_MAX]; | ||
279 | struct rsnd_mod *src_mod, *dst_mod; | ||
280 | int i, index; | ||
281 | |||
282 | |||
283 | for (i = 0; i < MOD_MAX; i++) | ||
284 | mod[i] = NULL; | ||
285 | |||
286 | /* | ||
287 | * in play case... | ||
288 | * | ||
289 | * src -> dst | ||
290 | * | ||
291 | * mem -> SSI | ||
292 | * mem -> SRC -> SSI | ||
293 | * mem -> SRC -> DVC -> SSI | ||
294 | */ | ||
295 | mod[0] = NULL; /* for "mem" */ | ||
296 | index = 1; | ||
297 | for (i = 1; i < MOD_MAX; i++) { | ||
298 | if (!src) { | ||
299 | mod[i] = ssi; | ||
300 | break; | ||
301 | } else if (!dvc) { | ||
302 | mod[i] = src; | ||
303 | src = NULL; | ||
304 | } else { | ||
305 | mod[i] = dvc; | ||
306 | dvc = NULL; | ||
307 | } | ||
308 | |||
309 | if (mod[i] == this) | ||
310 | index = i; | ||
311 | } | ||
312 | |||
313 | if (is_play) { | ||
314 | src_mod = mod[index - 1]; | ||
315 | dst_mod = mod[index]; | ||
316 | } else { | ||
317 | src_mod = mod[index]; | ||
318 | dst_mod = mod[index + 1]; | ||
319 | } | ||
320 | |||
321 | index = 0; | ||
322 | index = _rsnd_dma_of_name(dma_name + index, src_mod); | ||
323 | *(dma_name + index++) = '_'; | ||
324 | index = _rsnd_dma_of_name(dma_name + index, dst_mod); | ||
325 | } | ||
326 | |||
258 | int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, | 327 | int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, |
259 | int is_play, int id) | 328 | int is_play, int id) |
260 | { | 329 | { |
261 | struct device *dev = rsnd_priv_to_dev(priv); | 330 | struct device *dev = rsnd_priv_to_dev(priv); |
262 | struct dma_slave_config cfg; | 331 | struct dma_slave_config cfg; |
332 | char dma_name[DMA_NAME_SIZE]; | ||
263 | dma_cap_mask_t mask; | 333 | dma_cap_mask_t mask; |
264 | int ret; | 334 | int ret; |
265 | 335 | ||
@@ -271,18 +341,23 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, | |||
271 | dma_cap_zero(mask); | 341 | dma_cap_zero(mask); |
272 | dma_cap_set(DMA_SLAVE, mask); | 342 | dma_cap_set(DMA_SLAVE, mask); |
273 | 343 | ||
344 | if (dev->of_node) | ||
345 | rsnd_dma_of_name(dma, is_play, dma_name); | ||
346 | else | ||
347 | snprintf(dma_name, DMA_NAME_SIZE, | ||
348 | is_play ? "tx" : "rx"); | ||
349 | |||
350 | dev_dbg(dev, "dma name : %s\n", dma_name); | ||
351 | |||
274 | dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, | 352 | dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, |
275 | (void *)id, dev, | 353 | (void *)id, dev, |
276 | is_play ? "tx" : "rx"); | 354 | dma_name); |
277 | if (!dma->chan) { | 355 | if (!dma->chan) { |
278 | dev_err(dev, "can't get dma channel\n"); | 356 | dev_err(dev, "can't get dma channel\n"); |
279 | return -EIO; | 357 | return -EIO; |
280 | } | 358 | } |
281 | 359 | ||
282 | cfg.slave_id = id; | 360 | rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id); |
283 | cfg.dst_addr = 0; /* use default addr when playback */ | ||
284 | cfg.src_addr = 0; /* use default addr when capture */ | ||
285 | cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; | ||
286 | 361 | ||
287 | ret = dmaengine_slave_config(dma->chan, &cfg); | 362 | ret = dmaengine_slave_config(dma->chan, &cfg); |
288 | if (ret < 0) | 363 | if (ret < 0) |
@@ -956,7 +1031,7 @@ static int rsnd_probe(struct platform_device *pdev) | |||
956 | return -ENODEV; | 1031 | return -ENODEV; |
957 | } | 1032 | } |
958 | 1033 | ||
959 | priv->dev = dev; | 1034 | priv->pdev = pdev; |
960 | priv->info = info; | 1035 | priv->info = info; |
961 | spin_lock_init(&priv->lock); | 1036 | spin_lock_init(&priv->lock); |
962 | 1037 | ||
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 74769b1be005..ed0007006899 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c | |||
@@ -13,6 +13,9 @@ | |||
13 | #define RSND_DVC_NAME_SIZE 16 | 13 | #define RSND_DVC_NAME_SIZE 16 |
14 | #define RSND_DVC_VOLUME_MAX 100 | 14 | #define RSND_DVC_VOLUME_MAX 100 |
15 | #define RSND_DVC_VOLUME_NUM 2 | 15 | #define RSND_DVC_VOLUME_NUM 2 |
16 | |||
17 | #define DVC_NAME "dvc" | ||
18 | |||
16 | struct rsnd_dvc { | 19 | struct rsnd_dvc { |
17 | struct rsnd_dvc_platform_info *info; /* rcar_snd.h */ | 20 | struct rsnd_dvc_platform_info *info; /* rcar_snd.h */ |
18 | struct rsnd_mod mod; | 21 | struct rsnd_mod mod; |
@@ -43,6 +46,17 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod) | |||
43 | rsnd_mod_write(mod, DVC_VOL1R, vol[1]); | 46 | rsnd_mod_write(mod, DVC_VOL1R, vol[1]); |
44 | } | 47 | } |
45 | 48 | ||
49 | static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod, | ||
50 | struct rsnd_dai *rdai) | ||
51 | { | ||
52 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | ||
53 | struct device *dev = rsnd_priv_to_dev(priv); | ||
54 | |||
55 | dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod)); | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
46 | static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, | 60 | static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, |
47 | struct rsnd_dai *rdai) | 61 | struct rsnd_dai *rdai) |
48 | { | 62 | { |
@@ -208,7 +222,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
208 | } | 222 | } |
209 | 223 | ||
210 | static struct rsnd_mod_ops rsnd_dvc_ops = { | 224 | static struct rsnd_mod_ops rsnd_dvc_ops = { |
211 | .name = "dvc (gen2)", | 225 | .name = DVC_NAME, |
226 | .probe = rsnd_dvc_probe_gen2, | ||
212 | .init = rsnd_dvc_init, | 227 | .init = rsnd_dvc_init, |
213 | .quit = rsnd_dvc_quit, | 228 | .quit = rsnd_dvc_quit, |
214 | .start = rsnd_dvc_start, | 229 | .start = rsnd_dvc_start, |
@@ -255,7 +270,8 @@ int rsnd_dvc_probe(struct platform_device *pdev, | |||
255 | priv->dvc = dvc; | 270 | priv->dvc = dvc; |
256 | 271 | ||
257 | for_each_rsnd_dvc(dvc, priv, i) { | 272 | for_each_rsnd_dvc(dvc, priv, i) { |
258 | snprintf(name, RSND_DVC_NAME_SIZE, "dvc.%d", i); | 273 | snprintf(name, RSND_DVC_NAME_SIZE, "%s.%d", |
274 | DVC_NAME, i); | ||
259 | 275 | ||
260 | clk = devm_clk_get(dev, name); | 276 | clk = devm_clk_get(dev, name); |
261 | if (IS_ERR(clk)) | 277 | if (IS_ERR(clk)) |
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c index a1583b57bf8d..1dd2b7d38c2c 100644 --- a/sound/soc/sh/rcar/gen.c +++ b/sound/soc/sh/rcar/gen.c | |||
@@ -156,6 +156,101 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv, | |||
156 | } | 156 | } |
157 | 157 | ||
158 | /* | 158 | /* |
159 | * DMA read/write register offset | ||
160 | * | ||
161 | * RSND_xxx_I_N for Audio DMAC input | ||
162 | * RSND_xxx_O_N for Audio DMAC output | ||
163 | * RSND_xxx_I_P for Audio DMAC peri peri input | ||
164 | * RSND_xxx_O_P for Audio DMAC peri peri output | ||
165 | * | ||
166 | * ex) R-Car H2 case | ||
167 | * mod / DMAC in / DMAC out / DMAC PP in / DMAC pp out | ||
168 | * SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000 | ||
169 | * SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000 | ||
170 | * CMD : 0xec500000 / 0xec008000 0xec308000 | ||
171 | */ | ||
172 | #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8) | ||
173 | #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc) | ||
174 | |||
175 | #define RDMA_SSI_I_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i)) | ||
176 | #define RDMA_SSI_O_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i)) | ||
177 | |||
178 | #define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i)) | ||
179 | #define RDMA_SRC_O_N(addr, i) (addr ##_reg - 0x004fc000 + (0x400 * i)) | ||
180 | |||
181 | #define RDMA_SRC_I_P(addr, i) (addr ##_reg - 0x00200000 + (0x400 * i)) | ||
182 | #define RDMA_SRC_O_P(addr, i) (addr ##_reg - 0x001fc000 + (0x400 * i)) | ||
183 | |||
184 | #define RDMA_CMD_O_N(addr, i) (addr ##_reg - 0x004f8000 + (0x400 * i)) | ||
185 | #define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i)) | ||
186 | |||
187 | void rsnd_gen_dma_addr(struct rsnd_priv *priv, | ||
188 | struct rsnd_dma *dma, | ||
189 | struct dma_slave_config *cfg, | ||
190 | int is_play, int slave_id) | ||
191 | { | ||
192 | struct platform_device *pdev = rsnd_priv_to_pdev(priv); | ||
193 | struct device *dev = rsnd_priv_to_dev(priv); | ||
194 | struct rsnd_mod *mod = rsnd_dma_to_mod(dma); | ||
195 | struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); | ||
196 | dma_addr_t ssi_reg = platform_get_resource(pdev, | ||
197 | IORESOURCE_MEM, RSND_GEN2_SSI)->start; | ||
198 | dma_addr_t src_reg = platform_get_resource(pdev, | ||
199 | IORESOURCE_MEM, RSND_GEN2_SCU)->start; | ||
200 | int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod); | ||
201 | int use_src = !!rsnd_io_to_mod_src(io); | ||
202 | int use_dvc = !!rsnd_io_to_mod_dvc(io); | ||
203 | int id = rsnd_mod_id(mod); | ||
204 | struct dma_addr { | ||
205 | dma_addr_t src_addr; | ||
206 | dma_addr_t dst_addr; | ||
207 | } dma_addrs[2][2][3] = { | ||
208 | { /* SRC */ | ||
209 | /* Capture */ | ||
210 | {{ 0, 0 }, | ||
211 | { RDMA_SRC_O_N(src, id), 0 }, | ||
212 | { RDMA_CMD_O_N(src, id), 0 }}, | ||
213 | /* Playback */ | ||
214 | {{ 0, 0, }, | ||
215 | { 0, RDMA_SRC_I_N(src, id) }, | ||
216 | { 0, RDMA_SRC_I_N(src, id) }} | ||
217 | }, { /* SSI */ | ||
218 | /* Capture */ | ||
219 | {{ RDMA_SSI_O_N(ssi, id), 0 }, | ||
220 | { RDMA_SSI_O_P(ssi, id), RDMA_SRC_I_P(src, id) }, | ||
221 | { RDMA_SSI_O_P(ssi, id), RDMA_SRC_I_P(src, id) }}, | ||
222 | /* Playback */ | ||
223 | {{ 0, RDMA_SSI_I_N(ssi, id) }, | ||
224 | { RDMA_SRC_O_P(src, id), RDMA_SSI_I_P(ssi, id) }, | ||
225 | { RDMA_CMD_O_P(src, id), RDMA_SSI_I_P(ssi, id) }} | ||
226 | } | ||
227 | }; | ||
228 | |||
229 | cfg->slave_id = slave_id; | ||
230 | cfg->src_addr = 0; | ||
231 | cfg->dst_addr = 0; | ||
232 | cfg->direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; | ||
233 | |||
234 | /* | ||
235 | * gen1 uses default DMA addr | ||
236 | */ | ||
237 | if (rsnd_is_gen1(priv)) | ||
238 | return; | ||
239 | |||
240 | /* it shouldn't happen */ | ||
241 | if (use_dvc & !use_src) { | ||
242 | dev_err(dev, "DVC is selected without SRC\n"); | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr; | ||
247 | cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr; | ||
248 | |||
249 | dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n", | ||
250 | id, cfg->src_addr, cfg->dst_addr); | ||
251 | } | ||
252 | |||
253 | /* | ||
159 | * Gen2 | 254 | * Gen2 |
160 | */ | 255 | */ |
161 | 256 | ||
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 5aa790170b01..39d98af5ee05 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -281,6 +281,11 @@ int rsnd_gen_probe(struct platform_device *pdev, | |||
281 | void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, | 281 | void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv, |
282 | struct rsnd_mod *mod, | 282 | struct rsnd_mod *mod, |
283 | enum rsnd_reg reg); | 283 | enum rsnd_reg reg); |
284 | void rsnd_gen_dma_addr(struct rsnd_priv *priv, | ||
285 | struct rsnd_dma *dma, | ||
286 | struct dma_slave_config *cfg, | ||
287 | int is_play, int slave_id); | ||
288 | |||
284 | #define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1) | 289 | #define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1) |
285 | #define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2) | 290 | #define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2) |
286 | 291 | ||
@@ -317,7 +322,7 @@ struct rsnd_of_data { | |||
317 | 322 | ||
318 | struct rsnd_priv { | 323 | struct rsnd_priv { |
319 | 324 | ||
320 | struct device *dev; | 325 | struct platform_device *pdev; |
321 | struct rcar_snd_info *info; | 326 | struct rcar_snd_info *info; |
322 | spinlock_t lock; | 327 | spinlock_t lock; |
323 | 328 | ||
@@ -357,7 +362,8 @@ struct rsnd_priv { | |||
357 | int rdai_nr; | 362 | int rdai_nr; |
358 | }; | 363 | }; |
359 | 364 | ||
360 | #define rsnd_priv_to_dev(priv) ((priv)->dev) | 365 | #define rsnd_priv_to_pdev(priv) ((priv)->pdev) |
366 | #define rsnd_priv_to_dev(priv) (&(rsnd_priv_to_pdev(priv)->dev)) | ||
361 | #define rsnd_priv_to_info(priv) ((priv)->info) | 367 | #define rsnd_priv_to_info(priv) ((priv)->info) |
362 | #define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags) | 368 | #define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags) |
363 | #define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags) | 369 | #define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags) |
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index e3b078e7c3aa..200eda019bc7 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c | |||
@@ -10,6 +10,8 @@ | |||
10 | */ | 10 | */ |
11 | #include "rsnd.h" | 11 | #include "rsnd.h" |
12 | 12 | ||
13 | #define SRC_NAME "src" | ||
14 | |||
13 | struct rsnd_src { | 15 | struct rsnd_src { |
14 | struct rsnd_src_platform_info *info; /* rcar_snd.h */ | 16 | struct rsnd_src_platform_info *info; /* rcar_snd.h */ |
15 | struct rsnd_mod mod; | 17 | struct rsnd_mod mod; |
@@ -268,10 +270,6 @@ static int rsnd_src_stop(struct rsnd_mod *mod, | |||
268 | return 0; | 270 | return 0; |
269 | } | 271 | } |
270 | 272 | ||
271 | static struct rsnd_mod_ops rsnd_src_non_ops = { | ||
272 | .name = "src (non)", | ||
273 | }; | ||
274 | |||
275 | /* | 273 | /* |
276 | * Gen1 functions | 274 | * Gen1 functions |
277 | */ | 275 | */ |
@@ -393,6 +391,17 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod, | |||
393 | return 0; | 391 | return 0; |
394 | } | 392 | } |
395 | 393 | ||
394 | static int rsnd_src_probe_gen1(struct rsnd_mod *mod, | ||
395 | struct rsnd_dai *rdai) | ||
396 | { | ||
397 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | ||
398 | struct device *dev = rsnd_priv_to_dev(priv); | ||
399 | |||
400 | dev_dbg(dev, "%s (Gen1) is probed\n", rsnd_mod_name(mod)); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
396 | static int rsnd_src_init_gen1(struct rsnd_mod *mod, | 405 | static int rsnd_src_init_gen1(struct rsnd_mod *mod, |
397 | struct rsnd_dai *rdai) | 406 | struct rsnd_dai *rdai) |
398 | { | 407 | { |
@@ -438,7 +447,8 @@ static int rsnd_src_stop_gen1(struct rsnd_mod *mod, | |||
438 | } | 447 | } |
439 | 448 | ||
440 | static struct rsnd_mod_ops rsnd_src_gen1_ops = { | 449 | static struct rsnd_mod_ops rsnd_src_gen1_ops = { |
441 | .name = "sru (gen1)", | 450 | .name = SRC_NAME, |
451 | .probe = rsnd_src_probe_gen1, | ||
442 | .init = rsnd_src_init_gen1, | 452 | .init = rsnd_src_init_gen1, |
443 | .quit = rsnd_src_quit, | 453 | .quit = rsnd_src_quit, |
444 | .start = rsnd_src_start_gen1, | 454 | .start = rsnd_src_start_gen1, |
@@ -502,6 +512,8 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod, | |||
502 | if (ret < 0) | 512 | if (ret < 0) |
503 | dev_err(dev, "SRC DMA failed\n"); | 513 | dev_err(dev, "SRC DMA failed\n"); |
504 | 514 | ||
515 | dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod)); | ||
516 | |||
505 | return ret; | 517 | return ret; |
506 | } | 518 | } |
507 | 519 | ||
@@ -562,7 +574,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod, | |||
562 | } | 574 | } |
563 | 575 | ||
564 | static struct rsnd_mod_ops rsnd_src_gen2_ops = { | 576 | static struct rsnd_mod_ops rsnd_src_gen2_ops = { |
565 | .name = "src (gen2)", | 577 | .name = SRC_NAME, |
566 | .probe = rsnd_src_probe_gen2, | 578 | .probe = rsnd_src_probe_gen2, |
567 | .remove = rsnd_src_remove_gen2, | 579 | .remove = rsnd_src_remove_gen2, |
568 | .init = rsnd_src_init_gen2, | 580 | .init = rsnd_src_init_gen2, |
@@ -598,18 +610,21 @@ static void rsnd_of_parse_src(struct platform_device *pdev, | |||
598 | 610 | ||
599 | nr = of_get_child_count(src_node); | 611 | nr = of_get_child_count(src_node); |
600 | if (!nr) | 612 | if (!nr) |
601 | return; | 613 | goto rsnd_of_parse_src_end; |
602 | 614 | ||
603 | src_info = devm_kzalloc(dev, | 615 | src_info = devm_kzalloc(dev, |
604 | sizeof(struct rsnd_src_platform_info) * nr, | 616 | sizeof(struct rsnd_src_platform_info) * nr, |
605 | GFP_KERNEL); | 617 | GFP_KERNEL); |
606 | if (!src_info) { | 618 | if (!src_info) { |
607 | dev_err(dev, "src info allocation error\n"); | 619 | dev_err(dev, "src info allocation error\n"); |
608 | return; | 620 | goto rsnd_of_parse_src_end; |
609 | } | 621 | } |
610 | 622 | ||
611 | info->src_info = src_info; | 623 | info->src_info = src_info; |
612 | info->src_info_nr = nr; | 624 | info->src_info_nr = nr; |
625 | |||
626 | rsnd_of_parse_src_end: | ||
627 | of_node_put(src_node); | ||
613 | } | 628 | } |
614 | 629 | ||
615 | int rsnd_src_probe(struct platform_device *pdev, | 630 | int rsnd_src_probe(struct platform_device *pdev, |
@@ -624,6 +639,16 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
624 | char name[RSND_SRC_NAME_SIZE]; | 639 | char name[RSND_SRC_NAME_SIZE]; |
625 | int i, nr; | 640 | int i, nr; |
626 | 641 | ||
642 | ops = NULL; | ||
643 | if (rsnd_is_gen1(priv)) | ||
644 | ops = &rsnd_src_gen1_ops; | ||
645 | if (rsnd_is_gen2(priv)) | ||
646 | ops = &rsnd_src_gen2_ops; | ||
647 | if (!ops) { | ||
648 | dev_err(dev, "unknown Generation\n"); | ||
649 | return -EIO; | ||
650 | } | ||
651 | |||
627 | rsnd_of_parse_src(pdev, of_data, priv); | 652 | rsnd_of_parse_src(pdev, of_data, priv); |
628 | 653 | ||
629 | /* | 654 | /* |
@@ -643,7 +668,8 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
643 | priv->src = src; | 668 | priv->src = src; |
644 | 669 | ||
645 | for_each_rsnd_src(src, priv, i) { | 670 | for_each_rsnd_src(src, priv, i) { |
646 | snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i); | 671 | snprintf(name, RSND_SRC_NAME_SIZE, "%s.%d", |
672 | SRC_NAME, i); | ||
647 | 673 | ||
648 | clk = devm_clk_get(dev, name); | 674 | clk = devm_clk_get(dev, name); |
649 | if (IS_ERR(clk)) | 675 | if (IS_ERR(clk)) |
@@ -652,12 +678,6 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
652 | src->info = &info->src_info[i]; | 678 | src->info = &info->src_info[i]; |
653 | src->clk = clk; | 679 | src->clk = clk; |
654 | 680 | ||
655 | ops = &rsnd_src_non_ops; | ||
656 | if (rsnd_is_gen1(priv)) | ||
657 | ops = &rsnd_src_gen1_ops; | ||
658 | if (rsnd_is_gen2(priv)) | ||
659 | ops = &rsnd_src_gen2_ops; | ||
660 | |||
661 | rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i); | 681 | rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i); |
662 | 682 | ||
663 | dev_dbg(dev, "SRC%d probed\n", i); | 683 | dev_dbg(dev, "SRC%d probed\n", i); |
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 36654bd4e428..2df723df5d19 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -57,6 +57,8 @@ | |||
57 | */ | 57 | */ |
58 | #define CONT (1 << 8) /* WS Continue Function */ | 58 | #define CONT (1 << 8) /* WS Continue Function */ |
59 | 59 | ||
60 | #define SSI_NAME "ssi" | ||
61 | |||
60 | struct rsnd_ssi { | 62 | struct rsnd_ssi { |
61 | struct clk *clk; | 63 | struct clk *clk; |
62 | struct rsnd_ssi_platform_info *info; /* rcar_snd.h */ | 64 | struct rsnd_ssi_platform_info *info; /* rcar_snd.h */ |
@@ -373,6 +375,8 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod, | |||
373 | if (ret) | 375 | if (ret) |
374 | dev_err(dev, "SSI request interrupt failed\n"); | 376 | dev_err(dev, "SSI request interrupt failed\n"); |
375 | 377 | ||
378 | dev_dbg(dev, "%s (PIO) is probed\n", rsnd_mod_name(mod)); | ||
379 | |||
376 | return ret; | 380 | return ret; |
377 | } | 381 | } |
378 | 382 | ||
@@ -405,7 +409,7 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod, | |||
405 | } | 409 | } |
406 | 410 | ||
407 | static struct rsnd_mod_ops rsnd_ssi_pio_ops = { | 411 | static struct rsnd_mod_ops rsnd_ssi_pio_ops = { |
408 | .name = "ssi (pio)", | 412 | .name = SSI_NAME, |
409 | .probe = rsnd_ssi_pio_probe, | 413 | .probe = rsnd_ssi_pio_probe, |
410 | .init = rsnd_ssi_init, | 414 | .init = rsnd_ssi_init, |
411 | .quit = rsnd_ssi_quit, | 415 | .quit = rsnd_ssi_quit, |
@@ -430,6 +434,8 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, | |||
430 | if (ret < 0) | 434 | if (ret < 0) |
431 | dev_err(dev, "SSI DMA failed\n"); | 435 | dev_err(dev, "SSI DMA failed\n"); |
432 | 436 | ||
437 | dev_dbg(dev, "%s (DMA) is probed\n", rsnd_mod_name(mod)); | ||
438 | |||
433 | return ret; | 439 | return ret; |
434 | } | 440 | } |
435 | 441 | ||
@@ -480,7 +486,7 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod, | |||
480 | } | 486 | } |
481 | 487 | ||
482 | static struct rsnd_mod_ops rsnd_ssi_dma_ops = { | 488 | static struct rsnd_mod_ops rsnd_ssi_dma_ops = { |
483 | .name = "ssi (dma)", | 489 | .name = SSI_NAME, |
484 | .probe = rsnd_ssi_dma_probe, | 490 | .probe = rsnd_ssi_dma_probe, |
485 | .remove = rsnd_ssi_dma_remove, | 491 | .remove = rsnd_ssi_dma_remove, |
486 | .init = rsnd_ssi_init, | 492 | .init = rsnd_ssi_init, |
@@ -493,7 +499,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = { | |||
493 | * Non SSI | 499 | * Non SSI |
494 | */ | 500 | */ |
495 | static struct rsnd_mod_ops rsnd_ssi_non_ops = { | 501 | static struct rsnd_mod_ops rsnd_ssi_non_ops = { |
496 | .name = "ssi (non)", | 502 | .name = SSI_NAME, |
497 | }; | 503 | }; |
498 | 504 | ||
499 | /* | 505 | /* |
@@ -554,14 +560,14 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev, | |||
554 | 560 | ||
555 | nr = of_get_child_count(node); | 561 | nr = of_get_child_count(node); |
556 | if (!nr) | 562 | if (!nr) |
557 | return; | 563 | goto rsnd_of_parse_ssi_end; |
558 | 564 | ||
559 | ssi_info = devm_kzalloc(dev, | 565 | ssi_info = devm_kzalloc(dev, |
560 | sizeof(struct rsnd_ssi_platform_info) * nr, | 566 | sizeof(struct rsnd_ssi_platform_info) * nr, |
561 | GFP_KERNEL); | 567 | GFP_KERNEL); |
562 | if (!ssi_info) { | 568 | if (!ssi_info) { |
563 | dev_err(dev, "ssi info allocation error\n"); | 569 | dev_err(dev, "ssi info allocation error\n"); |
564 | return; | 570 | goto rsnd_of_parse_ssi_end; |
565 | } | 571 | } |
566 | 572 | ||
567 | info->ssi_info = ssi_info; | 573 | info->ssi_info = ssi_info; |
@@ -583,7 +589,16 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev, | |||
583 | * irq | 589 | * irq |
584 | */ | 590 | */ |
585 | ssi_info->pio_irq = irq_of_parse_and_map(np, 0); | 591 | ssi_info->pio_irq = irq_of_parse_and_map(np, 0); |
592 | |||
593 | /* | ||
594 | * DMA | ||
595 | */ | ||
596 | ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ? | ||
597 | 0 : 1; | ||
586 | } | 598 | } |
599 | |||
600 | rsnd_of_parse_ssi_end: | ||
601 | of_node_put(node); | ||
587 | } | 602 | } |
588 | 603 | ||
589 | int rsnd_ssi_probe(struct platform_device *pdev, | 604 | int rsnd_ssi_probe(struct platform_device *pdev, |
@@ -617,7 +632,8 @@ int rsnd_ssi_probe(struct platform_device *pdev, | |||
617 | for_each_rsnd_ssi(ssi, priv, i) { | 632 | for_each_rsnd_ssi(ssi, priv, i) { |
618 | pinfo = &info->ssi_info[i]; | 633 | pinfo = &info->ssi_info[i]; |
619 | 634 | ||
620 | snprintf(name, RSND_SSI_NAME_SIZE, "ssi.%d", i); | 635 | snprintf(name, RSND_SSI_NAME_SIZE, "%s.%d", |
636 | SSI_NAME, i); | ||
621 | 637 | ||
622 | clk = devm_clk_get(dev, name); | 638 | clk = devm_clk_get(dev, name); |
623 | if (IS_ERR(clk)) | 639 | if (IS_ERR(clk)) |