Release 4.7 drivers/media/pci/cx88/cx88-vbi.c
/*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include "cx88.h"
static unsigned int vbi_debug;
module_param(vbi_debug,int,0644);
MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
#define dprintk(level,fmt, arg...) if (vbi_debug >= level) \
printk(KERN_DEBUG "%s: " fmt, dev->core->name , ## arg)
/* ------------------------------------------------------------------ */
int cx8800_vbi_fmt (struct file *file, void *priv,
struct v4l2_format *f)
{
struct cx8800_dev *dev = video_drvdata(file);
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
f->fmt.vbi.offset = 244;
if (dev->core->tvnorm & V4L2_STD_525_60) {
/* ntsc */
f->fmt.vbi.sampling_rate = 28636363;
f->fmt.vbi.start[0] = 10;
f->fmt.vbi.start[1] = 273;
f->fmt.vbi.count[0] = VBI_LINE_NTSC_COUNT;
f->fmt.vbi.count[1] = VBI_LINE_NTSC_COUNT;
} else if (dev->core->tvnorm & V4L2_STD_625_50) {
/* pal */
f->fmt.vbi.sampling_rate = 35468950;
f->fmt.vbi.start[0] = V4L2_VBI_ITU_625_F1_START + 5;
f->fmt.vbi.start[1] = V4L2_VBI_ITU_625_F2_START + 5;
f->fmt.vbi.count[0] = VBI_LINE_PAL_COUNT;
f->fmt.vbi.count[1] = VBI_LINE_PAL_COUNT;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andrew morton | andrew morton | 120 | 55.30% | 1 | 16.67% |
hans verkuil | hans verkuil | 61 | 28.11% | 2 | 33.33% |
gerd knorr | gerd knorr | 20 | 9.22% | 2 | 33.33% |
mauro carvalho chehab | mauro carvalho chehab | 16 | 7.37% | 1 | 16.67% |
| Total | 217 | 100.00% | 6 | 100.00% |
static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
struct cx88_dmaqueue *q,
struct cx88_buffer *buf)
{
struct cx88_core *core = dev->core;
/* setup fifo + format */
cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH24],
VBI_LINE_LENGTH, buf->risc.dma);
cx_write(MO_VBOS_CONTROL, ( (1 << 18) | // comb filter delay fixup
(1 << 15) | // enable vbi capture
(1 << 11) ));
/* reset counter */
cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET);
q->count = 0;
/* enable irqs */
cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_VIDINT);
cx_set(MO_VID_INTMSK, 0x0f0088);
/* enable capture */
cx_set(VID_CAPTURE_CONTROL,0x18);
/* start dma */
cx_set(MO_DEV_CNTRL2, (1<<5));
cx_set(MO_VID_DMACNTRL, 0x88);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andrew morton | andrew morton | 122 | 85.92% | 1 | 14.29% |
gerd knorr | gerd knorr | 16 | 11.27% | 2 | 28.57% |
hans verkuil | hans verkuil | 2 | 1.41% | 2 | 28.57% |
trent piepho | trent piepho | 1 | 0.70% | 1 | 14.29% |
adrian bunk | adrian bunk | 1 | 0.70% | 1 | 14.29% |
| Total | 142 | 100.00% | 7 | 100.00% |
void cx8800_stop_vbi_dma(struct cx8800_dev *dev)
{
struct cx88_core *core = dev->core;
/* stop dma */
cx_clear(MO_VID_DMACNTRL, 0x88);
/* disable capture */
cx_clear(VID_CAPTURE_CONTROL,0x18);
/* disable irqs */
cx_clear(MO_PCI_INTMSK, PCI_INT_VIDINT);
cx_clear(MO_VID_INTMSK, 0x0f0088);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 48 | 96.00% | 1 | 33.33% |
hans verkuil | hans verkuil | 1 | 2.00% | 1 | 33.33% |
trent piepho | trent piepho | 1 | 2.00% | 1 | 33.33% |
| Total | 50 | 100.00% | 3 | 100.00% |
int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
struct cx88_dmaqueue *q)
{
struct cx88_buffer *buf;
if (list_empty(&q->active))
return 0;
buf = list_entry(q->active.next, struct cx88_buffer, list);
dprintk(2,"restart_queue [%p/%d]: restart dma\n",
buf, buf->vb.vb2_buf.index);
cx8800_start_vbi_dma(dev, q, buf);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andrew morton | andrew morton | 70 | 89.74% | 1 | 33.33% |
hans verkuil | hans verkuil | 7 | 8.97% | 1 | 33.33% |
junghak sung | junghak sung | 1 | 1.28% | 1 | 33.33% |
| Total | 78 | 100.00% | 3 | 100.00% |
/* ------------------------------------------------------------------ */
static int queue_setup(struct vb2_queue *q,
unsigned int *num_buffers, unsigned int *num_planes,
unsigned int sizes[], void *alloc_ctxs[])
{
struct cx8800_dev *dev = q->drv_priv;
*num_planes = 1;
if (dev->core->tvnorm & V4L2_STD_525_60)
sizes[0] = VBI_LINE_NTSC_COUNT * VBI_LINE_LENGTH * 2;
else
sizes[0] = VBI_LINE_PAL_COUNT * VBI_LINE_LENGTH * 2;
alloc_ctxs[0] = dev->alloc_ctx;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hans verkuil | hans verkuil | 84 | 93.33% | 3 | 75.00% |
andrew morton | andrew morton | 6 | 6.67% | 1 | 25.00% |
| Total | 90 | 100.00% | 4 | 100.00% |
static int buffer_prepare(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
unsigned int lines;
unsigned int size;
if (dev->core->tvnorm & V4L2_STD_525_60)
lines = VBI_LINE_NTSC_COUNT;
else
lines = VBI_LINE_PAL_COUNT;
size = lines * VBI_LINE_LENGTH * 2;
if (vb2_plane_size(vb, 0) < size)
return -EINVAL;
vb2_set_plane_payload(vb, 0, size);
cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl,
0, VBI_LINE_LENGTH * lines,
VBI_LINE_LENGTH, 0,
lines);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hans verkuil | hans verkuil | 94 | 63.09% | 2 | 40.00% |
andrew morton | andrew morton | 43 | 28.86% | 1 | 20.00% |
junghak sung | junghak sung | 11 | 7.38% | 1 | 20.00% |
gerd knorr | gerd knorr | 1 | 0.67% | 1 | 20.00% |
| Total | 149 | 100.00% | 5 | 100.00% |
static void buffer_finish(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
struct cx88_riscmem *risc = &buf->risc;
if (risc->cpu)
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
memset(risc, 0, sizeof(*risc));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hans verkuil | hans verkuil | 51 | 53.68% | 3 | 42.86% |
andrew morton | andrew morton | 26 | 27.37% | 1 | 14.29% |
junghak sung | junghak sung | 11 | 11.58% | 1 | 14.29% |
gerd knorr | gerd knorr | 6 | 6.32% | 1 | 14.29% |
mauro carvalho chehab | mauro carvalho chehab | 1 | 1.05% | 1 | 14.29% |
| Total | 95 | 100.00% | 7 | 100.00% |
static void buffer_queue(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
struct cx88_buffer *prev;
struct cx88_dmaqueue *q = &dev->vbiq;
/* add jump to start */
buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8);
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8);
if (list_empty(&q->active)) {
list_add_tail(&buf->list, &q->active);
cx8800_start_vbi_dma(dev, q, buf);
dprintk(2,"[%p/%d] vbi_queue - first active\n",
buf, buf->vb.vb2_buf.index);
} else {
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
prev = list_entry(q->active.prev, struct cx88_buffer, list);
list_add_tail(&buf->list, &q->active);
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
dprintk(2,"[%p/%d] buffer_queue - append to active\n",
buf, buf->vb.vb2_buf.index);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andrew morton | andrew morton | 168 | 66.93% | 1 | 20.00% |
hans verkuil | hans verkuil | 63 | 25.10% | 1 | 20.00% |
junghak sung | junghak sung | 13 | 5.18% | 1 | 20.00% |
gerd knorr | gerd knorr | 7 | 2.79% | 2 | 40.00% |
| Total | 251 | 100.00% | 5 | 100.00% |
static int start_streaming(struct vb2_queue *q, unsigned int count)
{
struct cx8800_dev *dev = q->drv_priv;
struct cx88_dmaqueue *dmaq = &dev->vbiq;
struct cx88_buffer *buf = list_entry(dmaq->active.next,
struct cx88_buffer, list);
cx8800_start_vbi_dma(dev, dmaq, buf);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hans verkuil | hans verkuil | 44 | 67.69% | 1 | 33.33% |
andrew morton | andrew morton | 15 | 23.08% | 1 | 33.33% |
gerd knorr | gerd knorr | 6 | 9.23% | 1 | 33.33% |
| Total | 65 | 100.00% | 3 | 100.00% |
static void stop_streaming(struct vb2_queue *q)
{
struct cx8800_dev *dev = q->drv_priv;
struct cx88_core *core = dev->core;
struct cx88_dmaqueue *dmaq = &dev->vbiq;
unsigned long flags;
cx_clear(MO_VID_DMACNTRL, 0x11);
cx_clear(VID_CAPTURE_CONTROL, 0x06);
cx8800_stop_vbi_dma(dev);
spin_lock_irqsave(&dev->slock, flags);
while (!list_empty(&dmaq->active)) {
struct cx88_buffer *buf = list_entry(dmaq->active.next,
struct cx88_buffer, list);
list_del(&buf->list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
}
spin_unlock_irqrestore(&dev->slock, flags);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hans verkuil | hans verkuil | 126 | 94.03% | 1 | 25.00% |
andrew morton | andrew morton | 5 | 3.73% | 1 | 25.00% |
junghak sung | junghak sung | 2 | 1.49% | 1 | 25.00% |
mauro carvalho chehab | mauro carvalho chehab | 1 | 0.75% | 1 | 25.00% |
| Total | 134 | 100.00% | 4 | 100.00% |
const struct vb2_ops cx8800_vbi_qops = {
.queue_setup = queue_setup,
.buf_prepare = buffer_prepare,
.buf_finish = buffer_finish,
.buf_queue = buffer_queue,
.wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vb2_ops_wait_finish,
.start_streaming = start_streaming,
.stop_streaming = stop_streaming,
};
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andrew morton | andrew morton | 634 | 46.41% | 1 | 5.26% |
hans verkuil | hans verkuil | 561 | 41.07% | 6 | 31.58% |
gerd knorr | gerd knorr | 110 | 8.05% | 4 | 21.05% |
junghak sung | junghak sung | 38 | 2.78% | 1 | 5.26% |
mauro carvalho chehab | mauro carvalho chehab | 19 | 1.39% | 4 | 21.05% |
trent piepho | trent piepho | 2 | 0.15% | 1 | 5.26% |
adrian bunk | adrian bunk | 1 | 0.07% | 1 | 5.26% |
lawrence rust | lawrence rust | 1 | 0.07% | 1 | 5.26% |
| Total | 1366 | 100.00% | 19 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.