Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / media / video / cx88 / cx88-input.c
index 78a63b7..c255646 100644 (file)
@@ -70,14 +70,33 @@ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
 static void cx88_ir_handle_key(struct cx88_IR *ir)
 {
        struct cx88_core *core = ir->core;
-       u32 gpio, data;
+       u32 gpio, data, auxgpio;
 
        /* read gpio value */
        gpio = cx_read(ir->gpio_addr);
+       if (core->board == CX88_BOARD_NPGTECH_REALTV_TOP10FM) {
+               /* This board apparently uses a combination of 2 GPIO
+                  to represent the keys. Additionally, the second GPIO
+                  can be used for parity.
+
+                  Example:
+
+                  for key "5"
+                       gpio = 0x758, auxgpio = 0xe5 or 0xf5
+                  for key "Power"
+                       gpio = 0x758, auxgpio = 0xed or 0xfd
+                */
+
+               auxgpio = cx_read(MO_GP1_IO);
+               /* Take out the parity part */
+               gpio=(gpio & 0x7fd) + (auxgpio & 0xef);
+       } else
+               auxgpio = gpio;
+
        if (ir->polling) {
-               if (ir->last_gpio == gpio)
+               if (ir->last_gpio == auxgpio)
                        return;
-               ir->last_gpio = gpio;
+               ir->last_gpio = auxgpio;
        }
 
        /* extract data */
@@ -172,12 +191,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
                ir_type = IR_TYPE_RC5;
                ir->sampling = 1;
                break;
+       case CX88_BOARD_WINFAST_DTV2000H:
        case CX88_BOARD_WINFAST2000XP_EXPERT:
                ir_codes = ir_codes_winfast;
                ir->gpio_addr = MO_GP0_IO;
                ir->mask_keycode = 0x8f8;
                ir->mask_keyup = 0x100;
-               ir->polling = 1; /* ms */
+               ir->polling = 50; /* ms */
                break;
        case CX88_BOARD_IODATA_GVBCTV7E:
                ir_codes = ir_codes_iodata_bctv7e;
@@ -228,6 +248,12 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
                ir_type = IR_TYPE_PD;
                ir->sampling = 0xff00; /* address */
                break;
+       case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
+               ir_codes = ir_codes_npgtech;
+               ir->gpio_addr = MO_GP0_IO;
+               ir->mask_keycode = 0xfa;
+               ir->polling = 50; /* ms */
+               break;
        }
 
        if (NULL == ir_codes) {