2 * Copyright (C) 2008-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 _VPFE_CAPTURE_H
20 #define _VPFE_CAPTURE_H
25 #include <media/v4l2-dev.h>
26 #include <linux/videodev2.h>
27 #include <linux/clk.h>
28 #include <linux/i2c.h>
29 #include <media/v4l2-ioctl.h>
30 #include <media/v4l2-device.h>
31 #include <media/videobuf-dma-contig.h>
32 #include <media/davinci/vpfe_types.h>
34 #define VPFE_CAPTURE_NUM_DECODERS 5
37 #define VPFE_MAJOR_RELEASE 0
38 #define VPFE_MINOR_RELEASE 0
40 #define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
41 (VPFE_MINOR_RELEASE << 8) | \
44 #define CAPTURE_DRV_NAME "vpfe-capture"
46 struct vpfe_pixel_format
{
47 struct v4l2_fmtdesc fmtdesc
;
52 struct vpfe_std_info
{
55 /* current frame format */
64 struct vpfe_subdev_info
{
67 /* Sub device group id */
69 /* Number of inputs supported */
71 /* inputs available at the sub device */
72 struct v4l2_input
*inputs
;
73 /* Sub dev routing information for each input */
74 struct vpfe_route
*routes
;
75 /* check if sub dev supports routing */
77 /* ccdc bus/interface configuration */
78 struct vpfe_hw_if_param ccdc_if_params
;
79 /* i2c subdevice board info */
80 struct i2c_board_info board_info
;
84 /* Number of sub devices connected to vpfe */
86 /* i2c bus adapter no */
88 /* information about each subdev */
89 struct vpfe_subdev_info
*sub_devs
;
97 /* Function for Clearing the interrupt */
98 void (*clr_intr
)(int vdint
);
102 /* V4l2 specific parameters */
103 /* Identifies video device for this channel */
104 struct video_device
*video_dev
;
106 struct v4l2_subdev
**sd
;
108 struct vpfe_config
*cfg
;
110 struct v4l2_device v4l2_dev
;
113 /* Used to keep track of state of the priority */
114 struct v4l2_prio_state prio
;
115 /* number of open instances of the channel */
117 /* Indicates id of the field which is being displayed */
119 /* flag to indicate whether decoder is initialized */
121 /* current interface type */
122 struct vpfe_hw_if_param vpfe_if_params
;
123 /* ptr to currently selected sub device */
124 struct vpfe_subdev_info
*current_subdev
;
125 /* current input at the sub device */
127 /* Keeps track of the information about the standard */
128 struct vpfe_std_info std_info
;
129 /* std index into std table */
131 /* CCDC IRQs used when CCDC/ISIF output to SDRAM */
132 unsigned int ccdc_irq0
;
133 unsigned int ccdc_irq1
;
134 /* number of buffers in fbuffers */
136 /* List of buffer pointers for storing frames */
137 u8
*fbuffers
[VIDEO_MAX_FRAME
];
138 /* Pointer pointing to current v4l2_buffer */
139 struct videobuf_buffer
*cur_frm
;
140 /* Pointer pointing to next v4l2_buffer */
141 struct videobuf_buffer
*next_frm
;
143 * This field keeps track of type of buffer exchange mechanism
146 enum v4l2_memory memory
;
147 /* Used to store pixel format */
148 struct v4l2_format fmt
;
150 * used when IMP is chained to store the crop window which
151 * is different from the image window
153 struct v4l2_rect crop
;
154 /* Buffer queue used in video-buf */
155 struct videobuf_queue buffer_queue
;
156 /* Queue of filled frames */
157 struct list_head dma_queue
;
158 /* Used in video-buf */
160 /* IRQ lock for DMA queue */
161 spinlock_t dma_queue_lock
;
162 /* lock used to access this structure */
164 /* number of users performing IO */
166 /* Indicates whether streaming started */
169 * offset where second field starts from the starting of the
170 * buffer for field separated YCbCr formats
175 /* File handle structure */
177 struct vpfe_device
*vpfe_dev
;
178 /* Indicates whether this file handle is doing IO */
180 /* Used to keep track priority of this instance */
181 enum v4l2_priority prio
;
184 struct vpfe_config_params
{
191 #endif /* End of __KERNEL__ */
193 * VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params
194 * This can be used to configure modules such as defect pixel correction,
195 * color space conversion, culling etc. This is an experimental ioctl that
196 * will change in future kernels. So use this ioctl with care !
197 * TODO: This is to be split into multiple ioctls and also explore the
198 * possibility of extending the v4l2 api to include this
200 #define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \
202 #endif /* _DAVINCI_VPFE_H */