summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88/cx88-alsa.c
diff options
context:
space:
mode:
authorRicardo Cerqueira <devnull@localhost>2005-12-30 06:22:40 +0000
committerRicardo Cerqueira <devnull@localhost>2005-12-30 06:22:40 +0000
commiteb599303c5d6acf7d232859e34cf96330fac6b56 (patch)
tree398bc2dfa7c8012855b0baed92cf67b867daed1c /linux/drivers/media/video/cx88/cx88-alsa.c
parentdbb82e683968b18c7396ef3f64d98da680c784a9 (diff)
downloadmediapointer-dvb-s2-eb599303c5d6acf7d232859e34cf96330fac6b56.tar.gz
mediapointer-dvb-s2-eb599303c5d6acf7d232859e34cf96330fac6b56.tar.bz2
More cx88-alsa changes, still not working
From: Ricardo Cerqueira <v4l@cerqueira.org> Changed a few more things in the buffers and ALSA initialization code, but still no luck. No IRQ activity yet, even with the IRQ mask fixed. Signed-off-by:
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-alsa.c')
-rw-r--r--linux/drivers/media/video/cx88/cx88-alsa.c83
1 files changed, 60 insertions, 23 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c
index f0bb1b0b5..9f912f5fe 100644
--- a/linux/drivers/media/video/cx88/cx88-alsa.c
+++ b/linux/drivers/media/video/cx88/cx88-alsa.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-alsa.c,v 1.19 2005/12/24 03:21:00 rmcc Exp $
+ * $Id: cx88-alsa.c,v 1.20 2005/12/30 06:22:40 rmcc Exp $
*
* Support for audio capture
* PCI function #1 of the cx2388x.
@@ -91,6 +91,7 @@ struct cx88_audio_dev {
unsigned int dma_size;
unsigned int period_size;
+ struct videobuf_dmabuf dma_risc;
int mixer_volume[MIXER_ADDR_LAST+1][2];
int capture_source[MIXER_ADDR_LAST+1][2];
@@ -102,7 +103,6 @@ struct cx88_audio_dev {
long opened;
snd_pcm_substream_t *substream;
- struct videobuf_dmabuf dma;
};
typedef struct cx88_audio_dev snd_cx88_card_t;
@@ -177,11 +177,12 @@ int _cx88_start_audio_dma(snd_cx88_card_t *chip,
/* sets bpl size */
cx_write(MO_AUDD_LNGTH, buf->bpl);
+ cx_write(MO_AUDR_LNGTH, buf->bpl);
/* reset counter */
cx_write(MO_AUDD_GPCNTRL,GP_COUNT_CONTROL_RESET);
- dprintk(1,"Enabling IRQ\n");
+ dprintk(1,"Enabling IRQ, setting mask from 0x%x to 0x%x\n",chip->core->pci_irqmask,(chip->core->pci_irqmask | 0x02));
/* enable irqs */
cx_set(MO_PCI_INTMSK, chip->core->pci_irqmask | 0x02);
@@ -189,13 +190,25 @@ int _cx88_start_audio_dma(snd_cx88_card_t *chip,
/* Enables corresponding bits at AUD_INT_STAT */
#if 1 /*keep*/
/* Maybe necessary to enable other errors */
- cx_set(MO_AUD_INTMSK, (1<<21)||(1<<19)||(1<<16)||1);
+ //cx_set(MO_AUD_INTMSK, (1<<21)||(1<<19)||(1<<16)||1);
+ cx_set(MO_AUD_INTMSK,
+ (1<<21)|
+ (1<<20)|
+ (1<<19)|
+ (1<<18)|
+ (1<<17)|
+ (1<<16)|
+ (1<<12)|
+ (1<<4)|
+ (1<<0)
+ );
#endif
/* start dma */
cx_set(MO_DEV_CNTRL2, (1<<5)); /* Enables Risc Processor */
cx_set(MO_AUD_DMACNTRL, 0x11); /* audio downstream FIFO and RISC enable */
+
q->count = 1;
return 0;
@@ -317,7 +330,7 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id, struct pt_regs *regs)
}
if (status & 0x02)
{
- dprintk( 1, " ALSA IRQ handling\n" );
+ dprintk( 1, " ALSA IRQ handling\n" );
cx8801_aud_irq(chip);
}
};
@@ -423,6 +436,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
fh->size,
(unsigned long)buf->risc.dma);
+ chip->dma_risc = buf->vb.dma;
return 0;
fail:
@@ -458,6 +472,7 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
} else if (list_empty(&q->active)) {
list_add_tail(&buf->vb.queue,&q->active);
_cx88_start_audio_dma(chip, q, buf);
+ printk("DEBUG TEMP: buf bpl is %d\n",buf->bpl);
buf->vb.state = STATE_ACTIVE;
buf->count = q->count++;
mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
@@ -520,19 +535,19 @@ static int dsp_buffer_init(snd_cx88_card_t *chip)
dprintk(1,"queue init\n");
videobuf_queue_init(&fh->vb_q, &audio_qops,
chip->pci, &chip->reg_lock,
- V4L2_BUF_TYPE_VIDEO_CAPTURE,
- V4L2_FIELD_INTERLACED,
+ V4L2_BUF_TYPE_PRIVATE,
+ V4L2_FIELD_NONE,
sizeof(struct cx88_buffer),
fh);
chip->fh=fh;
- //dprintk(1,"dma init kernel\n");
- //err = videobuf_dma_init_kernel(&chip->dma, PCI_DMA_FROMDEVICE,
- // (chip->dma_size + PAGE_SIZE) >> PAGE_SHIFT);
dprintk(1,"queue read start (coming from %d)\n",err);
deb = videobuf_read_start(&fh->vb_q);
dprintk(1,"dma init (coming from %d)\n",deb);
- videobuf_dma_init(&chip->dma);
+ videobuf_dma_init(&chip->dma_risc);
+ dprintk(1,"dma init kernel\n");
+ err = videobuf_dma_init_kernel(&chip->dma_risc, PCI_DMA_FROMDEVICE,
+ (chip->dma_size + PAGE_SIZE) >> PAGE_SHIFT);
if (0 != err)
return err;
@@ -541,14 +556,14 @@ static int dsp_buffer_init(snd_cx88_card_t *chip)
req.count = 2;
req.memory = V4L2_MEMORY_MMAP;
- dprintk(1,"request bufers\n");
- videobuf_reqbufs(&fh->vb_q, &req);
+ //dprintk(1,"request bufers\n");
+// videobuf_reqbufs(&fh->vb_q, &req);
// dprintk(1,"prepare bufers\n");
// videobuf_qbuf(&fh->vb_q, &req);
- dprintk(1,"start stream\n");
- err=videobuf_streamon(&fh->vb_q);
+// dprintk(1,"start stream\n");
+// err=videobuf_streamon(&fh->vb_q);
return 0;
}
@@ -557,7 +572,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
{
BUG_ON(!chip->dma_size);
- videobuf_dma_free(&chip->dma);
+ videobuf_dma_free(&chip->dma_risc);
chip->dma_size = 0;
@@ -665,6 +680,14 @@ static int snd_cx88_hw_params(snd_pcm_substream_t * substream,
printk("ALSA HW_params\n");
+ if (substream->runtime->dma_area) {
+ videobuf_queue_cancel(&chip->fh->vb_q);
+ videobuf_dma_pci_unmap(chip->pci, &chip->dma_risc);
+ dsp_buffer_free(chip);
+ substream->runtime->dma_area = NULL;
+ }
+
+
chip->period_size = params_period_bytes(hw_params);
chip->dma_size = chip->period_size * params_periods(hw_params);
@@ -672,15 +695,17 @@ static int snd_cx88_hw_params(snd_pcm_substream_t * substream,
dsp_buffer_init(chip);
-/*
- if (0 != (err = videobuf_dma_pci_map(chip->pci, &chip->dma))) {
+
+ if (0 != (err = videobuf_dma_pci_map(chip->pci, &chip->dma_risc))) {
dsp_buffer_free(chip);
return err;
}
-*/
- dprintk(1,"Buffer ready\n");
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
+ dprintk(1,"Buffer ready at 0x%x\n",(int )chip->dma_risc.vmalloc);
+
+ substream->runtime->dma_area = chip->dma_risc.vmalloc;
+ //return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
+ return 0;
}
/*
@@ -688,7 +713,16 @@ static int snd_cx88_hw_params(snd_pcm_substream_t * substream,
*/
static int snd_cx88_hw_free(snd_pcm_substream_t * substream)
{
- return snd_pcm_lib_free_pages(substream);
+
+ snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+
+ if (substream->runtime->dma_area) {
+ videobuf_queue_cancel(&chip->fh->vb_q);
+ videobuf_dma_pci_unmap(chip->pci, &chip->dma_risc);
+ dsp_buffer_free(chip);
+ substream->runtime->dma_area = NULL;
+ }
+ //return snd_pcm_lib_free_pages(substream);
}
/*
@@ -725,11 +759,14 @@ static int snd_cx88_card_trigger(snd_pcm_substream_t *substream, int cmd)
case SNDRV_PCM_TRIGGER_START:
//err=videobuf_streamon(&fh->vb_q);
//err=_cx88_start_audio_dma(chip);
+ break;
case SNDRV_PCM_TRIGGER_STOP:
// err=videobuf_streamoff(&fh->vb_q);
//err=_cx88_stop_audio_dma(chip);
+ break;
default:
err=-EINVAL;
+ break;
}
spin_unlock(&chip->reg_lock);
@@ -1019,7 +1056,7 @@ static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci,
chip->core = core;
-#if 1 /* Should be tested if it is wright */
+#if 1 /* Should be tested if it is right */
chip->dig_rate=48000;
#endif