summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-12-13 22:14:01 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-12-13 22:14:01 +0000
commit8944384ab4b1ee62190e3da6da4d17413e423adc (patch)
tree7286941497d198c6eff3517e7f48b0578b38ee3c /linux/drivers/media/video
parentcd4ccc241ea66d1c80ba4e61256324798bc25eb2 (diff)
downloadmediapointer-dvb-s2-8944384ab4b1ee62190e3da6da4d17413e423adc.tar.gz
mediapointer-dvb-s2-8944384ab4b1ee62190e3da6da4d17413e423adc.tar.bz2
Videobuf code in alsa now compiles
Signed-off-by: Mauro Carvalho Chehab <mchehab@brtubo.com.br>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/cx88/cx88-alsa.c128
1 files changed, 67 insertions, 61 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c
index b9f248c48..6e7a1d5e4 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.14 2005/12/13 04:01:49 rmcc Exp $
+ * $Id: cx88-alsa.c,v 1.15 2005/12/13 22:14:01 mchehab Exp $
*
* Support for audio capture
* PCI function #1 of the cx2388x.
@@ -64,6 +64,7 @@ enum { DEVICE_DIGITAL, DEVICE_ANALOG };
/* These can be replaced after done */
#define MIXER_ADDR_LAST MAX_CX88_INPUT
+
struct cx88_audio_dev {
struct cx88_core *core;
struct cx88_buffer *buf;
@@ -96,12 +97,19 @@ struct cx88_audio_dev {
};
typedef struct cx88_audio_dev snd_cx88_card_t;
+struct cx8801_fh {
+ struct cx88_audio_dev *dev;
+ struct videobuf_queue vb_q;
+
+ int size;
+};
+
typedef struct snd_card_cx88_pcm {
- struct cx88_dev *dev;
+ struct cx88_dev *dev;
- spinlock_t lock;
+ spinlock_t lock;
- snd_pcm_substream_t *substream;
+ snd_pcm_substream_t *substream;
} snd_card_cx88_pcm_t;
@@ -279,27 +287,27 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id, struct pt_regs *regs)
u32 status;
int loop, handled = 0;
- for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
- status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x02);
- if (0 == status)
- goto out;
- dprintk( 1, "cx8801_irq\n" );
- dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP );
- dprintk( 1, " status: %d\n", status );
- handled = 1;
- cx_write(MO_PCI_INTSTAT, status);
-
- if (status & core->pci_irqmask)
- {
- dprintk( 1, " passing to core\n" );
- cx88_core_irq(core,status);
+ for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
+ status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x02);
+ if (0 == status)
+ goto out;
+ dprintk( 1, "cx8801_irq\n" );
+ dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP );
+ dprintk( 1, " status: %d\n", status );
+ handled = 1;
+ cx_write(MO_PCI_INTSTAT, status);
+
+ if (status & core->pci_irqmask)
+ {
+ dprintk( 1, " passing to core\n" );
+ cx88_core_irq(core,status);
}
- if (status & 0x02)
+ if (status & 0x02)
{
- dprintk( 1, " ALSA IRQ handling\n" );
- cx8801_aud_irq(chip);
+ dprintk( 1, " ALSA IRQ handling\n" );
+ cx8801_aud_irq(chip);
}
- };
+ };
if (MAX_IRQ_LOOP == loop) {
dprintk( 0, "clearing mask\n" );
@@ -348,18 +356,20 @@ static void snd_cx88_pci_error(bt87x_t *chip, unsigned int status)
/****************************************************************************
Videobuf setup code
****************************************************************************/
-#if 0
static int
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{
- struct cx8800_fh *fh = q->priv_data;
+ struct cx8801_fh *fh = q->priv_data;
- *size = fh->fmt->depth*fh->width*fh->height >> 3;
+ *size = fh->size;
if (0 == *count)
*count = 32;
- while (*size * *count > vid_limit * 1024 * 1024)
- (*count)--;
+
+ if (*count < 2)
+ *count = 2;
+ if (*count > 32)
+ *count = 32;
return 0;
}
@@ -367,28 +377,24 @@ static int
buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
enum v4l2_field field)
{
- struct cx8800_fh *fh = q->priv_data;
- struct cx8800_dev *dev = fh->dev;
- struct cx88_core *core = dev->core;
+ struct cx8801_fh *fh = q->priv_data;
+ struct cx88_audio_dev *chip = fh->dev;
struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
- int rc, init_buffer = 0;
- unsigned int size;
-
- BUG_ON(NULL == fh->fmt);
- size = VBI_LINE_COUNT * VBI_LINE_LENGTH * 2;
+ int rc;
+ unsigned int size=fh->size;
if (0 != buf->vb.baddr && buf->vb.bsize < size)
return -EINVAL;
if (STATE_NEEDS_INIT == buf->vb.state) {
- buf->vb.width = VBI_LINE_LENGTH;
- buf->vb.height = VBI_LINE_COUNT;
+ buf->vb.width = size;
+ buf->vb.height = 1;
buf->vb.size = size;
buf->vb.field = V4L2_FIELD_SEQ_TB;
- if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL)))
+ if (0 != (rc = videobuf_iolock(chip->pci,&buf->vb,NULL)))
goto fail;
- cx88_risc_buffer(dev->pci, &buf->risc,
+ cx88_risc_buffer(chip->pci, &buf->risc,
buf->vb.dma.sglist,
0, buf->vb.width * buf->vb.height,
buf->vb.width, 0,
@@ -396,15 +402,15 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
}
buf->vb.state = STATE_PREPARED;
- dprintk_core(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
+ dprintk_core(2,"[%p/%d] buffer_prepare - size: %d - dma=0x%08lx\n",
buf, buf->vb.i,
- fh->width, fh->height, fh->fmt->depth, fh->fmt->name,
+ fh->size,
(unsigned long)buf->risc.dma);
return 0;
fail:
- cx88_free_buffer(dev->pci,buf);
+ cx88_free_buffer(chip->pci,buf);
return rc;
}
@@ -413,10 +419,10 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
{
struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
struct cx88_buffer *prev;
- struct cx8800_fh *fh = vq->priv_data;
- struct cx8800_dev *dev = fh->dev;
- struct cx88_core *core = dev->core;
- struct cx88_dmaqueue *q = &dev->vidq;
+ struct cx8801_fh *fh = vq->priv_data;
+ struct cx88_audio_dev *chip = fh->dev;
+ struct cx88_core *core = chip->core;
+ struct cx88_dmaqueue *q = &chip->q;
/* add jump to stopper */
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC);
@@ -430,7 +436,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);
- start_video_dma(dev, q, buf);
+ start_video_dma(chip, q, buf);
buf->vb.state = STATE_ACTIVE;
buf->count = q->count++;
mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
@@ -461,18 +467,18 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
- struct cx8800_fh *fh = q->priv_data;
+ struct cx8801_fh *fh = q->priv_data;
cx88_free_buffer(fh->dev->pci,buf);
}
-static struct videobuf_queue_ops cx8800_video_qops = {
+static struct videobuf_queue_ops audio_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
.buf_release = buffer_release,
};
-
+#if 0
static int dsp_buffer_init(snd_cx88_card_t *chip)
{
int err;
@@ -487,7 +493,7 @@ static int dsp_buffer_init(snd_cx88_card_t *chip)
file->private_data = fh;
fh->dev = dev;
- videobuf_queue_init(&fh->mpegq, &blackbird_qops,
+ videobuf_queue_init(&fh->mpegq, &audio_qops,
dev->pci, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED,
@@ -904,12 +910,12 @@ static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci,
spin_lock_init(&chip->reg_lock);
#if 0
- if (!request_mem_region(pci_resource_start(pci,0),
- pci_resource_len(pci,0),
- "CX88 audio")) {
- err = -EBUSY;
- printk(KERN_ERR "%s: can't get MMIO memory @ 0x%lx\n",
- "CX88 audio",pci_resource_start(pci,0));
+ if (!request_mem_region(pci_resource_start(pci,0),
+ pci_resource_len(pci,0),
+ "CX88 audio")) {
+ err = -EBUSY;
+ printk(KERN_ERR "%s: can't get MMIO memory @ 0x%lx\n",
+ "CX88 audio",pci_resource_start(pci,0));
kfree(chip);
pci_disable_device(pci);
return err;
@@ -1089,13 +1095,13 @@ static int cx88_audio_init(void)
*/
static void cx88_audio_fini(void)
{
- int idx;
+ int idx;
/* printk(KERN_INFO "cx88 fini\n");
- for (idx = 0; idx < SNDRV_CARDS; idx++) {
- snd_card_free(snd_cx88_cards[idx]);
+ for (idx = 0; idx < SNDRV_CARDS; idx++) {
+ snd_card_free(snd_cx88_cards[idx]);
snd_cx88_cards[idx] = NULL;
- }*/
+ }*/
pci_unregister_driver(&cx88_audio_pci_driver);
}