diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c24xx-pcm.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-pcm.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index 151a69463269..cb49400d8c56 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include "s3c24xx-pcm.h" | 33 | #include "s3c24xx-pcm.h" |
34 | 34 | ||
35 | static const struct snd_pcm_hardware s3c24xx_pcm_hardware = { | 35 | static const struct snd_pcm_hardware s3c_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 | |
@@ -62,15 +62,15 @@ struct s3c24xx_runtime_data { | |||
62 | dma_addr_t dma_start; | 62 | dma_addr_t dma_start; |
63 | dma_addr_t dma_pos; | 63 | dma_addr_t dma_pos; |
64 | dma_addr_t dma_end; | 64 | dma_addr_t dma_end; |
65 | struct s3c24xx_pcm_dma_params *params; | 65 | struct s3c_dma_params *params; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* s3c24xx_pcm_enqueue | 68 | /* s3c_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 s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) | 73 | static void s3c_dma_enqueue(struct snd_pcm_substream *substream) |
74 | { | 74 | { |
75 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 75 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; |
76 | dma_addr_t pos = prtd->dma_pos; | 76 | dma_addr_t pos = prtd->dma_pos; |
@@ -132,19 +132,19 @@ 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 | s3c24xx_pcm_enqueue(substream); | 135 | s3c_dma_enqueue(substream); |
136 | } | 136 | } |
137 | 137 | ||
138 | spin_unlock(&prtd->lock); | 138 | spin_unlock(&prtd->lock); |
139 | } | 139 | } |
140 | 140 | ||
141 | static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, | 141 | static int s3c_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 s3c24xx_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 | struct s3c24xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data; | 147 | struct s3c_dma_params *dma = rtd->dai->cpu_dai->dma_data; |
148 | unsigned long totbytes = params_buffer_bytes(params); | 148 | unsigned long totbytes = params_buffer_bytes(params); |
149 | int ret = 0; | 149 | int ret = 0; |
150 | 150 | ||
@@ -197,7 +197,7 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
199 | 199 | ||
200 | static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream) | 200 | static int s3c_dma_hw_free(struct snd_pcm_substream *substream) |
201 | { | 201 | { |
202 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 202 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; |
203 | 203 | ||
@@ -214,7 +214,7 @@ static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
214 | return 0; | 214 | return 0; |
215 | } | 215 | } |
216 | 216 | ||
217 | static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream) | 217 | static int s3c_dma_prepare(struct snd_pcm_substream *substream) |
218 | { | 218 | { |
219 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 219 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; |
220 | int ret = 0; | 220 | int ret = 0; |
@@ -247,12 +247,12 @@ static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream) | |||
247 | prtd->dma_pos = prtd->dma_start; | 247 | prtd->dma_pos = prtd->dma_start; |
248 | 248 | ||
249 | /* enqueue dma buffers */ | 249 | /* enqueue dma buffers */ |
250 | s3c24xx_pcm_enqueue(substream); | 250 | s3c_dma_enqueue(substream); |
251 | 251 | ||
252 | return ret; | 252 | return ret; |
253 | } | 253 | } |
254 | 254 | ||
255 | static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 255 | static int s3c_dma_trigger(struct snd_pcm_substream *substream, int cmd) |
256 | { | 256 | { |
257 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 257 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; |
258 | int ret = 0; | 258 | int ret = 0; |
@@ -287,7 +287,7 @@ static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | static snd_pcm_uframes_t | 289 | static snd_pcm_uframes_t |
290 | s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) | 290 | s3c_dma_pointer(struct snd_pcm_substream *substream) |
291 | { | 291 | { |
292 | struct snd_pcm_runtime *runtime = substream->runtime; | 292 | struct snd_pcm_runtime *runtime = substream->runtime; |
293 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 293 | struct s3c24xx_runtime_data *prtd = runtime->private_data; |
@@ -322,7 +322,7 @@ s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) | |||
322 | return bytes_to_frames(substream->runtime, res); | 322 | return bytes_to_frames(substream->runtime, res); |
323 | } | 323 | } |
324 | 324 | ||
325 | static int s3c24xx_pcm_open(struct snd_pcm_substream *substream) | 325 | static int s3c_dma_open(struct snd_pcm_substream *substream) |
326 | { | 326 | { |
327 | struct snd_pcm_runtime *runtime = substream->runtime; | 327 | struct snd_pcm_runtime *runtime = substream->runtime; |
328 | struct s3c24xx_runtime_data *prtd; | 328 | struct s3c24xx_runtime_data *prtd; |
@@ -330,7 +330,7 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream) | |||
330 | pr_debug("Entered %s\n", __func__); | 330 | pr_debug("Entered %s\n", __func__); |
331 | 331 | ||
332 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 332 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
333 | snd_soc_set_runtime_hwparams(substream, &s3c24xx_pcm_hardware); | 333 | snd_soc_set_runtime_hwparams(substream, &s3c_dma_hardware); |
334 | 334 | ||
335 | prtd = kzalloc(sizeof(struct s3c24xx_runtime_data), GFP_KERNEL); | 335 | prtd = kzalloc(sizeof(struct s3c24xx_runtime_data), GFP_KERNEL); |
336 | if (prtd == NULL) | 336 | if (prtd == NULL) |
@@ -342,7 +342,7 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream) | |||
342 | return 0; | 342 | return 0; |
343 | } | 343 | } |
344 | 344 | ||
345 | static int s3c24xx_pcm_close(struct snd_pcm_substream *substream) | 345 | static int s3c_dma_close(struct snd_pcm_substream *substream) |
346 | { | 346 | { |
347 | struct snd_pcm_runtime *runtime = substream->runtime; | 347 | struct snd_pcm_runtime *runtime = substream->runtime; |
348 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 348 | struct s3c24xx_runtime_data *prtd = runtime->private_data; |
@@ -350,14 +350,14 @@ static int s3c24xx_pcm_close(struct snd_pcm_substream *substream) | |||
350 | pr_debug("Entered %s\n", __func__); | 350 | pr_debug("Entered %s\n", __func__); |
351 | 351 | ||
352 | if (!prtd) | 352 | if (!prtd) |
353 | pr_debug("s3c24xx_pcm_close called with prtd == NULL\n"); | 353 | pr_debug("s3c_dma_close called with prtd == NULL\n"); |
354 | 354 | ||
355 | kfree(prtd); | 355 | kfree(prtd); |
356 | 356 | ||
357 | return 0; | 357 | return 0; |
358 | } | 358 | } |
359 | 359 | ||
360 | static int s3c24xx_pcm_mmap(struct snd_pcm_substream *substream, | 360 | static int s3c_dma_mmap(struct snd_pcm_substream *substream, |
361 | struct vm_area_struct *vma) | 361 | struct vm_area_struct *vma) |
362 | { | 362 | { |
363 | struct snd_pcm_runtime *runtime = substream->runtime; | 363 | struct snd_pcm_runtime *runtime = substream->runtime; |
@@ -370,23 +370,23 @@ static int s3c24xx_pcm_mmap(struct snd_pcm_substream *substream, | |||
370 | runtime->dma_bytes); | 370 | runtime->dma_bytes); |
371 | } | 371 | } |
372 | 372 | ||
373 | static struct snd_pcm_ops s3c24xx_pcm_ops = { | 373 | static struct snd_pcm_ops s3c_dma_ops = { |
374 | .open = s3c24xx_pcm_open, | 374 | .open = s3c_dma_open, |
375 | .close = s3c24xx_pcm_close, | 375 | .close = s3c_dma_close, |
376 | .ioctl = snd_pcm_lib_ioctl, | 376 | .ioctl = snd_pcm_lib_ioctl, |
377 | .hw_params = s3c24xx_pcm_hw_params, | 377 | .hw_params = s3c_dma_hw_params, |
378 | .hw_free = s3c24xx_pcm_hw_free, | 378 | .hw_free = s3c_dma_hw_free, |
379 | .prepare = s3c24xx_pcm_prepare, | 379 | .prepare = s3c_dma_prepare, |
380 | .trigger = s3c24xx_pcm_trigger, | 380 | .trigger = s3c_dma_trigger, |
381 | .pointer = s3c24xx_pcm_pointer, | 381 | .pointer = s3c_dma_pointer, |
382 | .mmap = s3c24xx_pcm_mmap, | 382 | .mmap = s3c_dma_mmap, |
383 | }; | 383 | }; |
384 | 384 | ||
385 | static int s3c24xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | 385 | static int s3c_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) |
386 | { | 386 | { |
387 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | 387 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; |
388 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 388 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
389 | size_t size = s3c24xx_pcm_hardware.buffer_bytes_max; | 389 | size_t size = s3c_dma_hardware.buffer_bytes_max; |
390 | 390 | ||
391 | pr_debug("Entered %s\n", __func__); | 391 | pr_debug("Entered %s\n", __func__); |
392 | 392 | ||
@@ -401,7 +401,7 @@ static int s3c24xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | |||
401 | return 0; | 401 | return 0; |
402 | } | 402 | } |
403 | 403 | ||
404 | static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | 404 | static void s3c_dma_free_dma_buffers(struct snd_pcm *pcm) |
405 | { | 405 | { |
406 | struct snd_pcm_substream *substream; | 406 | struct snd_pcm_substream *substream; |
407 | struct snd_dma_buffer *buf; | 407 | struct snd_dma_buffer *buf; |
@@ -424,9 +424,9 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | |||
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | static u64 s3c24xx_pcm_dmamask = DMA_BIT_MASK(32); | 427 | static u64 s3c_dma_mask = DMA_BIT_MASK(32); |
428 | 428 | ||
429 | static int s3c24xx_pcm_new(struct snd_card *card, | 429 | static int s3c_dma_new(struct snd_card *card, |
430 | struct snd_soc_dai *dai, struct snd_pcm *pcm) | 430 | struct snd_soc_dai *dai, struct snd_pcm *pcm) |
431 | { | 431 | { |
432 | int ret = 0; | 432 | int ret = 0; |
@@ -434,19 +434,19 @@ static int s3c24xx_pcm_new(struct snd_card *card, | |||
434 | pr_debug("Entered %s\n", __func__); | 434 | pr_debug("Entered %s\n", __func__); |
435 | 435 | ||
436 | if (!card->dev->dma_mask) | 436 | if (!card->dev->dma_mask) |
437 | card->dev->dma_mask = &s3c24xx_pcm_dmamask; | 437 | card->dev->dma_mask = &s3c_dma_mask; |
438 | if (!card->dev->coherent_dma_mask) | 438 | if (!card->dev->coherent_dma_mask) |
439 | card->dev->coherent_dma_mask = 0xffffffff; | 439 | card->dev->coherent_dma_mask = 0xffffffff; |
440 | 440 | ||
441 | if (dai->playback.channels_min) { | 441 | if (dai->playback.channels_min) { |
442 | ret = s3c24xx_pcm_preallocate_dma_buffer(pcm, | 442 | ret = s3c_preallocate_dma_buffer(pcm, |
443 | SNDRV_PCM_STREAM_PLAYBACK); | 443 | SNDRV_PCM_STREAM_PLAYBACK); |
444 | if (ret) | 444 | if (ret) |
445 | goto out; | 445 | goto out; |
446 | } | 446 | } |
447 | 447 | ||
448 | if (dai->capture.channels_min) { | 448 | if (dai->capture.channels_min) { |
449 | ret = s3c24xx_pcm_preallocate_dma_buffer(pcm, | 449 | ret = s3c_preallocate_dma_buffer(pcm, |
450 | SNDRV_PCM_STREAM_CAPTURE); | 450 | SNDRV_PCM_STREAM_CAPTURE); |
451 | if (ret) | 451 | if (ret) |
452 | goto out; | 452 | goto out; |
@@ -457,9 +457,9 @@ static int s3c24xx_pcm_new(struct snd_card *card, | |||
457 | 457 | ||
458 | struct snd_soc_platform s3c24xx_soc_platform = { | 458 | struct snd_soc_platform s3c24xx_soc_platform = { |
459 | .name = "s3c24xx-audio", | 459 | .name = "s3c24xx-audio", |
460 | .pcm_ops = &s3c24xx_pcm_ops, | 460 | .pcm_ops = &s3c_dma_ops, |
461 | .pcm_new = s3c24xx_pcm_new, | 461 | .pcm_new = s3c_dma_new, |
462 | .pcm_free = s3c24xx_pcm_free_dma_buffers, | 462 | .pcm_free = s3c_dma_free_dma_buffers, |
463 | }; | 463 | }; |
464 | EXPORT_SYMBOL_GPL(s3c24xx_soc_platform); | 464 | EXPORT_SYMBOL_GPL(s3c24xx_soc_platform); |
465 | 465 | ||
@@ -476,5 +476,5 @@ static void __exit s3c24xx_soc_platform_exit(void) | |||
476 | module_exit(s3c24xx_soc_platform_exit); | 476 | module_exit(s3c24xx_soc_platform_exit); |
477 | 477 | ||
478 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 478 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
479 | MODULE_DESCRIPTION("Samsung S3C24XX PCM DMA module"); | 479 | MODULE_DESCRIPTION("Samsung S3C Audio DMA module"); |
480 | MODULE_LICENSE("GPL"); | 480 | MODULE_LICENSE("GPL"); |