V4L/DVB (6021): cx88: Copy board information into card state
[deliverable/linux.git] / drivers / media / video / cx88 / cx88-cards.c
index c791708b13362bfb5d7f4b0d31919bc28e196683..8be90ad4e91027907c65db1c89757c3c7f7a7bbd 100644 (file)
@@ -30,7 +30,7 @@
 /* ------------------------------------------------------------------ */
 /* board config info                                                  */
 
-struct cx88_board cx88_boards[] = {
+const struct cx88_board cx88_boards[] = {
        [CX88_BOARD_UNKNOWN] = {
                .name           = "UNKNOWN/GENERIC",
                .tuner_type     = UNSET,
@@ -575,35 +575,34 @@ struct cx88_board cx88_boards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .tda9887_conf   = TDA9887_PRESENT,
+               /* GPIO[2] = audio source for analog audio out connector
+                *  0 = analog audio input connector
+                *  1 = CX88 audio DACs
+                *
+                * GPIO[7] = input to CX88's audio/chroma ADC
+                *  0 = FM 10.7 MHz IF
+                *  1 = Sound 4.5 MHz IF
+                *
+                * GPIO[1,5,6] = Oren 51132 pins 27,35,28 respectively
+                *
+                * GPIO[16] = Remote control input
+                */
                .input          = {{
                        .type   = CX88_VMUX_TELEVISION,
                        .vmux   = 0,
                        .gpio0  = 0x00008484,
-                       .gpio1  = 0x00000000,
-                       .gpio2  = 0x00000000,
-                       .gpio3  = 0x00000000,
                },{
                        .type   = CX88_VMUX_COMPOSITE1,
                        .vmux   = 1,
                        .gpio0  = 0x00008400,
-                       .gpio1  = 0x00000000,
-                       .gpio2  = 0x00000000,
-                       .gpio3  = 0x00000000,
                },{
                        .type   = CX88_VMUX_SVIDEO,
                        .vmux   = 2,
                        .gpio0  = 0x00008400,
-                       .gpio1  = 0x00000000,
-                       .gpio2  = 0x00000000,
-                       .gpio3  = 0x00000000,
                }},
                .radio = {
                        .type   = CX88_RADIO,
-                       .vmux   = 2,
-                       .gpio0  = 0x00008400,
-                       .gpio1  = 0x00000000,
-                       .gpio2  = 0x00000000,
-                       .gpio3  = 0x00000000,
+                       .gpio0  = 0x00008404,
                },
                .mpeg           = CX88_MPEG_DVB,
        },
@@ -764,6 +763,12 @@ struct cx88_board cx88_boards[] = {
                .input          = {{
                        .type   = CX88_VMUX_DVB,
                        .vmux   = 0,
+               },{
+                       .type   = CX88_VMUX_COMPOSITE1,
+                       .vmux   = 2,
+               },{
+                       .type   = CX88_VMUX_SVIDEO,
+                       .vmux   = 2,
                }},
                .mpeg           = CX88_MPEG_DVB,
        },
@@ -879,6 +884,12 @@ struct cx88_board cx88_boards[] = {
                .input          = {{
                        .type   = CX88_VMUX_DVB,
                        .vmux   = 0,
+               },{
+                       .type   = CX88_VMUX_COMPOSITE1,
+                       .vmux   = 1,
+               },{
+                       .type   = CX88_VMUX_SVIDEO,
+                       .vmux   = 2,
                }},
                .mpeg           = CX88_MPEG_DVB,
        },
@@ -1323,6 +1334,26 @@ struct cx88_board cx88_boards[] = {
                /* fixme: Add radio support */
                .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
        },
+       [CX88_BOARD_ADSTECH_PTV_390] = {
+               .name           = "ADS Tech Instant Video PCI",
+               .tuner_type     = TUNER_ABSENT,
+               .radio_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .input          = {{
+                       .type   = CX88_VMUX_DEBUG,
+                       .vmux   = 3,
+                       .gpio0  = 0x04ff,
+               },{
+                       .type   = CX88_VMUX_COMPOSITE1,
+                       .vmux   = 1,
+                       .gpio0  = 0x07fa,
+               },{
+                       .type   = CX88_VMUX_SVIDEO,
+                       .vmux   = 2,
+                       .gpio0  = 0x07fa,
+               }},
+       },
 };
 const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
 
@@ -1531,10 +1562,10 @@ struct cx88_subid cx88_subids[] = {
        },{
                .subvendor = 0x17de,
                .subdevice = 0x0840,
-              .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
-       },{
-              .subvendor = 0x1421,
-              .subdevice = 0x0305,
+               .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
+       },{
+               .subvendor = 0x1421,
+               .subdevice = 0x0305,
                .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
        },{
                .subvendor = 0x18ac,
@@ -1625,6 +1656,14 @@ struct cx88_subid cx88_subids[] = {
                .subvendor = 0x0070,
                .subdevice = 0x1402,
                .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
+       },{
+               .subvendor = 0x1421,
+               .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */
+               .card      = CX88_BOARD_KWORLD_DVBS_100,
+       },{
+               .subvendor = 0x1421,
+               .subdevice = 0x0390,
+               .card      = CX88_BOARD_ADSTECH_PTV_390,
        },
 };
 const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
@@ -1632,7 +1671,7 @@ const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
 /* ----------------------------------------------------------------------- */
 /* some leadtek specific stuff                                             */
 
-static void __devinit leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
+static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
 {
        /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
         * any others.
@@ -1648,12 +1687,12 @@ static void __devinit leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
                return;
        }
 
-       core->has_radio  = 1;
-       core->tuner_type = (eeprom_data[6] == 0x13) ? 43 : 38;
+       core->board.tuner_type = (eeprom_data[6] == 0x13) ?
+               TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3;
 
        printk(KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: "
               "tuner=%d, eeprom[0]=0x%02x\n",
-              core->name, core->tuner_type, eeprom_data[0]);
+              core->name, core->board.tuner_type, eeprom_data[0]);
 }
 
 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
