1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2008-2009 Texas Instruments Inc
6 #ifndef _VPFE_CAPTURE_H
7 #define _VPFE_CAPTURE_H
12 #include <media/v4l2-dev.h>
13 #include <linux/videodev2.h>
14 #include <linux/clk.h>
15 #include <linux/i2c.h>
16 #include <media/v4l2-fh.h>
17 #include <media/v4l2-ioctl.h>
18 #include <media/v4l2-device.h>
19 #include <media/videobuf-dma-contig.h>
20 #include <media/davinci/vpfe_types.h>
22 #define VPFE_CAPTURE_NUM_DECODERS 5
25 #define VPFE_MAJOR_RELEASE 0
26 #define VPFE_MINOR_RELEASE 0
28 #define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
29 (VPFE_MINOR_RELEASE << 8) | \
32 #define CAPTURE_DRV_NAME "vpfe-capture"
34 struct vpfe_pixel_format {
40 struct vpfe_std_info {
43 /* current frame format */
52 struct vpfe_subdev_info {
55 /* Sub device group id */
57 /* Number of inputs supported */
59 /* inputs available at the sub device */
60 struct v4l2_input *inputs;
61 /* Sub dev routing information for each input */
62 struct vpfe_route *routes;
63 /* check if sub dev supports routing */
65 /* ccdc bus/interface configuration */
66 struct vpfe_hw_if_param ccdc_if_params;
67 /* i2c subdevice board info */
68 struct i2c_board_info board_info;
72 /* Number of sub devices connected to vpfe */
74 /* i2c bus adapter no */
76 /* information about each subdev */
77 struct vpfe_subdev_info *sub_devs;
85 /* Function for Clearing the interrupt */
86 void (*clr_intr)(int vdint);
90 /* V4l2 specific parameters */
91 /* Identifies video device for this channel */
92 struct video_device video_dev;
94 struct v4l2_subdev **sd;
96 struct vpfe_config *cfg;
98 struct v4l2_device v4l2_dev;
101 /* number of open instances of the channel */
103 /* Indicates id of the field which is being displayed */
105 /* flag to indicate whether decoder is initialized */
107 /* current interface type */
108 struct vpfe_hw_if_param vpfe_if_params;
109 /* ptr to currently selected sub device */
110 struct vpfe_subdev_info *current_subdev;
111 /* current input at the sub device */
113 /* Keeps track of the information about the standard */
114 struct vpfe_std_info std_info;
115 /* std index into std table */
117 /* CCDC IRQs used when CCDC/ISIF output to SDRAM */
118 unsigned int ccdc_irq0;
119 unsigned int ccdc_irq1;
120 /* number of buffers in fbuffers */
122 /* List of buffer pointers for storing frames */
123 u8 *fbuffers[VIDEO_MAX_FRAME];
124 /* Pointer pointing to current v4l2_buffer */
125 struct videobuf_buffer *cur_frm;
126 /* Pointer pointing to next v4l2_buffer */
127 struct videobuf_buffer *next_frm;
129 * This field keeps track of type of buffer exchange mechanism
132 enum v4l2_memory memory;
133 /* Used to store pixel format */
134 struct v4l2_format fmt;
136 * used when IMP is chained to store the crop window which
137 * is different from the image window
139 struct v4l2_rect crop;
140 /* Buffer queue used in video-buf */
141 struct videobuf_queue buffer_queue;
142 /* Queue of filled frames */
143 struct list_head dma_queue;
144 /* Used in video-buf */
146 /* IRQ lock for DMA queue */
147 spinlock_t dma_queue_lock;
148 /* lock used to access this structure */
150 /* number of users performing IO */
152 /* Indicates whether streaming started */
155 * offset where second field starts from the starting of the
156 * buffer for field separated YCbCr formats
161 /* File handle structure */
164 struct vpfe_device *vpfe_dev;
165 /* Indicates whether this file handle is doing IO */
169 struct vpfe_config_params {
176 #endif /* End of __KERNEL__ */
177 #endif /* _DAVINCI_VPFE_H */