diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-08-24 00:06:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:06:37 -0400 |
commit | f6210c9160dff82ceaaf5e59cf5f8fcd6bdefa38 (patch) | |
tree | 14583f207bf08163a97f2ed61a3b93d17fc22f85 /drivers/media/video/cx88/cx88-alsa.c | |
parent | ffb7394d51cf6f60a3753a5cc40613fc9d5c5c96 (diff) |
V4L/DVB (6085): cx88-alsa: Fix mmap support
The driver has long claimed to support mmap, but it didn't work at all. Some
of the dma buffer parameters weren't set, and since video_buf uses vmalloc to
allocate the buffer, a page callback is needed too.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-alsa.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-alsa.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index ac317fb856e4..85d632224f3a 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/vmalloc.h> | ||
31 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
32 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
33 | 34 | ||
@@ -423,6 +424,8 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
423 | chip->dma_risc = buf->vb.dma; | 424 | chip->dma_risc = buf->vb.dma; |
424 | 425 | ||
425 | substream->runtime->dma_area = chip->dma_risc.vmalloc; | 426 | substream->runtime->dma_area = chip->dma_risc.vmalloc; |
427 | substream->runtime->dma_bytes = chip->dma_size; | ||
428 | substream->runtime->dma_addr = 0; | ||
426 | return 0; | 429 | return 0; |
427 | 430 | ||
428 | error: | 431 | error: |
@@ -500,6 +503,16 @@ static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream) | |||
500 | } | 503 | } |
501 | 504 | ||
502 | /* | 505 | /* |
506 | * page callback (needed for mmap) | ||
507 | */ | ||
508 | static struct page *snd_cx88_page(struct snd_pcm_substream *substream, | ||
509 | unsigned long offset) | ||
510 | { | ||
511 | void *pageptr = substream->runtime->dma_area + offset; | ||
512 | return vmalloc_to_page(pageptr); | ||
513 | } | ||
514 | |||
515 | /* | ||
503 | * operators | 516 | * operators |
504 | */ | 517 | */ |
505 | static struct snd_pcm_ops snd_cx88_pcm_ops = { | 518 | static struct snd_pcm_ops snd_cx88_pcm_ops = { |
@@ -511,6 +524,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = { | |||
511 | .prepare = snd_cx88_prepare, | 524 | .prepare = snd_cx88_prepare, |
512 | .trigger = snd_cx88_card_trigger, | 525 | .trigger = snd_cx88_card_trigger, |
513 | .pointer = snd_cx88_pointer, | 526 | .pointer = snd_cx88_pointer, |
527 | .page = snd_cx88_page, | ||
514 | }; | 528 | }; |
515 | 529 | ||
516 | /* | 530 | /* |