[PATCH] v4l: 812: supports the pinnacle pctv 110i board video inputs and remote
authorRicardo Cerqueira <v4l@cerqueira.org>
Wed, 9 Nov 2005 05:37:51 +0000 (21:37 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 9 Nov 2005 15:56:21 +0000 (07:56 -0800)
- Supports the Pinnacle PCTV 110i board, video inputs, and remote.

Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Documentation/video4linux/CARDLIST.saa7134
drivers/media/video/ir-kbd-i2c.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134.h
drivers/media/video/tda8290.c

index c5ae8a32f7567e4e1a5549c04f4ef9e9947fa946..9b3ef0031ef6068da26cbc98347f4a7ad99e8453 100644 (file)
@@ -75,3 +75,4 @@
  74 -> LifeView FlyTV Platinum Mini2            [14c0:1212]
  75 -> AVerMedia AVerTVHD MCE A180              [1461:1044]
  76 -> SKNet MonsterTV Mobile                   [1131:4ee9]
+ 77 -> Pinnacle PCTV 110i (saa7133)             [11bd:002e]
index 12f1053137daebed1f885795d439d62fbea23941..0cd1fc89b2d01e04e44316205fed5d8b779cd1c9 100644 (file)
@@ -122,6 +122,64 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
 
 };
 
+static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = {
+       [ 0x59 ] = KEY_MUTE,
+       [ 0x4a ] = KEY_POWER,
+
+       [ 0x18 ] = KEY_TEXT,
+       [ 0x26 ] = KEY_TV,
+       [ 0x3d ] = KEY_PRINT,
+
+       [ 0x48 ] = KEY_RED,
+       [ 0x04 ] = KEY_GREEN,
+       [ 0x11 ] = KEY_YELLOW,
+       [ 0x00 ] = KEY_BLUE,
+
+       [ 0x2d ] = KEY_VOLUMEUP,
+       [ 0x1e ] = KEY_VOLUMEDOWN,
+
+       [ 0x49 ] = KEY_MENU,
+
+       [ 0x16 ] = KEY_CHANNELUP,
+       [ 0x17 ] = KEY_CHANNELDOWN,
+
+       [ 0x20 ] = KEY_UP,
+       [ 0x21 ] = KEY_DOWN,
+       [ 0x22 ] = KEY_LEFT,
+       [ 0x23 ] = KEY_RIGHT,
+       [ 0x0d ] = KEY_SELECT,
+
+
+
+       [ 0x08 ] = KEY_BACK,
+       [ 0x07 ] = KEY_REFRESH,
+
+       [ 0x2f ] = KEY_ZOOM,
+       [ 0x29 ] = KEY_RECORD,
+
+       [ 0x4b ] = KEY_PAUSE,
+       [ 0x4d ] = KEY_REWIND,
+       [ 0x2e ] = KEY_PLAY,
+       [ 0x4e ] = KEY_FORWARD,
+       [ 0x53 ] = KEY_PREVIOUS,
+       [ 0x4c ] = KEY_STOP,
+       [ 0x54 ] = KEY_NEXT,
+
+       [ 0x69 ] = KEY_KP0,
+       [ 0x6a ] = KEY_KP1,
+       [ 0x6b ] = KEY_KP2,
+       [ 0x6c ] = KEY_KP3,
+       [ 0x6d ] = KEY_KP4,
+       [ 0x6e ] = KEY_KP5,
+       [ 0x6f ] = KEY_KP6,
+       [ 0x70 ] = KEY_KP7,
+       [ 0x71 ] = KEY_KP8,
+       [ 0x72 ] = KEY_KP9,
+
+       [ 0x74 ] = KEY_CHANNEL,
+       [ 0x0a ] = KEY_BACKSPACE,
+};
+
 /* ----------------------------------------------------------------------- */
 /* insmod parameters                                                       */
 
@@ -245,6 +303,58 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
        *ir_raw = b;
        return 1;
 }
