aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMuralidharan Karicheri <m-karicheri2@ti.com>2009-07-06 14:04:12 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:18:12 -0400
commit7da8a6cb3e5b60e73b196f1c71031423e0791032 (patch)
tree07994133d0edc06b0e3c752f4e47c42eb7595785 /include
parentc1c9d09cd368f75bbd10253b8266898fb9fecc7f (diff)
V4L/DVB (12248): v4l: vpfe capture bridge driver for DM355 and DM6446
This the vpfe capture bridge driver for doing video capture on DM355 and DM6446 evms. The ccdc hw modules register with the driver and are used for configuring the CCD Controller for a specific decoder interface. The driver also registers the sub devices required for a specific evm. More than one sub devices can be registered. This allows driver to switch dynamically to capture video from any sub device that is registered. Currently only one sub device (tvp5146) is supported. But in future this driver is expected to do capture from sensor devices such as Micron's MT9T001, MT9T031 and MT9P031 etc. The driver currently supports MMAP based IO. Reviewed by: Laurent Pinchart <laurent.pinchart@skynet.be> Reviewed by: Alexey Klimov <klimov.linux@gmail.com> Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/davinci/vpfe_capture.h198
-rw-r--r--include/media/davinci/vpfe_types.h51
2 files changed, 249 insertions, 0 deletions
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
new file mode 100644
index 000000000000..71d8982e13ff
--- /dev/null
+++ b/include/media/davinci/vpfe_capture.h
@@ -0,0 +1,198 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
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.
8 *
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.
13 *
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
17 */
18
19#ifndef _VPFE_CAPTURE_H
20#define _VPFE_CAPTURE_H
21
22#ifdef __KERNEL__
23
24/* Header files */
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>
33
34#define VPFE_CAPTURE_NUM_DECODERS 5
35
36/* Macros */
37#define VPFE_MAJOR_RELEASE 0
38#define VPFE_MINOR_RELEASE 0
39#define VPFE_BUILD 1
40#define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
41 (VPFE_MINOR_RELEASE << 8) | \
42 VPFE_BUILD)
43
44#define CAPTURE_DRV_NAME "vpfe-capture"
45
46struct vpfe_pixel_format {
47 struct v4l2_fmtdesc fmtdesc;
48 /* bytes per pixel */
49 int bpp;
50};
51
52struct vpfe_std_info {
53 int active_pixels;
54 int active_lines;
55 /* current frame format */
56 int frame_format;
57};
58
59struct vpfe_route {
60 u32 input;
61 u32 output;
62};
63
64struct vpfe_subdev_info {
65 /* Sub device name */
66 char name[32];
67 /* Sub device group id */
68 int grp_id;
69 /* Number of inputs supported */
70 int num_inputs;
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 */
76 int can_route;
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;
81};
82
83struct vpfe_config {
84 /* Number of sub devices connected to vpfe */
85 int num_subdevs;
86 /* information about each subdev */
87 struct vpfe_subdev_info *sub_devs;
88 /* evm card info */
89 char *card_name;
90 /* ccdc name */
91 char *ccdc;
92 /* vpfe clock */
93 struct clk *vpssclk;
94 struct clk *slaveclk;
95};
96
97struct vpfe_device {
98 /* V4l2 specific parameters */
99 /* Identifies video device for this channel */
100 struct video_device *video_dev;
101 /* sub devices */
102 struct v4l2_subdev **sd;
103 /* vpfe cfg */
104 struct vpfe_config *cfg;
105 /* V4l2 device */
106 struct v4l2_device v4l2_dev;
107 /* parent device */
108 struct device *pdev;
109 /* Used to keep track of state of the priority */
110 struct v4l2_prio_state prio;
111 /* number of open instances of the channel */
112 u32 usrs;
113 /* Indicates id of the field which is being displayed */
114 u32 field_id;
115 /* flag to indicate whether decoder is initialized */
116 u8 initialized;
117 /* current interface type */
118 struct vpfe_hw_if_param vpfe_if_params;
119 /* ptr to currently selected sub device */
120 struct vpfe_subdev_info *current_subdev;
121 /* current input at the sub device */
122 int current_input;
123 /* Keeps track of the information about the standard */
124 struct vpfe_std_info std_info;
125 /* std index into std table */
126 int std_index;
127 /* CCDC IRQs used when CCDC/ISIF output to SDRAM */
128 unsigned int ccdc_irq0;
129 unsigned int ccdc_irq1;
130 /* number of buffers in fbuffers */
131 u32 numbuffers;
132 /* List of buffer pointers for storing frames */
133 u8 *fbuffers[VIDEO_MAX_FRAME];
134 /* Pointer pointing to current v4l2_buffer */
135 struct videobuf_buffer *cur_frm;
136 /* Pointer pointing to next v4l2_buffer */
137 struct videobuf_buffer *next_frm;
138 /*
139 * This field keeps track of type of buffer exchange mechanism
140 * user has selected
141 */
142 enum v4l2_memory memory;
143 /* Used to store pixel format */
144 struct v4l2_format fmt;
145 /*
146 * used when IMP is chained to store the crop window which
147 * is different from the image window
148 */
149 struct v4l2_rect crop;
150 /* Buffer queue used in video-buf */
151 struct videobuf_queue buffer_queue;
152 /* Queue of filled frames */
153 struct list_head dma_queue;
154 /* Used in video-buf */
155 spinlock_t irqlock;
156 /* IRQ lock for DMA queue */
157 spinlock_t dma_queue_lock;
158 /* lock used to access this structure */
159 struct mutex lock;
160 /* number of users performing IO */
161 u32 io_usrs;
162 /* Indicates whether streaming started */
163 u8 started;
164 /*
165 * offset where second field starts from the starting of the
166 * buffer for field seperated YCbCr formats
167 */
168 u32 field_off;
169};
170
171/* File handle structure */
172struct vpfe_fh {
173 struct vpfe_device *vpfe_dev;
174 /* Indicates whether this file handle is doing IO */
175 u8 io_allowed;
176 /* Used to keep track priority of this instance */
177 enum v4l2_priority prio;
178};
179
180struct vpfe_config_params {
181 u8 min_numbuffers;
182 u8 numbuffers;
183 u32 min_bufsize;
184 u32 device_bufsize;
185};
186
187#endif /* End of __KERNEL__ */
188/**
189 * VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params
190 * This can be used to configure modules such as defect pixel correction,
191 * color space conversion, culling etc. This is an experimental ioctl that
192 * will change in future kernels. So use this ioctl with care !
193 * TODO: This is to be split into multiple ioctls and also explore the
194 * possibility of extending the v4l2 api to include this
195 **/
196#define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \
197 void *)
198#endif /* _DAVINCI_VPFE_H */
diff --git a/include/media/davinci/vpfe_types.h b/include/media/davinci/vpfe_types.h
new file mode 100644
index 000000000000..76fb74bad08c
--- /dev/null
+++ b/include/media/davinci/vpfe_types.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
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.
8 *
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.
13 *
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
17 */
18#ifndef _VPFE_TYPES_H
19#define _VPFE_TYPES_H
20
21#ifdef __KERNEL__
22
23enum vpfe_pin_pol {
24 VPFE_PINPOL_POSITIVE,
25 VPFE_PINPOL_NEGATIVE
26};
27
28enum vpfe_hw_if_type {
29 /* BT656 - 8 bit */
30 VPFE_BT656,
31 /* BT1120 - 16 bit */
32 VPFE_BT1120,
33 /* Raw Bayer */
34 VPFE_RAW_BAYER,
35 /* YCbCr - 8 bit with external sync */
36 VPFE_YCBCR_SYNC_8,
37 /* YCbCr - 16 bit with external sync */
38 VPFE_YCBCR_SYNC_16,
39 /* BT656 - 10 bit */
40 VPFE_BT656_10BIT
41};
42
43/* interface description */
44struct vpfe_hw_if_param {
45 enum vpfe_hw_if_type if_type;
46 enum vpfe_pin_pol hdpol;
47 enum vpfe_pin_pol vdpol;
48};
49
50#endif
51#endif