V4L/DVB (4898): Saa7134: add support for remote control of Hauppauge HVR1110
authorThomas Genty <tomlohave@gmail.com>
Thu, 30 Nov 2006 00:57:24 +0000 (21:57 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 10 Dec 2006 11:05:29 +0000 (09:05 -0200)
This patch adds support for the remote control bundled with the
Hauppauge HVR1110

Signed-off-by: Thomas Genty <tomlohave@gmail.com>
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/ir-kbd-i2c.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-i2c.c
drivers/media/video/saa7134/saa7134-input.c

index dd6341f2e390e1d7b56375ac914605de5730c81d..59edf58204de311935cc3d807b7d2bd3745c148d 100644 (file)
@@ -354,6 +354,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
                break;
        case 0x7a:
        case 0x47:
+       case 0x71:
                /* Handled by saa7134-input */
                name        = "SAA713x remote";
                ir_type     = IR_TYPE_OTHER;
@@ -448,7 +449,7 @@ static int ir_probe(struct i2c_adapter *adap)
        */
 
        static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
-       static const int probe_saa7134[] = { 0x7a, 0x47, -1 };
+       static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
        static const int probe_em28XX[] = { 0x30, 0x47, -1 };
        const int *probe = NULL;
        struct i2c_client c;
index d0ddc65d7eb194d5d308a1967894c680c1961c3c..4dead84aff4629d56f29c40cc29311730a807e02 100644 (file)
@@ -3135,17 +3135,23 @@ struct saa7134_board saa7134_boards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .mpeg           = SAA7134_MPEG_DVB,
-               .gpiomask       = 0x000200000,
                .inputs         = {{
                        .name = name_tv,
                        .vmux = 1,
                        .amux = TV,
                        .tv   = 1,
+               },{
+                       .name   = name_comp1,
+                       .vmux   = 3,
+                       .amux   = LINE2, /* FIXME: audio doesn't work on svideo/composite */
+               },{
+                       .name   = name_svideo,
+                       .vmux   = 8,
+                       .amux   = LINE2, /* FIXME: audio doesn't work on svideo/composite */
                }},
                .radio = {
                        .name = name_radio,
                        .amux   = TV,
-                       .gpio   = 0x0200000,
                },
        },
        [SAA7134_BOARD_CINERGY_HT_PCMCIA] = {
@@ -3976,6 +3982,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
        case SAA7134_BOARD_PINNACLE_PCTV_110i:
        case SAA7134_BOARD_PINNACLE_PCTV_310i:
        case SAA7134_BOARD_UPMOST_PURPLE_TV:
+       case SAA7134_BOARD_HAUPPAUGE_HVR1110:
                dev->has_remote = SAA7134_REMOTE_I2C;
                break;
        case SAA7134_BOARD_AVERMEDIA_A169_B:
index 6162550c413604c97069ae751ad5dbd415f0db14..6f9fe86fed9838c26c45bda2ae0759f8de30e124 100644 (file)
@@ -341,6 +341,7 @@ static int attach_inform(struct i2c_client *client)
        switch (client->addr) {
                case 0x7a:
                case 0x47:
+               case 0x71:
                {
                        struct IR_i2c *ir = i2c_get_clientdata(client);
                        d1printk("%s i2c IR detected (%s).\n",
index 5d2bf15239f7523ddd8bd696038aa43b5dc4054b..60b38defd9bccf3d86a1428c7a87dc1544100321 100644 (file)
@@ -112,6 +112,27 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
        return 1;
 }
 
+static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+       unsigned char buf[5], cod4, code3, code4;
+
+       /* poll IR chip */
+       if (5 != i2c_master_recv(&ir->c,buf,5))
+               return -EIO;
+
+       cod4    = buf[4];
+       code4   = (cod4 >> 2);
+       code3   = buf[3];
+       if (code3 == 0)
+               /* no key pressed */
+               return 0;
+
+       /* return key */
+       *ir_key = code4;
+       *ir_raw = code4;
+       return 1;
+}
+
 void saa7134_input_irq(struct saa7134_dev *dev)
 {
        struct saa7134_ir *ir = dev->remote;
@@ -371,6 +392,11 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir)
                ir->get_key   = get_key_purpletv;
                ir->ir_codes  = ir_codes_purpletv;
                break;
+       case SAA7134_BOARD_HAUPPAUGE_HVR1110:
+               snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110");
+               ir->get_key   = get_key_hvr1110;
+               ir->ir_codes  = ir_codes_hauppauge_new;
+               break;
        default:
                dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board);
                break;