This source file includes following definitions.
- to_hdpvr_dev
1
2
3
4
5
6
7
8 #include <linux/usb.h>
9 #include <linux/i2c.h>
10 #include <linux/mutex.h>
11 #include <linux/workqueue.h>
12 #include <linux/videodev2.h>
13
14 #include <media/v4l2-device.h>
15 #include <media/v4l2-ctrls.h>
16 #include <media/i2c/ir-kbd-i2c.h>
17
18 #define HDPVR_MAX 8
19 #define HDPVR_I2C_MAX_SIZE 128
20
21
22 #define HD_PVR_VENDOR_ID 0x2040
23 #define HD_PVR_PRODUCT_ID 0x4900
24 #define HD_PVR_PRODUCT_ID1 0x4901
25 #define HD_PVR_PRODUCT_ID2 0x4902
26 #define HD_PVR_PRODUCT_ID4 0x4903
27 #define HD_PVR_PRODUCT_ID3 0x4982
28
29 #define UNSET (-1U)
30
31 #define NUM_BUFFERS 64
32
33 #define HDPVR_FIRMWARE_VERSION 0x08
34 #define HDPVR_FIRMWARE_VERSION_AC3 0x0d
35 #define HDPVR_FIRMWARE_VERSION_0X12 0x12
36 #define HDPVR_FIRMWARE_VERSION_0X15 0x15
37 #define HDPVR_FIRMWARE_VERSION_0X1E 0x1e
38
39
40
41 extern int hdpvr_debug;
42
43 #define MSG_INFO 1
44 #define MSG_BUFFER 2
45
46 struct hdpvr_options {
47 u8 video_std;
48 u8 video_input;
49 u8 audio_input;
50 u8 bitrate;
51 u8 peak_bitrate;
52 u8 bitrate_mode;
53 u8 gop_mode;
54 enum v4l2_mpeg_audio_encoding audio_codec;
55 u8 brightness;
56 u8 contrast;
57 u8 hue;
58 u8 saturation;
59 u8 sharpness;
60 };
61
62
63 struct hdpvr_device {
64
65 struct video_device video_dev;
66
67 struct v4l2_ctrl_handler hdl;
68
69 struct usb_device *udev;
70
71 struct v4l2_device v4l2_dev;
72 struct {
73 struct v4l2_ctrl *video_mode;
74 struct v4l2_ctrl *video_bitrate;
75 struct v4l2_ctrl *video_bitrate_peak;
76 };
77
78 uint width, height;
79
80
81 size_t bulk_in_size;
82
83 __u8 bulk_in_endpointAddr;
84
85
86 __u8 status;
87
88
89 struct hdpvr_options options;
90 v4l2_std_id cur_std;
91 struct v4l2_dv_timings cur_dv_timings;
92
93 uint flags;
94
95
96 struct mutex io_mutex;
97
98 struct list_head free_buff_list;
99
100 struct list_head rec_buff_list;
101
102 wait_queue_head_t wait_buffer;
103
104 wait_queue_head_t wait_data;
105
106 struct work_struct worker;
107
108 struct v4l2_fh *owner;
109
110
111 struct i2c_adapter i2c_adapter;
112
113 struct mutex i2c_mutex;
114
115 char i2c_buf[HDPVR_I2C_MAX_SIZE];
116
117
118 struct IR_i2c_init_data ir_i2c_init_data;
119
120
121 struct mutex usbc_mutex;
122 u8 *usbc_buf;
123 u8 fw_ver;
124 };
125
126 static inline struct hdpvr_device *to_hdpvr_dev(struct v4l2_device *v4l2_dev)
127 {
128 return container_of(v4l2_dev, struct hdpvr_device, v4l2_dev);
129 }
130
131
132
133 struct hdpvr_buffer {
134 struct list_head buff_list;
135
136 struct urb *urb;
137
138 struct hdpvr_device *dev;
139
140 uint pos;
141
142 __u8 status;
143 };
144
145
146
147 struct hdpvr_video_info {
148 u16 width;
149 u16 height;
150 u8 fps;
151 bool valid;
152 };
153
154 enum {
155 STATUS_UNINITIALIZED = 0,
156 STATUS_IDLE,
157 STATUS_STARTING,
158 STATUS_SHUTTING_DOWN,
159 STATUS_STREAMING,
160 STATUS_ERROR,
161 STATUS_DISCONNECTED,
162 };
163
164 enum {
165 HDPVR_FLAG_AC3_CAP = 1,
166 };
167
168 enum {
169 BUFSTAT_UNINITIALIZED = 0,
170 BUFSTAT_AVAILABLE,
171 BUFSTAT_INPROGRESS,
172 BUFSTAT_READY,
173 };
174
175 #define CTRL_START_STREAMING_VALUE 0x0700
176 #define CTRL_STOP_STREAMING_VALUE 0x0800
177 #define CTRL_BITRATE_VALUE 0x1000
178 #define CTRL_BITRATE_MODE_VALUE 0x1200
179 #define CTRL_GOP_MODE_VALUE 0x1300
180 #define CTRL_VIDEO_INPUT_VALUE 0x1500
181 #define CTRL_VIDEO_STD_TYPE 0x1700
182 #define CTRL_AUDIO_INPUT_VALUE 0x2500
183 #define CTRL_BRIGHTNESS 0x2900
184 #define CTRL_CONTRAST 0x2a00
185 #define CTRL_HUE 0x2b00
186 #define CTRL_SATURATION 0x2c00
187 #define CTRL_SHARPNESS 0x2d00
188 #define CTRL_LOW_PASS_FILTER_VALUE 0x3100
189
190 #define CTRL_DEFAULT_INDEX 0x0003
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255 enum hdpvr_video_std {
256 HDPVR_60HZ = 0,
257 HDPVR_50HZ,
258 };
259
260 enum hdpvr_video_input {
261 HDPVR_COMPONENT = 0,
262 HDPVR_SVIDEO,
263 HDPVR_COMPOSITE,
264 HDPVR_VIDEO_INPUTS
265 };
266
267 enum hdpvr_audio_inputs {
268 HDPVR_RCA_BACK = 0,
269 HDPVR_RCA_FRONT,
270 HDPVR_SPDIF,
271 HDPVR_AUDIO_INPUTS
272 };
273
274 enum hdpvr_bitrate_mode {
275 HDPVR_CONSTANT = 1,
276 HDPVR_VARIABLE_PEAK,
277 HDPVR_VARIABLE_AVERAGE,
278 };
279
280 enum hdpvr_gop_mode {
281 HDPVR_ADVANCED_IDR_GOP = 0,
282 HDPVR_SIMPLE_IDR_GOP,
283 HDPVR_ADVANCED_NOIDR_GOP,
284 HDPVR_SIMPLE_NOIDR_GOP,
285 };
286
287 void hdpvr_delete(struct hdpvr_device *dev);
288
289
290
291 int hdpvr_set_options(struct hdpvr_device *dev);
292
293 int hdpvr_set_bitrate(struct hdpvr_device *dev);
294
295 int hdpvr_set_audio(struct hdpvr_device *dev, u8 input,
296 enum v4l2_mpeg_audio_encoding codec);
297
298 int hdpvr_config_call(struct hdpvr_device *dev, uint value,
299 unsigned char valbuf);
300
301 int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vid_info);
302
303
304
305 int get_input_lines_info(struct hdpvr_device *dev);
306
307
308
309
310 int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,
311 int devnumber);
312
313 int hdpvr_cancel_queue(struct hdpvr_device *dev);
314
315
316
317 int hdpvr_register_i2c_adapter(struct hdpvr_device *dev);
318
319 struct i2c_client *hdpvr_register_ir_i2c(struct hdpvr_device *dev);
320
321
322
323 int hdpvr_free_buffers(struct hdpvr_device *dev);
324 int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count);