+
+/* The new pinnacle PCTV remote (with the colored buttons)
+ *
+ * Ricardo Cerqueira <v4l@cerqueira.org>
+ */
+
+static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+       unsigned char b[4];
+       unsigned int start = 0,parity = 0,code = 0;
+
+       /* poll IR chip */
+       if (4 != i2c_master_recv(&ir->c,b,4)) {
+               dprintk(1,"read error\n");
+               return -EIO;
+       }
+
+       for (start = 0; start<4; start++) {
+               if (b[start] == 0x80) {
+                       code=b[(start+3)%4];
+                       parity=b[(start+2)%4];
+               }
+       }
+
+       /* Empty Request */
+       if (parity==0)
+               return 0;
+
+       /* Repeating... */
+       if (ir->old == parity)
+               return 0;
+
+
+       ir->old = parity;
+
+       /* Reduce code value to fit inside IR_KEYTAB_SIZE
+        *
+        * this is the only value that results in 42 unique
+        * codes < 128
+        */
+
+       code %= 0x88;
+
+       *ir_raw = code;
+       *ir_key = code;
+
+       dprintk(1,"Pinnacle PCTV key %02x\n", code);
+
+       return 1;
+}
+
+
 /* ----------------------------------------------------------------------- */
 
 static void ir_key_poll(struct IR_i2c *ir)
@@ -350,6 +460,12 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
                ir_type     = IR_TYPE_OTHER;
                ir_codes    = ir_codes_empty;
                break;
+       case 0x47:
+               name        = "Pinnacle PCTV";
+               ir->get_key = get_key_pinnacle;
+               ir_type     = IR_TYPE_OTHER;
+               ir_codes    = ir_codes_pinnacle;
+               break;
        case 0x7a:
                name        = "Purple TV";
                ir->get_key = get_key_purpletv;
@@ -426,7 +542,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, -1 };
+       static const int probe_saa7134[] = { 0x7a, 0x47, -1 };
        static const int probe_em2820[] = { 0x30, 0x47, -1 };
        const int *probe = NULL;
        struct i2c_client c;
index a60d49af341db7fad47cf79e445058dd34abea78..0147d8342f8dbe906512bce682baa814e8af449c 100644 (file)
@@ -2391,6 +2391,33 @@ struct saa7134_board saa7134_boards[] = {
                          .amux = LINE1,
                }},
        },
+       [SAA7134_BOARD_PINNACLE_PCTV_110i] = {
+               .name           = "Pinnacle PCTV 110i (saa7133)",
+               .audio_clock    = 0x00187de7,
+               .tuner_type     = TUNER_PHILIPS_TDA8290,
+               .radio_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .gpiomask       = 0x080200000,
+               .inputs         = {{
+                         .name = name_tv,
+                         .vmux = 4,
+                         .amux = TV,
+                         .tv   = 1,
+               },{
+                         .name = name_comp1,
+                         .vmux = 1,
+                         .amux = LINE2,
+               },{
+                         .name = name_svideo,
+                         .vmux = 8,
+                         .amux = LINE2,
+               }},
+               .radio = {
+                         .name = name_radio,
+                         .amux = LINE1,
+               },
+       },
 };
 
 const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -2808,6 +2835,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
                .subvendor    = 0x1131,
                .subdevice    = 0x4ee9,
                .driver_data  = SAA7134_BOARD_MONSTERTV_MOBILE,
+       },{
+               .vendor       = PCI_VENDOR_ID_PHILIPS,
+               .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+               .subvendor    = 0x11bd,
+               .subdevice    = 0x002e,
+               .driver_data  = SAA7134_BOARD_PINNACLE_PCTV_110i,
        },{
                /* --- boards without eeprom + subsystem ID --- */
                .vendor       = PCI_VENDOR_ID_PHILIPS,
index cd28a6a7b9720f66e63b929c6c2753ec6e1e7d7e..d497fea5425f101c5abc43e2f5a2070fff47ea75 100644 (file)
@@ -203,6 +203,7 @@ struct saa7134_format {
 #define SAA7134_BOARD_FLYTVPLATINUM_MINI2 74
 #define SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180 75
 #define SAA7134_BOARD_MONSTERTV_MOBILE 76
+#define SAA7134_BOARD_PINNACLE_PCTV_110i 77
 
 #define SAA7134_MAXBOARDS 8
 #define SAA7134_INPUT_MAX 8
index 8f9d7d1fd3f43eb53d939ae5d602126588d30c7e..fa9b4b898f687f31d322599fdbd7c66fb7bec3dd 100644 (file)
@@ -487,7 +487,7 @@ static void tda8290_init_tuner(struct i2c_client *c)
        unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b,
                                          0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b };
        struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0,
-                             .buf=tda8275_init, .len = 14};
+                             .buf=tda8275_init, .len = 14};
        if (t->tda827x_ver != 0)
                msg.buf = tda8275a_init;