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_HV_PCI6_ORION 1
39 #define HEXIUM_ORION_1SVHS_3BNC 2
40 #define HEXIUM_ORION_4BNC 3
42 #define HEXIUM_INPUTS 9
55 #define HEXIUM_AUDIOS 0
73 static u8 hexium_saa7110[53]={
74 0x4C,0x3C,0x0D,0xEF,0xBD,0xF0,0x00,0x00,
75 0xF8,0xF8,0x60,0x60,0x40,0x86,0x18,0x90,
76 0x00,0x2C,0x40,0x46,0x42,0x1A,0xFF,0xDA,
77 0xF0,0x8B,0x00,0x00,0x00,0x00,0x00,0x00,
78 0xD9,0x17,0x40,0x41,0x80,0x41,0x80,0x4F,
79 0xFE,0x01,0x0F,0x0F,0x03,0x01,0x81,0x03,
80 0x44,0x75,0x01,0x8C,0x03
85 } hexium_input_select[] = {
191 .v_offset = 16, .v_field = 288,
192 .h_offset = 1, .h_pixels = 680,
193 .v_max_out = 576, .h_max_out = 768,
196 .v_offset = 16, .v_field = 240,
197 .h_offset = 1, .h_pixels = 640,
198 .v_max_out = 480, .h_max_out = 640,
201 .v_offset = 16, .v_field = 288,
202 .h_offset = 1, .h_pixels = 720,
203 .v_max_out = 576, .h_max_out = 768,
222 hexium = kzalloc(
sizeof(
struct hexium),
GFP_KERNEL);
223 if (
NULL == hexium) {
224 pr_err(
"hexium_probe: not enough kernel memory\n");
236 .name =
"hexium orion",
240 DEB_S(
"cannot register i2c-device. skipping.\n");
253 if (0x17c8 == dev->
pci->subsystem_vendor && 0x0101 == dev->
pci->subsystem_device) {
254 pr_info(
"device is a Hexium Orion w/ 1 SVHS + 3 BNC inputs\n");
261 if (0x17c8 == dev->
pci->subsystem_vendor && 0x2101 == dev->
pci->subsystem_device) {
262 pr_info(
"device is a Hexium Orion w/ 4 BNC inputs\n");
272 pr_info(
"device is a Hexium HV-PCI6/Orion (old)\n");
288 static int hexium_init_done(
struct saa7146_dev *dev)
290 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
294 DEB_D(
"hexium_init_done called\n");
297 for (
i = 0;
i <
sizeof(hexium_saa7110);
i++) {
298 data.byte = hexium_saa7110[
i];
300 pr_err(
"failed for address 0x%02x\n",
i);
307 static int hexium_set_input(
struct hexium *hexium,
int input)
314 for (i = 0; i < 8; i++) {
315 int adr = hexium_input_select[
input].data[
i].adr;
316 data.byte = hexium_input_select[
input].data[
i].byte;
320 pr_debug(
"%d: 0x%02x => 0x%02x\n", input, adr,
data.byte);
335 DEB_D(
"v4l2_ioctl: VIDIOC_ENUMINPUT %d\n", i->
index);
339 static int vidioc_g_input(
struct file *file,
void *fh,
unsigned int *input)
342 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
346 DEB_D(
"VIDIOC_G_INPUT: %d\n", *input);
350 static int vidioc_s_input(
struct file *file,
void *fh,
unsigned int input)
353 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
359 hexium_set_input(hexium, input);
369 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
374 vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
375 vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
376 vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
378 pr_err(
"cannot register capture v4l2 device. skipping.\n");
382 pr_err(
"found 'hexium orion' frame grabber-%d\n", hexium_num);
387 hexium_init_done(dev);
394 struct hexium *hexium = (
struct hexium *) dev->
ext_priv;
416 .ext_priv =
"Hexium HV-PCI6 / Orion",
421 .ext_priv =
"Hexium HV-PCI6 / Orion (1 SVHS/3 BNC)",
426 .ext_priv =
"Hexium HV-PCI6 / Orion (4 BNC)",
436 .driver_data = (
unsigned long) &hexium_hv_pci6,
443 .driver_data = (
unsigned long) &hexium_orion_1svhs_3bnc,
450 .driver_data = (
unsigned long) &hexium_orion_4bnc,
462 .stds = &hexium_standards[0],
468 .name =
"hexium HV-PCI6 Orion",
471 .pci_tbl = &pci_tbl[0],
474 .probe = hexium_probe,
475 .attach = hexium_attach,
476 .detach = hexium_detach,
482 static int __init hexium_init_module(
void)
485 DEB_S(
"failed to register extension\n");
492 static void __exit hexium_cleanup_module(
void)