2 * Copyright (C) 2009 Texas Instruments Inc
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef VPIF_CAPTURE_H
20 #define VPIF_CAPTURE_H
23 #include <media/videobuf2-dma-contig.h>
24 #include <media/v4l2-device.h>
29 #define VPIF_CAPTURE_VERSION "0.0.2"
31 #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \
32 (V4L2_FIELD_NONE == field)) || \
33 (((V4L2_FIELD_INTERLACED == field) || \
34 (V4L2_FIELD_SEQ_TB == field)) || \
35 (V4L2_FIELD_SEQ_BT == field)))
37 #define VPIF_CAPTURE_MAX_DEVICES 2
38 #define VPIF_VIDEO_INDEX 0
39 #define VPIF_NUMBER_OF_OBJECTS 1
41 /* Enumerated data type to give id to each device per channel */
42 enum vpif_channel_id
{
43 VPIF_CHANNEL0_VIDEO
= 0,
48 enum v4l2_field buf_field
;
49 /* Currently selected or default standard */
51 struct v4l2_dv_timings dv_timings
;
54 struct vpif_cap_buffer
{
55 struct vb2_v4l2_buffer vb
;
56 struct list_head list
;
60 /* Pointer pointing to current v4l2_buffer */
61 struct vpif_cap_buffer
*cur_frm
;
62 /* Pointer pointing to current v4l2_buffer */
63 struct vpif_cap_buffer
*next_frm
;
64 /* Used to store pixel format */
65 struct v4l2_format fmt
;
66 /* Buffer queue used in video-buf */
67 struct vb2_queue buffer_queue
;
68 /* Queue of filled frames */
69 struct list_head dma_queue
;
70 /* Used in video-buf */
72 /* lock used to access this structure */
74 /* Function pointer to set the addresses */
75 void (*set_addr
) (unsigned long, unsigned long, unsigned long,
77 /* offset where Y top starts from the starting of the buffer */
79 /* offset where Y bottom starts from the starting of the buffer */
81 /* offset where C top starts from the starting of the buffer */
83 /* offset where C bottom starts from the starting of the buffer */
85 /* Indicates width of the image data */
87 /* Indicates height of the image data */
92 /* Identifies video device for this channel */
93 struct video_device video_dev
;
94 /* Indicates id of the field which is being displayed */
96 /* flag to indicate whether decoder is initialized */
98 /* Identifies channel */
99 enum vpif_channel_id channel_id
;
102 /* subdev corresponding to the current input, may be NULL */
103 struct v4l2_subdev
*sd
;
104 /* vpif configuration params */
105 struct vpif_params vpifparams
;
106 /* common object array */
107 struct common_obj common
[VPIF_NUMBER_OF_OBJECTS
];
109 struct video_obj video
;
113 struct v4l2_device v4l2_dev
;
114 struct channel_obj
*dev
[VPIF_CAPTURE_NUM_CHANNELS
];
115 struct v4l2_subdev
**sd
;
116 struct v4l2_async_notifier notifier
;
117 struct vpif_capture_config
*config
;
120 #endif /* VPIF_CAPTURE_H */