summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-10-31 07:40:09 -0700
committerTrent Piepho <xyzzy@speakeasy.org>2007-10-31 07:40:09 -0700
commit1816a3983b8c8a4ed5e9ba32b1eade0ce9499809 (patch)
tree553dd25c790b126899793485406ed1f90a51f5d4 /linux/drivers/media/video
parenteaf6bdcc22aa742bdec32708647fe07d891631db (diff)
downloadmediapointer-dvb-s2-1816a3983b8c8a4ed5e9ba32b1eade0ce9499809.tar.gz
mediapointer-dvb-s2-1816a3983b8c8a4ed5e9ba32b1eade0ce9499809.tar.bz2
saa7134-alsa: Fix mmap support
From: Alexander E. Patrakov <patrakov@ums.usu.ru> Trent Piepho wrote: > I do not think the saa7134-alsa driver supports mmap. The cx88-alsa driver > also claimed to support mmap, but it never worked until I fixed it. It's > pretty clear that the code in saa7134-alsa was based on the same code as > cx88-alsa, so it's likely it has the same bug. You are right. The patch below (based on your cx88 patch, but I don't really understand it) fixes mmap support in saa7134-alsa for me. Recording via mmap (arecord -M -f S16_LE -c 2 -r 32000 -D hw:1) didn't work at all before, works now, tested for at least 20 minutes (but, unfortunately, with one overrun at least 0.719 ms long). Signed-off-by: Alexander E. Patrakov <patrakov@ums.usu.ru> Acked-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-alsa.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c
index 9b557ab7c..a2ee5cf9c 100644
--- a/linux/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c
@@ -557,8 +557,10 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
V4L functions, and force ALSA to use that as the DMA area */
substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
+ substream->runtime->dma_bytes = dev->dmasound.bufsize;
+ substream->runtime->dma_addr = 0;
- return 1;
+ return 0;
}
@@ -666,6 +668,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
}
/*
+ * page callback (needed for mmap)
+ */
+
+static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream,
+ unsigned long offset)
+{
+ void *pageptr = substream->runtime->dma_area + offset;
+ return vmalloc_to_page(pageptr);
+}
+
+/*
* ALSA capture callbacks definition
*/
@@ -678,6 +691,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = {
.prepare = snd_card_saa7134_capture_prepare,
.trigger = snd_card_saa7134_capture_trigger,
.pointer = snd_card_saa7134_capture_pointer,
+ .page = snd_card_saa7134_page,
};
/*