diff options
Diffstat (limited to 'drivers/media/video/hexium_gemini.c')
-rw-r--r-- | drivers/media/video/hexium_gemini.c | 129 |
1 files changed, 13 insertions, 116 deletions
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c index a62322d5c0d8..366434f5647e 100644 --- a/drivers/media/video/hexium_gemini.c +++ b/drivers/media/video/hexium_gemini.c | |||
@@ -40,15 +40,15 @@ static int hexium_num; | |||
40 | 40 | ||
41 | #define HEXIUM_INPUTS 9 | 41 | #define HEXIUM_INPUTS 9 |
42 | static struct v4l2_input hexium_inputs[HEXIUM_INPUTS] = { | 42 | static struct v4l2_input hexium_inputs[HEXIUM_INPUTS] = { |
43 | { 0, "CVBS 1", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 43 | { 0, "CVBS 1", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
44 | { 1, "CVBS 2", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 44 | { 1, "CVBS 2", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
45 | { 2, "CVBS 3", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 45 | { 2, "CVBS 3", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
46 | { 3, "CVBS 4", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 46 | { 3, "CVBS 4", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
47 | { 4, "CVBS 5", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 47 | { 4, "CVBS 5", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
48 | { 5, "CVBS 6", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 48 | { 5, "CVBS 6", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
49 | { 6, "Y/C 1", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 49 | { 6, "Y/C 1", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
50 | { 7, "Y/C 2", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 50 | { 7, "Y/C 2", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
51 | { 8, "Y/C 3", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD }, | 51 | { 8, "Y/C 3", V4L2_INPUT_TYPE_CAMERA, 0, 0, V4L2_STD_ALL, 0, V4L2_IN_CAP_STD }, |
52 | }; | 52 | }; |
53 | 53 | ||
54 | #define HEXIUM_AUDIOS 0 | 54 | #define HEXIUM_AUDIOS 0 |
@@ -59,11 +59,6 @@ struct hexium_data | |||
59 | u8 byte; | 59 | u8 byte; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | #define HEXIUM_CONTROLS 1 | ||
63 | static struct v4l2_queryctrl hexium_controls[] = { | ||
64 | { V4L2_CID_PRIVATE_BASE, V4L2_CTRL_TYPE_BOOLEAN, "B/W", 0, 1, 1, 0, 0 }, | ||
65 | }; | ||
66 | |||
67 | #define HEXIUM_GEMINI_V_1_0 1 | 62 | #define HEXIUM_GEMINI_V_1_0 1 |
68 | #define HEXIUM_GEMINI_DUAL_V_1_0 2 | 63 | #define HEXIUM_GEMINI_DUAL_V_1_0 2 |
69 | 64 | ||
@@ -76,7 +71,6 @@ struct hexium | |||
76 | 71 | ||
77 | int cur_input; /* current input */ | 72 | int cur_input; /* current input */ |
78 | v4l2_std_id cur_std; /* current standard */ | 73 | v4l2_std_id cur_std; /* current standard */ |
79 | int cur_bw; /* current black/white status */ | ||
80 | }; | 74 | }; |
81 | 75 | ||
82 | /* Samsung KS0127B decoder default registers */ | 76 | /* Samsung KS0127B decoder default registers */ |
@@ -119,18 +113,10 @@ static struct hexium_data hexium_pal[] = { | |||
119 | { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF } | 113 | { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF } |
120 | }; | 114 | }; |
121 | 115 | ||
122 | static struct hexium_data hexium_pal_bw[] = { | ||
123 | { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF } | ||
124 | }; | ||
125 | |||
126 | static struct hexium_data hexium_ntsc[] = { | 116 | static struct hexium_data hexium_ntsc[] = { |
127 | { 0x01, 0x53 }, { 0x12, 0x04 }, { 0x2D, 0x23 }, { 0x2E, 0x81 }, { -1 , 0xFF } | 117 | { 0x01, 0x53 }, { 0x12, 0x04 }, { 0x2D, 0x23 }, { 0x2E, 0x81 }, { -1 , 0xFF } |
128 | }; | 118 | }; |
129 | 119 | ||
130 | static struct hexium_data hexium_ntsc_bw[] = { | ||
131 | { 0x01, 0x53 }, { 0x12, 0x04 }, { 0x2D, 0x23 }, { 0x2E, 0x81 }, { -1 , 0xFF } | ||
132 | }; | ||
133 | |||
134 | static struct hexium_data hexium_secam[] = { | 120 | static struct hexium_data hexium_secam[] = { |
135 | { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF } | 121 | { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF } |
136 | }; | 122 | }; |
@@ -264,93 +250,6 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) | |||
264 | return 0; | 250 | return 0; |
265 | } | 251 | } |
266 | 252 | ||
267 | /* the saa7146 provides some controls (brightness, contrast, saturation) | ||
268 | which gets registered *after* this function. because of this we have | ||
269 | to return with a value != 0 even if the function succeeded.. */ | ||
270 | static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qc) | ||
271 | { | ||
272 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | ||
273 | int i; | ||
274 | |||
275 | for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) { | ||
276 | if (hexium_controls[i].id == qc->id) { | ||
277 | *qc = hexium_controls[i]; | ||
278 | DEB_D("VIDIOC_QUERYCTRL %d\n", qc->id); | ||
279 | return 0; | ||
280 | } | ||
281 | } | ||
282 | return dev->ext_vv_data->core_ops->vidioc_queryctrl(file, fh, qc); | ||
283 | } | ||
284 | |||
285 | static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *vc) | ||
286 | { | ||
287 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | ||
288 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | ||
289 | int i; | ||
290 | |||
291 | for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) { | ||
292 | if (hexium_controls[i].id == vc->id) | ||
293 | break; | ||
294 | } | ||
295 | |||
296 | if (i < 0) | ||
297 | return dev->ext_vv_data->core_ops->vidioc_g_ctrl(file, fh, vc); | ||
298 | |||
299 | if (vc->id == V4L2_CID_PRIVATE_BASE) { | ||
300 | vc->value = hexium->cur_bw; | ||
301 | DEB_D("VIDIOC_G_CTRL BW:%d\n", vc->value); | ||
302 | return 0; | ||
303 | } | ||
304 | return -EINVAL; | ||
305 | } | ||
306 | |||
307 | static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc) | ||
308 | { | ||
309 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | ||
310 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | ||
311 | int i = 0; | ||
312 | |||
313 | for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) { | ||
314 | if (hexium_controls[i].id == vc->id) | ||
315 | break; | ||
316 | } | ||
317 | |||
318 | if (i < 0) | ||
319 | return dev->ext_vv_data->core_ops->vidioc_s_ctrl(file, fh, vc); | ||
320 | |||
321 | if (vc->id == V4L2_CID_PRIVATE_BASE) | ||
322 | hexium->cur_bw = vc->value; | ||
323 | |||
324 | DEB_D("VIDIOC_S_CTRL BW:%d\n", hexium->cur_bw); | ||
325 | |||
326 | if (0 == hexium->cur_bw && V4L2_STD_PAL == hexium->cur_std) { | ||
327 | hexium_set_standard(hexium, hexium_pal); | ||
328 | return 0; | ||
329 | } | ||
330 | if (0 == hexium->cur_bw && V4L2_STD_NTSC == hexium->cur_std) { | ||
331 | hexium_set_standard(hexium, hexium_ntsc); | ||
332 | return 0; | ||
333 | } | ||
334 | if (0 == hexium->cur_bw && V4L2_STD_SECAM == hexium->cur_std) { | ||
335 | hexium_set_standard(hexium, hexium_secam); | ||
336 | return 0; | ||
337 | } | ||
338 | if (1 == hexium->cur_bw && V4L2_STD_PAL == hexium->cur_std) { | ||
339 | hexium_set_standard(hexium, hexium_pal_bw); | ||
340 | return 0; | ||
341 | } | ||
342 | if (1 == hexium->cur_bw && V4L2_STD_NTSC == hexium->cur_std) { | ||
343 | hexium_set_standard(hexium, hexium_ntsc_bw); | ||
344 | return 0; | ||
345 | } | ||
346 | if (1 == hexium->cur_bw && V4L2_STD_SECAM == hexium->cur_std) | ||
347 | /* fixme: is there no bw secam mode? */ | ||
348 | return -EINVAL; | ||
349 | |||
350 | return -EINVAL; | ||
351 | } | ||
352 | |||
353 | |||
354 | static struct saa7146_ext_vv vv_data; | 253 | static struct saa7146_ext_vv vv_data; |
355 | 254 | ||
356 | /* this function only gets called when the probing was successful */ | 255 | /* this function only gets called when the probing was successful */ |
@@ -399,12 +298,10 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | |||
399 | hexium->cur_input = 0; | 298 | hexium->cur_input = 0; |
400 | 299 | ||
401 | saa7146_vv_init(dev, &vv_data); | 300 | saa7146_vv_init(dev, &vv_data); |
402 | vv_data.ops.vidioc_queryctrl = vidioc_queryctrl; | 301 | |
403 | vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl; | 302 | vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
404 | vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl; | 303 | vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
405 | vv_data.ops.vidioc_enum_input = vidioc_enum_input; | 304 | vv_data.vid_ops.vidioc_s_input = vidioc_s_input; |
406 | vv_data.ops.vidioc_g_input = vidioc_g_input; | ||
407 | vv_data.ops.vidioc_s_input = vidioc_s_input; | ||
408 | ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); | 305 | ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); |
409 | if (ret < 0) { | 306 | if (ret < 0) { |
410 | pr_err("cannot register capture v4l2 device. skipping.\n"); | 307 | pr_err("cannot register capture v4l2 device. skipping.\n"); |