diff options
author | Jassi Brar <jassi.brar@samsung.com> | 2010-11-22 01:36:50 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-23 09:06:38 -0500 |
commit | c3f2028b5b15c6799d84b29a07fb92934b10a4d2 (patch) | |
tree | bc8a3d366e630d66b10c603c92627147f03199b4 /sound/soc/s3c24xx/dma.c | |
parent | 158a782843f9b0716c9fecf14a0563b07cf84da4 (diff) |
ASoC: Samsung: Generalize DMA driver namespace
Remove S3C,s3c from static defines.
s3c_dma_ -> dma_
s3c24xx_runtime_ -> runtime_
s3c24xx_audio_ -> audio_
s3c_preallocate_ -> preallocate_
s3c24xx_soc_platform -> samsung_asoc_platform
s3c24xx_pcm_driver -> asoc_dma_driver
snd_s3c24xx_pcm_ -> samsung_asoc_
Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/s3c24xx/dma.c')
-rw-r--r-- | sound/soc/s3c24xx/dma.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/sound/soc/s3c24xx/dma.c b/sound/soc/s3c24xx/dma.c index c5eb1a2c72fd..21240198c5d6 100644 --- a/sound/soc/s3c24xx/dma.c +++ b/sound/soc/s3c24xx/dma.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include "dma.h" | 33 | #include "dma.h" |
34 | 34 | ||
35 | static const struct snd_pcm_hardware s3c_dma_hardware = { | 35 | static const struct snd_pcm_hardware dma_hardware = { |
36 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 36 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
37 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 37 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
38 | SNDRV_PCM_INFO_MMAP | | 38 | SNDRV_PCM_INFO_MMAP | |
@@ -53,7 +53,7 @@ static const struct snd_pcm_hardware s3c_dma_hardware = { | |||
53 | .fifo_size = 32, | 53 | .fifo_size = 32, |
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct s3c24xx_runtime_data { | 56 | struct runtime_data { |
57 | spinlock_t lock; | 57 | spinlock_t lock; |
58 | int state; | 58 | int state; |
59 | unsigned int dma_loaded; | 59 | unsigned int dma_loaded; |
@@ -65,14 +65,14 @@ struct s3c24xx_runtime_data { | |||
65 | struct s3c_dma_params *params; | 65 | struct s3c_dma_params *params; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* s3c_dma_enqueue | 68 | /* dma_enqueue |
69 | * | 69 | * |
70 | * place a dma buffer onto the queue for the dma system | 70 | * place a dma buffer onto the queue for the dma system |
71 | * to handle. | 71 | * to handle. |
72 | */ | 72 | */ |
73 | static void s3c_dma_enqueue(struct snd_pcm_substream *substream) | 73 | static void dma_enqueue(struct snd_pcm_substream *substream) |
74 | { | 74 | { |
75 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 75 | struct runtime_data *prtd = substream->runtime->private_data; |
76 | dma_addr_t pos = prtd->dma_pos; | 76 | dma_addr_t pos = prtd->dma_pos; |
77 | unsigned int limit; | 77 | unsigned int limit; |
78 | int ret; | 78 | int ret; |
@@ -112,12 +112,12 @@ static void s3c_dma_enqueue(struct snd_pcm_substream *substream) | |||
112 | prtd->dma_pos = pos; | 112 | prtd->dma_pos = pos; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel, | 115 | static void audio_buffdone(struct s3c2410_dma_chan *channel, |
116 | void *dev_id, int size, | 116 | void *dev_id, int size, |
117 | enum s3c2410_dma_buffresult result) | 117 | enum s3c2410_dma_buffresult result) |
118 | { | 118 | { |
119 | struct snd_pcm_substream *substream = dev_id; | 119 | struct snd_pcm_substream *substream = dev_id; |
120 | struct s3c24xx_runtime_data *prtd; | 120 | struct runtime_data *prtd; |
121 | 121 | ||
122 | pr_debug("Entered %s\n", __func__); | 122 | pr_debug("Entered %s\n", __func__); |
123 | 123 | ||
@@ -132,17 +132,17 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel, | |||
132 | spin_lock(&prtd->lock); | 132 | spin_lock(&prtd->lock); |
133 | if (prtd->state & ST_RUNNING && !s3c_dma_has_circular()) { | 133 | if (prtd->state & ST_RUNNING && !s3c_dma_has_circular()) { |
134 | prtd->dma_loaded--; | 134 | prtd->dma_loaded--; |
135 | s3c_dma_enqueue(substream); | 135 | dma_enqueue(substream); |
136 | } | 136 | } |
137 | 137 | ||
138 | spin_unlock(&prtd->lock); | 138 | spin_unlock(&prtd->lock); |
139 | } | 139 | } |
140 | 140 | ||
141 | static int s3c_dma_hw_params(struct snd_pcm_substream *substream, | 141 | static int dma_hw_params(struct snd_pcm_substream *substream, |
142 | struct snd_pcm_hw_params *params) | 142 | struct snd_pcm_hw_params *params) |
143 | { | 143 | { |
144 | struct snd_pcm_runtime *runtime = substream->runtime; | 144 | struct snd_pcm_runtime *runtime = substream->runtime; |
145 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 145 | struct runtime_data *prtd = runtime->private_data; |
146 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 146 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
147 | unsigned long totbytes = params_buffer_bytes(params); | 147 | unsigned long totbytes = params_buffer_bytes(params); |
148 | struct s3c_dma_params *dma = | 148 | struct s3c_dma_params *dma = |
@@ -181,7 +181,7 @@ static int s3c_dma_hw_params(struct snd_pcm_substream *substream, | |||
181 | } | 181 | } |
182 | 182 | ||
183 | s3c2410_dma_set_buffdone_fn(prtd->params->channel, | 183 | s3c2410_dma_set_buffdone_fn(prtd->params->channel, |
184 | s3c24xx_audio_buffdone); | 184 | audio_buffdone); |
185 | 185 | ||
186 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 186 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
187 | 187 | ||
@@ -199,9 +199,9 @@ static int s3c_dma_hw_params(struct snd_pcm_substream *substream, | |||
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | 201 | ||
202 | static int s3c_dma_hw_free(struct snd_pcm_substream *substream) | 202 | static int dma_hw_free(struct snd_pcm_substream *substream) |
203 | { | 203 | { |
204 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 204 | struct runtime_data *prtd = substream->runtime->private_data; |
205 | 205 | ||
206 | pr_debug("Entered %s\n", __func__); | 206 | pr_debug("Entered %s\n", __func__); |
207 | 207 | ||
@@ -216,9 +216,9 @@ static int s3c_dma_hw_free(struct snd_pcm_substream *substream) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static int s3c_dma_prepare(struct snd_pcm_substream *substream) | 219 | static int dma_prepare(struct snd_pcm_substream *substream) |
220 | { | 220 | { |
221 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 221 | struct runtime_data *prtd = substream->runtime->private_data; |
222 | int ret = 0; | 222 | int ret = 0; |
223 | 223 | ||
224 | pr_debug("Entered %s\n", __func__); | 224 | pr_debug("Entered %s\n", __func__); |
@@ -249,14 +249,14 @@ static int s3c_dma_prepare(struct snd_pcm_substream *substream) | |||
249 | prtd->dma_pos = prtd->dma_start; | 249 | prtd->dma_pos = prtd->dma_start; |
250 | 250 | ||
251 | /* enqueue dma buffers */ | 251 | /* enqueue dma buffers */ |
252 | s3c_dma_enqueue(substream); | 252 | dma_enqueue(substream); |
253 | 253 | ||
254 | return ret; | 254 | return ret; |
255 | } | 255 | } |
256 | 256 | ||
257 | static int s3c_dma_trigger(struct snd_pcm_substream *substream, int cmd) | 257 | static int dma_trigger(struct snd_pcm_substream *substream, int cmd) |
258 | { | 258 | { |
259 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 259 | struct runtime_data *prtd = substream->runtime->private_data; |
260 | int ret = 0; | 260 | int ret = 0; |
261 | 261 | ||
262 | pr_debug("Entered %s\n", __func__); | 262 | pr_debug("Entered %s\n", __func__); |
@@ -289,10 +289,10 @@ static int s3c_dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
289 | } | 289 | } |
290 | 290 | ||
291 | static snd_pcm_uframes_t | 291 | static snd_pcm_uframes_t |
292 | s3c_dma_pointer(struct snd_pcm_substream *substream) | 292 | dma_pointer(struct snd_pcm_substream *substream) |
293 | { | 293 | { |
294 | struct snd_pcm_runtime *runtime = substream->runtime; | 294 | struct snd_pcm_runtime *runtime = substream->runtime; |
295 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 295 | struct runtime_data *prtd = runtime->private_data; |
296 | unsigned long res; | 296 | unsigned long res; |
297 | dma_addr_t src, dst; | 297 | dma_addr_t src, dst; |
298 | 298 | ||
@@ -324,17 +324,17 @@ s3c_dma_pointer(struct snd_pcm_substream *substream) | |||
324 | return bytes_to_frames(substream->runtime, res); | 324 | return bytes_to_frames(substream->runtime, res); |
325 | } | 325 | } |
326 | 326 | ||
327 | static int s3c_dma_open(struct snd_pcm_substream *substream) | 327 | static int dma_open(struct snd_pcm_substream *substream) |
328 | { | 328 | { |
329 | struct snd_pcm_runtime *runtime = substream->runtime; | 329 | struct snd_pcm_runtime *runtime = substream->runtime; |
330 | struct s3c24xx_runtime_data *prtd; | 330 | struct runtime_data *prtd; |
331 | 331 | ||
332 | pr_debug("Entered %s\n", __func__); | 332 | pr_debug("Entered %s\n", __func__); |
333 | 333 | ||
334 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 334 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
335 | snd_soc_set_runtime_hwparams(substream, &s3c_dma_hardware); | 335 | snd_soc_set_runtime_hwparams(substream, &dma_hardware); |
336 | 336 | ||
337 | prtd = kzalloc(sizeof(struct s3c24xx_runtime_data), GFP_KERNEL); | 337 | prtd = kzalloc(sizeof(struct runtime_data), GFP_KERNEL); |
338 | if (prtd == NULL) | 338 | if (prtd == NULL) |
339 | return -ENOMEM; | 339 | return -ENOMEM; |
340 | 340 | ||
@@ -344,22 +344,22 @@ static int s3c_dma_open(struct snd_pcm_substream *substream) | |||
344 | return 0; | 344 | return 0; |
345 | } | 345 | } |
346 | 346 | ||
347 | static int s3c_dma_close(struct snd_pcm_substream *substream) | 347 | static int dma_close(struct snd_pcm_substream *substream) |
348 | { | 348 | { |
349 | struct snd_pcm_runtime *runtime = substream->runtime; | 349 | struct snd_pcm_runtime *runtime = substream->runtime; |
350 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 350 | struct runtime_data *prtd = runtime->private_data; |
351 | 351 | ||
352 | pr_debug("Entered %s\n", __func__); | 352 | pr_debug("Entered %s\n", __func__); |
353 | 353 | ||
354 | if (!prtd) | 354 | if (!prtd) |
355 | pr_debug("s3c_dma_close called with prtd == NULL\n"); | 355 | pr_debug("dma_close called with prtd == NULL\n"); |
356 | 356 | ||
357 | kfree(prtd); | 357 | kfree(prtd); |
358 | 358 | ||
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | static int s3c_dma_mmap(struct snd_pcm_substream *substream, | 362 | static int dma_mmap(struct snd_pcm_substream *substream, |
363 | struct vm_area_struct *vma) | 363 | struct vm_area_struct *vma) |
364 | { | 364 | { |
365 | struct snd_pcm_runtime *runtime = substream->runtime; | 365 | struct snd_pcm_runtime *runtime = substream->runtime; |
@@ -372,23 +372,23 @@ static int s3c_dma_mmap(struct snd_pcm_substream *substream, | |||
372 | runtime->dma_bytes); | 372 | runtime->dma_bytes); |
373 | } | 373 | } |
374 | 374 | ||
375 | static struct snd_pcm_ops s3c_dma_ops = { | 375 | static struct snd_pcm_ops dma_ops = { |
376 | .open = s3c_dma_open, | 376 | .open = dma_open, |
377 | .close = s3c_dma_close, | 377 | .close = dma_close, |
378 | .ioctl = snd_pcm_lib_ioctl, | 378 | .ioctl = snd_pcm_lib_ioctl, |
379 | .hw_params = s3c_dma_hw_params, | 379 | .hw_params = dma_hw_params, |
380 | .hw_free = s3c_dma_hw_free, | 380 | .hw_free = dma_hw_free, |
381 | .prepare = s3c_dma_prepare, | 381 | .prepare = dma_prepare, |
382 | .trigger = s3c_dma_trigger, | 382 | .trigger = dma_trigger, |
383 | .pointer = s3c_dma_pointer, | 383 | .pointer = dma_pointer, |
384 | .mmap = s3c_dma_mmap, | 384 | .mmap = dma_mmap, |
385 | }; | 385 | }; |
386 | 386 | ||
387 | static int s3c_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | 387 | static int preallocate_dma_buffer(struct snd_pcm *pcm, int stream) |
388 | { | 388 | { |
389 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | 389 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; |
390 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 390 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
391 | size_t size = s3c_dma_hardware.buffer_bytes_max; | 391 | size_t size = dma_hardware.buffer_bytes_max; |
392 | 392 | ||
393 | pr_debug("Entered %s\n", __func__); | 393 | pr_debug("Entered %s\n", __func__); |
394 | 394 | ||
@@ -403,7 +403,7 @@ static int s3c_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | |||
403 | return 0; | 403 | return 0; |
404 | } | 404 | } |
405 | 405 | ||
406 | static void s3c_dma_free_dma_buffers(struct snd_pcm *pcm) | 406 | static void dma_free_dma_buffers(struct snd_pcm *pcm) |
407 | { | 407 | { |
408 | struct snd_pcm_substream *substream; | 408 | struct snd_pcm_substream *substream; |
409 | struct snd_dma_buffer *buf; | 409 | struct snd_dma_buffer *buf; |
@@ -426,9 +426,9 @@ static void s3c_dma_free_dma_buffers(struct snd_pcm *pcm) | |||
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | static u64 s3c_dma_mask = DMA_BIT_MASK(32); | 429 | static u64 dma_mask = DMA_BIT_MASK(32); |
430 | 430 | ||
431 | static int s3c_dma_new(struct snd_card *card, | 431 | static int dma_new(struct snd_card *card, |
432 | struct snd_soc_dai *dai, struct snd_pcm *pcm) | 432 | struct snd_soc_dai *dai, struct snd_pcm *pcm) |
433 | { | 433 | { |
434 | int ret = 0; | 434 | int ret = 0; |
@@ -436,19 +436,19 @@ static int s3c_dma_new(struct snd_card *card, | |||
436 | pr_debug("Entered %s\n", __func__); | 436 | pr_debug("Entered %s\n", __func__); |
437 | 437 | ||
438 | if (!card->dev->dma_mask) | 438 | if (!card->dev->dma_mask) |
439 | card->dev->dma_mask = &s3c_dma_mask; | 439 | card->dev->dma_mask = &dma_mask; |
440 | if (!card->dev->coherent_dma_mask) | 440 | if (!card->dev->coherent_dma_mask) |
441 | card->dev->coherent_dma_mask = 0xffffffff; | 441 | card->dev->coherent_dma_mask = 0xffffffff; |
442 | 442 | ||
443 | if (dai->driver->playback.channels_min) { | 443 | if (dai->driver->playback.channels_min) { |
444 | ret = s3c_preallocate_dma_buffer(pcm, | 444 | ret = preallocate_dma_buffer(pcm, |
445 | SNDRV_PCM_STREAM_PLAYBACK); | 445 | SNDRV_PCM_STREAM_PLAYBACK); |
446 | if (ret) | 446 | if (ret) |
447 | goto out; | 447 | goto out; |
448 | } | 448 | } |
449 | 449 | ||
450 | if (dai->driver->capture.channels_min) { | 450 | if (dai->driver->capture.channels_min) { |
451 | ret = s3c_preallocate_dma_buffer(pcm, | 451 | ret = preallocate_dma_buffer(pcm, |
452 | SNDRV_PCM_STREAM_CAPTURE); | 452 | SNDRV_PCM_STREAM_CAPTURE); |
453 | if (ret) | 453 | if (ret) |
454 | goto out; | 454 | goto out; |
@@ -457,46 +457,46 @@ out: | |||
457 | return ret; | 457 | return ret; |
458 | } | 458 | } |
459 | 459 | ||
460 | static struct snd_soc_platform_driver s3c24xx_soc_platform = { | 460 | static struct snd_soc_platform_driver samsung_asoc_platform = { |
461 | .ops = &s3c_dma_ops, | 461 | .ops = &dma_ops, |
462 | .pcm_new = s3c_dma_new, | 462 | .pcm_new = dma_new, |
463 | .pcm_free = s3c_dma_free_dma_buffers, | 463 | .pcm_free = dma_free_dma_buffers, |
464 | }; | 464 | }; |
465 | 465 | ||
466 | static int __devinit s3c24xx_soc_platform_probe(struct platform_device *pdev) | 466 | static int __devinit samsung_asoc_platform_probe(struct platform_device *pdev) |
467 | { | 467 | { |
468 | return snd_soc_register_platform(&pdev->dev, &s3c24xx_soc_platform); | 468 | return snd_soc_register_platform(&pdev->dev, &samsung_asoc_platform); |
469 | } | 469 | } |
470 | 470 | ||
471 | static int __devexit s3c24xx_soc_platform_remove(struct platform_device *pdev) | 471 | static int __devexit samsung_asoc_platform_remove(struct platform_device *pdev) |
472 | { | 472 | { |
473 | snd_soc_unregister_platform(&pdev->dev); | 473 | snd_soc_unregister_platform(&pdev->dev); |
474 | return 0; | 474 | return 0; |
475 | } | 475 | } |
476 | 476 | ||
477 | static struct platform_driver s3c24xx_pcm_driver = { | 477 | static struct platform_driver asoc_dma_driver = { |
478 | .driver = { | 478 | .driver = { |
479 | .name = "samsung-audio", | 479 | .name = "samsung-audio", |
480 | .owner = THIS_MODULE, | 480 | .owner = THIS_MODULE, |
481 | }, | 481 | }, |
482 | 482 | ||
483 | .probe = s3c24xx_soc_platform_probe, | 483 | .probe = samsung_asoc_platform_probe, |
484 | .remove = __devexit_p(s3c24xx_soc_platform_remove), | 484 | .remove = __devexit_p(samsung_asoc_platform_remove), |
485 | }; | 485 | }; |
486 | 486 | ||
487 | static int __init snd_s3c24xx_pcm_init(void) | 487 | static int __init samsung_asoc_init(void) |
488 | { | 488 | { |
489 | return platform_driver_register(&s3c24xx_pcm_driver); | 489 | return platform_driver_register(&asoc_dma_driver); |
490 | } | 490 | } |
491 | module_init(snd_s3c24xx_pcm_init); | 491 | module_init(samsung_asoc_init); |
492 | 492 | ||
493 | static void __exit snd_s3c24xx_pcm_exit(void) | 493 | static void __exit samsung_asoc_exit(void) |
494 | { | 494 | { |
495 | platform_driver_unregister(&s3c24xx_pcm_driver); | 495 | platform_driver_unregister(&asoc_dma_driver); |
496 | } | 496 | } |
497 | module_exit(snd_s3c24xx_pcm_exit); | 497 | module_exit(samsung_asoc_exit); |
498 | 498 | ||
499 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 499 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
500 | MODULE_DESCRIPTION("Samsung S3C Audio DMA module"); | 500 | MODULE_DESCRIPTION("Samsung ASoC DMA Driver"); |
501 | MODULE_LICENSE("GPL"); | 501 | MODULE_LICENSE("GPL"); |
502 | MODULE_ALIAS("platform:samsung-audio"); | 502 | MODULE_ALIAS("platform:samsung-audio"); |