diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-05-11 09:36:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 14:22:19 -0400 |
commit | fecfedeb27ab9497cbdd2c6fb7972082a7ed9263 (patch) | |
tree | e81b9ee9c9c0278849d92f0b778ea964fa6f33b3 /drivers/media/video/cx88/cx88-alsa.c | |
parent | 952684035a91334dbe33b15063514cab5e7c6907 (diff) |
V4L/DVB: Remove videobuf_sg_alloc abuse
The cx88 and cx25821 drivers abuse videobuf_buffer to handle audio data.
Remove the abuse by creating private audio buffer structures with a
videobuf_dmabuf field.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88/cx88-alsa.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-alsa.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 07fe905f6575..ba499d04de4d 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
@@ -54,6 +54,12 @@ | |||
54 | Data type declarations - Can be moded to a header file later | 54 | Data type declarations - Can be moded to a header file later |
55 | ****************************************************************************/ | 55 | ****************************************************************************/ |
56 | 56 | ||
57 | struct cx88_audio_buffer { | ||
58 | unsigned int bpl; | ||
59 | struct btcx_riscmem risc; | ||
60 | struct videobuf_dmabuf dma; | ||
61 | }; | ||
62 | |||
57 | struct cx88_audio_dev { | 63 | struct cx88_audio_dev { |
58 | struct cx88_core *core; | 64 | struct cx88_core *core; |
59 | struct cx88_dmaqueue q; | 65 | struct cx88_dmaqueue q; |
@@ -75,7 +81,7 @@ struct cx88_audio_dev { | |||
75 | 81 | ||
76 | struct videobuf_dmabuf *dma_risc; | 82 | struct videobuf_dmabuf *dma_risc; |
77 | 83 | ||
78 | struct cx88_buffer *buf; | 84 | struct cx88_audio_buffer *buf; |
79 | 85 | ||
80 | struct snd_pcm_substream *substream; | 86 | struct snd_pcm_substream *substream; |
81 | }; | 87 | }; |
@@ -123,7 +129,7 @@ MODULE_PARM_DESC(debug,"enable debug messages"); | |||
123 | 129 | ||
124 | static int _cx88_start_audio_dma(snd_cx88_card_t *chip) | 130 | static int _cx88_start_audio_dma(snd_cx88_card_t *chip) |
125 | { | 131 | { |
126 | struct cx88_buffer *buf = chip->buf; | 132 | struct cx88_audio_buffer *buf = chip->buf; |
127 | struct cx88_core *core=chip->core; | 133 | struct cx88_core *core=chip->core; |
128 | struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; | 134 | struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; |
129 | 135 | ||
@@ -376,7 +382,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
376 | snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); | 382 | snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); |
377 | struct videobuf_dmabuf *dma; | 383 | struct videobuf_dmabuf *dma; |
378 | 384 | ||
379 | struct cx88_buffer *buf; | 385 | struct cx88_audio_buffer *buf; |
380 | int ret; | 386 | int ret; |
381 | 387 | ||
382 | if (substream->runtime->dma_area) { | 388 | if (substream->runtime->dma_area) { |
@@ -391,21 +397,16 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
391 | BUG_ON(!chip->dma_size); | 397 | BUG_ON(!chip->dma_size); |
392 | BUG_ON(chip->num_periods & (chip->num_periods-1)); | 398 | BUG_ON(chip->num_periods & (chip->num_periods-1)); |
393 | 399 | ||
394 | buf = videobuf_sg_alloc(sizeof(*buf)); | 400 | buf = kzalloc(sizeof(*buf), GFP_KERNEL); |
395 | if (NULL == buf) | 401 | if (NULL == buf) |
396 | return -ENOMEM; | 402 | return -ENOMEM; |
397 | 403 | ||
398 | buf->vb.memory = V4L2_MEMORY_MMAP; | 404 | buf->bpl = chip->period_size; |
399 | buf->vb.field = V4L2_FIELD_NONE; | ||
400 | buf->vb.width = chip->period_size; | ||
401 | buf->bpl = chip->period_size; | ||
402 | buf->vb.height = chip->num_periods; | ||
403 | buf->vb.size = chip->dma_size; | ||
404 | 405 | ||
405 | dma = videobuf_to_dma(&buf->vb); | 406 | dma = &buf->dma; |
406 | videobuf_dma_init(dma); | 407 | videobuf_dma_init(dma); |
407 | ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, | 408 | ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, |
408 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); | 409 | (PAGE_ALIGN(chip->dma_size) >> PAGE_SHIFT)); |
409 | if (ret < 0) | 410 | if (ret < 0) |
410 | goto error; | 411 | goto error; |
411 | 412 | ||
@@ -414,7 +415,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
414 | goto error; | 415 | goto error; |
415 | 416 | ||
416 | ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist, | 417 | ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist, |
417 | buf->vb.width, buf->vb.height, 1); | 418 | chip->period_size, chip->num_periods, 1); |
418 | if (ret < 0) | 419 | if (ret < 0) |
419 | goto error; | 420 | goto error; |
420 | 421 | ||
@@ -422,8 +423,6 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
422 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP|RISC_IRQ1|RISC_CNT_INC); | 423 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP|RISC_IRQ1|RISC_CNT_INC); |
423 | buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 424 | buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
424 | 425 | ||
425 | buf->vb.state = VIDEOBUF_PREPARED; | ||
426 | |||
427 | chip->buf = buf; | 426 | chip->buf = buf; |
428 | chip->dma_risc = dma; | 427 | chip->dma_risc = dma; |
429 | 428 | ||