aboutsummaryrefslogtreecommitdiffstats
path: root/sound/arm/aaci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/arm/aaci.c')
-rw-r--r--sound/arm/aaci.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1f0f8213e2d5..1497dce1b04a 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -18,10 +18,7 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
21 21#include <linux/io.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24#include <asm/sizes.h>
25 22
26#include <sound/core.h> 23#include <sound/core.h>
27#include <sound/initval.h> 24#include <sound/initval.h>
@@ -30,7 +27,6 @@
30#include <sound/pcm_params.h> 27#include <sound/pcm_params.h>
31 28
32#include "aaci.h" 29#include "aaci.h"
33#include "devdma.h"
34 30
35#define DRIVER_NAME "aaci-pl041" 31#define DRIVER_NAME "aaci-pl041"
36 32
@@ -492,7 +488,7 @@ static int aaci_pcm_hw_free(struct snd_pcm_substream *substream)
492 /* 488 /*
493 * Clear out the DMA and any allocated buffers. 489 * Clear out the DMA and any allocated buffers.
494 */ 490 */
495 devdma_hw_free(NULL, substream); 491 snd_pcm_lib_free_pages(substream);
496 492
497 return 0; 493 return 0;
498} 494}
@@ -504,21 +500,19 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
504 int err; 500 int err;
505 501
506 aaci_pcm_hw_free(substream); 502 aaci_pcm_hw_free(substream);
503 if (aacirun->pcm_open) {
504 snd_ac97_pcm_close(aacirun->pcm);
505 aacirun->pcm_open = 0;
506 }
507 507
508 err = devdma_hw_alloc(NULL, substream, 508 err = snd_pcm_lib_malloc_pages(substream,
509 params_buffer_bytes(params)); 509 params_buffer_bytes(params));
510 if (err < 0) 510 if (err < 0)
511 goto out; 511 goto out;
512 512
513 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 513 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params),
514 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), 514 params_channels(params),
515 params_channels(params), 515 aacirun->pcm->r[0].slots);
516 aacirun->pcm->r[0].slots);
517 else
518 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params),
519 params_channels(params),
520 aacirun->pcm->r[1].slots);
521
522 if (err) 516 if (err)
523 goto out; 517 goto out;
524 518
@@ -534,7 +528,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream)
534 struct aaci_runtime *aacirun = runtime->private_data; 528 struct aaci_runtime *aacirun = runtime->private_data;
535 529
536 aacirun->start = (void *)runtime->dma_area; 530 aacirun->start = (void *)runtime->dma_area;
537 aacirun->end = aacirun->start + runtime->dma_bytes; 531 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream);
538 aacirun->ptr = aacirun->start; 532 aacirun->ptr = aacirun->start;
539 aacirun->period = 533 aacirun->period =
540 aacirun->bytes = frames_to_bytes(runtime, runtime->period_size); 534 aacirun->bytes = frames_to_bytes(runtime, runtime->period_size);
@@ -551,11 +545,6 @@ static snd_pcm_uframes_t aaci_pcm_pointer(struct snd_pcm_substream *substream)
551 return bytes_to_frames(runtime, bytes); 545 return bytes_to_frames(runtime, bytes);
552} 546}
553 547
554static int aaci_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma)
555{
556 return devdma_mmap(NULL, substream, vma);
557}
558
559 548
560/* 549/*
561 * Playback specific ALSA stuff 550 * Playback specific ALSA stuff
@@ -722,7 +711,6 @@ static struct snd_pcm_ops aaci_playback_ops = {
722 .prepare = aaci_pcm_prepare, 711 .prepare = aaci_pcm_prepare,
723 .trigger = aaci_pcm_playback_trigger, 712 .trigger = aaci_pcm_playback_trigger,
724 .pointer = aaci_pcm_pointer, 713 .pointer = aaci_pcm_pointer,
725 .mmap = aaci_pcm_mmap,
726}; 714};
727 715
728static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 716static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
@@ -850,7 +838,6 @@ static struct snd_pcm_ops aaci_capture_ops = {
850 .prepare = aaci_pcm_capture_prepare, 838 .prepare = aaci_pcm_capture_prepare,
851 .trigger = aaci_pcm_capture_trigger, 839 .trigger = aaci_pcm_capture_trigger,
852 .pointer = aaci_pcm_pointer, 840 .pointer = aaci_pcm_pointer,
853 .mmap = aaci_pcm_mmap,
854}; 841};
855 842
856/* 843/*
@@ -1040,6 +1027,8 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
1040 1027
1041 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); 1028 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops);
1042 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); 1029 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops);
1030 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1031 NULL, 0, 64 * 104);
1043 } 1032 }
1044 1033
1045 return ret; 1034 return ret;