@@ -1661,9 +1700,9 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
        struct tveeprom tv;
 
        tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data);
-       core->tuner_type = tv.tuner_type;
+       core->board.tuner_type = tv.tuner_type;
        core->tuner_formats = tv.tuner_formats;
-       core->has_radio  = tv.has_radio;
+       core->board.radio.type = tv.has_radio ? CX88_RADIO : 0;
 
        /* Make sure we support the board model */
        switch (tv.model)
@@ -1753,8 +1792,9 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
               name ? name : "unknown");
        if (NULL == name)
                return;
-       core->tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
-       core->has_radio  = gdi_tuner[eeprom_data[0x0d]].fm;
+       core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
+       core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
+               CX88_RADIO : 0;
 }
 
 /* ----------------------------------------------------------------------- */
@@ -1780,7 +1820,7 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
                { 0x03, 0x0C },
        };
 
-       for (i = 0; i < 13; i++) {
+       for (i = 0; i < ARRAY_SIZE(init_bufs); i++) {
                msg.buf = init_bufs[i];
                msg.len = (i != 12 ? 5 : 2);
                err = i2c_transfer(&core->i2c_adap, &msg, 1);
@@ -1821,7 +1861,7 @@ void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
 
 void cx88_card_setup_pre_i2c(struct cx88_core *core)
 {
-       switch (core->board) {
+       switch (core->boardnr) {
        case CX88_BOARD_HAUPPAUGE_HVR1300:
                /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */
                /* We leave here with the 702 on the bus */
@@ -1844,7 +1884,7 @@ void cx88_card_setup(struct cx88_core *core)
                tveeprom_read(&core->i2c_client,eeprom,sizeof(eeprom));
        }
 
-       switch (core->board) {
+       switch (core->boardnr) {
        case CX88_BOARD_HAUPPAUGE:
        case CX88_BOARD_HAUPPAUGE_ROSLYN:
                if (0 == core->i2c_rc)
@@ -1888,7 +1928,7 @@ void cx88_card_setup(struct cx88_core *core)
                msleep(1);
                cx_set(MO_GP0_IO, 0x00000101);
                if (0 == core->i2c_rc &&
-                   core->board == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
+                   core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
                        dvico_fusionhdtv_hybrid_init(core);
                break;
        case CX88_BOARD_KWORLD_DVB_T:
@@ -1907,24 +1947,29 @@ void cx88_card_setup(struct cx88_core *core)
                if (0 == core->i2c_rc) {
                        /* enable tuner */
                        int i;
-                       static const u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 };
+                       static const u8 buffer [][2] = {
+                               {0x10,0x12},
+                               {0x13,0x04},
+                               {0x16,0x00},
+                               {0x14,0x04},
+                               {0x17,0x00}
+                       };
                        core->i2c_client.addr = 0x0a;
 
-                       for (i = 0; i < 5; i++)
-                               if (2 != i2c_master_send(&core->i2c_client,&buffer[i*2],2))
-                                       printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n",
+                       for (i = 0; i < ARRAY_SIZE(buffer); i++)
+                               if (2 != i2c_master_send(&core->i2c_client,
+                                                       buffer[i],2))
+                                       printk(KERN_WARNING
+                                               "%s: Unable to enable "
+                                               "tuner(%i).\n",
                                                core->name, i);
                }
                break;
        }
-       if (cx88_boards[core->board].radio.type == CX88_RADIO)
-               core->has_radio = 1;
 }
 
 /* ------------------------------------------------------------------ */
 
-EXPORT_SYMBOL(cx88_boards);
-
 /*
  * Local variables:
  * c-basic-offset: 8
This page took 0.041252 seconds and 5 git commands to generate.