aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-alsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88/cx88-alsa.c')
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index f4abed454fd4..90c36c5705c3 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -72,7 +72,7 @@ struct cx88_audio_dev {
72 unsigned int period_size; 72 unsigned int period_size;
73 unsigned int num_periods; 73 unsigned int num_periods;
74 74
75 struct videobuf_dmabuf dma_risc; 75 struct videobuf_dmabuf *dma_risc;
76 76
77 struct cx88_buffer *buf; 77 struct cx88_buffer *buf;
78 78
@@ -282,11 +282,12 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
282 BUG_ON(!chip->dma_size); 282 BUG_ON(!chip->dma_size);
283 283
284 dprintk(2,"Freeing buffer\n"); 284 dprintk(2,"Freeing buffer\n");
285 videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc); 285 videobuf_pci_dma_unmap(chip->pci, chip->dma_risc);
286 videobuf_dma_free(&chip->dma_risc); 286 videobuf_dma_free(chip->dma_risc);
287 btcx_riscmem_free(chip->pci,&chip->buf->risc); 287 btcx_riscmem_free(chip->pci,&chip->buf->risc);
288 kfree(chip->buf); 288 kfree(chip->buf);
289 289
290 chip->dma_risc = NULL;
290 chip->dma_size = 0; 291 chip->dma_size = 0;
291 292
292 return 0; 293 return 0;
@@ -366,6 +367,8 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
366 struct snd_pcm_hw_params * hw_params) 367 struct snd_pcm_hw_params * hw_params)
367{ 368{
368 snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); 369 snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
370 struct videobuf_dmabuf *dma;
371
369 struct cx88_buffer *buf; 372 struct cx88_buffer *buf;
370 int ret; 373 int ret;
371 374
@@ -381,7 +384,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
381 BUG_ON(!chip->dma_size); 384 BUG_ON(!chip->dma_size);
382 BUG_ON(chip->num_periods & (chip->num_periods-1)); 385 BUG_ON(chip->num_periods & (chip->num_periods-1));
383 386
384 buf = kzalloc(sizeof(*buf), GFP_KERNEL); 387 buf = videobuf_pci_alloc(sizeof(*buf));
385 if (NULL == buf) 388 if (NULL == buf)
386 return -ENOMEM; 389 return -ENOMEM;
387 390
@@ -392,17 +395,18 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
392 buf->vb.height = chip->num_periods; 395 buf->vb.height = chip->num_periods;
393 buf->vb.size = chip->dma_size; 396 buf->vb.size = chip->dma_size;
394 397
395 videobuf_dma_init(&buf->vb.dma); 398 dma=videobuf_to_dma(&buf->vb);
396 ret = videobuf_dma_init_kernel(&buf->vb.dma, PCI_DMA_FROMDEVICE, 399 videobuf_dma_init(dma);
400 ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
397 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); 401 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT));
398 if (ret < 0) 402 if (ret < 0)
399 goto error; 403 goto error;
400 404
401 ret = videobuf_pci_dma_map(chip->pci,&buf->vb.dma); 405 ret = videobuf_pci_dma_map(chip->pci,dma);
402 if (ret < 0) 406 if (ret < 0)
403 goto error; 407 goto error;
404 408
405 ret = cx88_risc_databuffer(chip->pci, &buf->risc, buf->vb.dma.sglist, 409 ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist,
406 buf->vb.width, buf->vb.height, 1); 410 buf->vb.width, buf->vb.height, 1);
407 if (ret < 0) 411 if (ret < 0)
408 goto error; 412 goto error;
@@ -414,9 +418,9 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
414 buf->vb.state = STATE_PREPARED; 418 buf->vb.state = STATE_PREPARED;
415 419
416 chip->buf = buf; 420 chip->buf = buf;
417 chip->dma_risc = buf->vb.dma; 421 chip->dma_risc = dma;
418 422
419 substream->runtime->dma_area = chip->dma_risc.vmalloc; 423 substream->runtime->dma_area = chip->dma_risc->vmalloc;
420 substream->runtime->dma_bytes = chip->dma_size; 424 substream->runtime->dma_bytes = chip->dma_size;
421 substream->runtime->dma_addr = 0; 425 substream->runtime->dma_addr = 0;
422 return 0; 426 return 0;