diff options
Diffstat (limited to 'drivers/media/platform/davinci/vpif_capture.h')
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.h | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h new file mode 100644 index 000000000000..d24efc17e4c8 --- /dev/null +++ b/drivers/media/platform/davinci/vpif_capture.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * Copyright (C) 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 VPIF_CAPTURE_H | ||
20 | #define VPIF_CAPTURE_H | ||
21 | |||
22 | #ifdef __KERNEL__ | ||
23 | |||
24 | /* Header files */ | ||
25 | #include <linux/videodev2.h> | ||
26 | #include <media/v4l2-common.h> | ||
27 | #include <media/v4l2-device.h> | ||
28 | #include <media/videobuf2-dma-contig.h> | ||
29 | #include <media/davinci/vpif_types.h> | ||
30 | |||
31 | #include "vpif.h" | ||
32 | |||
33 | /* Macros */ | ||
34 | #define VPIF_CAPTURE_VERSION "0.0.2" | ||
35 | |||
36 | #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \ | ||
37 | (V4L2_FIELD_NONE == field)) || \ | ||
38 | (((V4L2_FIELD_INTERLACED == field) || \ | ||
39 | (V4L2_FIELD_SEQ_TB == field)) || \ | ||
40 | (V4L2_FIELD_SEQ_BT == field))) | ||
41 | |||
42 | #define VPIF_CAPTURE_MAX_DEVICES 2 | ||
43 | #define VPIF_VIDEO_INDEX 0 | ||
44 | #define VPIF_NUMBER_OF_OBJECTS 1 | ||
45 | |||
46 | /* Enumerated data type to give id to each device per channel */ | ||
47 | enum vpif_channel_id { | ||
48 | VPIF_CHANNEL0_VIDEO = 0, | ||
49 | VPIF_CHANNEL1_VIDEO, | ||
50 | }; | ||
51 | |||
52 | struct video_obj { | ||
53 | enum v4l2_field buf_field; | ||
54 | /* Currently selected or default standard */ | ||
55 | v4l2_std_id stdid; | ||
56 | struct v4l2_dv_timings dv_timings; | ||
57 | /* This is to track the last input that is passed to application */ | ||
58 | u32 input_idx; | ||
59 | }; | ||
60 | |||
61 | struct vpif_cap_buffer { | ||
62 | struct vb2_buffer vb; | ||
63 | struct list_head list; | ||
64 | }; | ||
65 | |||
66 | struct common_obj { | ||
67 | /* Pointer pointing to current v4l2_buffer */ | ||
68 | struct vpif_cap_buffer *cur_frm; | ||
69 | /* Pointer pointing to current v4l2_buffer */ | ||
70 | struct vpif_cap_buffer *next_frm; | ||
71 | /* | ||
72 | * This field keeps track of type of buffer exchange mechanism | ||
73 | * user has selected | ||
74 | */ | ||
75 | enum v4l2_memory memory; | ||
76 | /* Used to store pixel format */ | ||
77 | struct v4l2_format fmt; | ||
78 | /* Buffer queue used in video-buf */ | ||
79 | struct vb2_queue buffer_queue; | ||
80 | /* allocator-specific contexts for each plane */ | ||
81 | struct vb2_alloc_ctx *alloc_ctx; | ||
82 | /* Queue of filled frames */ | ||
83 | struct list_head dma_queue; | ||
84 | /* Used in video-buf */ | ||
85 | spinlock_t irqlock; | ||
86 | /* lock used to access this structure */ | ||
87 | struct mutex lock; | ||
88 | /* number of users performing IO */ | ||
89 | u32 io_usrs; | ||
90 | /* Indicates whether streaming started */ | ||
91 | u8 started; | ||
92 | /* Function pointer to set the addresses */ | ||
93 | void (*set_addr) (unsigned long, unsigned long, unsigned long, | ||
94 | unsigned long); | ||
95 | /* offset where Y top starts from the starting of the buffer */ | ||
96 | u32 ytop_off; | ||
97 | /* offset where Y bottom starts from the starting of the buffer */ | ||
98 | u32 ybtm_off; | ||
99 | /* offset where C top starts from the starting of the buffer */ | ||
100 | u32 ctop_off; | ||
101 | /* offset where C bottom starts from the starting of the buffer */ | ||
102 | u32 cbtm_off; | ||
103 | /* Indicates width of the image data */ | ||
104 | u32 width; | ||
105 | /* Indicates height of the image data */ | ||
106 | u32 height; | ||
107 | }; | ||
108 | |||
109 | struct channel_obj { | ||
110 | /* Identifies video device for this channel */ | ||
111 | struct video_device *video_dev; | ||
112 | /* Used to keep track of state of the priority */ | ||
113 | struct v4l2_prio_state prio; | ||
114 | /* number of open instances of the channel */ | ||
115 | int usrs; | ||
116 | /* Indicates id of the field which is being displayed */ | ||
117 | u32 field_id; | ||
118 | /* flag to indicate whether decoder is initialized */ | ||
119 | u8 initialized; | ||
120 | /* Identifies channel */ | ||
121 | enum vpif_channel_id channel_id; | ||
122 | /* index into sd table */ | ||
123 | int curr_sd_index; | ||
124 | /* ptr to current sub device information */ | ||
125 | struct vpif_subdev_info *curr_subdev_info; | ||
126 | /* vpif configuration params */ | ||
127 | struct vpif_params vpifparams; | ||
128 | /* common object array */ | ||
129 | struct common_obj common[VPIF_NUMBER_OF_OBJECTS]; | ||
130 | /* video object */ | ||
131 | struct video_obj video; | ||
132 | }; | ||
133 | |||
134 | /* File handle structure */ | ||
135 | struct vpif_fh { | ||
136 | /* pointer to channel object for opened device */ | ||
137 | struct channel_obj *channel; | ||
138 | /* Indicates whether this file handle is doing IO */ | ||
139 | u8 io_allowed[VPIF_NUMBER_OF_OBJECTS]; | ||
140 | /* Used to keep track priority of this instance */ | ||
141 | enum v4l2_priority prio; | ||
142 | /* Used to indicate channel is initialize or not */ | ||
143 | u8 initialized; | ||
144 | }; | ||
145 | |||
146 | struct vpif_device { | ||
147 | struct v4l2_device v4l2_dev; | ||
148 | struct channel_obj *dev[VPIF_CAPTURE_NUM_CHANNELS]; | ||
149 | struct v4l2_subdev **sd; | ||
150 | }; | ||
151 | |||
152 | struct vpif_config_params { | ||
153 | u8 min_numbuffers; | ||
154 | u8 numbuffers[VPIF_CAPTURE_NUM_CHANNELS]; | ||
155 | s8 device_type; | ||
156 | u32 min_bufsize[VPIF_CAPTURE_NUM_CHANNELS]; | ||
157 | u32 channel_bufsize[VPIF_CAPTURE_NUM_CHANNELS]; | ||
158 | u8 default_device[VPIF_CAPTURE_NUM_CHANNELS]; | ||
159 | u32 video_limit[VPIF_CAPTURE_NUM_CHANNELS]; | ||
160 | u8 max_device_type; | ||
161 | }; | ||
162 | /* Struct which keeps track of the line numbers for the sliced vbi service */ | ||
163 | struct vpif_service_line { | ||
164 | u16 service_id; | ||
165 | u16 service_line[2]; | ||
166 | }; | ||
167 | #endif /* End of __KERNEL__ */ | ||
168 | #endif /* VPIF_CAPTURE_H */ | ||