24 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26 #define DEBUG_VARIABLE debug
29 #include <linux/module.h>
36 static int hexium_num;
38 #define HEXIUM_GEMINI 4
39 #define HEXIUM_GEMINI_DUAL 5
41 #define HEXIUM_INPUTS 9
54 #define HEXIUM_AUDIOS 0
62 #define HEXIUM_GEMINI_V_1_0 1
63 #define HEXIUM_GEMINI_DUAL_V_1_0 2
77 static u8 hexium_ks0127b[0x100]={
78 0x00,0x52,0x30,0x40,0x01,0x0C,0x2A,0x10,
79 0x00,0x00,0x00,0x60,0x00,0x00,0x0F,0x06,
80 0x00,0x00,0xE4,0xC0,0x00,0x00,0x00,0x00,
81 0x14,0x9B,0xFE,0xFF,0xFC,0xFF,0x03,0x22,
82 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
83 0x00,0x00,0x00,0x00,0x00,0x2C,0x9B,0x00,
84 0x00,0x00,0x10,0x80,0x80,0x10,0x80,0x80,
85 0x01,0x04,0x00,0x00,0x00,0x29,0xC0,0x00,
86 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
87 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
88 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
89 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
90 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
91 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
92 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
93 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
94 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
95 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
96 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
97 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
98 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
100 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
101 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
102 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
103 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
104 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
105 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
106 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
107 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
108 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
109 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
113 { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF }
117 { 0x01, 0x53 }, { 0x12, 0x04 }, { 0x2D, 0x23 }, { 0x2E, 0x81 }, { -1 , 0xFF }
121 { 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF }
124 static struct hexium_data hexium_input_select[] = {
141 .v_offset = 28, .v_field = 288,
142 .h_offset = 1, .h_pixels = 680,
143 .v_max_out = 576, .h_max_out = 768,
146 .v_offset = 28, .v_field = 240,
147 .h_offset = 1, .h_pixels = 640,
148 .v_max_out = 480, .h_max_out = 640,
151 .v_offset = 28, .v_field = 288,
152 .h_offset = 1, .h_pixels = 720,
153 .v_max_out = 576, .h_max_out = 768,
167 DEB_D(
"hexium_init_done called\n");
170 for (
i = 0;
i <
sizeof(hexium_ks0127b);
i++) {
171 data.byte = hexium_ks0127b[
i];
173 pr_err(
"hexium_init_done() failed for address 0x%02x\n",
181 static int hexium_set_input(
struct hexium *hexium,
int input)
195 static int hexium_set_standard(
struct hexium *hexium,
struct hexium_data *vdec)
202 while (vdec[i].adr != -1) {
205 pr_err(
"hexium_init_done: hexium_set_standard() failed for address 0x%02x\n",
223 DEB_D(
"v4l2_ioctl: VIDIOC_ENUMINPUT %d\n", i->
index);
227 static int vidioc_g_input(
struct file *file,
void *fh,
unsigned int *input)
230 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
234 DEB_D(
"VIDIOC_G_INPUT: %d\n", *input);
238 static int vidioc_s_input(
struct file *file,
void *fh,
unsigned int input)
241 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
243 DEB_EE(
"VIDIOC_S_INPUT %d\n", input);
249 hexium_set_input(hexium, input);
258 struct hexium *hexium;
263 hexium = kzalloc(
sizeof(
struct hexium),
GFP_KERNEL);
264 if (
NULL == hexium) {
265 pr_err(
"not enough kernel memory in hexium_attach()\n");
274 .name =
"hexium gemini",
278 DEB_S(
"cannot register i2c-device. skipping.\n");
292 hexium_init_done(dev);
294 hexium_set_standard(hexium, hexium_pal);
297 hexium_set_input(hexium, 0);
302 vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
303 vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
304 vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
307 pr_err(
"cannot register capture v4l2 device. skipping.\n");
311 pr_info(
"found 'hexium gemini' frame grabber-%d\n", hexium_num);
319 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
335 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
338 hexium_set_standard(hexium, hexium_pal);
342 hexium_set_standard(hexium, hexium_ntsc);
346 hexium_set_standard(hexium, hexium_secam);
357 .ext_priv =
"Hexium Gemini (4 BNC)",
358 .ext = &hexium_extension,
362 .ext_priv =
"Hexium Gemini Dual (4 BNC)",
363 .ext = &hexium_extension,
372 .driver_data = (
unsigned long) &hexium_gemini_4bnc,
379 .driver_data = (
unsigned long) &hexium_gemini_dual_4bnc,
391 .stds = &hexium_standards[0],
397 .name =
"hexium gemini",
400 .pci_tbl = &pci_tbl[0],
403 .attach = hexium_attach,
404 .detach = hexium_detach,
410 static int __init hexium_init_module(
void)
413 DEB_S(
"failed to register extension\n");
420 static void __exit hexium_cleanup_module(
void)