2019-05-27 14:55:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2008-01-10 15:25:59 +08:00
|
|
|
/*
|
|
|
|
* Driver for the Conexant CX23885 PCIe bridge
|
|
|
|
*
|
2008-09-04 04:12:12 +08:00
|
|
|
* Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
|
2008-01-10 15:25:59 +08:00
|
|
|
*/
|
|
|
|
|
2016-11-13 19:46:11 +08:00
|
|
|
#include "cx23885.h"
|
|
|
|
|
2008-01-10 15:25:59 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
|
|
|
|
static unsigned int vbibufs = 4;
|
|
|
|
module_param(vbibufs, int, 0644);
|
|
|
|
MODULE_PARM_DESC(vbibufs, "number of vbi buffers, range 2-32");
|
|
|
|
|
2008-01-12 22:36:36 +08:00
|
|
|
static unsigned int vbi_debug;
|
2008-01-10 15:25:59 +08:00
|
|
|
module_param(vbi_debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]");
|
|
|
|
|
2008-01-12 22:36:36 +08:00
|
|
|
#define dprintk(level, fmt, arg...)\
|
|
|
|
do { if (vbi_debug >= level)\
|
2016-11-13 19:46:11 +08:00
|
|
|
printk(KERN_DEBUG pr_fmt("%s: vbi:" fmt), \
|
|
|
|
__func__, ##arg); \
|
2008-01-12 22:36:36 +08:00
|
|
|
} while (0)
|
2008-01-10 15:25:59 +08:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2011-10-10 22:09:54 +08:00
|
|
|
#define VBI_LINE_LENGTH 1440
|
2014-08-14 17:43:01 +08:00
|
|
|
#define VBI_NTSC_LINE_COUNT 12
|
|
|
|
#define VBI_PAL_LINE_COUNT 18
|
2011-10-10 22:09:54 +08:00
|
|
|
|
|
|
|
|
2008-01-10 15:25:59 +08:00
|
|
|
int cx23885_vbi_fmt(struct file *file, void *priv,
|
|
|
|
struct v4l2_format *f)
|
|
|
|
{
|
2014-04-23 19:43:51 +08:00
|
|
|
struct cx23885_dev *dev = video_drvdata(file);
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
f->fmt.vbi.sampling_rate = 27000000;
|
|
|
|
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
|
|
|
|
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
|
|
|
|
f->fmt.vbi.offset = 0;
|
|
|
|
f->fmt.vbi.flags = 0;
|
2008-01-10 15:25:59 +08:00
|
|
|
if (dev->tvnorm & V4L2_STD_525_60) {
|
|
|
|
/* ntsc */
|
2014-09-20 21:19:32 +08:00
|
|
|
f->fmt.vbi.start[0] = V4L2_VBI_ITU_525_F1_START + 9;
|
|
|
|
f->fmt.vbi.start[1] = V4L2_VBI_ITU_525_F2_START + 9;
|
2014-08-14 17:43:01 +08:00
|
|
|
f->fmt.vbi.count[0] = VBI_NTSC_LINE_COUNT;
|
|
|
|
f->fmt.vbi.count[1] = VBI_NTSC_LINE_COUNT;
|
2008-01-10 15:25:59 +08:00
|
|
|
} else if (dev->tvnorm & V4L2_STD_625_50) {
|
|
|
|
/* pal */
|
2014-09-20 21:19:32 +08:00
|
|
|
f->fmt.vbi.start[0] = V4L2_VBI_ITU_625_F1_START + 5;
|
|
|
|
f->fmt.vbi.start[1] = V4L2_VBI_ITU_625_F2_START + 5;
|
2014-08-14 17:43:01 +08:00
|
|
|
f->fmt.vbi.count[0] = VBI_PAL_LINE_COUNT;
|
|
|
|
f->fmt.vbi.count[1] = VBI_PAL_LINE_COUNT;
|
2008-01-10 15:25:59 +08:00
|
|
|
}
|
2011-10-10 22:09:54 +08:00
|
|
|
|
2008-01-10 15:25:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-10 22:09:54 +08:00
|
|
|
/* 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);
|
2015-12-01 00:47:00 +08:00
|
|
|
count = cx_read(VBI_A_GPCNT);
|
2011-10-10 22:09:54 +08:00
|
|
|
cx23885_video_wakeup(dev, &dev->vbiq, count);
|
|
|
|
spin_unlock(&dev->slock);
|
|
|
|
handled++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2008-01-10 15:25:59 +08:00
|
|
|
static int cx23885_start_vbi_dma(struct cx23885_dev *dev,
|
|
|
|
struct cx23885_dmaqueue *q,
|
|
|
|
struct cx23885_buffer *buf)
|
|
|
|
{
|
2011-10-10 22:09:54 +08:00
|
|
|
dprintk(1, "%s()\n", __func__);
|
|
|
|
|
2008-01-10 15:25:59 +08:00
|
|
|
/* setup fifo + format */
|
|
|
|
cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH02],
|
2014-08-14 17:43:01 +08:00
|
|
|
VBI_LINE_LENGTH, buf->risc.dma);
|
2008-01-10 15:25:59 +08:00
|
|
|
|
|
|
|
/* reset counter */
|
2011-10-10 22:09:54 +08:00
|
|
|
cx_write(VID_A_VBI_CTRL, 3);
|
|
|
|
cx_write(VBI_A_GPCNT_CTL, 3);
|
2014-08-14 17:43:01 +08:00
|
|
|
q->count = 0;
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2011-10-10 22:09:54 +08:00
|
|
|
/* enable irq */
|
2010-07-19 12:19:43 +08:00
|
|
|
cx23885_irq_add_enable(dev, 0x01);
|
2008-01-10 15:25:59 +08:00
|
|
|
cx_set(VID_A_INT_MSK, 0x000022);
|
|
|
|
|
|
|
|
/* start dma */
|
|
|
|
cx_set(DEV_CNTRL2, (1<<5));
|
2011-10-10 22:09:54 +08:00
|
|
|
cx_set(VID_A_DMA_CTL, 0x22); /* FIFO and RISC enable */
|
2008-01-10 15:25:59 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
/* ------------------------------------------------------------------ */
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2015-10-28 10:50:37 +08:00
|
|
|
static int queue_setup(struct vb2_queue *q,
|
2014-08-14 17:43:01 +08:00
|
|
|
unsigned int *num_buffers, unsigned int *num_planes,
|
2016-04-15 20:15:05 +08:00
|
|
|
unsigned int sizes[], struct device *alloc_devs[])
|
2008-01-10 15:25:59 +08:00
|
|
|
{
|
2014-08-14 17:43:01 +08:00
|
|
|
struct cx23885_dev *dev = q->drv_priv;
|
|
|
|
unsigned lines = VBI_PAL_LINE_COUNT;
|
|
|
|
|
|
|
|
if (dev->tvnorm & V4L2_STD_525_60)
|
|
|
|
lines = VBI_NTSC_LINE_COUNT;
|
|
|
|
*num_planes = 1;
|
|
|
|
sizes[0] = lines * VBI_LINE_LENGTH * 2;
|
2008-01-10 15:25:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
static int buffer_prepare(struct vb2_buffer *vb)
|
2008-01-10 15:25:59 +08:00
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-08-14 17:43:01 +08:00
|
|
|
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct cx23885_buffer *buf = container_of(vbuf,
|
2014-08-14 17:43:01 +08:00
|
|
|
struct cx23885_buffer, vb);
|
|
|
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
|
|
|
unsigned lines = VBI_PAL_LINE_COUNT;
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
if (dev->tvnorm & V4L2_STD_525_60)
|
|
|
|
lines = VBI_NTSC_LINE_COUNT;
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
if (vb2_plane_size(vb, 0) < lines * VBI_LINE_LENGTH * 2)
|
|
|
|
return -EINVAL;
|
|
|
|
vb2_set_plane_payload(vb, 0, lines * VBI_LINE_LENGTH * 2);
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
cx23885_risc_vbibuffer(dev->pci, &buf->risc,
|
|
|
|
sgt->sgl,
|
|
|
|
0, VBI_LINE_LENGTH * lines,
|
|
|
|
VBI_LINE_LENGTH, 0,
|
|
|
|
lines);
|
2008-01-10 15:25:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
static void buffer_finish(struct vb2_buffer *vb)
|
2008-01-10 15:25:59 +08:00
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
|
|
|
struct cx23885_buffer *buf = container_of(vbuf,
|
2008-01-10 15:25:59 +08:00
|
|
|
struct cx23885_buffer, vb);
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
|
2008-01-10 15:25:59 +08:00
|
|
|
}
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
/*
|
|
|
|
* The risc program for each buffer works as follows: it starts with a simple
|
|
|
|
* 'JUMP to addr + 12', which is effectively a NOP. Then the code to DMA the
|
|
|
|
* buffer follows and at the end we have a JUMP back to the start + 12 (skipping
|
|
|
|
* the initial JUMP).
|
|
|
|
*
|
|
|
|
* This is the risc program of the first buffer to be queued if the active list
|
|
|
|
* is empty and it just keeps DMAing this buffer without generating any
|
|
|
|
* interrupts.
|
|
|
|
*
|
|
|
|
* If a new buffer is added then the initial JUMP in the code for that buffer
|
|
|
|
* will generate an interrupt which signals that the previous buffer has been
|
|
|
|
* DMAed successfully and that it can be returned to userspace.
|
|
|
|
*
|
|
|
|
* It also sets the final jump of the previous buffer to the start of the new
|
|
|
|
* buffer, thus chaining the new buffer into the DMA chain. This is a single
|
|
|
|
* atomic u32 write, so there is no race condition.
|
|
|
|
*
|
|
|
|
* The end-result of all this that you only get an interrupt when a buffer
|
|
|
|
* is ready, so the control flow is very easy.
|
|
|
|
*/
|
|
|
|
static void buffer_queue(struct vb2_buffer *vb)
|
2008-01-10 15:25:59 +08:00
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-08-14 17:43:01 +08:00
|
|
|
struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct cx23885_buffer *buf = container_of(vbuf,
|
|
|
|
struct cx23885_buffer, vb);
|
2014-08-14 17:43:01 +08:00
|
|
|
struct cx23885_buffer *prev;
|
|
|
|
struct cx23885_dmaqueue *q = &dev->vbiq;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 12);
|
|
|
|
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
|
|
|
|
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 12);
|
2008-01-10 15:25:59 +08:00
|
|
|
buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */
|
|
|
|
|
|
|
|
if (list_empty(&q->active)) {
|
2014-08-14 17:43:01 +08:00
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
|
|
|
list_add_tail(&buf->queue, &q->active);
|
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
2008-01-10 15:25:59 +08:00
|
|
|
dprintk(2, "[%p/%d] vbi_queue - first active\n",
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
buf, buf->vb.vb2_buf.index);
|
2008-01-10 15:25:59 +08:00
|
|
|
|
|
|
|
} else {
|
2014-08-14 17:43:01 +08:00
|
|
|
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
2008-01-10 15:25:59 +08:00
|
|
|
prev = list_entry(q->active.prev, struct cx23885_buffer,
|
2014-08-14 17:43:01 +08:00
|
|
|
queue);
|
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
|
|
|
list_add_tail(&buf->queue, &q->active);
|
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
2008-01-10 15:25:59 +08:00
|
|
|
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
|
|
|
dprintk(2, "[%p/%d] buffer_queue - append to active\n",
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
buf, buf->vb.vb2_buf.index);
|
2008-01-10 15:25:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
static int cx23885_start_streaming(struct vb2_queue *q, unsigned int count)
|
2008-01-10 15:25:59 +08:00
|
|
|
{
|
2014-08-14 17:43:01 +08:00
|
|
|
struct cx23885_dev *dev = q->drv_priv;
|
|
|
|
struct cx23885_dmaqueue *dmaq = &dev->vbiq;
|
|
|
|
struct cx23885_buffer *buf = list_entry(dmaq->active.next,
|
|
|
|
struct cx23885_buffer, queue);
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
cx23885_start_vbi_dma(dev, dmaq, buf);
|
|
|
|
return 0;
|
2008-01-10 15:25:59 +08:00
|
|
|
}
|
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
static void cx23885_stop_streaming(struct vb2_queue *q)
|
|
|
|
{
|
|
|
|
struct cx23885_dev *dev = q->drv_priv;
|
|
|
|
struct cx23885_dmaqueue *dmaq = &dev->vbiq;
|
|
|
|
unsigned long flags;
|
2008-01-10 15:25:59 +08:00
|
|
|
|
2014-08-14 17:43:01 +08:00
|
|
|
cx_clear(VID_A_DMA_CTL, 0x22); /* FIFO and RISC enable */
|
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
|
|
|
while (!list_empty(&dmaq->active)) {
|
|
|
|
struct cx23885_buffer *buf = list_entry(dmaq->active.next,
|
|
|
|
struct cx23885_buffer, queue);
|
|
|
|
|
|
|
|
list_del(&buf->queue);
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
2014-08-14 17:43:01 +08:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-28 00:59:06 +08:00
|
|
|
const struct vb2_ops cx23885_vbi_qops = {
|
2014-08-14 17:43:01 +08:00
|
|
|
.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 = cx23885_start_streaming,
|
|
|
|
.stop_streaming = cx23885_stop_streaming,
|
|
|
|
};
|