Hello, I have attached a patch which adds support for the IR-control of the SAA7134 based Terratec Cinergy 400 tv-card (and probably 600, too). It is relative to the saa7134-20030910 snapshot. The first two hunks are just copied-and-pasted from the Flyvideo part. About the third one (setting SAA7134_IRQ2), I am wondering how it works on the Flyvideo without this patch. In saa7134_core.c there will be done | static int __devinit saa7134_initdev(...) | { | saa7134_hwinit1(); | saa_writel(SAA7134_IRQ2, /* lots of bits */); | /* unrelated stuff */ | | saa_writel(SAA7134_IRQ2, 0); which means that the actions of SAA7134_IRQ2 in hwinit1() will be nullified. But since I do not have the datasheet, I might be wrong and the "unrelated stuff" is related somehow. I am setting GPIO18A and GPIO18 bits only (one causes signaling of press-key, the other one of release-key events); but it works with '~0 & ~..INTE_PE' also (setting PE causes interrupt-looping). The position where I set IRQ2 might be wrong too... The cinergy_codes array is my personal and working setup; when there are better/standardized values, please tell me. I have not followed the discussion about the input-event implementation of the v4l drivers completely, and the 'input_report_key()' hunk is just a quick hack to use the control here. The '(gpio&0x40000)==0' part should be parameterized also to support different hardware. Enrico
--- saa7134-0.2.9/saa7134-cards.c~cinergy-remote 2003-08-26 13:42:52.000000000 +0200 +++ saa7134-0.2.9/saa7134-cards.c 2003-09-19 21:20:02.000000000 +0200 @@ -722,6 +722,13 @@ static void board_flyvideo(struct saa713 #endif } +static void board_cinergy(struct saa7134_dev *dev) +{ +#if 1 + printk(KERN_INFO "board_cinergy()\n"); +#endif +} + /* ----------------------------------------------------------- */ int saa7134_board_init(struct saa7134_dev *dev) @@ -737,6 +744,10 @@ int saa7134_board_init(struct saa7134_de board_flyvideo(dev); dev->has_remote = 1; break; + case SAA7134_BOARD_CINERGY400: + board_cinergy(dev); + dev->has_remote = 1; + break; } return 0; } --- saa7134-0.2.9/saa7134-core.c~cinergy-remote 2003-09-10 11:49:15.000000000 +0200 +++ saa7134-0.2.9/saa7134-core.c 2003-09-19 21:20:03.000000000 +0200 @@ -985,6 +985,11 @@ static int __devinit saa7134_initdev(str break; } + if (dev->has_remote) + saa_writel(SAA7134_IRQ2, + SAA7134_IRQ2_INTE_GPIO18A | + SAA7134_IRQ2_INTE_GPIO18 ); + /* everything worked */ list_add_tail(&dev->devlist,&saa7134_devlist); pci_set_drvdata(pci_dev,dev); --- saa7134-0.2.9/saa7134-input.c~cinergy-remote 2003-09-10 11:34:58.000000000 +0200 +++ saa7134-0.2.9/saa7134-input.c 2003-09-19 21:20:03.000000000 +0200 @@ -35,6 +35,45 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_ [ 42 ] = KEY_COFFEE, }; +static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { + [ 0 ] = KEY_KP0, + [ 1 ] = KEY_KP1, + [ 2 ] = KEY_KP2, + [ 3 ] = KEY_KP3, + [ 4 ] = KEY_KP4, + [ 5 ] = KEY_KP5, + [ 6 ] = KEY_KP6, + [ 7 ] = KEY_KP7, + [ 8 ] = KEY_KP8, + [ 9 ] = KEY_KP9, + [ 0x0a ] = KEY_POWER, + [ 0x0b ] = KEY_PROG1, // app + [ 0x0c ] = KEY_F21, // zoom/fullscreen + [ 0x0d ] = KEY_KPPLUS, // channel+ + [ 0x0e ] = KEY_KPMINUS, // channel- + [ 0x0f ] = KEY_VOLUMEUP, + [ 0x10 ] = KEY_VOLUMEDOWN, + [ 0x11 ] = KEY_F22, // AV + [ 0x12 ] = KEY_NUMLOCK, // -/-- + [ 0x13 ] = KEY_SETUP, // audio + [ 0x14 ] = KEY_MUTE, + [ 0x15 ] = KEY_UP, + [ 0x16 ] = KEY_DOWN, + [ 0x17 ] = KEY_LEFT, + [ 0x18 ] = KEY_RIGHT, + [ 0x19 ] = BTN_LEFT, + [ 0x1a ] = BTN_RIGHT, + [ 0x1b ] = KEY_WWW, // text + [ 0x1c ] = KEY_REWIND, + [ 0x1d ] = KEY_FORWARD, + [ 0x1e ] = KEY_RECORD, + [ 0x1f ] = KEY_PLAYCD, + [ 0x20 ] = KEY_PREVIOUSSONG, + [ 0x21 ] = KEY_NEXTSONG, + [ 0x22 ] = KEY_PAUSECD, + [ 0x23 ] = KEY_STOP +}; + /* ---------------------------------------------------------------------- */ static int build_key(struct saa7134_dev *dev) @@ -50,6 +89,10 @@ static int build_key(struct saa7134_dev printk("%s: build_key gpio=0x%x mask=0x%x data=%d\n", dev->name, gpio, ir->mask_keycode, data); + + if (data<IR_KEYTAB_SIZE) + input_report_key(&ir->dev, ir->ir.ir_codes[data], + (gpio&0x40000) == 0); return 0; } @@ -77,7 +120,15 @@ int saa7134_input_init1(struct saa7134_d ir_codes = flyvideo_codes; mask_keycode = 0xEC00000; break; + + case SAA7134_BOARD_CINERGY400: + case SAA7134_BOARD_CINERGY600: + ir_type = IR_TYPE_OTHER; + ir_codes = cinergy_codes; + mask_keycode = 0x3f; + break; } + if (NULL == ir_codes) { printk("%s: Oops: IR config error [card=%d]\n", dev->name, dev->board);
Attachment:
pgpgD6BuDNgsS.pgp
Description: PGP signature