]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/em28xx/em28xx-input.c
Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[linux-2.6-omap-h63xx.git] / drivers / media / video / em28xx / em28xx-input.c
index 32c49df58adc14c73c304c53adce2af78a8ca78d..31e89e4f18be5764200c57a76730e3bda95f93d5 100644 (file)
@@ -43,39 +43,6 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
 #define dprintk(fmt, arg...)   if (ir_debug) \
        printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg)
 
-/* ---------------------------------------------------------------------- */
-
-static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = {
-       [ 0x01 ] = KEY_CHANNEL,
-       [ 0x02 ] = KEY_SELECT,
-       [ 0x03 ] = KEY_MUTE,
-       [ 0x04 ] = KEY_POWER,
-       [ 0x05 ] = KEY_KP1,
-       [ 0x06 ] = KEY_KP2,
-       [ 0x07 ] = KEY_KP3,
-       [ 0x08 ] = KEY_CHANNELUP,
-       [ 0x09 ] = KEY_KP4,
-       [ 0x0a ] = KEY_KP5,
-       [ 0x0b ] = KEY_KP6,
-       [ 0x0c ] = KEY_CHANNELDOWN,
-       [ 0x0d ] = KEY_KP7,
-       [ 0x0e ] = KEY_KP8,
-       [ 0x0f ] = KEY_KP9,
-       [ 0x10 ] = KEY_VOLUMEUP,
-       [ 0x11 ] = KEY_KP0,
-       [ 0x12 ] = KEY_MENU,
-       [ 0x13 ] = KEY_PRINT,
-       [ 0x14 ] = KEY_VOLUMEDOWN,
-       [ 0x16 ] = KEY_PAUSE,
-       [ 0x18 ] = KEY_RECORD,
-       [ 0x19 ] = KEY_REWIND,
-       [ 0x1a ] = KEY_PLAY,
-       [ 0x1b ] = KEY_FORWARD,
-       [ 0x1c ] = KEY_BACKSPACE,
-       [ 0x1e ] = KEY_STOP,
-       [ 0x40 ] = KEY_ZOOM,
-};
-
 /* ----------------------------------------------------------------------- */
 
 static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
@@ -120,9 +87,6 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
        if (buf[1]==0xff)
                return 0;
 
-       /* avoid fast reapeating */
-       if (buf[1]==ir->old)
-               return 0;
        ir->old=buf[1];
 
        /* Rearranges bits to the right order */
@@ -141,6 +105,28 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
        return 1;
 }
 
+static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+       unsigned char buf[3];
+
+       /* poll IR chip */
+
+       if (3 != i2c_master_recv(&ir->c,buf,3)) {
+               dprintk("read error\n");
+               return -EIO;
+       }
+
+       dprintk("key %02x\n", buf[2]&0x3f);
+       if (buf[0]!=0x00){
+               return 0;
+       }
+
+       *ir_key = buf[2]&0x3f;
+       *ir_raw = buf[2]&0x3f;
+
+       return 1;
+}
+
 /* ----------------------------------------------------------------------- */
 void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
 {
@@ -162,6 +148,9 @@ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
                snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)");
                break;
        case (EM2820_BOARD_PINNACLE_USB_2):
+               ir->ir_codes = ir_codes_em_pinnacle_usb;
+               ir->get_key = get_key_pinnacle_usb;
+               snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)");
                break;
        case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
                ir->ir_codes = ir_codes_hauppauge_new;