aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-08-15 13:41:57 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:05:16 -0400
commit6a59d64c5cc302e0139ddb1f5e57afceecb14368 (patch)
treee3a14e27b5aca04a4069797893d59df7bc0f8f65 /drivers
parentb09a79f5848f2143a8ffc724910743027d5a70e0 (diff)
V4L/DVB (6021): cx88: Copy board information into card state
The cx88 driver state stored the ID of the board type in core->board. Every time the driver need to get some information about the board configuration, it uses the board number as an index into board configuration array. This patch changes it so that the board number is in core->boardnr, and core->board is a copy of the board configuration information. This allows access to board information without the extra indirection. e.g. cx88_boards[core->board].mpeg becomes core->board.mpeg. This has a number of advantages: - The code is simpler to write. - It compiles to be smaller and faster, without needing the extra array lookup to get at the board information. - The cx88_boards array no longer needs to be exported to all cx88 modules. - The boards array can be made const - It should be possible to avoid keeping the (large) cx88_boards array around after the module is loaded. - If module parameters or eeprom info override some board configuration setting, it's not necessary to modify the boards array, which would affect all boards of the same type. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c18
-rw-r--r--drivers/media/video/cx88/cx88-cards.c27
-rw-r--r--drivers/media/video/cx88/cx88-core.c45
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c10
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c24
-rw-r--r--drivers/media/video/cx88/cx88-input.c11
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c22
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c4
-rw-r--r--drivers/media/video/cx88/cx88-video.c63
-rw-r--r--drivers/media/video/cx88/cx88-vp3054-i2c.c4
-rw-r--r--drivers/media/video/cx88/cx88.h13
11 files changed, 112 insertions, 129 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index f2fcdb92ecce..74e3eb945751 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -734,14 +734,14 @@ static int vidioc_querycap (struct file *file, void *priv,
734 struct cx88_core *core = dev->core; 734 struct cx88_core *core = dev->core;
735 735
736 strcpy(cap->driver, "cx88_blackbird"); 736 strcpy(cap->driver, "cx88_blackbird");
737 strlcpy(cap->card, cx88_boards[core->board].name,sizeof(cap->card)); 737 strlcpy(cap->card, core->board.name, sizeof(cap->card));
738 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); 738 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci));
739 cap->version = CX88_VERSION_CODE; 739 cap->version = CX88_VERSION_CODE;
740 cap->capabilities = 740 cap->capabilities =
741 V4L2_CAP_VIDEO_CAPTURE | 741 V4L2_CAP_VIDEO_CAPTURE |
742 V4L2_CAP_READWRITE | 742 V4L2_CAP_READWRITE |
743 V4L2_CAP_STREAMING; 743 V4L2_CAP_STREAMING;
744 if (UNSET != core->tuner_type) 744 if (UNSET != core->board.tuner_type)
745 cap->capabilities |= V4L2_CAP_TUNER; 745 cap->capabilities |= V4L2_CAP_TUNER;
746 return 0; 746 return 0;
747} 747}
@@ -990,7 +990,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
990 struct cx8802_fh *fh = priv; 990 struct cx8802_fh *fh = priv;
991 struct cx88_core *core = fh->dev->core; 991 struct cx88_core *core = fh->dev->core;
992 992
993 if (unlikely(UNSET == core->tuner_type)) 993 if (unlikely(UNSET == core->board.tuner_type))
994 return -EINVAL; 994 return -EINVAL;
995 995
996 f->type = V4L2_TUNER_ANALOG_TV; 996 f->type = V4L2_TUNER_ANALOG_TV;
@@ -1028,7 +1028,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
1028 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core; 1028 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core;
1029 u32 reg; 1029 u32 reg;
1030 1030
1031 if (unlikely(UNSET == core->tuner_type)) 1031 if (unlikely(UNSET == core->board.tuner_type))
1032 return -EINVAL; 1032 return -EINVAL;
1033 if (0 != t->index) 1033 if (0 != t->index)
1034 return -EINVAL; 1034 return -EINVAL;
@@ -1049,7 +1049,7 @@ static int vidioc_s_tuner (struct file *file, void *priv,
1049{ 1049{
1050 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core; 1050 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core;
1051 1051
1052 if (UNSET == core->tuner_type) 1052 if (UNSET == core->board.tuner_type)
1053 return -EINVAL; 1053 return -EINVAL;
1054 if (0 != t->index) 1054 if (0 != t->index)
1055 return -EINVAL; 1055 return -EINVAL;
@@ -1246,7 +1246,7 @@ static int cx8802_blackbird_advise_acquire(struct cx8802_driver *drv)
1246 struct cx88_core *core = drv->core; 1246 struct cx88_core *core = drv->core;
1247 int err = 0; 1247 int err = 0;
1248 1248
1249 switch (core->board) { 1249 switch (core->boardnr) {
1250 case CX88_BOARD_HAUPPAUGE_HVR1300: 1250 case CX88_BOARD_HAUPPAUGE_HVR1300:
1251 /* By default, core setup will leave the cx22702 out of reset, on the bus. 1251 /* By default, core setup will leave the cx22702 out of reset, on the bus.
1252 * We left the hardware on power up with the cx22702 active. 1252 * We left the hardware on power up with the cx22702 active.
@@ -1268,7 +1268,7 @@ static int cx8802_blackbird_advise_release(struct cx8802_driver *drv)
1268 struct cx88_core *core = drv->core; 1268 struct cx88_core *core = drv->core;
1269 int err = 0; 1269 int err = 0;
1270 1270
1271 switch (core->board) { 1271 switch (core->boardnr) {
1272 case CX88_BOARD_HAUPPAUGE_HVR1300: 1272 case CX88_BOARD_HAUPPAUGE_HVR1300:
1273 /* Exit leaving the cx23416 on the bus */ 1273 /* Exit leaving the cx23416 on the bus */
1274 break; 1274 break;
@@ -1316,13 +1316,13 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
1316 1316
1317 dprintk( 1, "%s\n", __FUNCTION__); 1317 dprintk( 1, "%s\n", __FUNCTION__);
1318 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1318 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
1319 core->board, 1319 core->boardnr,
1320 core->name, 1320 core->name,
1321 core->pci_bus, 1321 core->pci_bus,
1322 core->pci_slot); 1322 core->pci_slot);
1323 1323
1324 err = -ENODEV; 1324 err = -ENODEV;
1325 if (!(cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD)) 1325 if (!(core->board.mpeg & CX88_MPEG_BLACKBIRD))
1326 goto fail_core; 1326 goto fail_core;
1327 1327
1328 dev->width = 720; 1328 dev->width = 720;
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 1fc71a78b926..8be90ad4e910 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -30,7 +30,7 @@
30/* ------------------------------------------------------------------ */ 30/* ------------------------------------------------------------------ */
31/* board config info */ 31/* board config info */
32 32
33struct cx88_board cx88_boards[] = { 33const struct cx88_board cx88_boards[] = {
34 [CX88_BOARD_UNKNOWN] = { 34 [CX88_BOARD_UNKNOWN] = {
35 .name = "UNKNOWN/GENERIC", 35 .name = "UNKNOWN/GENERIC",
36 .tuner_type = UNSET, 36 .tuner_type = UNSET,
@@ -1687,12 +1687,12 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
1687 return; 1687 return;
1688 } 1688 }
1689 1689
1690 core->has_radio = 1; 1690 core->board.tuner_type = (eeprom_data[6] == 0x13) ?
1691 core->tuner_type = (eeprom_data[6] == 0x13) ? 43 : 38; 1691 TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3;
1692 1692
1693 printk(KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: " 1693 printk(KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: "
1694 "tuner=%d, eeprom[0]=0x%02x\n", 1694 "tuner=%d, eeprom[0]=0x%02x\n",
1695 core->name, core->tuner_type, eeprom_data[0]); 1695 core->name, core->board.tuner_type, eeprom_data[0]);
1696} 1696}
1697 1697
1698static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) 1698static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
@@ -1700,9 +1700,9 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
1700 struct tveeprom tv; 1700 struct tveeprom tv;
1701 1701
1702 tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data); 1702 tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data);
1703 core->tuner_type = tv.tuner_type; 1703 core->board.tuner_type = tv.tuner_type;
1704 core->tuner_formats = tv.tuner_formats; 1704 core->tuner_formats = tv.tuner_formats;
1705 core->has_radio = tv.has_radio; 1705 core->board.radio.type = tv.has_radio ? CX88_RADIO : 0;
1706 1706
1707 /* Make sure we support the board model */ 1707 /* Make sure we support the board model */
1708 switch (tv.model) 1708 switch (tv.model)
@@ -1792,8 +1792,9 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
1792 name ? name : "unknown"); 1792 name ? name : "unknown");
1793 if (NULL == name) 1793 if (NULL == name)
1794 return; 1794 return;
1795 core->tuner_type = gdi_tuner[eeprom_data[0x0d]].id; 1795 core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
1796 core->has_radio = gdi_tuner[eeprom_data[0x0d]].fm; 1796 core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
1797 CX88_RADIO : 0;
1797} 1798}
1798 1799
1799/* ----------------------------------------------------------------------- */ 1800/* ----------------------------------------------------------------------- */
@@ -1860,7 +1861,7 @@ void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
1860 1861
1861void cx88_card_setup_pre_i2c(struct cx88_core *core) 1862void cx88_card_setup_pre_i2c(struct cx88_core *core)
1862{ 1863{
1863 switch (core->board) { 1864 switch (core->boardnr) {
1864 case CX88_BOARD_HAUPPAUGE_HVR1300: 1865 case CX88_BOARD_HAUPPAUGE_HVR1300:
1865 /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */ 1866 /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */
1866 /* We leave here with the 702 on the bus */ 1867 /* We leave here with the 702 on the bus */
@@ -1883,7 +1884,7 @@ void cx88_card_setup(struct cx88_core *core)
1883 tveeprom_read(&core->i2c_client,eeprom,sizeof(eeprom)); 1884 tveeprom_read(&core->i2c_client,eeprom,sizeof(eeprom));
1884 } 1885 }
1885 1886
1886 switch (core->board) { 1887 switch (core->boardnr) {
1887 case CX88_BOARD_HAUPPAUGE: 1888 case CX88_BOARD_HAUPPAUGE:
1888 case CX88_BOARD_HAUPPAUGE_ROSLYN: 1889 case CX88_BOARD_HAUPPAUGE_ROSLYN:
1889 if (0 == core->i2c_rc) 1890 if (0 == core->i2c_rc)
@@ -1927,7 +1928,7 @@ void cx88_card_setup(struct cx88_core *core)
1927 msleep(1); 1928 msleep(1);
1928 cx_set(MO_GP0_IO, 0x00000101); 1929 cx_set(MO_GP0_IO, 0x00000101);
1929 if (0 == core->i2c_rc && 1930 if (0 == core->i2c_rc &&
1930 core->board == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID) 1931 core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
1931 dvico_fusionhdtv_hybrid_init(core); 1932 dvico_fusionhdtv_hybrid_init(core);
1932 break; 1933 break;
1933 case CX88_BOARD_KWORLD_DVB_T: 1934 case CX88_BOARD_KWORLD_DVB_T:
@@ -1965,14 +1966,10 @@ void cx88_card_setup(struct cx88_core *core)
1965 } 1966 }
1966 break; 1967 break;
1967 } 1968 }
1968 if (cx88_boards[core->board].radio.type == CX88_RADIO)
1969 core->has_radio = 1;
1970} 1969}
1971 1970
1972/* ------------------------------------------------------------------ */ 1971/* ------------------------------------------------------------------ */
1973 1972
1974EXPORT_SYMBOL(cx88_boards);
1975
1976/* 1973/*
1977 * Local variables: 1974 * Local variables:
1978 * c-basic-offset: 8 1975 * c-basic-offset: 8
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 055264b9cd61..ece788bd3d55 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -738,7 +738,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
738 value |= (1 << 15); 738 value |= (1 << 15);
739 value |= (1 << 16); 739 value |= (1 << 16);
740 } 740 }
741 if (INPUT(core->input)->type == CX88_VMUX_SVIDEO) 741 if (INPUT(core->input).type == CX88_VMUX_SVIDEO)
742 value |= (1 << 13) | (1 << 5); 742 value |= (1 << 13) | (1 << 5);
743 if (V4L2_FIELD_INTERLACED == field) 743 if (V4L2_FIELD_INTERLACED == field)
744 value |= (1 << 3); // VINT (interlaced vertical scaling) 744 value |= (1 << 3); // VINT (interlaced vertical scaling)
@@ -833,7 +833,7 @@ static int set_tvaudio(struct cx88_core *core)
833{ 833{
834 v4l2_std_id norm = core->tvnorm; 834 v4l2_std_id norm = core->tvnorm;
835 835
836 if (CX88_VMUX_TELEVISION != INPUT(core->input)->type) 836 if (CX88_VMUX_TELEVISION != INPUT(core->input).type)
837 return 0; 837 return 0;
838 838
839 if (V4L2_STD_PAL_BG & norm) { 839 if (V4L2_STD_PAL_BG & norm) {
@@ -1067,7 +1067,7 @@ struct video_device *cx88_vdev_init(struct cx88_core *core,
1067 vfd->dev = &pci->dev; 1067 vfd->dev = &pci->dev;
1068 vfd->release = video_device_release; 1068 vfd->release = video_device_release;
1069 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", 1069 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
1070 core->name, type, cx88_boards[core->board].name); 1070 core->name, type, core->board.name);
1071 return vfd; 1071 return vfd;
1072} 1072}
1073 1073
@@ -1130,39 +1130,34 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1130 core->bmmio = (u8 __iomem *)core->lmmio; 1130 core->bmmio = (u8 __iomem *)core->lmmio;
1131 1131
1132 /* board config */ 1132 /* board config */
1133 core->board = UNSET; 1133 core->boardnr = UNSET;
1134 if (card[core->nr] < cx88_bcount) 1134 if (card[core->nr] < cx88_bcount)
1135 core->board = card[core->nr]; 1135 core->boardnr = card[core->nr];
1136 for (i = 0; UNSET == core->board && i < cx88_idcount; i++) 1136 for (i = 0; UNSET == core->boardnr && i < cx88_idcount; i++)
1137 if (pci->subsystem_vendor == cx88_subids[i].subvendor && 1137 if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
1138 pci->subsystem_device == cx88_subids[i].subdevice) 1138 pci->subsystem_device == cx88_subids[i].subdevice)
1139 core->board = cx88_subids[i].card; 1139 core->boardnr = cx88_subids[i].card;
1140 if (UNSET == core->board) { 1140 if (UNSET == core->boardnr) {
1141 core->board = CX88_BOARD_UNKNOWN; 1141 core->boardnr = CX88_BOARD_UNKNOWN;
1142 cx88_card_list(core,pci); 1142 cx88_card_list(core,pci);
1143 } 1143 }
1144
1145 memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
1146
1144 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", 1147 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
1145 core->name,pci->subsystem_vendor, 1148 core->name,pci->subsystem_vendor,
1146 pci->subsystem_device,cx88_boards[core->board].name, 1149 pci->subsystem_device, core->board.name,
1147 core->board, card[core->nr] == core->board ? 1150 core->boardnr, card[core->nr] == core->boardnr ?
1148 "insmod option" : "autodetected"); 1151 "insmod option" : "autodetected");
1149 1152
1150 core->tuner_type = tuner[core->nr]; 1153 if (tuner[core->nr] != UNSET)
1151 core->radio_type = radio[core->nr]; 1154 core->board.tuner_type = tuner[core->nr];
1152 if (UNSET == core->tuner_type) 1155 if (radio[core->nr] != UNSET)
1153 core->tuner_type = cx88_boards[core->board].tuner_type; 1156 core->board.radio_type = radio[core->nr];
1154 if (UNSET == core->radio_type)
1155 core->radio_type = cx88_boards[core->board].radio_type;
1156 if (!core->tuner_addr)
1157 core->tuner_addr = cx88_boards[core->board].tuner_addr;
1158 if (!core->radio_addr)
1159 core->radio_addr = cx88_boards[core->board].radio_addr;
1160 1157
1161 printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", 1158 printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n",
1162 core->tuner_type, core->tuner_addr<<1, 1159 core->board.tuner_type, core->board.tuner_addr<<1,
1163 core->radio_type, core->radio_addr<<1); 1160 core->board.radio_type, core->board.radio_addr<<1);
1164
1165 core->tda9887_conf = cx88_boards[core->board].tda9887_conf;
1166 1161
1167 /* init hardware */ 1162 /* init hardware */
1168 cx88_reset(core); 1163 cx88_reset(core);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 1773b40467dc..d98b90721019 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -378,7 +378,7 @@ static int dvb_register(struct cx8802_dev *dev)
378 dev->ts_gen_cntrl = 0x0c; 378 dev->ts_gen_cntrl = 0x0c;
379 379
380 /* init frontend */ 380 /* init frontend */
381 switch (dev->core->board) { 381 switch (dev->core->boardnr) {
382 case CX88_BOARD_HAUPPAUGE_DVB_T1: 382 case CX88_BOARD_HAUPPAUGE_DVB_T1:
383 dev->dvb.frontend = dvb_attach(cx22702_attach, 383 dev->dvb.frontend = dvb_attach(cx22702_attach,
384 &connexant_refboard_config, 384 &connexant_refboard_config,
@@ -653,7 +653,7 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv)
653 int err = 0; 653 int err = 0;
654 dprintk( 1, "%s\n", __FUNCTION__); 654 dprintk( 1, "%s\n", __FUNCTION__);
655 655
656 switch (core->board) { 656 switch (core->boardnr) {
657 case CX88_BOARD_HAUPPAUGE_HVR1300: 657 case CX88_BOARD_HAUPPAUGE_HVR1300:
658 /* We arrive here with either the cx23416 or the cx22702 658 /* We arrive here with either the cx23416 or the cx22702
659 * on the bus. Take the bus from the cx23416 and enable the 659 * on the bus. Take the bus from the cx23416 and enable the
@@ -676,7 +676,7 @@ static int cx8802_dvb_advise_release(struct cx8802_driver *drv)
676 int err = 0; 676 int err = 0;
677 dprintk( 1, "%s\n", __FUNCTION__); 677 dprintk( 1, "%s\n", __FUNCTION__);
678 678
679 switch (core->board) { 679 switch (core->boardnr) {
680 case CX88_BOARD_HAUPPAUGE_HVR1300: 680 case CX88_BOARD_HAUPPAUGE_HVR1300:
681 /* Do Nothing, leave the cx22702 on the bus. */ 681 /* Do Nothing, leave the cx22702 on the bus. */
682 break; 682 break;
@@ -694,13 +694,13 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
694 694
695 dprintk( 1, "%s\n", __FUNCTION__); 695 dprintk( 1, "%s\n", __FUNCTION__);
696 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 696 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
697 core->board, 697 core->boardnr,
698 core->name, 698 core->name,
699 core->pci_bus, 699 core->pci_bus,
700 core->pci_slot); 700 core->pci_slot);
701 701
702 err = -ENODEV; 702 err = -ENODEV;
703 if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB)) 703 if (!(core->board.mpeg & CX88_MPEG_DVB))
704 goto fail_core; 704 goto fail_core;
705 705
706 /* If vp3054 isn't enabled, a stub will just return 0 */ 706 /* If vp3054 isn't enabled, a stub will just return 0 */
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 78bbcfab9670..6b42dea860fd 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -108,28 +108,28 @@ static int attach_inform(struct i2c_client *client)
108 if (!client->driver->command) 108 if (!client->driver->command)
109 return 0; 109 return 0;
110 110
111 if (core->radio_type != UNSET) { 111 if (core->board.radio_type != UNSET) {
112 if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) { 112 if ((core->board.radio_addr==ADDR_UNSET)||(core->board.radio_addr==client->addr)) {
113 tun_setup.mode_mask = T_RADIO; 113 tun_setup.mode_mask = T_RADIO;
114 tun_setup.type = core->radio_type; 114 tun_setup.type = core->board.radio_type;
115 tun_setup.addr = core->radio_addr; 115 tun_setup.addr = core->board.radio_addr;
116 116
117 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); 117 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
118 } 118 }
119 } 119 }
120 if (core->tuner_type != UNSET) { 120 if (core->board.tuner_type != UNSET) {
121 if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) { 121 if ((core->board.tuner_addr==ADDR_UNSET)||(core->board.tuner_addr==client->addr)) {
122 122
123 tun_setup.mode_mask = T_ANALOG_TV; 123 tun_setup.mode_mask = T_ANALOG_TV;
124 tun_setup.type = core->tuner_type; 124 tun_setup.type = core->board.tuner_type;
125 tun_setup.addr = core->tuner_addr; 125 tun_setup.addr = core->board.tuner_addr;
126 126
127 client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); 127 client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup);
128 } 128 }
129 } 129 }
130 130
131 if (core->tda9887_conf) 131 if (core->board.tda9887_conf)
132 client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); 132 client->driver->command(client, TDA9887_SET_CONFIG, &core->board.tda9887_conf);
133 return 0; 133 return 0;
134} 134}
135 135
@@ -204,9 +204,9 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
204 memcpy(&core->i2c_algo, &cx8800_i2c_algo_template, 204 memcpy(&core->i2c_algo, &cx8800_i2c_algo_template,
205 sizeof(core->i2c_algo)); 205 sizeof(core->i2c_algo));
206 206
207 if (core->tuner_type != TUNER_ABSENT) 207 if (core->board.tuner_type != TUNER_ABSENT)
208 core->i2c_adap.class |= I2C_CLASS_TV_ANALOG; 208 core->i2c_adap.class |= I2C_CLASS_TV_ANALOG;
209 if (cx88_boards[core->board].mpeg & CX88_MPEG_DVB) 209 if (core->board.mpeg & CX88_MPEG_DVB)
210 core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL; 210 core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
211 211
212 core->i2c_adap.dev.parent = &pci->dev; 212 core->i2c_adap.dev.parent = &pci->dev;
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index f5d4a565346e..120f56857f0e 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -74,7 +74,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
74 74
75 /* read gpio value */ 75 /* read gpio value */
76 gpio = cx_read(ir->gpio_addr); 76 gpio = cx_read(ir->gpio_addr);
77 switch (core->board) { 77 switch (core->boardnr) {
78 case CX88_BOARD_NPGTECH_REALTV_TOP10FM: 78 case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
79 /* This board apparently uses a combination of 2 GPIO 79 /* This board apparently uses a combination of 2 GPIO
80 to represent the keys. Additionally, the second GPIO 80 to represent the keys. Additionally, the second GPIO
@@ -113,7 +113,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
113 (gpio & ir->mask_keydown) ? " down" : "", 113 (gpio & ir->mask_keydown) ? " down" : "",
114 (gpio & ir->mask_keyup) ? " up" : ""); 114 (gpio & ir->mask_keyup) ? " up" : "");
115 115
116 if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) { 116 if (ir->core->boardnr == CX88_BOARD_NORWOOD_MICRO) {
117 u32 gpio_key = cx_read(MO_GP0_IO); 117 u32 gpio_key = cx_read(MO_GP0_IO);
118 118
119 data = (data << 4) | ((gpio_key & 0xf0) >> 4); 119 data = (data << 4) | ((gpio_key & 0xf0) >> 4);
@@ -204,7 +204,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
204 ir->input = input_dev; 204 ir->input = input_dev;
205 205
206 /* detect & configure */ 206 /* detect & configure */
207 switch (core->board) { 207 switch (core->boardnr) {
208 case CX88_BOARD_DNTV_LIVE_DVB_T: 208 case CX88_BOARD_DNTV_LIVE_DVB_T:
209 case CX88_BOARD_KWORLD_DVB_T: 209 case CX88_BOARD_KWORLD_DVB_T:
210 case CX88_BOARD_KWORLD_DVB_T_CX22702: 210 case CX88_BOARD_KWORLD_DVB_T_CX22702:
@@ -314,8 +314,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
314 } 314 }
315 315
316 /* init input device */ 316 /* init input device */
317 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", 317 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
318 cx88_boards[core->board].name);
319 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); 318 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
320 319
321 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); 320 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
@@ -406,7 +405,7 @@ void cx88_ir_irq(struct cx88_core *core)
406 ir_dump_samples(ir->samples, ir->scount); 405 ir_dump_samples(ir->samples, ir->scount);
407 406
408 /* decode it */ 407 /* decode it */
409 switch (core->board) { 408 switch (core->boardnr) {
410 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 409 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
411 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: 410 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
412 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); 411 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4);
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index c34158d9dcc1..1df245ace2d0 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -55,9 +55,9 @@ static void request_module_async(struct work_struct *work)
55{ 55{
56 struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk); 56 struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk);
57 57
58 if (cx88_boards[dev->core->board].mpeg & CX88_MPEG_DVB) 58 if (dev->core->board.mpeg & CX88_MPEG_DVB)
59 request_module("cx88-dvb"); 59 request_module("cx88-dvb");
60 if (cx88_boards[dev->core->board].mpeg & CX88_MPEG_BLACKBIRD) 60 if (dev->core->board.mpeg & CX88_MPEG_BLACKBIRD)
61 request_module("cx88-blackbird"); 61 request_module("cx88-blackbird");
62} 62}
63 63
@@ -95,7 +95,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
95 dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id); 95 dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id);
96 96
97 if ( (core->active_type_id == CX88_MPEG_DVB) && 97 if ( (core->active_type_id == CX88_MPEG_DVB) &&
98 (cx88_boards[core->board].mpeg & CX88_MPEG_DVB) ) { 98 (core->board.mpeg & CX88_MPEG_DVB) ) {
99 99
100 dprintk( 1, "cx8802_start_dma doing .dvb\n"); 100 dprintk( 1, "cx8802_start_dma doing .dvb\n");
101 /* negedge driven & software reset */ 101 /* negedge driven & software reset */
@@ -103,7 +103,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
103 udelay(100); 103 udelay(100);
104 cx_write(MO_PINMUX_IO, 0x00); 104 cx_write(MO_PINMUX_IO, 0x00);
105 cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); 105 cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01);
106 switch (core->board) { 106 switch (core->boardnr) {
107 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 107 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
108 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: 108 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
109 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: 109 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
@@ -124,7 +124,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
124 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); 124 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
125 udelay(100); 125 udelay(100);
126 } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) && 126 } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) &&
127 (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) ) { 127 (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) {
128 dprintk( 1, "cx8802_start_dma doing .blackbird\n"); 128 dprintk( 1, "cx8802_start_dma doing .blackbird\n");
129 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ 129 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
130 130
@@ -138,7 +138,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
138 udelay(100); 138 udelay(100);
139 } else { 139 } else {
140 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __FUNCTION__, 140 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __FUNCTION__,
141 cx88_boards[core->board].mpeg ); 141 core->board.mpeg );
142 return -EINVAL; 142 return -EINVAL;
143 } 143 }
144 144
@@ -689,8 +689,8 @@ int cx8802_register_driver(struct cx8802_driver *drv)
689 689
690 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n", 690 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n",
691 h->core->name,h->pci->subsystem_vendor, 691 h->core->name,h->pci->subsystem_vendor,
692 h->pci->subsystem_device,cx88_boards[h->core->board].name, 692 h->pci->subsystem_device,h->core->board.name,
693 h->core->board); 693 h->core->boardnr);
694 694
695 /* Bring up a new struct for each driver instance */ 695 /* Bring up a new struct for each driver instance */
696 driver = kzalloc(sizeof(*drv),GFP_KERNEL); 696 driver = kzalloc(sizeof(*drv),GFP_KERNEL);
@@ -741,8 +741,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
741 741
742 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n", 742 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n",
743 h->core->name,h->pci->subsystem_vendor, 743 h->core->name,h->pci->subsystem_vendor,
744 h->pci->subsystem_device,cx88_boards[h->core->board].name, 744 h->pci->subsystem_device,h->core->board.name,
745 h->core->board); 745 h->core->boardnr);
746 746
747 list_for_each_safe(list2, q, &h->drvlist.devlist) { 747 list_for_each_safe(list2, q, &h->drvlist.devlist) {
748 d = list_entry(list2, struct cx8802_driver, devlist); 748 d = list_entry(list2, struct cx8802_driver, devlist);
@@ -782,7 +782,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
782 printk("%s/2: cx2388x 8802 Driver Manager\n", core->name); 782 printk("%s/2: cx2388x 8802 Driver Manager\n", core->name);
783 783
784 err = -ENODEV; 784 err = -ENODEV;
785 if (!cx88_boards[core->board].mpeg) 785 if (!core->board.mpeg)
786 goto fail_core; 786 goto fail_core;
787 787
788 err = -ENOMEM; 788 err = -ENOMEM;
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 1cc2d286a1cb..99e120483ecd 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -140,7 +140,7 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
140 cx_write(AUD_RATE_THRES_DMD, 0x000000C0); 140 cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
141 cx88_start_audio_dma(core); 141 cx88_start_audio_dma(core);
142 142
143 if (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) { 143 if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
144 cx_write(AUD_I2SINPUTCNTL, 4); 144 cx_write(AUD_I2SINPUTCNTL, 4);
145 cx_write(AUD_BAUDRATE, 1); 145 cx_write(AUD_BAUDRATE, 1);
146 /* 'pass-thru mode': this enables the i2s output to the mpeg encoder */ 146 /* 'pass-thru mode': this enables the i2s output to the mpeg encoder */
@@ -149,7 +149,7 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
149 cx_write(AUD_I2SCNTL, 0); 149 cx_write(AUD_I2SCNTL, 0);
150 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */ 150 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
151 } 151 }
152 if ((always_analog) || (!(cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD))) { 152 if ((always_analog) || (!(core->board.mpeg & CX88_MPEG_BLACKBIRD))) {
153 ctl |= EN_DAC_ENABLE; 153 ctl |= EN_DAC_ENABLE;
154 cx_write(AUD_CTL, ctl); 154 cx_write(AUD_CTL, ctl);
155 } 155 }
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 58ec76be436c..b0dd4313a841 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -368,17 +368,17 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
368 /* struct cx88_core *core = dev->core; */ 368 /* struct cx88_core *core = dev->core; */
369 369
370 dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n", 370 dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n",
371 input, INPUT(input)->vmux, 371 input, INPUT(input).vmux,
372 INPUT(input)->gpio0,INPUT(input)->gpio1, 372 INPUT(input).gpio0,INPUT(input).gpio1,
373 INPUT(input)->gpio2,INPUT(input)->gpio3); 373 INPUT(input).gpio2,INPUT(input).gpio3);
374 core->input = input; 374 core->input = input;
375 cx_andor(MO_INPUT_FORMAT, 0x03 << 14, INPUT(input)->vmux << 14); 375 cx_andor(MO_INPUT_FORMAT, 0x03 << 14, INPUT(input).vmux << 14);
376 cx_write(MO_GP3_IO, INPUT(input)->gpio3); 376 cx_write(MO_GP3_IO, INPUT(input).gpio3);
377 cx_write(MO_GP0_IO, INPUT(input)->gpio0); 377 cx_write(MO_GP0_IO, INPUT(input).gpio0);
378 cx_write(MO_GP1_IO, INPUT(input)->gpio1); 378 cx_write(MO_GP1_IO, INPUT(input).gpio1);
379 cx_write(MO_GP2_IO, INPUT(input)->gpio2); 379 cx_write(MO_GP2_IO, INPUT(input).gpio2);
380 380
381 switch (INPUT(input)->type) { 381 switch (INPUT(input).type) {
382 case CX88_VMUX_SVIDEO: 382 case CX88_VMUX_SVIDEO:
383 cx_set(MO_AFECFG_IO, 0x00000001); 383 cx_set(MO_AFECFG_IO, 0x00000001);
384 cx_set(MO_INPUT_FORMAT, 0x00010010); 384 cx_set(MO_INPUT_FORMAT, 0x00010010);
@@ -393,9 +393,9 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
393 break; 393 break;
394 } 394 }
395 395
396 if (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) { 396 if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
397 /* sets sound input from external adc */ 397 /* sets sound input from external adc */
398 if (INPUT(input)->extadc) 398 if (INPUT(input).extadc)
399 cx_set(AUD_CTL, EN_I2SIN_ENABLE); 399 cx_set(AUD_CTL, EN_I2SIN_ENABLE);
400 else 400 else
401 cx_clear(AUD_CTL, EN_I2SIN_ENABLE); 401 cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
@@ -767,12 +767,11 @@ static int video_open(struct inode *inode, struct file *file)
767 fh); 767 fh);
768 768
769 if (fh->radio) { 769 if (fh->radio) {
770 int board = core->board;
771 dprintk(1,"video_open: setting radio device\n"); 770 dprintk(1,"video_open: setting radio device\n");
772 cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); 771 cx_write(MO_GP3_IO, core->board.radio.gpio3);
773 cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); 772 cx_write(MO_GP0_IO, core->board.radio.gpio0);
774 cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); 773 cx_write(MO_GP1_IO, core->board.radio.gpio1);
775 cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); 774 cx_write(MO_GP2_IO, core->board.radio.gpio2);
776 core->tvaudio = WW_FM; 775 core->tvaudio = WW_FM;
777 cx88_set_tvaudio(core); 776 cx88_set_tvaudio(core);
778 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); 777 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
@@ -1078,8 +1077,7 @@ static int vidioc_querycap (struct file *file, void *priv,
1078 struct cx88_core *core = dev->core; 1077 struct cx88_core *core = dev->core;
1079 1078
1080 strcpy(cap->driver, "cx8800"); 1079 strcpy(cap->driver, "cx8800");
1081 strlcpy(cap->card, cx88_boards[core->board].name, 1080 strlcpy(cap->card, core->board.name, sizeof(cap->card));
1082 sizeof(cap->card));
1083 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); 1081 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci));
1084 cap->version = CX88_VERSION_CODE; 1082 cap->version = CX88_VERSION_CODE;
1085 cap->capabilities = 1083 cap->capabilities =
@@ -1087,7 +1085,7 @@ static int vidioc_querycap (struct file *file, void *priv,
1087 V4L2_CAP_READWRITE | 1085 V4L2_CAP_READWRITE |
1088 V4L2_CAP_STREAMING | 1086 V4L2_CAP_STREAMING |
1089 V4L2_CAP_VBI_CAPTURE; 1087 V4L2_CAP_VBI_CAPTURE;
1090 if (UNSET != core->tuner_type) 1088 if (UNSET != core->board.tuner_type)
1091 cap->capabilities |= V4L2_CAP_TUNER; 1089 cap->capabilities |= V4L2_CAP_TUNER;
1092 return 0; 1090 return 0;
1093} 1091}
@@ -1221,14 +1219,14 @@ int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
1221 n = i->index; 1219 n = i->index;
1222 if (n >= 4) 1220 if (n >= 4)
1223 return -EINVAL; 1221 return -EINVAL;
1224 if (0 == INPUT(n)->type) 1222 if (0 == INPUT(n).type)
1225 return -EINVAL; 1223 return -EINVAL;
1226 memset(i,0,sizeof(*i)); 1224 memset(i,0,sizeof(*i));
1227 i->index = n; 1225 i->index = n;
1228 i->type = V4L2_INPUT_TYPE_CAMERA; 1226 i->type = V4L2_INPUT_TYPE_CAMERA;
1229 strcpy(i->name,iname[INPUT(n)->type]); 1227 strcpy(i->name,iname[INPUT(n).type]);
1230 if ((CX88_VMUX_TELEVISION == INPUT(n)->type) || 1228 if ((CX88_VMUX_TELEVISION == INPUT(n).type) ||
1231 (CX88_VMUX_CABLE == INPUT(n)->type)) 1229 (CX88_VMUX_CABLE == INPUT(n).type))
1232 i->type = V4L2_INPUT_TYPE_TUNER; 1230 i->type = V4L2_INPUT_TYPE_TUNER;
1233 i->std = CX88_NORMS; 1231 i->std = CX88_NORMS;
1234 return 0; 1232 return 0;
@@ -1297,7 +1295,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
1297 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; 1295 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1298 u32 reg; 1296 u32 reg;
1299 1297
1300 if (unlikely(UNSET == core->tuner_type)) 1298 if (unlikely(UNSET == core->board.tuner_type))
1301 return -EINVAL; 1299 return -EINVAL;
1302 if (0 != t->index) 1300 if (0 != t->index)
1303 return -EINVAL; 1301 return -EINVAL;
@@ -1318,7 +1316,7 @@ static int vidioc_s_tuner (struct file *file, void *priv,
1318{ 1316{
1319 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; 1317 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1320 1318
1321 if (UNSET == core->tuner_type) 1319 if (UNSET == core->board.tuner_type)
1322 return -EINVAL; 1320 return -EINVAL;
1323 if (0 != t->index) 1321 if (0 != t->index)
1324 return -EINVAL; 1322 return -EINVAL;
@@ -1333,7 +1331,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
1333 struct cx8800_fh *fh = priv; 1331 struct cx8800_fh *fh = priv;
1334 struct cx88_core *core = fh->dev->core; 1332 struct cx88_core *core = fh->dev->core;
1335 1333
1336 if (unlikely(UNSET == core->tuner_type)) 1334 if (unlikely(UNSET == core->board.tuner_type))
1337 return -EINVAL; 1335 return -EINVAL;
1338 1336
1339 /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */ 1337 /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */
@@ -1348,7 +1346,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
1348int cx88_set_freq (struct cx88_core *core, 1346int cx88_set_freq (struct cx88_core *core,
1349 struct v4l2_frequency *f) 1347 struct v4l2_frequency *f)
1350{ 1348{
1351 if (unlikely(UNSET == core->tuner_type)) 1349 if (unlikely(UNSET == core->board.tuner_type))
1352 return -EINVAL; 1350 return -EINVAL;
1353 if (unlikely(f->tuner != 0)) 1351 if (unlikely(f->tuner != 0))
1354 return -EINVAL; 1352 return -EINVAL;
@@ -1419,8 +1417,7 @@ static int radio_querycap (struct file *file, void *priv,
1419 struct cx88_core *core = dev->core; 1417 struct cx88_core *core = dev->core;
1420 1418
1421 strcpy(cap->driver, "cx8800"); 1419 strcpy(cap->driver, "cx8800");
1422 strlcpy(cap->card, cx88_boards[core->board].name, 1420 strlcpy(cap->card, core->board.name, sizeof(cap->card));
1423 sizeof(cap->card));
1424 sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); 1421 sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci));
1425 cap->version = CX88_VERSION_CODE; 1422 cap->version = CX88_VERSION_CODE;
1426 cap->capabilities = V4L2_CAP_TUNER; 1423 cap->capabilities = V4L2_CAP_TUNER;
@@ -1828,10 +1825,10 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1828 cx_set(MO_PCI_INTMSK, core->pci_irqmask); 1825 cx_set(MO_PCI_INTMSK, core->pci_irqmask);
1829 1826
1830 /* load and configure helper modules */ 1827 /* load and configure helper modules */
1831 if (TUNER_ABSENT != core->tuner_type) 1828 if (TUNER_ABSENT != core->board.tuner_type)
1832 request_module("tuner"); 1829 request_module("tuner");
1833 1830
1834 if (cx88_boards[ core->board ].audio_chip == AUDIO_CHIP_WM8775) 1831 if (core->board.audio_chip == AUDIO_CHIP_WM8775)
1835 request_module("wm8775"); 1832 request_module("wm8775");
1836 1833
1837 /* register v4l devices */ 1834 /* register v4l devices */
@@ -1858,7 +1855,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1858 printk(KERN_INFO "%s/0: registered device vbi%d\n", 1855 printk(KERN_INFO "%s/0: registered device vbi%d\n",
1859 core->name,dev->vbi_dev->minor & 0x1f); 1856 core->name,dev->vbi_dev->minor & 0x1f);
1860 1857
1861 if (core->has_radio) { 1858 if (core->board.radio.type == CX88_RADIO) {
1862 dev->radio_dev = cx88_vdev_init(core,dev->pci, 1859 dev->radio_dev = cx88_vdev_init(core,dev->pci,
1863 &cx8800_radio_template,"radio"); 1860 &cx8800_radio_template,"radio");
1864 err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO, 1861 err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO,
@@ -1884,7 +1881,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1884 mutex_unlock(&core->lock); 1881 mutex_unlock(&core->lock);
1885 1882
1886 /* start tvaudio thread */ 1883 /* start tvaudio thread */
1887 if (core->tuner_type != TUNER_ABSENT) { 1884 if (core->board.tuner_type != TUNER_ABSENT) {
1888 core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio"); 1885 core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio");
1889 if (IS_ERR(core->kthread)) { 1886 if (IS_ERR(core->kthread)) {
1890 err = PTR_ERR(core->kthread); 1887 err = PTR_ERR(core->kthread);
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c
index cd0877636a32..f76ca9e2eebf 100644
--- a/drivers/media/video/cx88/cx88-vp3054-i2c.c
+++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c
@@ -111,7 +111,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
111 struct vp3054_i2c_state *vp3054_i2c; 111 struct vp3054_i2c_state *vp3054_i2c;
112 int rc; 112 int rc;
113 113
114 if (core->board != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) 114 if (core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO)
115 return 0; 115 return 0;
116 116
117 dev->card_priv = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL); 117 dev->card_priv = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL);
@@ -152,7 +152,7 @@ void vp3054_i2c_remove(struct cx8802_dev *dev)
152 struct vp3054_i2c_state *vp3054_i2c = dev->card_priv; 152 struct vp3054_i2c_state *vp3054_i2c = dev->card_priv;
153 153
154 if (vp3054_i2c == NULL || 154 if (vp3054_i2c == NULL ||
155 dev->core->board != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) 155 dev->core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO)
156 return; 156 return;
157 157
158 i2c_del_adapter(&vp3054_i2c->adap); 158 i2c_del_adapter(&vp3054_i2c->adap);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 78486f90327a..3636ec26de59 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -250,7 +250,7 @@ struct cx88_subid {
250 u32 card; 250 u32 card;
251}; 251};
252 252
253#define INPUT(nr) (&cx88_boards[core->board].input[nr]) 253#define INPUT(nr) (core->board.input[nr])
254 254
255/* ----------------------------------------------------------- */ 255/* ----------------------------------------------------------- */
256/* device / file handle status */ 256/* device / file handle status */
@@ -304,13 +304,8 @@ struct cx88_core {
304 u32 i2c_state, i2c_rc; 304 u32 i2c_state, i2c_rc;
305 305
306 /* config info -- analog */ 306 /* config info -- analog */
307 unsigned int board; 307 unsigned int boardnr;
308 unsigned int tuner_type; 308 struct cx88_board board;
309 unsigned int radio_type;
310 unsigned char tuner_addr;
311 unsigned char radio_addr;
312 unsigned int tda9887_conf;
313 unsigned int has_radio;
314 309
315 /* Supported V4L _STD_ tuner formats */ 310 /* Supported V4L _STD_ tuner formats */
316 unsigned int tuner_formats; 311 unsigned int tuner_formats;
@@ -585,7 +580,7 @@ extern void cx88_call_i2c_clients(struct cx88_core *core,
585/* ----------------------------------------------------------- */ 580/* ----------------------------------------------------------- */
586/* cx88-cards.c */ 581/* cx88-cards.c */
587 582
588extern struct cx88_board cx88_boards[]; 583extern const struct cx88_board cx88_boards[];
589extern const unsigned int cx88_bcount; 584extern const unsigned int cx88_bcount;
590 585
591extern struct cx88_subid cx88_subids[]; 586extern struct cx88_subid cx88_subids[];