Commit b5f74050 authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab
Browse files

[media] cx23885: initial support for VBI with the cx23885



A handlful of coding style issue cleaned up in the following patches.

Signed-off-by: default avatarSteven Toth <stoth@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6aa07d9e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,10 +46,10 @@
#define AUDIO_SRAM_CHANNEL	SRAM_CH07

#define dprintk(level, fmt, arg...)	if (audio_debug >= level) \
	printk(KERN_INFO "%s/1: " fmt, chip->dev->name , ## arg)
	printk(KERN_INFO "%s: " fmt, chip->dev->name , ## arg)

#define dprintk_core(level, fmt, arg...)	if (audio_debug >= level) \
	printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg)
	printk(KERN_DEBUG "%s: " fmt, chip->dev->name , ## arg)

/****************************************************************************
			Module global static vars
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(card, "card type");

#define dprintk(level, fmt, arg...)\
	do { if (debug >= level)\
		printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\
		printk(KERN_DEBUG "%s: " fmt, dev->name, ## arg);\
	} while (0)

static unsigned int cx23885_devcount;
+39 −3
Original line number Diff line number Diff line
@@ -62,30 +62,65 @@ int cx23885_vbi_fmt(struct file *file, void *priv,
	return 0;
}

/* We're given the Video Interrupt status register.
 * The cx23885_video_irq() func has already validated
 * the potential error bits, we just need to
 * deal with vbi payload and return indication if
 * we actually processed any payload.
 */
int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status)
{
	u32 count;
	int handled = 0;

	if (status & VID_BC_MSK_VBI_RISCI1) {
		dprintk(1, "%s() VID_BC_MSK_VBI_RISCI1\n", __func__);
		spin_lock(&dev->slock);
		count = cx_read(VID_A_GPCNT);
		cx23885_video_wakeup(dev, &dev->vbiq, count);
		spin_unlock(&dev->slock);
		handled++;
	}

	if (status & VID_BC_MSK_VBI_RISCI2) {
		dprintk(1, "%s() VID_BC_MSK_VBI_RISCI2\n", __func__);
		dprintk(2, "stopper vbi\n");
		spin_lock(&dev->slock);
		cx23885_restart_vbi_queue(dev, &dev->vbiq);
		spin_unlock(&dev->slock);
		handled++;
	}

	return handled;
}

static int cx23885_start_vbi_dma(struct cx23885_dev    *dev,
			 struct cx23885_dmaqueue *q,
			 struct cx23885_buffer   *buf)
{
	dprintk(1, "%s()\n", __func__);

	/* setup fifo + format */
	cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH02],
				buf->vb.width, buf->risc.dma);

	/* reset counter */
	cx_write(VID_A_GPCNT_CTL, 3);
	q->count = 1;

	/* enable irqs */
	/* enable irq */
	cx23885_irq_add_enable(dev, 0x01);
	cx_set(VID_A_INT_MSK, 0x000022);

	/* start dma */
	cx_set(DEV_CNTRL2, (1<<5));
	cx_set(VID_A_DMA_CTL, 0x00000022);
	cx_set(VID_A_DMA_CTL, 0x22); /* FIFO and RISC enable */

	return 0;
}


static int cx23885_restart_vbi_queue(struct cx23885_dev    *dev,
int cx23885_restart_vbi_queue(struct cx23885_dev    *dev,
			     struct cx23885_dmaqueue *q)
{
	struct cx23885_buffer *buf;
@@ -115,6 +150,7 @@ void cx23885_vbi_timeout(unsigned long data)

	cx23885_sram_channel_dump(dev, &dev->sram_channels[SRAM_CH02]);

	/* Stop the VBI engine */
	cx_clear(VID_A_DMA_CTL, 0x22);

	spin_lock_irqsave(&dev->slock, flags);
+5 −0
Original line number Diff line number Diff line
@@ -564,6 +564,8 @@ extern void cx23885_free_buffer(struct videobuf_queue *q,
extern int cx23885_video_register(struct cx23885_dev *dev);
extern void cx23885_video_unregister(struct cx23885_dev *dev);
extern int cx23885_video_irq(struct cx23885_dev *dev, u32 status);
extern void cx23885_video_wakeup(struct cx23885_dev *dev,
	struct cx23885_dmaqueue *q, u32 count);

/* ----------------------------------------------------------- */
/* cx23885-vbi.c                                               */
@@ -571,6 +573,9 @@ extern int cx23885_vbi_fmt(struct file *file, void *priv,
	struct v4l2_format *f);
extern void cx23885_vbi_timeout(unsigned long data);
extern struct videobuf_queue_ops cx23885_vbi_qops;
extern int cx23885_restart_vbi_queue(struct cx23885_dev *dev,
	struct cx23885_dmaqueue *q);
extern int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status);

/* cx23885-i2c.c                                                */
extern int cx23885_i2c_register(struct cx23885_i2c *bus);