Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / media / video / cx88 / cx88-input.c
index eccc5e4..fc777bc 100644 (file)
@@ -405,6 +405,11 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
                ir->mask_keycode = 0x7e;
                ir->polling      = 100; /* ms */
                break;
+       case CX88_BOARD_TWINHAN_VP1027_DVBS:
+               ir_codes         = RC_MAP_TWINHAN_VP1027_DVBS;
+               ir_type          = IR_TYPE_NEC;
+               ir->sampling     = 0xff00; /* address */
+               break;
        }
 
        if (NULL == ir_codes) {
@@ -530,6 +535,7 @@ void cx88_ir_irq(struct cx88_core *core)
        case CX88_BOARD_PROF_7300:
        case CX88_BOARD_PROF_7301:
        case CX88_BOARD_PROF_6200:
+       case CX88_BOARD_TWINHAN_VP1027_DVBS:
                ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4);
 
                if (ircode == 0xffffffff) { /* decoding error */
@@ -609,13 +615,54 @@ void cx88_ir_irq(struct cx88_core *core)
        return;
 }
 
+
+void cx88_i2c_init_ir(struct cx88_core *core)
+{
+       struct i2c_board_info info;
+       const unsigned short addr_list[] = {
+               0x18, 0x6b, 0x71,
+               I2C_CLIENT_END
+       };
+       const unsigned short *addrp;
+       /* Instantiate the IR receiver device, if present */
+       if (0 != core->i2c_rc)
+               return;
+
+       memset(&info, 0, sizeof(struct i2c_board_info));
+       strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
+
+       /*
+        * We can't call i2c_new_probed_device() because it uses
+        * quick writes for probing and at least some RC receiver
+        * devices only reply to reads.
+        * Also, Hauppauge XVR needs to be specified, as address 0x71
+        * conflicts with another remote type used with saa7134
+        */
+       for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) {
+               info.platform_data = NULL;
+               memset(&core->init_data, 0, sizeof(core->init_data));
+
+               if (*addrp == 0x71) {
+                       /* Hauppauge XVR */
+                       core->init_data.name = "cx88 Hauppauge XVR remote";
+                       core->init_data.ir_codes = RC_MAP_HAUPPAUGE_NEW;
+                       core->init_data.type = IR_TYPE_RC5;
+                       core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
+
+                       info.platform_data = &core->init_data;
+               }
+               if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
+                                       I2C_SMBUS_READ, 0,
+                                       I2C_SMBUS_QUICK, NULL) >= 0) {
+                       info.addr = *addrp;
+                       i2c_new_device(&core->i2c_adap, &info);
+                       break;
+               }
+       }
+}
+
 /* ---------------------------------------------------------------------- */
 
 MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe");
 MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");
 MODULE_LICENSE("GPL");
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */