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.
15 #ifndef _VPFE_CAPTURE_H
16 #define _VPFE_CAPTURE_H
21 #include <media/v4l2-dev.h>
22 #include <linux/videodev2.h>
23 #include <linux/clk.h>
24 #include <linux/i2c.h>
25 #include <media/v4l2-fh.h>
26 #include <media/v4l2-ioctl.h>
27 #include <media/v4l2-device.h>
28 #include <media/videobuf-dma-contig.h>
29 #include <media/davinci/vpfe_types.h>
31 #define VPFE_CAPTURE_NUM_DECODERS 5
34 #define VPFE_MAJOR_RELEASE 0
35 #define VPFE_MINOR_RELEASE 0
37 #define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
38 (VPFE_MINOR_RELEASE << 8) | \
41 #define CAPTURE_DRV_NAME "vpfe-capture"
43 struct vpfe_pixel_format {
44 struct v4l2_fmtdesc fmtdesc;
49 struct vpfe_std_info {
52 /* current frame format */
61 struct vpfe_subdev_info {
64 /* Sub device group id */
66 /* Number of inputs supported */
68 /* inputs available at the sub device */
69 struct v4l2_input *inputs;
70 /* Sub dev routing information for each input */
71 struct vpfe_route *routes;
72 /* check if sub dev supports routing */
74 /* ccdc bus/interface configuration */
75 struct vpfe_hw_if_param ccdc_if_params;
76 /* i2c subdevice board info */
77 struct i2c_board_info board_info;
81 /* Number of sub devices connected to vpfe */
83 /* i2c bus adapter no */
85 /* information about each subdev */
86 struct vpfe_subdev_info *sub_devs;
94 /* Function for Clearing the interrupt */
95 void (*clr_intr)(int vdint);
99 /* V4l2 specific parameters */
100 /* Identifies video device for this channel */
101 struct video_device video_dev;
103 struct v4l2_subdev **sd;
105 struct vpfe_config *cfg;
107 struct v4l2_device v4l2_dev;
110 /* number of open instances of the channel */
112 /* Indicates id of the field which is being displayed */
114 /* flag to indicate whether decoder is initialized */
116 /* current interface type */
117 struct vpfe_hw_if_param vpfe_if_params;
118 /* ptr to currently selected sub device */
119 struct vpfe_subdev_info *current_subdev;
120 /* current input at the sub device */
122 /* Keeps track of the information about the standard */
123 struct vpfe_std_info std_info;
124 /* std index into std table */
126 /* CCDC IRQs used when CCDC/ISIF output to SDRAM */
127 unsigned int ccdc_irq0;
128 unsigned int ccdc_irq1;
129 /* number of buffers in fbuffers */
131 /* List of buffer pointers for storing frames */
132 u8 *fbuffers[VIDEO_MAX_FRAME];
133 /* Pointer pointing to current v4l2_buffer */
134 struct videobuf_buffer *cur_frm;
135 /* Pointer pointing to next v4l2_buffer */
136 struct videobuf_buffer *next_frm;
138 * This field keeps track of type of buffer exchange mechanism
141 enum v4l2_memory memory;
142 /* Used to store pixel format */
143 struct v4l2_format fmt;
145 * used when IMP is chained to store the crop window which
146 * is different from the image window
148 struct v4l2_rect crop;
149 /* Buffer queue used in video-buf */
150 struct videobuf_queue buffer_queue;
151 /* Queue of filled frames */
152 struct list_head dma_queue;
153 /* Used in video-buf */
155 /* IRQ lock for DMA queue */
156 spinlock_t dma_queue_lock;
157 /* lock used to access this structure */
159 /* number of users performing IO */
161 /* Indicates whether streaming started */
164 * offset where second field starts from the starting of the
165 * buffer for field separated YCbCr formats
170 /* File handle structure */
173 struct vpfe_device *vpfe_dev;
174 /* Indicates whether this file handle is doing IO */
178 struct vpfe_config_params {
185 #endif /* End of __KERNEL__ */
186 #endif /* _DAVINCI_VPFE_H */