2008-01-10 10:25:59 +03:00
/*
* Driver for the Conexant CX23885 PCIe bridge
*
2008-09-04 00:12:12 +04:00
* Copyright ( c ) 2007 Steven Toth < stoth @ linuxtv . org >
2008-01-10 10:25:59 +03:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
*
* GNU General Public License for more details .
*/
2016-11-13 14:46:11 +03:00
# include "cx23885.h"
2008-01-10 10:25:59 +03: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 17:36:36 +03:00
static unsigned int vbi_debug ;
2008-01-10 10:25:59 +03:00
module_param ( vbi_debug , int , 0644 ) ;
MODULE_PARM_DESC ( vbi_debug , " enable debug messages [vbi] " ) ;
2008-01-12 17:36:36 +03:00
# define dprintk(level, fmt, arg...)\
do { if ( vbi_debug > = level ) \
2016-11-13 14:46:11 +03:00
printk ( KERN_DEBUG pr_fmt ( " %s: vbi: " fmt ) , \
__func__ , # # arg ) ; \
2008-01-12 17:36:36 +03:00
} while ( 0 )
2008-01-10 10:25:59 +03:00
/* ------------------------------------------------------------------ */
2011-10-10 18:09:54 +04:00
# define VBI_LINE_LENGTH 1440
2014-08-14 13:43:01 +04:00
# define VBI_NTSC_LINE_COUNT 12
# define VBI_PAL_LINE_COUNT 18
2011-10-10 18:09:54 +04:00
2008-01-10 10:25:59 +03:00
int cx23885_vbi_fmt ( struct file * file , void * priv ,
struct v4l2_format * f )
{
2014-04-23 15:43:51 +04:00
struct cx23885_dev * dev = video_drvdata ( file ) ;
2008-01-10 10:25:59 +03:00
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
if ( dev - > tvnorm & V4L2_STD_525_60 ) {
/* ntsc */
2014-09-20 17:19:32 +04: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 13:43:01 +04:00
f - > fmt . vbi . count [ 0 ] = VBI_NTSC_LINE_COUNT ;
f - > fmt . vbi . count [ 1 ] = VBI_NTSC_LINE_COUNT ;
2008-01-10 10:25:59 +03:00
} else if ( dev - > tvnorm & V4L2_STD_625_50 ) {
/* pal */
2014-09-20 17:19:32 +04: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 13:43:01 +04:00
f - > fmt . vbi . count [ 0 ] = VBI_PAL_LINE_COUNT ;
f - > fmt . vbi . count [ 1 ] = VBI_PAL_LINE_COUNT ;
2008-01-10 10:25:59 +03:00
}
2011-10-10 18:09:54 +04:00
2008-01-10 10:25:59 +03:00
return 0 ;
}
2011-10-10 18:09:54 +04: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-11-30 19:47:00 +03:00
count = cx_read ( VBI_A_GPCNT ) ;
2011-10-10 18:09:54 +04:00
cx23885_video_wakeup ( dev , & dev - > vbiq , count ) ;
spin_unlock ( & dev - > slock ) ;
handled + + ;
}
return handled ;
}
2008-01-10 10:25:59 +03:00
static int cx23885_start_vbi_dma ( struct cx23885_dev * dev ,
struct cx23885_dmaqueue * q ,
struct cx23885_buffer * buf )
{
2011-10-10 18:09:54 +04:00
dprintk ( 1 , " %s() \n " , __func__ ) ;
2008-01-10 10:25:59 +03:00
/* setup fifo + format */
cx23885_sram_channel_setup ( dev , & dev - > sram_channels [ SRAM_CH02 ] ,
2014-08-14 13:43:01 +04:00
VBI_LINE_LENGTH , buf - > risc . dma ) ;
2008-01-10 10:25:59 +03:00
/* reset counter */
2011-10-10 18:09:54 +04:00
cx_write ( VID_A_VBI_CTRL , 3 ) ;
cx_write ( VBI_A_GPCNT_CTL , 3 ) ;
2014-08-14 13:43:01 +04:00
q - > count = 0 ;
2008-01-10 10:25:59 +03:00
2011-10-10 18:09:54 +04:00
/* enable irq */
2010-07-19 08:19:43 +04:00
cx23885_irq_add_enable ( dev , 0x01 ) ;
2008-01-10 10:25:59 +03:00
cx_set ( VID_A_INT_MSK , 0x000022 ) ;
/* start dma */
cx_set ( DEV_CNTRL2 , ( 1 < < 5 ) ) ;
2011-10-10 18:09:54 +04:00
cx_set ( VID_A_DMA_CTL , 0x22 ) ; /* FIFO and RISC enable */
2008-01-10 10:25:59 +03:00
return 0 ;
}
2014-08-14 13:43:01 +04:00
/* ------------------------------------------------------------------ */
2008-01-10 10:25:59 +03:00
2015-10-28 05:50:37 +03:00
static int queue_setup ( struct vb2_queue * q ,
2014-08-14 13:43:01 +04:00
unsigned int * num_buffers , unsigned int * num_planes ,
2016-04-15 15:15:05 +03:00
unsigned int sizes [ ] , struct device * alloc_devs [ ] )
2008-01-10 10:25:59 +03:00
{
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
return 0 ;
}
2014-08-14 13:43:01 +04:00
static int buffer_prepare ( struct vb2_buffer * vb )
2008-01-10 10:25:59 +03: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 16:30:30 +03:00
struct vb2_v4l2_buffer * vbuf = to_vb2_v4l2_buffer ( vb ) ;
2014-08-14 13:43:01 +04: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 16:30:30 +03:00
struct cx23885_buffer * buf = container_of ( vbuf ,
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
2014-08-14 13:43:01 +04:00
if ( dev - > tvnorm & V4L2_STD_525_60 )
lines = VBI_NTSC_LINE_COUNT ;
2008-01-10 10:25:59 +03:00
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
2014-08-14 13:43:01 +04:00
cx23885_risc_vbibuffer ( dev - > pci , & buf - > risc ,
sgt - > sgl ,
0 , VBI_LINE_LENGTH * lines ,
VBI_LINE_LENGTH , 0 ,
lines ) ;
2008-01-10 10:25:59 +03:00
return 0 ;
}
2014-08-14 13:43:01 +04:00
static void buffer_finish ( struct vb2_buffer * vb )
2008-01-10 10:25:59 +03: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 16:30:30 +03:00
struct vb2_v4l2_buffer * vbuf = to_vb2_v4l2_buffer ( vb ) ;
struct cx23885_buffer * buf = container_of ( vbuf ,
2008-01-10 10:25:59 +03:00
struct cx23885_buffer , vb ) ;
2014-08-14 13:43:01 +04:00
cx23885_free_buffer ( vb - > vb2_queue - > drv_priv , buf ) ;
2008-01-10 10:25:59 +03:00
}
2014-08-14 13:43:01 +04: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 10:25:59 +03: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 16:30:30 +03:00
struct vb2_v4l2_buffer * vbuf = to_vb2_v4l2_buffer ( vb ) ;
2014-08-14 13:43:01 +04: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 16:30:30 +03:00
struct cx23885_buffer * buf = container_of ( vbuf ,
struct cx23885_buffer , vb ) ;
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
buf - > risc . jmp [ 2 ] = cpu_to_le32 ( 0 ) ; /* bits 63-32 */
if ( list_empty ( & q - > active ) ) {
2014-08-14 13:43:01 +04:00
spin_lock_irqsave ( & dev - > slock , flags ) ;
list_add_tail ( & buf - > queue , & q - > active ) ;
spin_unlock_irqrestore ( & dev - > slock , flags ) ;
2008-01-10 10:25:59 +03: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 16:30:30 +03:00
buf , buf - > vb . vb2_buf . index ) ;
2008-01-10 10:25:59 +03:00
} else {
2014-08-14 13:43:01 +04:00
buf - > risc . cpu [ 0 ] | = cpu_to_le32 ( RISC_IRQ1 ) ;
2008-01-10 10:25:59 +03:00
prev = list_entry ( q - > active . prev , struct cx23885_buffer ,
2014-08-14 13:43:01 +04:00
queue ) ;
spin_lock_irqsave ( & dev - > slock , flags ) ;
list_add_tail ( & buf - > queue , & q - > active ) ;
spin_unlock_irqrestore ( & dev - > slock , flags ) ;
2008-01-10 10:25:59 +03: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 16:30:30 +03:00
buf , buf - > vb . vb2_buf . index ) ;
2008-01-10 10:25:59 +03:00
}
}
2014-08-14 13:43:01 +04:00
static int cx23885_start_streaming ( struct vb2_queue * q , unsigned int count )
2008-01-10 10:25:59 +03:00
{
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
2014-08-14 13:43:01 +04:00
cx23885_start_vbi_dma ( dev , dmaq , buf ) ;
return 0 ;
2008-01-10 10:25:59 +03:00
}
2014-08-14 13:43:01 +04: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 10:25:59 +03:00
2014-08-14 13:43:01 +04: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 16:30:30 +03:00
vb2_buffer_done ( & buf - > vb . vb2_buf , VB2_BUF_STATE_ERROR ) ;
2014-08-14 13:43:01 +04:00
}
spin_unlock_irqrestore ( & dev - > slock , flags ) ;
}
2017-09-27 19:59:06 +03:00
const struct vb2_ops cx23885_vbi_qops = {
2014-08-14 13:43:01 +04: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 ,
} ;