Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6210c91 authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab
Browse files

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: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent ffb7394d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/dma-mapping.h>
#include <linux/pci.h>

@@ -423,6 +424,8 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
	chip->dma_risc = buf->vb.dma;

	substream->runtime->dma_area = chip->dma_risc.vmalloc;
	substream->runtime->dma_bytes = chip->dma_size;
	substream->runtime->dma_addr = 0;
	return 0;

error:
@@ -499,6 +502,16 @@ static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
	return runtime->period_size * (count & (runtime->periods-1));
}

/*
 * page callback (needed for mmap)
 */
static struct page *snd_cx88_page(struct snd_pcm_substream *substream,
				unsigned long offset)
{
	void *pageptr = substream->runtime->dma_area + offset;
	return vmalloc_to_page(pageptr);
}

/*
 * operators
 */
@@ -511,6 +524,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = {
	.prepare = snd_cx88_prepare,
	.trigger = snd_cx88_card_trigger,
	.pointer = snd_cx88_pointer,
	.page = snd_cx88_page,
};

/*