2009-09-16 17:31:10 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 Texas Instruments Inc
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VPIF_CAPTURE_H
|
|
|
|
#define VPIF_CAPTURE_H
|
|
|
|
|
|
|
|
/* Header files */
|
2012-06-28 12:28:05 +00:00
|
|
|
#include <media/videobuf2-dma-contig.h>
|
2013-04-19 08:53:29 +00:00
|
|
|
#include <media/v4l2-device.h>
|
2009-09-16 17:31:10 +00:00
|
|
|
|
|
|
|
#include "vpif.h"
|
|
|
|
|
|
|
|
/* Macros */
|
2011-06-25 14:28:37 +00:00
|
|
|
#define VPIF_CAPTURE_VERSION "0.0.2"
|
2009-09-16 17:31:10 +00:00
|
|
|
|
|
|
|
#define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \
|
|
|
|
(V4L2_FIELD_NONE == field)) || \
|
|
|
|
(((V4L2_FIELD_INTERLACED == field) || \
|
|
|
|
(V4L2_FIELD_SEQ_TB == field)) || \
|
|
|
|
(V4L2_FIELD_SEQ_BT == field)))
|
|
|
|
|
|
|
|
#define VPIF_CAPTURE_MAX_DEVICES 2
|
|
|
|
#define VPIF_VIDEO_INDEX 0
|
|
|
|
#define VPIF_NUMBER_OF_OBJECTS 1
|
|
|
|
|
|
|
|
/* Enumerated data type to give id to each device per channel */
|
|
|
|
enum vpif_channel_id {
|
|
|
|
VPIF_CHANNEL0_VIDEO = 0,
|
|
|
|
VPIF_CHANNEL1_VIDEO,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct video_obj {
|
|
|
|
enum v4l2_field buf_field;
|
|
|
|
/* Currently selected or default standard */
|
|
|
|
v4l2_std_id stdid;
|
2012-09-18 10:18:47 +00:00
|
|
|
struct v4l2_dv_timings dv_timings;
|
2009-09-16 17:31:10 +00:00
|
|
|
};
|
|
|
|
|
2012-06-28 12:28:05 +00:00
|
|
|
struct vpif_cap_buffer {
|
[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 13:30:30 +00:00
|
|
|
struct vb2_v4l2_buffer vb;
|
2012-06-28 12:28:05 +00:00
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
2009-09-16 17:31:10 +00:00
|
|
|
struct common_obj {
|
|
|
|
/* Pointer pointing to current v4l2_buffer */
|
2012-06-28 12:28:05 +00:00
|
|
|
struct vpif_cap_buffer *cur_frm;
|
2009-09-16 17:31:10 +00:00
|
|
|
/* Pointer pointing to current v4l2_buffer */
|
2012-06-28 12:28:05 +00:00
|
|
|
struct vpif_cap_buffer *next_frm;
|
2009-09-16 17:31:10 +00:00
|
|
|
/* Used to store pixel format */
|
|
|
|
struct v4l2_format fmt;
|
|
|
|
/* Buffer queue used in video-buf */
|
2012-06-28 12:28:05 +00:00
|
|
|
struct vb2_queue buffer_queue;
|
|
|
|
/* allocator-specific contexts for each plane */
|
|
|
|
struct vb2_alloc_ctx *alloc_ctx;
|
2009-09-16 17:31:10 +00:00
|
|
|
/* Queue of filled frames */
|
|
|
|
struct list_head dma_queue;
|
|
|
|
/* Used in video-buf */
|
|
|
|
spinlock_t irqlock;
|
|
|
|
/* lock used to access this structure */
|
|
|
|
struct mutex lock;
|
|
|
|
/* Function pointer to set the addresses */
|
|
|
|
void (*set_addr) (unsigned long, unsigned long, unsigned long,
|
|
|
|
unsigned long);
|
|
|
|
/* offset where Y top starts from the starting of the buffer */
|
|
|
|
u32 ytop_off;
|
|
|
|
/* offset where Y bottom starts from the starting of the buffer */
|
|
|
|
u32 ybtm_off;
|
|
|
|
/* offset where C top starts from the starting of the buffer */
|
|
|
|
u32 ctop_off;
|
|
|
|
/* offset where C bottom starts from the starting of the buffer */
|
|
|
|
u32 cbtm_off;
|
|
|
|
/* Indicates width of the image data */
|
|
|
|
u32 width;
|
|
|
|
/* Indicates height of the image data */
|
|
|
|
u32 height;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct channel_obj {
|
|
|
|
/* Identifies video device for this channel */
|
2015-03-08 21:57:23 +00:00
|
|
|
struct video_device video_dev;
|
2009-09-16 17:31:10 +00:00
|
|
|
/* Indicates id of the field which is being displayed */
|
|
|
|
u32 field_id;
|
|
|
|
/* flag to indicate whether decoder is initialized */
|
|
|
|
u8 initialized;
|
|
|
|
/* Identifies channel */
|
|
|
|
enum vpif_channel_id channel_id;
|
2012-09-20 12:06:22 +00:00
|
|
|
/* Current input */
|
|
|
|
u32 input_idx;
|
2012-09-20 12:06:30 +00:00
|
|
|
/* subdev corresponding to the current input, may be NULL */
|
|
|
|
struct v4l2_subdev *sd;
|
2009-09-16 17:31:10 +00:00
|
|
|
/* vpif configuration params */
|
|
|
|
struct vpif_params vpifparams;
|
|
|
|
/* common object array */
|
|
|
|
struct common_obj common[VPIF_NUMBER_OF_OBJECTS];
|
|
|
|
/* video object */
|
|
|
|
struct video_obj video;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vpif_device {
|
|
|
|
struct v4l2_device v4l2_dev;
|
|
|
|
struct channel_obj *dev[VPIF_CAPTURE_NUM_CHANNELS];
|
|
|
|
struct v4l2_subdev **sd;
|
2013-06-25 14:17:34 +00:00
|
|
|
struct v4l2_async_notifier notifier;
|
|
|
|
struct vpif_capture_config *config;
|
2009-09-16 17:31:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* VPIF_CAPTURE_H */
|