Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=32d111a9f0e6de901667612d1b0c46bbfd5d37cb
Commit:     32d111a9f0e6de901667612d1b0c46bbfd5d37cb
Parent:     f21daa41d19def8c0a1e9d9626f773447b8191f6
Author:     Alexander E. Patrakov <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 31 11:40:09 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Sun Nov 4 21:41:26 2007 -0200

    V4L/DVB (6506): saa7134-alsa: Fix mmap support
    
    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 <[EMAIL PROTECTED]>
    Acked-by: Takashi Iwai <[EMAIL PROTECTED]>
    Signed-off-by: Trent Piepho <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/saa7134/saa7134-alsa.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/saa7134/saa7134-alsa.c 
b/drivers/media/video/saa7134/saa7134-alsa.c
index c6f7279..b9c5cf7 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -543,8 +543,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;
 
 }
 
@@ -652,6 +654,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
  */
 
@@ -664,6 +677,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,
 };
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to