V4L/DVB (9020): Added support for TBS 8920 DVB-S/S2 card
[safe/jmp/linux-2.6] / drivers / media / video / cx88 / cx88-cards.c
1 /*
2  *
3  * device driver for Conexant 2388x based TV cards
4  * card-specific stuff.
5  *
6  * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 #include <linux/init.h>
24 #include <linux/module.h>
25 #include <linux/pci.h>
26 #include <linux/delay.h>
27
28 #include "cx88.h"
29 #include "tea5767.h"
30
31 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
32 static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
33 static unsigned int card[]  = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
34
35 module_param_array(tuner, int, NULL, 0444);
36 module_param_array(radio, int, NULL, 0444);
37 module_param_array(card,  int, NULL, 0444);
38
39 MODULE_PARM_DESC(tuner,"tuner type");
40 MODULE_PARM_DESC(radio,"radio tuner type");
41 MODULE_PARM_DESC(card,"card type");
42
43 static unsigned int latency = UNSET;
44 module_param(latency,int,0444);
45 MODULE_PARM_DESC(latency,"pci latency timer");
46
47 #define info_printk(core, fmt, arg...) \
48         printk(KERN_INFO "%s: " fmt, core->name , ## arg)
49
50 #define warn_printk(core, fmt, arg...) \
51         printk(KERN_WARNING "%s: " fmt, core->name , ## arg)
52
53 #define err_printk(core, fmt, arg...) \
54         printk(KERN_ERR "%s: " fmt, core->name , ## arg)
55
56
57 /* ------------------------------------------------------------------ */
58 /* board config info                                                  */
59
60 /* If radio_type !=UNSET, radio_addr should be specified
61  */
62
63 static const struct cx88_board cx88_boards[] = {
64         [CX88_BOARD_UNKNOWN] = {
65                 .name           = "UNKNOWN/GENERIC",
66                 .tuner_type     = UNSET,
67                 .radio_type     = UNSET,
68                 .tuner_addr     = ADDR_UNSET,
69                 .radio_addr     = ADDR_UNSET,
70                 .input          = {{
71                         .type   = CX88_VMUX_COMPOSITE1,
72                         .vmux   = 0,
73                 },{
74                         .type   = CX88_VMUX_COMPOSITE2,
75                         .vmux   = 1,
76                 },{
77                         .type   = CX88_VMUX_COMPOSITE3,
78                         .vmux   = 2,
79                 },{
80                         .type   = CX88_VMUX_COMPOSITE4,
81                         .vmux   = 3,
82                 }},
83         },
84         [CX88_BOARD_HAUPPAUGE] = {
85                 .name           = "Hauppauge WinTV 34xxx models",
86                 .tuner_type     = UNSET,
87                 .radio_type     = UNSET,
88                 .tuner_addr     = ADDR_UNSET,
89                 .radio_addr     = ADDR_UNSET,
90                 .tda9887_conf   = TDA9887_PRESENT,
91                 .input          = {{
92                         .type   = CX88_VMUX_TELEVISION,
93                         .vmux   = 0,
94                         .gpio0  = 0xff00,  // internal decoder
95                 },{
96                         .type   = CX88_VMUX_DEBUG,
97                         .vmux   = 0,
98                         .gpio0  = 0xff01,  // mono from tuner chip
99                 },{
100                         .type   = CX88_VMUX_COMPOSITE1,
101                         .vmux   = 1,
102                         .gpio0  = 0xff02,
103                 },{
104                         .type   = CX88_VMUX_SVIDEO,
105                         .vmux   = 2,
106                         .gpio0  = 0xff02,
107                 }},
108                 .radio = {
109                         .type   = CX88_RADIO,
110                         .gpio0  = 0xff01,
111                 },
112         },
113         [CX88_BOARD_GDI] = {
114                 .name           = "GDI Black Gold",
115                 .tuner_type     = UNSET,
116                 .radio_type     = UNSET,
117                 .tuner_addr     = ADDR_UNSET,
118                 .radio_addr     = ADDR_UNSET,
119                 .input          = {{
120                         .type   = CX88_VMUX_TELEVISION,
121                         .vmux   = 0,
122                 },{
123                         .type   = CX88_VMUX_SVIDEO,
124                         .vmux   = 2,
125                 }},
126         },
127         [CX88_BOARD_PIXELVIEW] = {
128                 .name           = "PixelView",
129                 .tuner_type     = TUNER_PHILIPS_PAL,
130                 .radio_type     = UNSET,
131                 .tuner_addr     = ADDR_UNSET,
132                 .radio_addr     = ADDR_UNSET,
133                 .input          = {{
134                         .type   = CX88_VMUX_TELEVISION,
135                         .vmux   = 0,
136                         .gpio0  = 0xff00,  // internal decoder
137                 },{
138                         .type   = CX88_VMUX_COMPOSITE1,
139                         .vmux   = 1,
140                 },{
141                         .type   = CX88_VMUX_SVIDEO,
142                         .vmux   = 2,
143                 }},
144                 .radio = {
145                          .type  = CX88_RADIO,
146                          .gpio0 = 0xff10,
147                 },
148         },
149         [CX88_BOARD_ATI_WONDER_PRO] = {
150                 .name           = "ATI TV Wonder Pro",
151                 .tuner_type     = TUNER_PHILIPS_4IN1,
152                 .radio_type     = UNSET,
153                 .tuner_addr     = ADDR_UNSET,
154                 .radio_addr     = ADDR_UNSET,
155                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
156                 .input          = {{
157                         .type   = CX88_VMUX_TELEVISION,
158                         .vmux   = 0,
159                         .gpio0  = 0x03ff,
160                 },{
161                         .type   = CX88_VMUX_COMPOSITE1,
162                         .vmux   = 1,
163                         .gpio0  = 0x03fe,
164                 },{
165                         .type   = CX88_VMUX_SVIDEO,
166                         .vmux   = 2,
167                         .gpio0  = 0x03fe,
168                 }},
169         },
170         [CX88_BOARD_WINFAST2000XP_EXPERT] = {
171                 .name           = "Leadtek Winfast 2000XP Expert",
172                 .tuner_type     = TUNER_PHILIPS_4IN1,
173                 .radio_type     = UNSET,
174                 .tuner_addr     = ADDR_UNSET,
175                 .radio_addr     = ADDR_UNSET,
176                 .tda9887_conf   = TDA9887_PRESENT,
177                 .input          = {{
178                         .type   = CX88_VMUX_TELEVISION,
179                         .vmux   = 0,
180                         .gpio0  = 0x00F5e700,
181                         .gpio1  = 0x00003004,
182                         .gpio2  = 0x00F5e700,
183                         .gpio3  = 0x02000000,
184                 },{
185                         .type   = CX88_VMUX_COMPOSITE1,
186                         .vmux   = 1,
187                         .gpio0  = 0x00F5c700,
188                         .gpio1  = 0x00003004,
189                         .gpio2  = 0x00F5c700,
190                         .gpio3  = 0x02000000,
191                 },{
192                         .type   = CX88_VMUX_SVIDEO,
193                         .vmux   = 2,
194                         .gpio0  = 0x00F5c700,
195                         .gpio1  = 0x00003004,
196                         .gpio2  = 0x00F5c700,
197                         .gpio3  = 0x02000000,
198                 }},
199                 .radio = {
200                         .type   = CX88_RADIO,
201                         .gpio0  = 0x00F5d700,
202                         .gpio1  = 0x00003004,
203                         .gpio2  = 0x00F5d700,
204                         .gpio3  = 0x02000000,
205                 },
206         },
207         [CX88_BOARD_AVERTV_STUDIO_303] = {
208                 .name           = "AverTV Studio 303 (M126)",
209                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
210                 .radio_type     = UNSET,
211                 .tuner_addr     = ADDR_UNSET,
212                 .radio_addr     = ADDR_UNSET,
213                 .tda9887_conf   = TDA9887_PRESENT,
214                 .input          = {{
215                         .type   = CX88_VMUX_TELEVISION,
216                         .vmux   = 0,
217                         .gpio1  = 0xe09f,
218                 },{
219                         .type   = CX88_VMUX_COMPOSITE1,
220                         .vmux   = 1,
221                         .gpio1  = 0xe05f,
222                 },{
223                         .type   = CX88_VMUX_SVIDEO,
224                         .vmux   = 2,
225                         .gpio1  = 0xe05f,
226                 }},
227                 .radio = {
228                         .gpio1  = 0xe0df,
229                         .type   = CX88_RADIO,
230                 },
231         },
232         [CX88_BOARD_MSI_TVANYWHERE_MASTER] = {
233                 // added gpio values thanks to Michal
234                 // values for PAL from DScaler
235                 .name           = "MSI TV-@nywhere Master",
236                 .tuner_type     = TUNER_MT2032,
237                 .radio_type     = UNSET,
238                 .tuner_addr     = ADDR_UNSET,
239                 .radio_addr     = ADDR_UNSET,
240                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER_NTSC,
241                 .input          = {{
242                         .type   = CX88_VMUX_TELEVISION,
243                         .vmux   = 0,
244                         .gpio0  = 0x000040bf,
245                         .gpio1  = 0x000080c0,
246                         .gpio2  = 0x0000ff40,
247                 },{
248                         .type   = CX88_VMUX_COMPOSITE1,
249                         .vmux   = 1,
250                         .gpio0  = 0x000040bf,
251                         .gpio1  = 0x000080c0,
252                         .gpio2  = 0x0000ff40,
253                 },{
254                         .type   = CX88_VMUX_SVIDEO,
255                         .vmux   = 2,
256                         .gpio0  = 0x000040bf,
257                         .gpio1  = 0x000080c0,
258                         .gpio2  = 0x0000ff40,
259                 }},
260                 .radio = {
261                          .type   = CX88_RADIO,
262                          .vmux   = 3,
263                          .gpio0  = 0x000040bf,
264                          .gpio1  = 0x000080c0,
265                          .gpio2  = 0x0000ff20,
266                 },
267         },
268         [CX88_BOARD_WINFAST_DV2000] = {
269                 .name           = "Leadtek Winfast DV2000",
270                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
271                 .radio_type     = UNSET,
272                 .tuner_addr     = ADDR_UNSET,
273                 .radio_addr     = ADDR_UNSET,
274                 .tda9887_conf   = TDA9887_PRESENT,
275                 .input          = {{
276                         .type   = CX88_VMUX_TELEVISION,
277                         .vmux   = 0,
278                         .gpio0  = 0x0035e700,
279                         .gpio1  = 0x00003004,
280                         .gpio2  = 0x0035e700,
281                         .gpio3  = 0x02000000,
282                 },{
283
284                         .type   = CX88_VMUX_COMPOSITE1,
285                         .vmux   = 1,
286                         .gpio0  = 0x0035c700,
287                         .gpio1  = 0x00003004,
288                         .gpio2  = 0x0035c700,
289                         .gpio3  = 0x02000000,
290                 },{
291                         .type   = CX88_VMUX_SVIDEO,
292                         .vmux   = 2,
293                         .gpio0  = 0x0035c700,
294                         .gpio1  = 0x0035c700,
295                         .gpio2  = 0x02000000,
296                         .gpio3  = 0x02000000,
297                 }},
298                 .radio = {
299                         .type   = CX88_RADIO,
300                         .gpio0  = 0x0035d700,
301                         .gpio1  = 0x00007004,
302                         .gpio2  = 0x0035d700,
303                         .gpio3  = 0x02000000,
304                 },
305         },
306         [CX88_BOARD_LEADTEK_PVR2000] = {
307                 // gpio values for PAL version from regspy by DScaler
308                 .name           = "Leadtek PVR 2000",
309                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
310                 .radio_type     = UNSET,
311                 .tuner_addr     = ADDR_UNSET,
312                 .radio_addr     = ADDR_UNSET,
313                 .tda9887_conf   = TDA9887_PRESENT,
314                 .input          = {{
315                         .type   = CX88_VMUX_TELEVISION,
316                         .vmux   = 0,
317                         .gpio0  = 0x0000bde2,
318                         .audioroute = 1,
319                 },{
320                         .type   = CX88_VMUX_COMPOSITE1,
321                         .vmux   = 1,
322                         .gpio0  = 0x0000bde6,
323                         .audioroute = 1,
324                 },{
325                         .type   = CX88_VMUX_SVIDEO,
326                         .vmux   = 2,
327                         .gpio0  = 0x0000bde6,
328                         .audioroute = 1,
329                 }},
330                 .radio = {
331                         .type   = CX88_RADIO,
332                         .gpio0  = 0x0000bd62,
333                         .audioroute = 1,
334                 },
335                 .mpeg           = CX88_MPEG_BLACKBIRD,
336         },
337         [CX88_BOARD_IODATA_GVVCP3PCI] = {
338                 .name           = "IODATA GV-VCP3/PCI",
339                 .tuner_type     = TUNER_ABSENT,
340                 .radio_type     = UNSET,
341                 .tuner_addr     = ADDR_UNSET,
342                 .radio_addr     = ADDR_UNSET,
343                 .input          = {{
344                         .type   = CX88_VMUX_COMPOSITE1,
345                         .vmux   = 0,
346                 },{
347                         .type   = CX88_VMUX_COMPOSITE2,
348                         .vmux   = 1,
349                 },{
350                         .type   = CX88_VMUX_SVIDEO,
351                         .vmux   = 2,
352                 }},
353         },
354         [CX88_BOARD_PROLINK_PLAYTVPVR] = {
355                 .name           = "Prolink PlayTV PVR",
356                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
357                 .radio_type     = UNSET,
358                 .tuner_addr     = ADDR_UNSET,
359                 .radio_addr     = ADDR_UNSET,
360                 .tda9887_conf   = TDA9887_PRESENT,
361                 .input          = {{
362                         .type   = CX88_VMUX_TELEVISION,
363                         .vmux   = 0,
364                         .gpio0  = 0xbff0,
365                 },{
366                         .type   = CX88_VMUX_COMPOSITE1,
367                         .vmux   = 1,
368                         .gpio0  = 0xbff3,
369                 },{
370                         .type   = CX88_VMUX_SVIDEO,
371                         .vmux   = 2,
372                         .gpio0  = 0xbff3,
373                 }},
374                 .radio = {
375                         .type   = CX88_RADIO,
376                         .gpio0  = 0xbff0,
377                 },
378         },
379         [CX88_BOARD_ASUS_PVR_416] = {
380                 .name           = "ASUS PVR-416",
381                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
382                 .radio_type     = UNSET,
383                 .tuner_addr     = ADDR_UNSET,
384                 .radio_addr     = ADDR_UNSET,
385                 .tda9887_conf   = TDA9887_PRESENT,
386                 .input          = {{
387                         .type   = CX88_VMUX_TELEVISION,
388                         .vmux   = 0,
389                         .gpio0  = 0x0000fde6,
390                 },{
391                         .type   = CX88_VMUX_SVIDEO,
392                         .vmux   = 2,
393                         .gpio0  = 0x0000fde6, // 0x0000fda6 L,R RCA audio in?
394                         .audioroute = 1,
395                 }},
396                 .radio = {
397                         .type   = CX88_RADIO,
398                         .gpio0  = 0x0000fde2,
399                 },
400                 .mpeg           = CX88_MPEG_BLACKBIRD,
401         },
402         [CX88_BOARD_MSI_TVANYWHERE] = {
403                 .name           = "MSI TV-@nywhere",
404                 .tuner_type     = TUNER_MT2032,
405                 .radio_type     = UNSET,
406                 .tuner_addr     = ADDR_UNSET,
407                 .radio_addr     = ADDR_UNSET,
408                 .tda9887_conf   = TDA9887_PRESENT,
409                 .input          = {{
410                         .type   = CX88_VMUX_TELEVISION,
411                         .vmux   = 0,
412                         .gpio0  = 0x00000fbf,
413                         .gpio2  = 0x0000fc08,
414                 },{
415                         .type   = CX88_VMUX_COMPOSITE1,
416                         .vmux   = 1,
417                         .gpio0  = 0x00000fbf,
418                         .gpio2  = 0x0000fc68,
419                 },{
420                         .type   = CX88_VMUX_SVIDEO,
421                         .vmux   = 2,
422                         .gpio0  = 0x00000fbf,
423                         .gpio2  = 0x0000fc68,
424                 }},
425         },
426         [CX88_BOARD_KWORLD_DVB_T] = {
427                 .name           = "KWorld/VStream XPert DVB-T",
428                 .tuner_type     = TUNER_ABSENT,
429                 .radio_type     = UNSET,
430                 .tuner_addr     = ADDR_UNSET,
431                 .radio_addr     = ADDR_UNSET,
432                 .input          = {{
433                         .type   = CX88_VMUX_COMPOSITE1,
434                         .vmux   = 1,
435                         .gpio0  = 0x0700,
436                         .gpio2  = 0x0101,
437                 },{
438                         .type   = CX88_VMUX_SVIDEO,
439                         .vmux   = 2,
440                         .gpio0  = 0x0700,
441                         .gpio2  = 0x0101,
442                 }},
443                 .mpeg           = CX88_MPEG_DVB,
444         },
445         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = {
446                 .name           = "DViCO FusionHDTV DVB-T1",
447                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
448                 .radio_type     = UNSET,
449                 .tuner_addr     = ADDR_UNSET,
450                 .radio_addr     = ADDR_UNSET,
451                 .input          = {{
452                         .type   = CX88_VMUX_COMPOSITE1,
453                         .vmux   = 1,
454                         .gpio0  = 0x000027df,
455                 },{
456                         .type   = CX88_VMUX_SVIDEO,
457                         .vmux   = 2,
458                         .gpio0  = 0x000027df,
459                 }},
460                 .mpeg           = CX88_MPEG_DVB,
461         },
462         [CX88_BOARD_KWORLD_LTV883] = {
463                 .name           = "KWorld LTV883RF",
464                 .tuner_type     = TUNER_TNF_8831BGFF,
465                 .radio_type     = UNSET,
466                 .tuner_addr     = ADDR_UNSET,
467                 .radio_addr     = ADDR_UNSET,
468                 .input          = {{
469                         .type   = CX88_VMUX_TELEVISION,
470                         .vmux   = 0,
471                         .gpio0  = 0x07f8,
472                 },{
473                         .type   = CX88_VMUX_DEBUG,
474                         .vmux   = 0,
475                         .gpio0  = 0x07f9,  // mono from tuner chip
476                 },{
477                         .type   = CX88_VMUX_COMPOSITE1,
478                         .vmux   = 1,
479                         .gpio0  = 0x000007fa,
480                 },{
481                         .type   = CX88_VMUX_SVIDEO,
482                         .vmux   = 2,
483                         .gpio0  = 0x000007fa,
484                 }},
485                 .radio = {
486                         .type   = CX88_RADIO,
487                         .gpio0  = 0x000007f8,
488                 },
489         },
490         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q] = {
491                 .name           = "DViCO FusionHDTV 3 Gold-Q",
492                 .tuner_type     = TUNER_MICROTUNE_4042FI5,
493                 .radio_type     = UNSET,
494                 .tuner_addr     = ADDR_UNSET,
495                 .radio_addr     = ADDR_UNSET,
496                 /*
497                    GPIO[0] resets DT3302 DTV receiver
498                     0 - reset asserted
499                     1 - normal operation
500                    GPIO[1] mutes analog audio output connector
501                     0 - enable selected source
502                     1 - mute
503                    GPIO[2] selects source for analog audio output connector
504                     0 - analog audio input connector on tab
505                     1 - analog DAC output from CX23881 chip
506                    GPIO[3] selects RF input connector on tuner module
507                     0 - RF connector labeled CABLE
508                     1 - RF connector labeled ANT
509                    GPIO[4] selects high RF for QAM256 mode
510                     0 - normal RF
511                     1 - high RF
512                 */
513                 .input          = {{
514                         .type   = CX88_VMUX_TELEVISION,
515                         .vmux   = 0,
516                         .gpio0  = 0x0f0d,
517                 },{
518                         .type   = CX88_VMUX_CABLE,
519                         .vmux   = 0,
520                         .gpio0  = 0x0f05,
521                 },{
522                         .type   = CX88_VMUX_COMPOSITE1,
523                         .vmux   = 1,
524                         .gpio0  = 0x0f00,
525                 },{
526                         .type   = CX88_VMUX_SVIDEO,
527                         .vmux   = 2,
528                         .gpio0  = 0x0f00,
529                 }},
530                 .mpeg           = CX88_MPEG_DVB,
531         },
532         [CX88_BOARD_HAUPPAUGE_DVB_T1] = {
533                 .name           = "Hauppauge Nova-T DVB-T",
534                 .tuner_type     = TUNER_ABSENT,
535                 .radio_type     = UNSET,
536                 .tuner_addr     = ADDR_UNSET,
537                 .radio_addr     = ADDR_UNSET,
538                 .input          = {{
539                         .type   = CX88_VMUX_DVB,
540                         .vmux   = 0,
541                 }},
542                 .mpeg           = CX88_MPEG_DVB,
543         },
544         [CX88_BOARD_CONEXANT_DVB_T1] = {
545                 .name           = "Conexant DVB-T reference design",
546                 .tuner_type     = TUNER_ABSENT,
547                 .radio_type     = UNSET,
548                 .tuner_addr     = ADDR_UNSET,
549                 .radio_addr     = ADDR_UNSET,
550                 .input          = {{
551                         .type   = CX88_VMUX_DVB,
552                         .vmux   = 0,
553                 }},
554                 .mpeg           = CX88_MPEG_DVB,
555         },
556         [CX88_BOARD_PROVIDEO_PV259] = {
557                 .name           = "Provideo PV259",
558                 .tuner_type     = TUNER_PHILIPS_FQ1216ME,
559                 .radio_type     = UNSET,
560                 .tuner_addr     = ADDR_UNSET,
561                 .radio_addr     = ADDR_UNSET,
562                 .input          = {{
563                         .type   = CX88_VMUX_TELEVISION,
564                         .vmux   = 0,
565                         .audioroute = 1,
566                 }},
567                 .mpeg           = CX88_MPEG_BLACKBIRD,
568         },
569         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
570                 .name           = "DViCO FusionHDTV DVB-T Plus",
571                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
572                 .radio_type     = UNSET,
573                 .tuner_addr     = ADDR_UNSET,
574                 .radio_addr     = ADDR_UNSET,
575                 .input          = {{
576                         .type   = CX88_VMUX_COMPOSITE1,
577                         .vmux   = 1,
578                         .gpio0  = 0x000027df,
579                 },{
580                         .type   = CX88_VMUX_SVIDEO,
581                         .vmux   = 2,
582                         .gpio0  = 0x000027df,
583                 }},
584                 .mpeg           = CX88_MPEG_DVB,
585         },
586         [CX88_BOARD_DNTV_LIVE_DVB_T] = {
587                 .name           = "digitalnow DNTV Live! DVB-T",
588                 .tuner_type     = TUNER_ABSENT,
589                 .radio_type     = UNSET,
590                 .tuner_addr     = ADDR_UNSET,
591                 .radio_addr     = ADDR_UNSET,
592                 .input          = {{
593                         .type   = CX88_VMUX_COMPOSITE1,
594                         .vmux   = 1,
595                         .gpio0  = 0x00000700,
596                         .gpio2  = 0x00000101,
597                 },{
598                         .type   = CX88_VMUX_SVIDEO,
599                         .vmux   = 2,
600                         .gpio0  = 0x00000700,
601                         .gpio2  = 0x00000101,
602                 }},
603                 .mpeg           = CX88_MPEG_DVB,
604         },
605         [CX88_BOARD_PCHDTV_HD3000] = {
606                 .name           = "pcHDTV HD3000 HDTV",
607                 .tuner_type     = TUNER_THOMSON_DTT761X,
608                 .radio_type     = UNSET,
609                 .tuner_addr     = ADDR_UNSET,
610                 .radio_addr     = ADDR_UNSET,
611                 .tda9887_conf   = TDA9887_PRESENT,
612                 /* GPIO[2] = audio source for analog audio out connector
613                  *  0 = analog audio input connector
614                  *  1 = CX88 audio DACs
615                  *
616                  * GPIO[7] = input to CX88's audio/chroma ADC
617                  *  0 = FM 10.7 MHz IF
618                  *  1 = Sound 4.5 MHz IF
619                  *
620                  * GPIO[1,5,6] = Oren 51132 pins 27,35,28 respectively
621                  *
622                  * GPIO[16] = Remote control input
623                  */
624                 .input          = {{
625                         .type   = CX88_VMUX_TELEVISION,
626                         .vmux   = 0,
627                         .gpio0  = 0x00008484,
628                 },{
629                         .type   = CX88_VMUX_COMPOSITE1,
630                         .vmux   = 1,
631                         .gpio0  = 0x00008400,
632                 },{
633                         .type   = CX88_VMUX_SVIDEO,
634                         .vmux   = 2,
635                         .gpio0  = 0x00008400,
636                 }},
637                 .radio = {
638                         .type   = CX88_RADIO,
639                         .gpio0  = 0x00008404,
640                 },
641                 .mpeg           = CX88_MPEG_DVB,
642         },
643         [CX88_BOARD_HAUPPAUGE_ROSLYN] = {
644                 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu>
645                 // GPIO values obtained from regspy, courtesy Sean Covel
646                 .name           = "Hauppauge WinTV 28xxx (Roslyn) models",
647                 .tuner_type     = UNSET,
648                 .radio_type     = UNSET,
649                 .tuner_addr     = ADDR_UNSET,
650                 .radio_addr     = ADDR_UNSET,
651                 .input          = {{
652                         .type   = CX88_VMUX_TELEVISION,
653                         .vmux   = 0,
654                         .gpio0  = 0xed1a,
655                         .gpio2  = 0x00ff,
656                 },{
657                         .type   = CX88_VMUX_DEBUG,
658                         .vmux   = 0,
659                         .gpio0  = 0xff01,
660                 },{
661                         .type   = CX88_VMUX_COMPOSITE1,
662                         .vmux   = 1,
663                         .gpio0  = 0xff02,
664                 },{
665                         .type   = CX88_VMUX_SVIDEO,
666                         .vmux   = 2,
667                         .gpio0  = 0xed92,
668                         .gpio2  = 0x00ff,
669                 }},
670                 .radio = {
671                          .type   = CX88_RADIO,
672                          .gpio0  = 0xed96,
673                          .gpio2  = 0x00ff,
674                  },
675                 .mpeg           = CX88_MPEG_BLACKBIRD,
676         },
677         [CX88_BOARD_DIGITALLOGIC_MEC] = {
678                 .name           = "Digital-Logic MICROSPACE Entertainment Center (MEC)",
679                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
680                 .radio_type     = UNSET,
681                 .tuner_addr     = ADDR_UNSET,
682                 .radio_addr     = ADDR_UNSET,
683                 .tda9887_conf   = TDA9887_PRESENT,
684                 .input          = {{
685                         .type   = CX88_VMUX_TELEVISION,
686                         .vmux   = 0,
687                         .gpio0  = 0x00009d80,
688                         .audioroute = 1,
689                 },{
690                         .type   = CX88_VMUX_COMPOSITE1,
691                         .vmux   = 1,
692                         .gpio0  = 0x00009d76,
693                         .audioroute = 1,
694                 },{
695                         .type   = CX88_VMUX_SVIDEO,
696                         .vmux   = 2,
697                         .gpio0  = 0x00009d76,
698                         .audioroute = 1,
699                 }},
700                 .radio = {
701                         .type   = CX88_RADIO,
702                         .gpio0  = 0x00009d00,
703                         .audioroute = 1,
704                 },
705                 .mpeg           = CX88_MPEG_BLACKBIRD,
706         },
707         [CX88_BOARD_IODATA_GVBCTV7E] = {
708                 .name           = "IODATA GV/BCTV7E",
709                 .tuner_type     = TUNER_PHILIPS_FQ1286,
710                 .radio_type     = UNSET,
711                 .tuner_addr     = ADDR_UNSET,
712                 .radio_addr     = ADDR_UNSET,
713                 .tda9887_conf   = TDA9887_PRESENT,
714                 .input          = {{
715                         .type   = CX88_VMUX_TELEVISION,
716                         .vmux   = 1,
717                         .gpio1  = 0x0000e03f,
718                 },{
719                         .type   = CX88_VMUX_COMPOSITE1,
720                         .vmux   = 2,
721                         .gpio1  = 0x0000e07f,
722                 },{
723                         .type   = CX88_VMUX_SVIDEO,
724                         .vmux   = 3,
725                         .gpio1  = 0x0000e07f,
726                 }}
727         },
728         [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = {
729                 .name           = "PixelView PlayTV Ultra Pro (Stereo)",
730                 /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */
731                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
732                 .radio_type     = UNSET,
733                 .tuner_addr     = ADDR_UNSET,
734                 .radio_addr     = ADDR_UNSET,
735                 .input          = {{
736                         .type   = CX88_VMUX_TELEVISION,
737                         .vmux   = 0,
738                         .gpio0  = 0xbf61,  /* internal decoder */
739                 },{
740                         .type   = CX88_VMUX_COMPOSITE1,
741                         .vmux   = 1,
742                         .gpio0  = 0xbf63,
743                 },{
744                         .type   = CX88_VMUX_SVIDEO,
745                         .vmux   = 2,
746                         .gpio0  = 0xbf63,
747                 }},
748                 .radio = {
749                          .type  = CX88_RADIO,
750                          .gpio0 = 0xbf60,
751                  },
752         },
753         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = {
754                 .name           = "DViCO FusionHDTV 3 Gold-T",
755                 .tuner_type     = TUNER_THOMSON_DTT761X,
756                 .radio_type     = UNSET,
757                 .tuner_addr     = ADDR_UNSET,
758                 .radio_addr     = ADDR_UNSET,
759                 .tda9887_conf   = TDA9887_PRESENT,
760                 .input          = {{
761                         .type   = CX88_VMUX_TELEVISION,
762                         .vmux   = 0,
763                         .gpio0  = 0x97ed,
764                 },{
765                         .type   = CX88_VMUX_COMPOSITE1,
766                         .vmux   = 1,
767                         .gpio0  = 0x97e9,
768                 },{
769                         .type   = CX88_VMUX_SVIDEO,
770                         .vmux   = 2,
771                         .gpio0  = 0x97e9,
772                 }},
773                 .mpeg           = CX88_MPEG_DVB,
774         },
775         [CX88_BOARD_ADSTECH_DVB_T_PCI] = {
776                 .name           = "ADS Tech Instant TV DVB-T PCI",
777                 .tuner_type     = TUNER_ABSENT,
778                 .radio_type     = UNSET,
779                 .tuner_addr     = ADDR_UNSET,
780                 .radio_addr     = ADDR_UNSET,
781                 .input          = {{
782                         .type   = CX88_VMUX_COMPOSITE1,
783                         .vmux   = 1,
784                         .gpio0  = 0x0700,
785                         .gpio2  = 0x0101,
786                 },{
787                         .type   = CX88_VMUX_SVIDEO,
788                         .vmux   = 2,
789                         .gpio0  = 0x0700,
790                         .gpio2  = 0x0101,
791                 }},
792                 .mpeg           = CX88_MPEG_DVB,
793         },
794         [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = {
795                 .name           = "TerraTec Cinergy 1400 DVB-T",
796                 .tuner_type     = TUNER_ABSENT,
797                 .input          = {{
798                         .type   = CX88_VMUX_DVB,
799                         .vmux   = 0,
800                 },{
801                         .type   = CX88_VMUX_COMPOSITE1,
802                         .vmux   = 2,
803                 },{
804                         .type   = CX88_VMUX_SVIDEO,
805                         .vmux   = 2,
806                 }},
807                 .mpeg           = CX88_MPEG_DVB,
808         },
809         [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = {
810                 .name           = "DViCO FusionHDTV 5 Gold",
811                 .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H062F */
812                 .radio_type     = UNSET,
813                 .tuner_addr     = ADDR_UNSET,
814                 .radio_addr     = ADDR_UNSET,
815                 .tda9887_conf   = TDA9887_PRESENT,
816                 .input          = {{
817                         .type   = CX88_VMUX_TELEVISION,
818                         .vmux   = 0,
819                         .gpio0  = 0x87fd,
820                 },{
821                         .type   = CX88_VMUX_COMPOSITE1,
822                         .vmux   = 1,
823                         .gpio0  = 0x87f9,
824                 },{
825                         .type   = CX88_VMUX_SVIDEO,
826                         .vmux   = 2,
827                         .gpio0  = 0x87f9,
828                 }},
829                 .mpeg           = CX88_MPEG_DVB,
830         },
831         [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = {
832                 .name           = "AverMedia UltraTV Media Center PCI 550",
833                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
834                 .radio_type     = UNSET,
835                 .tuner_addr     = ADDR_UNSET,
836                 .radio_addr     = ADDR_UNSET,
837                 .tda9887_conf   = TDA9887_PRESENT,
838                 .input          = {{
839                         .type   = CX88_VMUX_COMPOSITE1,
840                         .vmux   = 0,
841                         .gpio0  = 0x0000cd73,
842                         .audioroute = 1,
843                 },{
844                         .type   = CX88_VMUX_SVIDEO,
845                         .vmux   = 1,
846                         .gpio0  = 0x0000cd73,
847                         .audioroute = 1,
848                 },{
849                         .type   = CX88_VMUX_TELEVISION,
850                         .vmux   = 3,
851                         .gpio0  = 0x0000cdb3,
852                         .audioroute = 1,
853                 }},
854                 .radio = {
855                         .type   = CX88_RADIO,
856                         .vmux   = 2,
857                         .gpio0  = 0x0000cdf3,
858                         .audioroute = 1,
859                 },
860                 .mpeg           = CX88_MPEG_BLACKBIRD,
861         },
862         [CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD] = {
863                  /* Alexander Wold <awold@bigfoot.com> */
864                  .name           = "Kworld V-Stream Xpert DVD",
865                  .tuner_type     = UNSET,
866                  .input          = {{
867                          .type   = CX88_VMUX_COMPOSITE1,
868                          .vmux   = 1,
869                          .gpio0  = 0x03000000,
870                          .gpio1  = 0x01000000,
871                          .gpio2  = 0x02000000,
872                          .gpio3  = 0x00100000,
873                  },{
874                          .type   = CX88_VMUX_SVIDEO,
875                          .vmux   = 2,
876                          .gpio0  = 0x03000000,
877                          .gpio1  = 0x01000000,
878                          .gpio2  = 0x02000000,
879                          .gpio3  = 0x00100000,
880                  }},
881         },
882         [CX88_BOARD_ATI_HDTVWONDER] = {
883                 .name           = "ATI HDTV Wonder",
884                 .tuner_type     = TUNER_PHILIPS_TUV1236D,
885                 .radio_type     = UNSET,
886                 .tuner_addr     = ADDR_UNSET,
887                 .radio_addr     = ADDR_UNSET,
888                 .input          = {{
889                         .type   = CX88_VMUX_TELEVISION,
890                         .vmux   = 0,
891                         .gpio0  = 0x00000ff7,
892                         .gpio1  = 0x000000ff,
893                         .gpio2  = 0x00000001,
894                         .gpio3  = 0x00000000,
895                 },{
896                         .type   = CX88_VMUX_COMPOSITE1,
897                         .vmux   = 1,
898                         .gpio0  = 0x00000ffe,
899                         .gpio1  = 0x000000ff,
900                         .gpio2  = 0x00000001,
901                         .gpio3  = 0x00000000,
902                 },{
903                         .type   = CX88_VMUX_SVIDEO,
904                         .vmux   = 2,
905                         .gpio0  = 0x00000ffe,
906                         .gpio1  = 0x000000ff,
907                         .gpio2  = 0x00000001,
908                         .gpio3  = 0x00000000,
909                 }},
910                 .mpeg           = CX88_MPEG_DVB,
911         },
912         [CX88_BOARD_WINFAST_DTV1000] = {
913                 .name           = "WinFast DTV1000-T",
914                 .tuner_type     = TUNER_ABSENT,
915                 .radio_type     = UNSET,
916                 .tuner_addr     = ADDR_UNSET,
917                 .radio_addr     = ADDR_UNSET,
918                 .input          = {{
919                         .type   = CX88_VMUX_DVB,
920                         .vmux   = 0,
921                 },{
922                         .type   = CX88_VMUX_COMPOSITE1,
923                         .vmux   = 1,
924                 },{
925                         .type   = CX88_VMUX_SVIDEO,
926                         .vmux   = 2,
927                 }},
928                 .mpeg           = CX88_MPEG_DVB,
929         },
930         [CX88_BOARD_AVERTV_303] = {
931                 .name           = "AVerTV 303 (M126)",
932                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
933                 .radio_type     = UNSET,
934                 .tuner_addr     = ADDR_UNSET,
935                 .radio_addr     = ADDR_UNSET,
936                 .tda9887_conf   = TDA9887_PRESENT,
937                 .input          = {{
938                         .type   = CX88_VMUX_TELEVISION,
939                         .vmux   = 0,
940                         .gpio0  = 0x00ff,
941                         .gpio1  = 0xe09f,
942                         .gpio2  = 0x0010,
943                         .gpio3  = 0x0000,
944                 },{
945                         .type   = CX88_VMUX_COMPOSITE1,
946                         .vmux   = 1,
947                         .gpio0  = 0x00ff,
948                         .gpio1  = 0xe05f,
949                         .gpio2  = 0x0010,
950                         .gpio3  = 0x0000,
951                 },{
952                         .type   = CX88_VMUX_SVIDEO,
953                         .vmux   = 2,
954                         .gpio0  = 0x00ff,
955                         .gpio1  = 0xe05f,
956                         .gpio2  = 0x0010,
957                         .gpio3  = 0x0000,
958                 }},
959         },
960         [CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1] = {
961                 .name           = "Hauppauge Nova-S-Plus DVB-S",
962                 .tuner_type     = TUNER_ABSENT,
963                 .radio_type     = UNSET,
964                 .tuner_addr     = ADDR_UNSET,
965                 .radio_addr     = ADDR_UNSET,
966                 .input          = {{
967                         .type   = CX88_VMUX_DVB,
968                         .vmux   = 0,
969                 },{
970                         .type   = CX88_VMUX_COMPOSITE1,
971                         .vmux   = 1,
972                 },{
973                         .type   = CX88_VMUX_SVIDEO,
974                         .vmux   = 2,
975                 }},
976                 .mpeg           = CX88_MPEG_DVB,
977         },
978         [CX88_BOARD_HAUPPAUGE_NOVASE2_S1] = {
979                 .name           = "Hauppauge Nova-SE2 DVB-S",
980                 .tuner_type     = TUNER_ABSENT,
981                 .radio_type     = UNSET,
982                 .tuner_addr     = ADDR_UNSET,
983                 .radio_addr     = ADDR_UNSET,
984                 .input          = {{
985                         .type   = CX88_VMUX_DVB,
986                         .vmux   = 0,
987                 }},
988                 .mpeg           = CX88_MPEG_DVB,
989         },
990         [CX88_BOARD_KWORLD_DVBS_100] = {
991                 .name           = "KWorld DVB-S 100",
992                 .tuner_type     = TUNER_ABSENT,
993                 .radio_type     = UNSET,
994                 .tuner_addr     = ADDR_UNSET,
995                 .radio_addr     = ADDR_UNSET,
996                 .input          = {{
997                         .type   = CX88_VMUX_DVB,
998                         .vmux   = 0,
999                 },{
1000                         .type   = CX88_VMUX_COMPOSITE1,
1001                         .vmux   = 1,
1002                 },{
1003                         .type   = CX88_VMUX_SVIDEO,
1004                         .vmux   = 2,
1005                 }},
1006                 .mpeg           = CX88_MPEG_DVB,
1007         },
1008         [CX88_BOARD_HAUPPAUGE_HVR1100] = {
1009                 .name           = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid",
1010                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1011                 .radio_type     = UNSET,
1012                 .tuner_addr     = ADDR_UNSET,
1013                 .radio_addr     = ADDR_UNSET,
1014                 .tda9887_conf   = TDA9887_PRESENT,
1015                 .input          = {{
1016                         .type   = CX88_VMUX_TELEVISION,
1017                         .vmux   = 0,
1018                 },{
1019                         .type   = CX88_VMUX_COMPOSITE1,
1020                         .vmux   = 1,
1021                 },{
1022                         .type   = CX88_VMUX_SVIDEO,
1023                         .vmux   = 2,
1024                 }},
1025                 /* fixme: Add radio support */
1026                 .mpeg           = CX88_MPEG_DVB,
1027         },
1028         [CX88_BOARD_HAUPPAUGE_HVR1100LP] = {
1029                 .name           = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)",
1030                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1031                 .radio_type     = UNSET,
1032                 .tuner_addr     = ADDR_UNSET,
1033                 .radio_addr     = ADDR_UNSET,
1034                 .tda9887_conf   = TDA9887_PRESENT,
1035                 .input          = {{
1036                         .type   = CX88_VMUX_TELEVISION,
1037                         .vmux   = 0,
1038                 },{
1039                         .type   = CX88_VMUX_COMPOSITE1,
1040                         .vmux   = 1,
1041                 }},
1042                 /* fixme: Add radio support */
1043                 .mpeg           = CX88_MPEG_DVB,
1044         },
1045         [CX88_BOARD_DNTV_LIVE_DVB_T_PRO] = {
1046                 .name           = "digitalnow DNTV Live! DVB-T Pro",
1047                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1048                 .radio_type     = UNSET,
1049                 .tuner_addr     = ADDR_UNSET,
1050                 .radio_addr     = ADDR_UNSET,
1051                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE |
1052                                   TDA9887_PORT2_ACTIVE,
1053                 .input          = {{
1054                         .type   = CX88_VMUX_TELEVISION,
1055                         .vmux   = 0,
1056                         .gpio0  = 0xf80808,
1057                 },{
1058                         .type   = CX88_VMUX_COMPOSITE1,
1059                         .vmux   = 1,
1060                         .gpio0  = 0xf80808,
1061                 },{
1062                         .type   = CX88_VMUX_SVIDEO,
1063                         .vmux   = 2,
1064                         .gpio0  = 0xf80808,
1065                 }},
1066                 .radio = {
1067                          .type  = CX88_RADIO,
1068                          .gpio0 = 0xf80808,
1069                 },
1070                 .mpeg           = CX88_MPEG_DVB,
1071         },
1072         [CX88_BOARD_KWORLD_DVB_T_CX22702] = {
1073                 /* Kworld V-stream Xpert DVB-T with Thomson tuner */
1074                 /* DTT 7579 Conexant CX22702-19 Conexant CX2388x  */
1075                 /* Manenti Marco <marco_manenti@colman.it> */
1076                 .name           = "KWorld/VStream XPert DVB-T with cx22702",
1077                 .tuner_type     = TUNER_ABSENT,
1078                 .radio_type     = UNSET,
1079                 .tuner_addr     = ADDR_UNSET,
1080                 .radio_addr     = ADDR_UNSET,
1081                 .input          = {{
1082                         .type   = CX88_VMUX_COMPOSITE1,
1083                         .vmux   = 1,
1084                         .gpio0  = 0x0700,
1085                         .gpio2  = 0x0101,
1086                 },{
1087                         .type   = CX88_VMUX_SVIDEO,
1088                         .vmux   = 2,
1089                         .gpio0  = 0x0700,
1090                         .gpio2  = 0x0101,
1091                 }},
1092                 .mpeg           = CX88_MPEG_DVB,
1093         },
1094         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL] = {
1095                 .name           = "DViCO FusionHDTV DVB-T Dual Digital",
1096                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
1097                 .radio_type     = UNSET,
1098                 .tuner_addr     = ADDR_UNSET,
1099                 .radio_addr     = ADDR_UNSET,
1100                 .input          = {{
1101                         .type   = CX88_VMUX_COMPOSITE1,
1102                         .vmux   = 1,
1103                         .gpio0  = 0x000067df,
1104                  },{
1105                         .type   = CX88_VMUX_SVIDEO,
1106                         .vmux   = 2,
1107                         .gpio0  = 0x000067df,
1108                 }},
1109                 .mpeg           = CX88_MPEG_DVB,
1110         },
1111         [CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT] = {
1112                 .name           = "KWorld HardwareMpegTV XPert",
1113                 .tuner_type     = TUNER_PHILIPS_TDA8290,
1114                 .radio_type     = UNSET,
1115                 .tuner_addr     = ADDR_UNSET,
1116                 .radio_addr     = ADDR_UNSET,
1117                 .input          = {{
1118                         .type   = CX88_VMUX_TELEVISION,
1119                         .vmux   = 0,
1120                         .gpio0  = 0x3de2,
1121                         .gpio2  = 0x00ff,
1122                 },{
1123                         .type   = CX88_VMUX_COMPOSITE1,
1124                         .vmux   = 1,
1125                         .gpio0  = 0x3de6,
1126                         .audioroute = 1,
1127                 },{
1128                         .type   = CX88_VMUX_SVIDEO,
1129                         .vmux   = 2,
1130                         .gpio0  = 0x3de6,
1131                         .audioroute = 1,
1132                 }},
1133                 .radio = {
1134                         .type   = CX88_RADIO,
1135                         .gpio0  = 0x3de6,
1136                         .gpio2  = 0x00ff,
1137                 },
1138                 .mpeg           = CX88_MPEG_BLACKBIRD,
1139         },
1140         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID] = {
1141                 .name           = "DViCO FusionHDTV DVB-T Hybrid",
1142                 .tuner_type     = TUNER_THOMSON_FE6600,
1143                 .radio_type     = UNSET,
1144                 .tuner_addr     = ADDR_UNSET,
1145                 .radio_addr     = ADDR_UNSET,
1146                 .input          = {{
1147                         .type   = CX88_VMUX_TELEVISION,
1148                         .vmux   = 0,
1149                         .gpio0  = 0x0000a75f,
1150                 },{
1151                         .type   = CX88_VMUX_COMPOSITE1,
1152                         .vmux   = 1,
1153                         .gpio0  = 0x0000a75b,
1154                 },{
1155                         .type   = CX88_VMUX_SVIDEO,
1156                         .vmux   = 2,
1157                         .gpio0  = 0x0000a75b,
1158                 }},
1159                 .mpeg           = CX88_MPEG_DVB,
1160         },
1161         [CX88_BOARD_PCHDTV_HD5500] = {
1162                 .name           = "pcHDTV HD5500 HDTV",
1163                 .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H064F */
1164                 .radio_type     = UNSET,
1165                 .tuner_addr     = ADDR_UNSET,
1166                 .radio_addr     = ADDR_UNSET,
1167                 .tda9887_conf   = TDA9887_PRESENT,
1168                 .input          = {{
1169                         .type   = CX88_VMUX_TELEVISION,
1170                         .vmux   = 0,
1171                         .gpio0  = 0x87fd,
1172                 },{
1173                         .type   = CX88_VMUX_COMPOSITE1,
1174                         .vmux   = 1,
1175                         .gpio0  = 0x87f9,
1176                 },{
1177                         .type   = CX88_VMUX_SVIDEO,
1178                         .vmux   = 2,
1179                         .gpio0  = 0x87f9,
1180                 }},
1181                 .mpeg           = CX88_MPEG_DVB,
1182         },
1183         [CX88_BOARD_KWORLD_MCE200_DELUXE] = {
1184                 /* FIXME: tested TV input only, disabled composite,
1185                    svideo and radio until they can be tested also. */
1186                 .name           = "Kworld MCE 200 Deluxe",
1187                 .tuner_type     = TUNER_TENA_9533_DI,
1188                 .radio_type     = UNSET,
1189                 .tda9887_conf   = TDA9887_PRESENT,
1190                 .tuner_addr     = ADDR_UNSET,
1191                 .radio_addr     = ADDR_UNSET,
1192                 .input          = {{
1193                         .type   = CX88_VMUX_TELEVISION,
1194                         .vmux   = 0,
1195                         .gpio0  = 0x0000BDE6
1196                 }},
1197                 .mpeg           = CX88_MPEG_BLACKBIRD,
1198         },
1199         [CX88_BOARD_PIXELVIEW_PLAYTV_P7000] = {
1200                 /* FIXME: SVideo, Composite and FM inputs are untested */
1201                 .name           = "PixelView PlayTV P7000",
1202                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
1203                 .radio_type     = UNSET,
1204                 .tuner_addr     = ADDR_UNSET,
1205                 .radio_addr     = ADDR_UNSET,
1206                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE |
1207                                   TDA9887_PORT2_ACTIVE,
1208                 .input          = {{
1209                         .type   = CX88_VMUX_TELEVISION,
1210                         .vmux   = 0,
1211                         .gpio0  = 0x5da6,
1212                 }},
1213                 .mpeg           = CX88_MPEG_BLACKBIRD,
1214         },
1215         [CX88_BOARD_NPGTECH_REALTV_TOP10FM] = {
1216                 .name           = "NPG Tech Real TV FM Top 10",
1217                 .tuner_type     = TUNER_TNF_5335MF, /* Actually a TNF9535 */
1218                 .radio_type     = UNSET,
1219                 .tuner_addr     = ADDR_UNSET,
1220                 .radio_addr     = ADDR_UNSET,
1221                 .input          = {{
1222                         .type   = CX88_VMUX_TELEVISION,
1223                         .vmux   = 0,
1224                         .gpio0  = 0x0788,
1225                 },{
1226                         .type   = CX88_VMUX_COMPOSITE1,
1227                         .vmux   = 1,
1228                         .gpio0  = 0x078b,
1229                 },{
1230                         .type   = CX88_VMUX_SVIDEO,
1231                         .vmux   = 2,
1232                         .gpio0  = 0x078b,
1233                 }},
1234                 .radio = {
1235                          .type  = CX88_RADIO,
1236                          .gpio0 = 0x074a,
1237                 },
1238         },
1239         [CX88_BOARD_WINFAST_DTV2000H] = {
1240                 /* video inputs and radio still in testing */
1241                 .name           = "WinFast DTV2000 H",
1242                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1243                 .radio_type     = UNSET,
1244                 .tuner_addr     = ADDR_UNSET,
1245                 .radio_addr     = ADDR_UNSET,
1246                 .tda9887_conf   = TDA9887_PRESENT,
1247                 .input          = {{
1248                         .type   = CX88_VMUX_TELEVISION,
1249                         .vmux   = 0,
1250                         .gpio0  = 0x00017304,
1251                         .gpio1  = 0x00008203,
1252                         .gpio2  = 0x00017304,
1253                         .gpio3  = 0x02000000,
1254                 }},
1255                 .mpeg           = CX88_MPEG_DVB,
1256         },
1257         [CX88_BOARD_GENIATECH_DVBS] = {
1258                 .name          = "Geniatech DVB-S",
1259                 .tuner_type    = TUNER_ABSENT,
1260                 .radio_type    = UNSET,
1261                 .tuner_addr    = ADDR_UNSET,
1262                 .radio_addr    = ADDR_UNSET,
1263                 .input  = {{
1264                         .type  = CX88_VMUX_DVB,
1265                         .vmux  = 0,
1266                 },{
1267                         .type  = CX88_VMUX_COMPOSITE1,
1268                         .vmux  = 1,
1269                 }},
1270                 .mpeg           = CX88_MPEG_DVB,
1271         },
1272         [CX88_BOARD_HAUPPAUGE_HVR3000] = {
1273                 /* FIXME: Add dvb & radio support */
1274                 .name           = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T",
1275                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1276                 .radio_type     = UNSET,
1277                 .tuner_addr     = ADDR_UNSET,
1278                 .radio_addr     = ADDR_UNSET,
1279                 .tda9887_conf   = TDA9887_PRESENT,
1280                 .input          = {{
1281                         .type   = CX88_VMUX_TELEVISION,
1282                         .vmux   = 0,
1283                         .gpio0  = 0x84bf,
1284                 },{
1285                         .type   = CX88_VMUX_COMPOSITE1,
1286                         .vmux   = 1,
1287                         .gpio0  = 0x84bf,
1288                 },{
1289                         .type   = CX88_VMUX_SVIDEO,
1290                         .vmux   = 2,
1291                         .gpio0  = 0x84bf,
1292                 }},
1293                 .mpeg           = CX88_MPEG_DVB,
1294         },
1295         [CX88_BOARD_NORWOOD_MICRO] = {
1296                 .name           = "Norwood Micro TV Tuner",
1297                 .tuner_type     = TUNER_TNF_5335MF,
1298                 .radio_type     = UNSET,
1299                 .tuner_addr     = ADDR_UNSET,
1300                 .radio_addr     = ADDR_UNSET,
1301                 .input          = {{
1302                         .type   = CX88_VMUX_TELEVISION,
1303                         .vmux   = 0,
1304                         .gpio0  = 0x0709,
1305                 },{
1306                         .type   = CX88_VMUX_COMPOSITE1,
1307                         .vmux   = 1,
1308                         .gpio0  = 0x070b,
1309                 },{
1310                         .type   = CX88_VMUX_SVIDEO,
1311                         .vmux   = 2,
1312                         .gpio0  = 0x070b,
1313                 }},
1314         },
1315         [CX88_BOARD_TE_DTV_250_OEM_SWANN] = {
1316                 .name           = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM",
1317                 .tuner_type     = TUNER_LG_PAL_NEW_TAPC,
1318                 .radio_type     = UNSET,
1319                 .tuner_addr     = ADDR_UNSET,
1320                 .radio_addr     = ADDR_UNSET,
1321                 .input          = {{
1322                         .type   = CX88_VMUX_TELEVISION,
1323                         .vmux   = 0,
1324                         .gpio0  = 0x003fffff,
1325                         .gpio1  = 0x00e00000,
1326                         .gpio2  = 0x003fffff,
1327                         .gpio3  = 0x02000000,
1328                 },{
1329                         .type   = CX88_VMUX_COMPOSITE1,
1330                         .vmux   = 1,
1331                         .gpio0  = 0x003fffff,
1332                         .gpio1  = 0x00e00000,
1333                         .gpio2  = 0x003fffff,
1334                         .gpio3  = 0x02000000,
1335                 },{
1336                         .type   = CX88_VMUX_SVIDEO,
1337                         .vmux   = 2,
1338                         .gpio0  = 0x003fffff,
1339                         .gpio1  = 0x00e00000,
1340                         .gpio2  = 0x003fffff,
1341                         .gpio3  = 0x02000000,
1342                 }},
1343         },
1344         [CX88_BOARD_HAUPPAUGE_HVR1300] = {
1345                 .name           = "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder",
1346                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1347                 .radio_type     = UNSET,
1348                 .tuner_addr     = ADDR_UNSET,
1349                 .radio_addr     = ADDR_UNSET,
1350                 .tda9887_conf   = TDA9887_PRESENT,
1351                 .audio_chip     = V4L2_IDENT_WM8775,
1352                 .input          = {{
1353                         .type   = CX88_VMUX_TELEVISION,
1354                         .vmux   = 0,
1355                         .gpio0  = 0xe780,
1356                         .audioroute = 1,
1357                 },{
1358                         .type   = CX88_VMUX_COMPOSITE1,
1359                         .vmux   = 1,
1360                         .gpio0  = 0xe780,
1361                         .audioroute = 2,
1362                 },{
1363                         .type   = CX88_VMUX_SVIDEO,
1364                         .vmux   = 2,
1365                         .gpio0  = 0xe780,
1366                         .audioroute = 2,
1367                 }},
1368                 /* fixme: Add radio support */
1369                 .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
1370                 .radio = {
1371                         .type   = CX88_RADIO,
1372                         .gpio0  = 0xe780,
1373                 },
1374         },
1375         [CX88_BOARD_ADSTECH_PTV_390] = {
1376                 .name           = "ADS Tech Instant Video PCI",
1377                 .tuner_type     = TUNER_ABSENT,
1378                 .radio_type     = UNSET,
1379                 .tuner_addr     = ADDR_UNSET,
1380                 .radio_addr     = ADDR_UNSET,
1381                 .input          = {{
1382                         .type   = CX88_VMUX_DEBUG,
1383                         .vmux   = 3,
1384                         .gpio0  = 0x04ff,
1385                 },{
1386                         .type   = CX88_VMUX_COMPOSITE1,
1387                         .vmux   = 1,
1388                         .gpio0  = 0x07fa,
1389                 },{
1390                         .type   = CX88_VMUX_SVIDEO,
1391                         .vmux   = 2,
1392                         .gpio0  = 0x07fa,
1393                 }},
1394         },
1395         [CX88_BOARD_PINNACLE_PCTV_HD_800i] = {
1396                 .name           = "Pinnacle PCTV HD 800i",
1397                 .tuner_type     = TUNER_XC5000,
1398                 .radio_type     = UNSET,
1399                 .tuner_addr     = ADDR_UNSET,
1400                 .radio_addr     = ADDR_UNSET,
1401                 .input          = {{
1402                         .type   = CX88_VMUX_TELEVISION,
1403                         .vmux   = 0,
1404                         .gpio0  = 0x04fb,
1405                         .gpio1  = 0x10ff,
1406                 },{
1407                         .type   = CX88_VMUX_COMPOSITE1,
1408                         .vmux   = 1,
1409                         .gpio0  = 0x04fb,
1410                         .gpio1  = 0x10ef,
1411                         .audioroute = 1,
1412                 },{
1413                         .type   = CX88_VMUX_SVIDEO,
1414                         .vmux   = 2,
1415                         .gpio0  = 0x04fb,
1416                         .gpio1  = 0x10ef,
1417                         .audioroute = 1,
1418                 }},
1419                 .mpeg           = CX88_MPEG_DVB,
1420         },
1421         [CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO] = {
1422                 .name           = "DViCO FusionHDTV 5 PCI nano",
1423                 /* xc3008 tuner, digital only for now */
1424                 .tuner_type     = TUNER_ABSENT,
1425                 .radio_type     = UNSET,
1426                 .tuner_addr     = ADDR_UNSET,
1427                 .radio_addr     = ADDR_UNSET,
1428                 .input          = {{
1429                         .type   = CX88_VMUX_TELEVISION,
1430                         .vmux   = 0,
1431                         .gpio0  = 0x000027df, /* Unconfirmed */
1432                 }, {
1433                         .type   = CX88_VMUX_COMPOSITE1,
1434                         .vmux   = 1,
1435                         .gpio0  = 0x000027df, /* Unconfirmed */
1436                         .audioroute = 1,
1437                 }, {
1438                         .type   = CX88_VMUX_SVIDEO,
1439                         .vmux   = 2,
1440                         .gpio0  = 0x000027df, /* Unconfirmed */
1441                         .audioroute = 1,
1442                 } },
1443                 .mpeg           = CX88_MPEG_DVB,
1444         },
1445         [CX88_BOARD_PINNACLE_HYBRID_PCTV] = {
1446                 .name           = "Pinnacle Hybrid PCTV",
1447                 .tuner_type     = TUNER_XC2028,
1448                 .tuner_addr     = 0x61,
1449                 .input          = { {
1450                         .type   = CX88_VMUX_TELEVISION,
1451                         .vmux   = 0,
1452                 }, {
1453                         .type   = CX88_VMUX_COMPOSITE1,
1454                         .vmux   = 1,
1455                 }, {
1456                         .type   = CX88_VMUX_SVIDEO,
1457                         .vmux   = 2,
1458                 } },
1459                 .radio = {
1460                         .type   = CX88_RADIO,
1461                         .gpio0  = 0x004ff,
1462                         .gpio1  = 0x010ff,
1463                         .gpio2  = 0x0ff,
1464                 },
1465         },
1466         [CX88_BOARD_WINFAST_TV2000_XP_GLOBAL] = {
1467                 .name           = "Winfast TV2000 XP Global",
1468                 .tuner_type     = TUNER_XC2028,
1469                 .tuner_addr     = 0x61,
1470                 .input          = { {
1471                         .type   = CX88_VMUX_TELEVISION,
1472                         .vmux   = 0,
1473                         .gpio0  = 0x0400, /* pin 2:mute = 0 (off?) */
1474                         .gpio1  = 0x0000,
1475                         .gpio2  = 0x0800, /* pin 19:audio = 0 (tv) */
1476
1477                 }, {
1478                         .type   = CX88_VMUX_COMPOSITE1,
1479                         .vmux   = 1,
1480                         .gpio0  = 0x0400, /* probably?  or 0x0404 to turn mute on */
1481                         .gpio1  = 0x0000,
1482                         .gpio2  = 0x0808, /* pin 19:audio = 1 (line) */
1483
1484                 }, {
1485                         .type   = CX88_VMUX_SVIDEO,
1486                         .vmux   = 2,
1487                 } },
1488                 .radio = {
1489                         .type   = CX88_RADIO,
1490                         .gpio0  = 0x004ff,
1491                         .gpio1  = 0x010ff,
1492                         .gpio2  = 0x0ff,
1493                 },
1494         },
1495         [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
1496                 .name           = "PowerColor RA330",   /* Long names may confuse LIRC. */
1497                 .tuner_type     = TUNER_XC2028,
1498                 .tuner_addr     = 0x61,
1499                 .input          = { {
1500                         .type   = CX88_VMUX_DEBUG,
1501                         .vmux   = 3,            /* Due to the way the cx88 driver is written,   */
1502                         .gpio0 = 0x00ff,        /* there is no way to deactivate audio pass-    */
1503                         .gpio1 = 0xf39d,        /* through without this entry. Furthermore, if  */
1504                         .gpio3 = 0x0000,        /* the TV mux entry is first, you get audio     */
1505                 }, {                            /* from the tuner on boot for a little while.   */
1506                         .type   = CX88_VMUX_TELEVISION,
1507                         .vmux   = 0,
1508                         .gpio0 = 0x00ff,
1509                         .gpio1 = 0xf35d,
1510                         .gpio3 = 0x0000,
1511                 }, {
1512                         .type   = CX88_VMUX_COMPOSITE1,
1513                         .vmux   = 1,
1514                         .gpio0 = 0x00ff,
1515                         .gpio1 = 0xf37d,
1516                         .gpio3 = 0x0000,
1517                 }, {
1518                         .type   = CX88_VMUX_SVIDEO,
1519                         .vmux   = 2,
1520                         .gpio0  = 0x000ff,
1521                         .gpio1  = 0x0f37d,
1522                         .gpio3  = 0x00000,
1523                 } },
1524                 .radio = {
1525                         .type   = CX88_RADIO,
1526                         .gpio0  = 0x000ff,
1527                         .gpio1  = 0x0f35d,
1528                         .gpio3  = 0x00000,
1529                 },
1530         },
1531         [CX88_BOARD_GENIATECH_X8000_MT] = {
1532                 /* Also PowerColor Real Angel 330 and Geniatech X800 OEM */
1533                 .name           = "Geniatech X8000-MT DVBT",
1534                 .tuner_type     = TUNER_XC2028,
1535                 .tuner_addr     = 0x61,
1536                 .input          = { {
1537                         .type   = CX88_VMUX_TELEVISION,
1538                         .vmux   = 0,
1539                         .gpio0  = 0x00000000,
1540                         .gpio1  = 0x00e3e341,
1541                         .gpio2  = 0x00000000,
1542                         .gpio3  = 0x00000000,
1543                 }, {
1544                         .type   = CX88_VMUX_COMPOSITE1,
1545                         .vmux   = 1,
1546                         .gpio0  = 0x00000000,
1547                         .gpio1  = 0x00e3e361,
1548                         .gpio2  = 0x00000000,
1549                         .gpio3  = 0x00000000,
1550                 }, {
1551                         .type   = CX88_VMUX_SVIDEO,
1552                         .vmux   = 2,
1553                         .gpio0  = 0x00000000,
1554                         .gpio1  = 0x00e3e361,
1555                         .gpio2  = 0x00000000,
1556                         .gpio3  = 0x00000000,
1557                 } },
1558                 .radio = {
1559                         .type   = CX88_RADIO,
1560                         .gpio0  = 0x00000000,
1561                         .gpio1  = 0x00e3e341,
1562                         .gpio2  = 0x00000000,
1563                         .gpio3  = 0x00000000,
1564                 },
1565                 .mpeg           = CX88_MPEG_DVB,
1566         },
1567         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO] = {
1568                 .name           = "DViCO FusionHDTV DVB-T PRO",
1569                 .tuner_type     = TUNER_ABSENT, /* XXX: Has XC3028 */
1570                 .radio_type     = UNSET,
1571                 .tuner_addr     = ADDR_UNSET,
1572                 .radio_addr     = ADDR_UNSET,
1573                 .input          = { {
1574                         .type   = CX88_VMUX_COMPOSITE1,
1575                         .vmux   = 1,
1576                         .gpio0  = 0x000067df,
1577                 }, {
1578                         .type   = CX88_VMUX_SVIDEO,
1579                         .vmux   = 2,
1580                         .gpio0  = 0x000067df,
1581                 } },
1582                 .mpeg           = CX88_MPEG_DVB,
1583         },
1584         [CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD] = {
1585                 .name           = "DViCO FusionHDTV 7 Gold",
1586                 .tuner_type     = TUNER_XC5000,
1587                 .radio_type     = UNSET,
1588                 .tuner_addr     = ADDR_UNSET,
1589                 .radio_addr     = ADDR_UNSET,
1590                 .input          = {{
1591                         .type   = CX88_VMUX_TELEVISION,
1592                         .vmux   = 0,
1593                         .gpio0  = 0x10df,
1594                 },{
1595                         .type   = CX88_VMUX_COMPOSITE1,
1596                         .vmux   = 1,
1597                         .gpio0  = 0x16d9,
1598                 },{
1599                         .type   = CX88_VMUX_SVIDEO,
1600                         .vmux   = 2,
1601                         .gpio0  = 0x16d9,
1602                 }},
1603                 .mpeg           = CX88_MPEG_DVB,
1604         },
1605         [CX88_BOARD_PROLINK_PV_8000GT] = {
1606                 .name           = "Prolink Pixelview MPEG 8000GT",
1607                 .tuner_type     = TUNER_XC2028,
1608                 .tuner_addr     = 0x61,
1609                 .input          = { {
1610                         .type   = CX88_VMUX_TELEVISION,
1611                         .vmux   = 0,
1612                         .gpio0 = 0x0ff,
1613                         .gpio2 = 0x0cfb,
1614                 }, {
1615                         .type   = CX88_VMUX_COMPOSITE1,
1616                         .vmux   = 1,
1617                         .gpio2 = 0x0cfb,
1618                 }, {
1619                         .type   = CX88_VMUX_SVIDEO,
1620                         .vmux   = 2,
1621                         .gpio2 = 0x0cfb,
1622                 } },
1623                 .radio = {
1624                         .type   = CX88_RADIO,
1625                         .gpio2 = 0x0cfb,
1626                 },
1627         },
1628         /* Both radio, analog and ATSC work with this board.
1629            However, for analog to work, s5h1409 gate should be open,
1630            otherwise, tuner-xc3028 won't be detected.
1631            A proper fix require using the newer i2c methods to add
1632            tuner-xc3028 without doing an i2c probe.
1633          */
1634         [CX88_BOARD_KWORLD_ATSC_120] = {
1635                 .name           = "Kworld PlusTV HD PCI 120 (ATSC 120)",
1636                 .tuner_type     = TUNER_XC2028,
1637                 .radio_type     = UNSET,
1638                 .tuner_addr     = ADDR_UNSET,
1639                 .radio_addr     = ADDR_UNSET,
1640                 .input          = { {
1641                         .type   = CX88_VMUX_TELEVISION,
1642                         .vmux   = 0,
1643                         .gpio0  = 0x000000ff,
1644                         .gpio1  = 0x0000f35d,
1645                         .gpio2  = 0x00000000,
1646                 }, {
1647                         .type   = CX88_VMUX_COMPOSITE1,
1648                         .vmux   = 1,
1649                         .gpio0  = 0x000000ff,
1650                         .gpio1  = 0x0000f37e,
1651                         .gpio2  = 0x00000000,
1652                 }, {
1653                         .type   = CX88_VMUX_SVIDEO,
1654                         .vmux   = 2,
1655                         .gpio0  = 0x000000ff,
1656                         .gpio1  = 0x0000f37e,
1657                         .gpio2  = 0x00000000,
1658                 } },
1659                 .radio = {
1660                         .type   = CX88_RADIO,
1661                         .gpio0  = 0x000000ff,
1662                         .gpio1  = 0x0000f35d,
1663                         .gpio2  = 0x00000000,
1664                 },
1665                 .mpeg           = CX88_MPEG_DVB,
1666         },
1667         [CX88_BOARD_HAUPPAUGE_HVR4000] = {
1668                 .name           = "Hauppauge WinTV-HVR4000 DVB-S/S2/T/Hybrid",
1669                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1670                 .radio_type     = UNSET,
1671                 .tuner_addr     = ADDR_UNSET,
1672                 .radio_addr     = ADDR_UNSET,
1673                 .tda9887_conf   = TDA9887_PRESENT,
1674                 /*
1675                  * GPIO0 (WINTV2000)
1676                  *
1677                  * Analogue     SAT     DVB-T
1678                  * Antenna      0xc4bf  0xc4bb
1679                  * Composite    0xc4bf  0xc4bb
1680                  * S-Video      0xc4bf  0xc4bb
1681                  * Composite1   0xc4ff  0xc4fb
1682                  * S-Video1     0xc4ff  0xc4fb
1683                  */
1684                 .input          = {{
1685                         .type   = CX88_VMUX_TELEVISION,
1686                         .vmux   = 0,
1687                         .gpio0  = 0xc4bf,
1688                 }, {
1689                         .type   = CX88_VMUX_COMPOSITE1,
1690                         .vmux   = 1,
1691                         .gpio0  = 0xc4bf,
1692                 }, {
1693                         .type   = CX88_VMUX_SVIDEO,
1694                         .vmux   = 2,
1695                         .gpio0  = 0xc4bf,
1696                 } },
1697                 /* fixme: Add radio support */
1698                 .mpeg           = CX88_MPEG_DVB,
1699         },
1700         [CX88_BOARD_HAUPPAUGE_HVR4000LITE] = {
1701                 .name           = "Hauppauge WinTV-HVR4000(Lite) DVB-S/S2",
1702                 .tuner_type     = UNSET,
1703                 .radio_type     = UNSET,
1704                 .tuner_addr     = ADDR_UNSET,
1705                 .radio_addr     = ADDR_UNSET,
1706                 .input          = {{
1707                         .type   = CX88_VMUX_DVB,
1708                         .vmux   = 0,
1709                 } },
1710                 .mpeg           = CX88_MPEG_DVB,
1711         },
1712         [CX88_BOARD_TEVII_S460] = {
1713                 .name           = "TeVii S460 DVB-S/S2",
1714                 .tuner_type     = UNSET,
1715                 .radio_type     = UNSET,
1716                 .tuner_addr     = ADDR_UNSET,
1717                 .radio_addr     = ADDR_UNSET,
1718                 .input          = {{
1719                         .type   = CX88_VMUX_DVB,
1720                         .vmux   = 0,
1721                 } },
1722                 .mpeg           = CX88_MPEG_DVB,
1723         },
1724         [CX88_BOARD_OMICOM_SS4_PCI] = {
1725                 .name           = "Omicom SS4 DVB-S/S2 PCI",
1726                 .tuner_type     = UNSET,
1727                 .radio_type     = UNSET,
1728                 .tuner_addr     = ADDR_UNSET,
1729                 .radio_addr     = ADDR_UNSET,
1730                 .input          = {{
1731                         .type   = CX88_VMUX_DVB,
1732                         .vmux   = 0,
1733                 } },
1734                 .mpeg           = CX88_MPEG_DVB,
1735         },
1736         [CX88_BOARD_TBS_8920] = {
1737                 .name           = "TBS 8920 DVB-S/S2",
1738                 .tuner_type     = TUNER_ABSENT,
1739                 .radio_type     = UNSET,
1740                 .tuner_addr     = ADDR_UNSET,
1741                 .radio_addr     = ADDR_UNSET,
1742                 .input          = {{
1743                         .type   = CX88_VMUX_DVB,
1744                         .vmux   = 1,
1745                 } },
1746                 .mpeg           = CX88_MPEG_DVB,
1747         },
1748 };
1749
1750 /* ------------------------------------------------------------------ */
1751 /* PCI subsystem IDs                                                  */
1752
1753 static const struct cx88_subid cx88_subids[] = {
1754         {
1755                 .subvendor = 0x0070,
1756                 .subdevice = 0x3400,
1757                 .card      = CX88_BOARD_HAUPPAUGE,
1758         },{
1759                 .subvendor = 0x0070,
1760                 .subdevice = 0x3401,
1761                 .card      = CX88_BOARD_HAUPPAUGE,
1762         },{
1763                 .subvendor = 0x14c7,
1764                 .subdevice = 0x0106,
1765                 .card      = CX88_BOARD_GDI,
1766         },{
1767                 .subvendor = 0x14c7,
1768                 .subdevice = 0x0107, /* with mpeg encoder */
1769                 .card      = CX88_BOARD_GDI,
1770         },{
1771                 .subvendor = PCI_VENDOR_ID_ATI,
1772                 .subdevice = 0x00f8,
1773                 .card      = CX88_BOARD_ATI_WONDER_PRO,
1774         },{
1775                 .subvendor = 0x107d,
1776                 .subdevice = 0x6611,
1777                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
1778         },{
1779                 .subvendor = 0x107d,
1780                 .subdevice = 0x6613,    /* NTSC */
1781                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
1782         },{
1783                 .subvendor = 0x107d,
1784                 .subdevice = 0x6620,
1785                 .card      = CX88_BOARD_WINFAST_DV2000,
1786         },{
1787                 .subvendor = 0x107d,
1788                 .subdevice = 0x663b,
1789                 .card      = CX88_BOARD_LEADTEK_PVR2000,
1790         },{
1791                 .subvendor = 0x107d,
1792                 .subdevice = 0x663c,
1793                 .card      = CX88_BOARD_LEADTEK_PVR2000,
1794         },{
1795                 .subvendor = 0x1461,
1796                 .subdevice = 0x000b,
1797                 .card      = CX88_BOARD_AVERTV_STUDIO_303,
1798         },{
1799                 .subvendor = 0x1462,
1800                 .subdevice = 0x8606,
1801                 .card      = CX88_BOARD_MSI_TVANYWHERE_MASTER,
1802         },{
1803                 .subvendor = 0x10fc,
1804                 .subdevice = 0xd003,
1805                 .card      = CX88_BOARD_IODATA_GVVCP3PCI,
1806         },{
1807                 .subvendor = 0x1043,
1808                 .subdevice = 0x4823,  /* with mpeg encoder */
1809                 .card      = CX88_BOARD_ASUS_PVR_416,
1810         },{
1811                 .subvendor = 0x17de,
1812                 .subdevice = 0x08a6,
1813                 .card      = CX88_BOARD_KWORLD_DVB_T,
1814         },{
1815                 .subvendor = 0x18ac,
1816                 .subdevice = 0xd810,
1817                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
1818         },{
1819                 .subvendor = 0x18ac,
1820                 .subdevice = 0xd820,
1821                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T,
1822         },{
1823                 .subvendor = 0x18ac,
1824                 .subdevice = 0xdb00,
1825                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1,
1826         },{
1827                 .subvendor = 0x0070,
1828                 .subdevice = 0x9002,
1829                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
1830         },{
1831                 .subvendor = 0x14f1,
1832                 .subdevice = 0x0187,
1833                 .card      = CX88_BOARD_CONEXANT_DVB_T1,
1834         },{
1835                 .subvendor = 0x1540,
1836                 .subdevice = 0x2580,
1837                 .card      = CX88_BOARD_PROVIDEO_PV259,
1838         },{
1839                 .subvendor = 0x18ac,
1840                 .subdevice = 0xdb10,
1841                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
1842         },{
1843                 .subvendor = 0x1554,
1844                 .subdevice = 0x4811,
1845                 .card      = CX88_BOARD_PIXELVIEW,
1846         },{
1847                 .subvendor = 0x7063,
1848                 .subdevice = 0x3000, /* HD-3000 card */
1849                 .card      = CX88_BOARD_PCHDTV_HD3000,
1850         },{
1851                 .subvendor = 0x17de,
1852                 .subdevice = 0xa8a6,
1853                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T,
1854         },{
1855                 .subvendor = 0x0070,
1856                 .subdevice = 0x2801,
1857                 .card      = CX88_BOARD_HAUPPAUGE_ROSLYN,
1858         },{
1859                 .subvendor = 0x14f1,
1860                 .subdevice = 0x0342,
1861                 .card      = CX88_BOARD_DIGITALLOGIC_MEC,
1862         },{
1863                 .subvendor = 0x10fc,
1864                 .subdevice = 0xd035,
1865                 .card      = CX88_BOARD_IODATA_GVBCTV7E,
1866         },{
1867                 .subvendor = 0x1421,
1868                 .subdevice = 0x0334,
1869                 .card      = CX88_BOARD_ADSTECH_DVB_T_PCI,
1870         },{
1871                 .subvendor = 0x153b,
1872                 .subdevice = 0x1166,
1873                 .card      = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1,
1874         },{
1875                 .subvendor = 0x18ac,
1876                 .subdevice = 0xd500,
1877                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD,
1878         },{
1879                 .subvendor = 0x1461,
1880                 .subdevice = 0x8011,
1881                 .card      = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550,
1882         },{
1883                 .subvendor = PCI_VENDOR_ID_ATI,
1884                 .subdevice = 0xa101,
1885                 .card      = CX88_BOARD_ATI_HDTVWONDER,
1886         },{
1887                 .subvendor = 0x107d,
1888                 .subdevice = 0x665f,
1889                 .card      = CX88_BOARD_WINFAST_DTV1000,
1890         },{
1891                 .subvendor = 0x1461,
1892                 .subdevice = 0x000a,
1893                 .card      = CX88_BOARD_AVERTV_303,
1894         },{
1895                 .subvendor = 0x0070,
1896                 .subdevice = 0x9200,
1897                 .card      = CX88_BOARD_HAUPPAUGE_NOVASE2_S1,
1898         },{
1899                 .subvendor = 0x0070,
1900                 .subdevice = 0x9201,
1901                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
1902         },{
1903                 .subvendor = 0x0070,
1904                 .subdevice = 0x9202,
1905                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
1906         },{
1907                 .subvendor = 0x17de,
1908                 .subdevice = 0x08b2,
1909                 .card      = CX88_BOARD_KWORLD_DVBS_100,
1910         },{
1911                 .subvendor = 0x0070,
1912                 .subdevice = 0x9400,
1913                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
1914         },{
1915                 .subvendor = 0x0070,
1916                 .subdevice = 0x9402,
1917                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
1918         },{
1919                 .subvendor = 0x0070,
1920                 .subdevice = 0x9800,
1921                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
1922         },{
1923                 .subvendor = 0x0070,
1924                 .subdevice = 0x9802,
1925                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
1926         },{
1927                 .subvendor = 0x0070,
1928                 .subdevice = 0x9001,
1929                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
1930         },{
1931                 .subvendor = 0x1822,
1932                 .subdevice = 0x0025,
1933                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
1934         },{
1935                 .subvendor = 0x17de,
1936                 .subdevice = 0x08a1,
1937                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
1938         },{
1939                 .subvendor = 0x18ac,
1940                 .subdevice = 0xdb50,
1941                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
1942         },{
1943                 .subvendor = 0x18ac,
1944                 .subdevice = 0xdb54,
1945                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
1946                 /* Re-branded DViCO: DigitalNow DVB-T Dual */
1947         },{
1948                 .subvendor = 0x18ac,
1949                 .subdevice = 0xdb11,
1950                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
1951                 /* Re-branded DViCO: UltraView DVB-T Plus */
1952         }, {
1953                 .subvendor = 0x18ac,
1954                 .subdevice = 0xdb30,
1955                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO,
1956         }, {
1957                 .subvendor = 0x17de,
1958                 .subdevice = 0x0840,
1959                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
1960         },{
1961                 .subvendor = 0x1421,
1962                 .subdevice = 0x0305,
1963                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
1964         },{
1965                 .subvendor = 0x18ac,
1966                 .subdevice = 0xdb40,
1967                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
1968         },{
1969                 .subvendor = 0x18ac,
1970                 .subdevice = 0xdb44,
1971                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
1972         },{
1973                 .subvendor = 0x7063,
1974                 .subdevice = 0x5500,
1975                 .card      = CX88_BOARD_PCHDTV_HD5500,
1976         },{
1977                 .subvendor = 0x17de,
1978                 .subdevice = 0x0841,
1979                 .card      = CX88_BOARD_KWORLD_MCE200_DELUXE,
1980         },{
1981                 .subvendor = 0x1822,
1982                 .subdevice = 0x0019,
1983                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
1984         },{
1985                 .subvendor = 0x1554,
1986                 .subdevice = 0x4813,
1987                 .card      = CX88_BOARD_PIXELVIEW_PLAYTV_P7000,
1988         },{
1989                 .subvendor = 0x14f1,
1990                 .subdevice = 0x0842,
1991                 .card      = CX88_BOARD_NPGTECH_REALTV_TOP10FM,
1992         },{
1993                 .subvendor = 0x107d,
1994                 .subdevice = 0x665e,
1995                 .card      = CX88_BOARD_WINFAST_DTV2000H,
1996         },{
1997                 .subvendor = 0x18ac,
1998                 .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */
1999                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
2000         },{
2001                 .subvendor = 0x14f1,
2002                 .subdevice = 0x0084,
2003                 .card      = CX88_BOARD_GENIATECH_DVBS,
2004         },{
2005                 .subvendor = 0x0070,
2006                 .subdevice = 0x1404,
2007                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2008         },{
2009                 .subvendor = 0x1461,
2010                 .subdevice = 0xc111, /* AverMedia M150-D */
2011                 /* This board is known to work with the ASUS PVR416 config */
2012                 .card      = CX88_BOARD_ASUS_PVR_416,
2013         },{
2014                 .subvendor = 0xc180,
2015                 .subdevice = 0xc980,
2016                 .card      = CX88_BOARD_TE_DTV_250_OEM_SWANN,
2017         },{
2018                 .subvendor = 0x0070,
2019                 .subdevice = 0x9600,
2020                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2021         },{
2022                 .subvendor = 0x0070,
2023                 .subdevice = 0x9601,
2024                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2025         },{
2026                 .subvendor = 0x0070,
2027                 .subdevice = 0x9602,
2028                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2029         },{
2030                 .subvendor = 0x107d,
2031                 .subdevice = 0x6632,
2032                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2033         },{
2034                 .subvendor = 0x12ab,
2035                 .subdevice = 0x2300, /* Club3D Zap TV2100 */
2036                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
2037         },{
2038                 .subvendor = 0x0070,
2039                 .subdevice = 0x9000,
2040                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2041         },{
2042                 .subvendor = 0x0070,
2043                 .subdevice = 0x1400,
2044                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2045         },{
2046                 .subvendor = 0x0070,
2047                 .subdevice = 0x1401,
2048                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2049         },{
2050                 .subvendor = 0x0070,
2051                 .subdevice = 0x1402,
2052                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2053         },{
2054                 .subvendor = 0x1421,
2055                 .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */
2056                 .card      = CX88_BOARD_KWORLD_DVBS_100,
2057         },{
2058                 .subvendor = 0x1421,
2059                 .subdevice = 0x0390,
2060                 .card      = CX88_BOARD_ADSTECH_PTV_390,
2061         },{
2062                 .subvendor = 0x11bd,
2063                 .subdevice = 0x0051,
2064                 .card      = CX88_BOARD_PINNACLE_PCTV_HD_800i,
2065         }, {
2066                 .subvendor = 0x18ac,
2067                 .subdevice = 0xd530,
2068                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO,
2069         }, {
2070                 .subvendor = 0x12ab,
2071                 .subdevice = 0x1788,
2072                 .card      = CX88_BOARD_PINNACLE_HYBRID_PCTV,
2073         }, {
2074                 .subvendor = 0x14f1,
2075                 .subdevice = 0xea3d,
2076                 .card      = CX88_BOARD_POWERCOLOR_REAL_ANGEL,
2077         }, {
2078                 .subvendor = 0x107d,
2079                 .subdevice = 0x6f18,
2080                 .card      = CX88_BOARD_WINFAST_TV2000_XP_GLOBAL,
2081         }, {
2082                 .subvendor = 0x14f1,
2083                 .subdevice = 0x8852,
2084                 .card      = CX88_BOARD_GENIATECH_X8000_MT,
2085         }, {
2086                 .subvendor = 0x18ac,
2087                 .subdevice = 0xd610,
2088                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD,
2089         }, {
2090                 .subvendor = 0x1554,
2091                 .subdevice = 0x4935,
2092                 .card      = CX88_BOARD_PROLINK_PV_8000GT,
2093         }, {
2094                 .subvendor = 0x17de,
2095                 .subdevice = 0x08c1,
2096                 .card      = CX88_BOARD_KWORLD_ATSC_120,
2097         }, {
2098                 .subvendor = 0x0070,
2099                 .subdevice = 0x6900,
2100                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2101         }, {
2102                 .subvendor = 0x0070,
2103                 .subdevice = 0x6904,
2104                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2105         }, {
2106                 .subvendor = 0x0070,
2107                 .subdevice = 0x6902,
2108                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2109         }, {
2110                 .subvendor = 0x0070,
2111                 .subdevice = 0x6905,
2112                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000LITE,
2113         }, {
2114                 .subvendor = 0x0070,
2115                 .subdevice = 0x6906,
2116                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000LITE,
2117         }, {
2118                 .subvendor = 0xD460,
2119                 .subdevice = 0x9022,
2120                 .card      = CX88_BOARD_TEVII_S460,
2121         }, {
2122                 .subvendor = 0xA044,
2123                 .subdevice = 0x2011,
2124                 .card      = CX88_BOARD_OMICOM_SS4_PCI,
2125         }, {
2126                 .subvendor = 0x8920,
2127                 .subdevice = 0x8888,
2128                 .card      = CX88_BOARD_TBS_8920,
2129         },
2130 };
2131
2132 /* ----------------------------------------------------------------------- */
2133 /* some leadtek specific stuff                                             */
2134
2135 static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
2136 {
2137         /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
2138          * any others.
2139          *
2140          * Byte 0 is 1 on the NTSC board.
2141          */
2142
2143         if (eeprom_data[4] != 0x7d ||
2144             eeprom_data[5] != 0x10 ||
2145             eeprom_data[7] != 0x66) {
2146                 warn_printk(core, "Leadtek eeprom invalid.\n");
2147                 return;
2148         }
2149
2150         core->board.tuner_type = (eeprom_data[6] == 0x13) ?
2151                 TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3;
2152
2153         info_printk(core, "Leadtek Winfast 2000XP Expert config: "
2154                     "tuner=%d, eeprom[0]=0x%02x\n",
2155                     core->board.tuner_type, eeprom_data[0]);
2156 }
2157
2158 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
2159 {
2160         struct tveeprom tv;
2161
2162         tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data);
2163         core->board.tuner_type = tv.tuner_type;
2164         core->tuner_formats = tv.tuner_formats;
2165         core->board.radio.type = tv.has_radio ? CX88_RADIO : 0;
2166
2167         /* Make sure we support the board model */
2168         switch (tv.model)
2169         {
2170         case 14009: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in) */
2171         case 14019: /* WinTV-HVR3000 (Retail, IR Blaster, b/panel video, 3.5mm audio in) */
2172         case 14029: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge) */
2173         case 14109: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - low profile) */
2174         case 14129: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge - LP) */
2175         case 14559: /* WinTV-HVR3000 (OEM, no IR, b/panel video, 3.5mm audio in) */
2176         case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */
2177         case 14659: /* WinTV-HVR3000 (OEM, no IR, b/panel video, RCA audio in - Low profile) */
2178         case 14669: /* WinTV-HVR3000 (OEM, no IR, no b/panel video - Low profile) */
2179         case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
2180         case 34519: /* WinTV-PCI-FM */
2181         case 69009:
2182                 /* WinTV-HVR4000 (DVBS/S2/T, Video and IR, back panel inputs) */
2183         case 69100: /* WinTV-HVR4000LITE (DVBS/S2, IR) */
2184         case 69500: /* WinTV-HVR4000LITE (DVBS/S2, No IR) */
2185         case 69559:
2186                 /* WinTV-HVR4000 (DVBS/S2/T, Video no IR, back panel inputs) */
2187         case 69569: /* WinTV-HVR4000 (DVBS/S2/T, Video no IR) */
2188         case 90002: /* Nova-T-PCI (9002) */
2189         case 92001: /* Nova-S-Plus (Video and IR) */
2190         case 92002: /* Nova-S-Plus (Video and IR) */
2191         case 90003: /* Nova-T-PCI (9002 No RF out) */
2192         case 90500: /* Nova-T-PCI (oem) */
2193         case 90501: /* Nova-T-PCI (oem/IR) */
2194         case 92000: /* Nova-SE2 (OEM, No Video or IR) */
2195         case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
2196         case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
2197         case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */
2198         case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */
2199         case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */
2200         case 96569: /* WinTV-HVR1300 () */
2201         case 96659: /* WinTV-HVR1300 () */
2202         case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
2203                 /* known */
2204                 break;
2205         default:
2206                 warn_printk(core, "warning: unknown hauppauge model #%d\n",
2207                             tv.model);
2208                 break;
2209         }
2210
2211         info_printk(core, "hauppauge eeprom: model=%d\n", tv.model);
2212 }
2213
2214 /* ----------------------------------------------------------------------- */
2215 /* some GDI (was: Modular Technology) specific stuff                       */
2216
2217 static struct {
2218         int  id;
2219         int  fm;
2220         char *name;
2221 } gdi_tuner[] = {
2222         [ 0x01 ] = { .id   = TUNER_ABSENT,
2223                      .name = "NTSC_M" },
2224         [ 0x02 ] = { .id   = TUNER_ABSENT,
2225                      .name = "PAL_B" },
2226         [ 0x03 ] = { .id   = TUNER_ABSENT,
2227                      .name = "PAL_I" },
2228         [ 0x04 ] = { .id   = TUNER_ABSENT,
2229                      .name = "PAL_D" },
2230         [ 0x05 ] = { .id   = TUNER_ABSENT,
2231                      .name = "SECAM" },
2232
2233         [ 0x10 ] = { .id   = TUNER_ABSENT,
2234                      .fm   = 1,
2235                      .name = "TEMIC_4049" },
2236         [ 0x11 ] = { .id   = TUNER_TEMIC_4136FY5,
2237                      .name = "TEMIC_4136" },
2238         [ 0x12 ] = { .id   = TUNER_ABSENT,
2239                      .name = "TEMIC_4146" },
2240
2241         [ 0x20 ] = { .id   = TUNER_PHILIPS_FQ1216ME,
2242                      .fm   = 1,
2243                      .name = "PHILIPS_FQ1216_MK3" },
2244         [ 0x21 ] = { .id   = TUNER_ABSENT, .fm = 1,
2245                      .name = "PHILIPS_FQ1236_MK3" },
2246         [ 0x22 ] = { .id   = TUNER_ABSENT,
2247                      .name = "PHILIPS_FI1236_MK3" },
2248         [ 0x23 ] = { .id   = TUNER_ABSENT,
2249                      .name = "PHILIPS_FI1216_MK3" },
2250 };
2251
2252 static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
2253 {
2254         char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
2255                 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
2256
2257         info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
2258         if (NULL == name)
2259                 return;
2260         core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
2261         core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
2262                 CX88_RADIO : 0;
2263 }
2264
2265 /* ------------------------------------------------------------------- */
2266 /* some Divco specific stuff                                           */
2267 static int cx88_dvico_xc2028_callback(struct cx88_core *core,
2268                                       int command, int arg)
2269 {
2270         switch (command) {
2271         case XC2028_TUNER_RESET:
2272                 cx_write(MO_GP0_IO, 0x101000);
2273                 mdelay(5);
2274                 cx_set(MO_GP0_IO, 0x101010);
2275                 break;
2276         default:
2277                 return -EINVAL;
2278         }
2279
2280         return 0;
2281 }
2282
2283
2284 /* ----------------------------------------------------------------------- */
2285 /* some Geniatech specific stuff                                           */
2286
2287 static int cx88_xc3028_geniatech_tuner_callback(struct cx88_core *core,
2288                                                 int command, int mode)
2289 {
2290         switch (command) {
2291         case XC2028_TUNER_RESET:
2292                 switch (INPUT(core->input).type) {
2293                 case CX88_RADIO:
2294                         break;
2295                 case CX88_VMUX_DVB:
2296                         cx_write(MO_GP1_IO, 0x030302);
2297                         mdelay(50);
2298                         break;
2299                 default:
2300                         cx_write(MO_GP1_IO, 0x030301);
2301                         mdelay(50);
2302                 }
2303                 cx_write(MO_GP1_IO, 0x101010);
2304                 mdelay(50);
2305                 cx_write(MO_GP1_IO, 0x101000);
2306                 mdelay(50);
2307                 cx_write(MO_GP1_IO, 0x101010);
2308                 mdelay(50);
2309                 return 0;
2310         }
2311         return -EINVAL;
2312 }
2313
2314 /* ------------------------------------------------------------------- */
2315 /* some Divco specific stuff                                           */
2316 static int cx88_pv_8000gt_callback(struct cx88_core *core,
2317                                    int command, int arg)
2318 {
2319         switch (command) {
2320         case XC2028_TUNER_RESET:
2321                 cx_write(MO_GP2_IO, 0xcf7);
2322                 mdelay(50);
2323                 cx_write(MO_GP2_IO, 0xef5);
2324                 mdelay(50);
2325                 cx_write(MO_GP2_IO, 0xcf7);
2326                 break;
2327         default:
2328                 return -EINVAL;
2329         }
2330
2331         return 0;
2332 }
2333
2334 /* ----------------------------------------------------------------------- */
2335 /* some DViCO specific stuff                                               */
2336
2337 static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
2338 {
2339         struct i2c_msg msg = { .addr = 0x45, .flags = 0 };
2340         int i, err;
2341         static u8 init_bufs[13][5] = {
2342                 { 0x10, 0x00, 0x20, 0x01, 0x03 },
2343                 { 0x10, 0x10, 0x01, 0x00, 0x21 },
2344                 { 0x10, 0x10, 0x10, 0x00, 0xCA },
2345                 { 0x10, 0x10, 0x12, 0x00, 0x08 },
2346                 { 0x10, 0x10, 0x13, 0x00, 0x0A },
2347                 { 0x10, 0x10, 0x16, 0x01, 0xC0 },
2348                 { 0x10, 0x10, 0x22, 0x01, 0x3D },
2349                 { 0x10, 0x10, 0x73, 0x01, 0x2E },
2350                 { 0x10, 0x10, 0x72, 0x00, 0xC5 },
2351                 { 0x10, 0x10, 0x71, 0x01, 0x97 },
2352                 { 0x10, 0x10, 0x70, 0x00, 0x0F },
2353                 { 0x10, 0x10, 0xB0, 0x00, 0x01 },
2354                 { 0x03, 0x0C },
2355         };
2356
2357         for (i = 0; i < ARRAY_SIZE(init_bufs); i++) {
2358                 msg.buf = init_bufs[i];
2359                 msg.len = (i != 12 ? 5 : 2);
2360                 err = i2c_transfer(&core->i2c_adap, &msg, 1);
2361                 if (err != 1) {
2362                         warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d "
2363                                           "failed (err = %d)!\n", i, err);
2364                         return;
2365                 }
2366         }
2367 }
2368
2369 static int cx88_xc2028_tuner_callback(struct cx88_core *core,
2370                                       int command, int arg)
2371 {
2372         /* Board-specific callbacks */
2373         switch (core->boardnr) {
2374         case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
2375         case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2376         case CX88_BOARD_GENIATECH_X8000_MT:
2377         case CX88_BOARD_KWORLD_ATSC_120:
2378                 return cx88_xc3028_geniatech_tuner_callback(core,
2379                                                         command, arg);
2380         case CX88_BOARD_PROLINK_PV_8000GT:
2381                 return cx88_pv_8000gt_callback(core, command, arg);
2382         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2383                 return cx88_dvico_xc2028_callback(core, command, arg);
2384         }
2385
2386         switch (command) {
2387         case XC2028_TUNER_RESET:
2388                 switch (INPUT(core->input).type) {
2389                 case CX88_RADIO:
2390                         info_printk(core, "setting GPIO to radio!\n");
2391                         cx_write(MO_GP0_IO, 0x4ff);
2392                         mdelay(250);
2393                         cx_write(MO_GP2_IO, 0xff);
2394                         mdelay(250);
2395                         break;
2396                 case CX88_VMUX_DVB:     /* Digital TV*/
2397                 default:                /* Analog TV */
2398                         info_printk(core, "setting GPIO to TV!\n");
2399                         break;
2400                 }
2401                 cx_write(MO_GP1_IO, 0x101010);
2402                 mdelay(250);
2403                 cx_write(MO_GP1_IO, 0x101000);
2404                 mdelay(250);
2405                 cx_write(MO_GP1_IO, 0x101010);
2406                 mdelay(250);
2407                 return 0;
2408         }
2409         return -EINVAL;
2410 }
2411
2412 /* ----------------------------------------------------------------------- */
2413 /* Tuner callback function. Currently only needed for the Pinnacle         *
2414  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both       *
2415  * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c)    */
2416
2417 static int cx88_xc5000_tuner_callback(struct cx88_core *core,
2418                                       int command, int arg)
2419 {
2420         switch (core->boardnr) {
2421         case CX88_BOARD_PINNACLE_PCTV_HD_800i:
2422                 if (command == 0) { /* This is the reset command from xc5000 */
2423                         /* Reset XC5000 tuner via SYS_RSTO_pin */
2424                         cx_write(MO_SRST_IO, 0);
2425                         msleep(10);
2426                         cx_write(MO_SRST_IO, 1);
2427                         return 0;
2428                 } else {
2429                         err_printk(core, "xc5000: unknown tuner "
2430                                    "callback command.\n");
2431                         return -EINVAL;
2432                 }
2433                 break;
2434         case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
2435                 if (command == 0) { /* This is the reset command from xc5000 */
2436                         cx_clear(MO_GP0_IO, 0x00000010);
2437                         msleep(10);
2438                         cx_set(MO_GP0_IO, 0x00000010);
2439                         return 0;
2440                 } else {
2441                         printk(KERN_ERR
2442                                 "xc5000: unknown tuner callback command.\n");
2443                         return -EINVAL;
2444                 }
2445                 break;
2446         }
2447         return 0; /* Should never be here */
2448 }
2449
2450 int cx88_tuner_callback(void *priv, int command, int arg)
2451 {
2452         struct i2c_algo_bit_data *i2c_algo = priv;
2453         struct cx88_core *core;
2454
2455         if (!i2c_algo) {
2456                 printk(KERN_ERR "cx88: Error - i2c private data undefined.\n");
2457                 return -EINVAL;
2458         }
2459
2460         core = i2c_algo->data;
2461
2462         if (!core) {
2463                 printk(KERN_ERR "cx88: Error - device struct undefined.\n");
2464                 return -EINVAL;
2465         }
2466
2467         switch (core->board.tuner_type) {
2468                 case TUNER_XC2028:
2469                         info_printk(core, "Calling XC2028/3028 callback\n");
2470                         return cx88_xc2028_tuner_callback(core, command, arg);
2471                 case TUNER_XC5000:
2472                         info_printk(core, "Calling XC5000 callback\n");
2473                         return cx88_xc5000_tuner_callback(core, command, arg);
2474         }
2475         err_printk(core, "Error: Calling callback for tuner %d\n",
2476                    core->board.tuner_type);
2477         return -EINVAL;
2478 }
2479 EXPORT_SYMBOL(cx88_tuner_callback);
2480
2481 /* ----------------------------------------------------------------------- */
2482
2483 static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
2484 {
2485         int i;
2486
2487         if (0 == pci->subsystem_vendor &&
2488             0 == pci->subsystem_device) {
2489                 printk(KERN_ERR
2490                        "%s: Your board has no valid PCI Subsystem ID and thus can't\n"
2491                        "%s: be autodetected.  Please pass card=<n> insmod option to\n"
2492                        "%s: workaround that.  Redirect complaints to the vendor of\n"
2493                        "%s: the TV card.  Best regards,\n"
2494                        "%s:         -- tux\n",
2495                        core->name,core->name,core->name,core->name,core->name);
2496         } else {
2497                 printk(KERN_ERR
2498                        "%s: Your board isn't known (yet) to the driver.  You can\n"
2499                        "%s: try to pick one of the existing card configs via\n"
2500                        "%s: card=<n> insmod option.  Updating to the latest\n"
2501                        "%s: version might help as well.\n",
2502                        core->name,core->name,core->name,core->name);
2503         }
2504         err_printk(core, "Here is a list of valid choices for the card=<n> "
2505                    "insmod option:\n");
2506         for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
2507                 printk(KERN_ERR "%s:    card=%d -> %s\n",
2508                        core->name, i, cx88_boards[i].name);
2509 }
2510
2511 static void cx88_card_setup_pre_i2c(struct cx88_core *core)
2512 {
2513         switch (core->boardnr) {
2514         case CX88_BOARD_HAUPPAUGE_HVR1300:
2515                 /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */
2516                 /* We leave here with the 702 on the bus */
2517                 cx_write(MO_GP0_IO, 0x0000e780);
2518                 udelay(1000);
2519                 cx_clear(MO_GP0_IO, 0x00000080);
2520                 udelay(50);
2521                 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
2522                 udelay(1000);
2523                 break;
2524
2525         case CX88_BOARD_PROLINK_PV_8000GT:
2526                 cx_write(MO_GP2_IO, 0xcf7);
2527                 mdelay(50);
2528                 cx_write(MO_GP2_IO, 0xef5);
2529                 mdelay(50);
2530                 cx_write(MO_GP2_IO, 0xcf7);
2531                 msleep(10);
2532                 break;
2533
2534          case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
2535                 /* Enable the xc5000 tuner */
2536                 cx_set(MO_GP0_IO, 0x00001010);
2537                 break;
2538         case CX88_BOARD_HAUPPAUGE_HVR4000:
2539         case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
2540                 /* Init GPIO to allow tuner to attach */
2541                 cx_write(MO_GP0_IO, 0x0000c4bf);
2542                 udelay(1000);
2543         }
2544 }
2545
2546 /*
2547  * Sets board-dependent xc3028 configuration
2548  */
2549 void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl)
2550 {
2551         memset(ctl, 0, sizeof(*ctl));
2552
2553         ctl->fname   = XC2028_DEFAULT_FIRMWARE;
2554         ctl->max_len = 64;
2555
2556         switch (core->boardnr) {
2557         case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2558                 /* Now works with firmware version 2.7 */
2559                 if (core->i2c_algo.udelay < 16)
2560                         core->i2c_algo.udelay = 16;
2561                 break;
2562         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2563                 ctl->scode_table = XC3028_FE_ZARLINK456;
2564                 break;
2565         case CX88_BOARD_KWORLD_ATSC_120:
2566         case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2567                 ctl->demod = XC3028_FE_OREN538;
2568                 break;
2569         case CX88_BOARD_PROLINK_PV_8000GT:
2570                 /*
2571                  * This board uses non-MTS firmware
2572                  */
2573                 break;
2574         default:
2575                 ctl->demod = XC3028_FE_OREN538;
2576                 ctl->mts = 1;
2577         }
2578 }
2579 EXPORT_SYMBOL_GPL(cx88_setup_xc3028);
2580
2581 static void cx88_card_setup(struct cx88_core *core)
2582 {
2583         static u8 eeprom[256];
2584         struct tuner_setup tun_setup;
2585         unsigned int mode_mask = T_RADIO     |
2586                                  T_ANALOG_TV |
2587                                  T_DIGITAL_TV;
2588
2589         memset(&tun_setup, 0, sizeof(tun_setup));
2590
2591         if (0 == core->i2c_rc) {
2592                 core->i2c_client.addr = 0xa0 >> 1;
2593                 tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom));
2594         }
2595
2596         switch (core->boardnr) {
2597         case CX88_BOARD_HAUPPAUGE:
2598         case CX88_BOARD_HAUPPAUGE_ROSLYN:
2599                 if (0 == core->i2c_rc)
2600                         hauppauge_eeprom(core, eeprom+8);
2601                 break;
2602         case CX88_BOARD_GDI:
2603                 if (0 == core->i2c_rc)
2604                         gdi_eeprom(core, eeprom);
2605                 break;
2606         case CX88_BOARD_WINFAST2000XP_EXPERT:
2607                 if (0 == core->i2c_rc)
2608                         leadtek_eeprom(core, eeprom);
2609                 break;
2610         case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
2611         case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
2612         case CX88_BOARD_HAUPPAUGE_DVB_T1:
2613         case CX88_BOARD_HAUPPAUGE_HVR1100:
2614         case CX88_BOARD_HAUPPAUGE_HVR1100LP:
2615         case CX88_BOARD_HAUPPAUGE_HVR3000:
2616         case CX88_BOARD_HAUPPAUGE_HVR1300:
2617         case CX88_BOARD_HAUPPAUGE_HVR4000:
2618         case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
2619                 if (0 == core->i2c_rc)
2620                         hauppauge_eeprom(core, eeprom);
2621                 break;
2622         case CX88_BOARD_KWORLD_DVBS_100:
2623                 cx_write(MO_GP0_IO, 0x000007f8);
2624                 cx_write(MO_GP1_IO, 0x00000001);
2625                 break;
2626         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2627                 /* GPIO0:0 is hooked to demod reset */
2628                 /* GPIO0:4 is hooked to xc3028 reset */
2629                 cx_write(MO_GP0_IO, 0x00111100);
2630                 msleep(1);
2631                 cx_write(MO_GP0_IO, 0x00111111);
2632                 break;
2633         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
2634                 /* GPIO0:6 is hooked to FX2 reset pin */
2635                 cx_set(MO_GP0_IO, 0x00004040);
2636                 cx_clear(MO_GP0_IO, 0x00000040);
2637                 msleep(1000);
2638                 cx_set(MO_GP0_IO, 0x00004040);
2639                 /* FALLTHROUGH */
2640         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
2641         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
2642         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
2643                 /* GPIO0:0 is hooked to mt352 reset pin */
2644                 cx_set(MO_GP0_IO, 0x00000101);
2645                 cx_clear(MO_GP0_IO, 0x00000001);
2646                 msleep(1);
2647                 cx_set(MO_GP0_IO, 0x00000101);
2648                 if (0 == core->i2c_rc &&
2649                     core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
2650                         dvico_fusionhdtv_hybrid_init(core);
2651                 break;
2652         case CX88_BOARD_KWORLD_DVB_T:
2653         case CX88_BOARD_DNTV_LIVE_DVB_T:
2654                 cx_set(MO_GP0_IO, 0x00000707);
2655                 cx_set(MO_GP2_IO, 0x00000101);
2656                 cx_clear(MO_GP2_IO, 0x00000001);
2657                 msleep(1);
2658                 cx_clear(MO_GP0_IO, 0x00000007);
2659                 cx_set(MO_GP2_IO, 0x00000101);
2660                 break;
2661         case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
2662                 cx_write(MO_GP0_IO, 0x00080808);
2663                 break;
2664         case CX88_BOARD_ATI_HDTVWONDER:
2665                 if (0 == core->i2c_rc) {
2666                         /* enable tuner */
2667                         int i;
2668                         static const u8 buffer [][2] = {
2669                                 {0x10,0x12},
2670                                 {0x13,0x04},
2671                                 {0x16,0x00},
2672                                 {0x14,0x04},
2673                                 {0x17,0x00}
2674                         };
2675                         core->i2c_client.addr = 0x0a;
2676
2677                         for (i = 0; i < ARRAY_SIZE(buffer); i++)
2678                                 if (2 != i2c_master_send(&core->i2c_client,
2679                                                         buffer[i],2))
2680                                         warn_printk(core, "Unable to enable "
2681                                                     "tuner(%i).\n", i);
2682                 }
2683                 break;
2684         case CX88_BOARD_MSI_TVANYWHERE_MASTER:
2685         {
2686                 struct v4l2_priv_tun_config tea5767_cfg;
2687                 struct tea5767_ctrl ctl;
2688
2689                 memset(&ctl, 0, sizeof(ctl));
2690
2691                 ctl.high_cut  = 1;
2692                 ctl.st_noise  = 1;
2693                 ctl.deemph_75 = 1;
2694                 ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
2695
2696                 tea5767_cfg.tuner = TUNER_TEA5767;
2697                 tea5767_cfg.priv  = &ctl;
2698
2699                 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg);
2700                 break;
2701         }
2702         case  CX88_BOARD_TEVII_S460:
2703                 cx_write(MO_SRST_IO, 0);
2704                 msleep(100);
2705                 cx_write(MO_SRST_IO, 1);
2706                 msleep(100);
2707                 break;
2708         case  CX88_BOARD_OMICOM_SS4_PCI:
2709                 cx_write(MO_SRST_IO, 0);
2710                 msleep(100);
2711                 cx_write(MO_SRST_IO, 1);
2712                 msleep(100);
2713                 break;
2714         case  CX88_BOARD_TBS_8920:
2715                 cx_write(MO_SRST_IO, 0);
2716                 msleep(100);
2717                 cx_write(MO_SRST_IO, 1);
2718                 msleep(100);
2719                 break;
2720         } /*end switch() */
2721
2722
2723         /* Setup tuners */
2724         if ((core->board.radio_type != UNSET)) {
2725                 tun_setup.mode_mask      = T_RADIO;
2726                 tun_setup.type           = core->board.radio_type;
2727                 tun_setup.addr           = core->board.radio_addr;
2728                 tun_setup.tuner_callback = cx88_tuner_callback;
2729                 cx88_call_i2c_clients(core, TUNER_SET_TYPE_ADDR, &tun_setup);
2730                 mode_mask &= ~T_RADIO;
2731         }
2732
2733         if (core->board.tuner_type != TUNER_ABSENT) {
2734                 tun_setup.mode_mask      = mode_mask;
2735                 tun_setup.type           = core->board.tuner_type;
2736                 tun_setup.addr           = core->board.tuner_addr;
2737                 tun_setup.tuner_callback = cx88_tuner_callback;
2738
2739                 cx88_call_i2c_clients(core, TUNER_SET_TYPE_ADDR, &tun_setup);
2740         }
2741
2742         if (core->board.tda9887_conf) {
2743                 struct v4l2_priv_tun_config tda9887_cfg;
2744
2745                 tda9887_cfg.tuner = TUNER_TDA9887;
2746                 tda9887_cfg.priv  = &core->board.tda9887_conf;
2747
2748                 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tda9887_cfg);
2749         }
2750
2751         if (core->board.tuner_type == TUNER_XC2028) {
2752                 struct v4l2_priv_tun_config  xc2028_cfg;
2753                 struct xc2028_ctrl           ctl;
2754
2755                 /* Fills device-dependent initialization parameters */
2756                 cx88_setup_xc3028(core, &ctl);
2757
2758                 /* Sends parameters to xc2028/3028 tuner */
2759                 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2760                 xc2028_cfg.tuner = TUNER_XC2028;
2761                 xc2028_cfg.priv  = &ctl;
2762                 info_printk(core, "Asking xc2028/3028 to load firmware %s\n",
2763                             ctl.fname);
2764                 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &xc2028_cfg);
2765         }
2766         cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL);
2767 }
2768
2769 /* ------------------------------------------------------------------ */
2770
2771 static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
2772 {
2773         unsigned int lat = UNSET;
2774         u8 ctrl = 0;
2775         u8 value;
2776
2777         /* check pci quirks */
2778         if (pci_pci_problems & PCIPCI_TRITON) {
2779                 printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n",
2780                        name);
2781                 ctrl |= CX88X_EN_TBFX;
2782         }
2783         if (pci_pci_problems & PCIPCI_NATOMA) {
2784                 printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n",
2785                        name);
2786                 ctrl |= CX88X_EN_TBFX;
2787         }
2788         if (pci_pci_problems & PCIPCI_VIAETBF) {
2789                 printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n",
2790                        name);
2791                 ctrl |= CX88X_EN_TBFX;
2792         }
2793         if (pci_pci_problems & PCIPCI_VSFX) {
2794                 printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n",
2795                        name);
2796                 ctrl |= CX88X_EN_VSFX;
2797         }
2798 #ifdef PCIPCI_ALIMAGIK
2799         if (pci_pci_problems & PCIPCI_ALIMAGIK) {
2800                 printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
2801                        name);
2802                 lat = 0x0A;
2803         }
2804 #endif
2805
2806         /* check insmod options */
2807         if (UNSET != latency)
2808                 lat = latency;
2809
2810         /* apply stuff */
2811         if (ctrl) {
2812                 pci_read_config_byte(pci, CX88X_DEVCTRL, &value);
2813                 value |= ctrl;
2814                 pci_write_config_byte(pci, CX88X_DEVCTRL, value);
2815         }
2816         if (UNSET != lat) {
2817                 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
2818                        name, latency);
2819                 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
2820         }
2821         return 0;
2822 }
2823
2824 int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
2825 {
2826         if (request_mem_region(pci_resource_start(pci,0),
2827                                pci_resource_len(pci,0),
2828                                core->name))
2829                 return 0;
2830         printk(KERN_ERR
2831                "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
2832                core->name, PCI_FUNC(pci->devfn),
2833                (unsigned long long)pci_resource_start(pci, 0),
2834                pci->subsystem_vendor, pci->subsystem_device);
2835         return -EBUSY;
2836 }
2837
2838 /* Allocate and initialize the cx88 core struct.  One should hold the
2839  * devlist mutex before calling this.  */
2840 struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
2841 {
2842         struct cx88_core *core;
2843         int i;
2844
2845         core = kzalloc(sizeof(*core), GFP_KERNEL);
2846
2847         atomic_inc(&core->refcount);
2848         core->pci_bus  = pci->bus->number;
2849         core->pci_slot = PCI_SLOT(pci->devfn);
2850         core->pci_irqmask = PCI_INT_RISC_RD_BERRINT | PCI_INT_RISC_WR_BERRINT |
2851                             PCI_INT_BRDG_BERRINT | PCI_INT_SRC_DMA_BERRINT |
2852                             PCI_INT_DST_DMA_BERRINT | PCI_INT_IPB_DMA_BERRINT;
2853         mutex_init(&core->lock);
2854
2855         core->nr = nr;
2856         sprintf(core->name, "cx88[%d]", core->nr);
2857         if (0 != cx88_get_resources(core, pci)) {
2858                 kfree(core);
2859                 return NULL;
2860         }
2861
2862         /* PCI stuff */
2863         cx88_pci_quirks(core->name, pci);
2864         core->lmmio = ioremap(pci_resource_start(pci, 0),
2865                               pci_resource_len(pci, 0));
2866         core->bmmio = (u8 __iomem *)core->lmmio;
2867
2868         /* board config */
2869         core->boardnr = UNSET;
2870         if (card[core->nr] < ARRAY_SIZE(cx88_boards))
2871                 core->boardnr = card[core->nr];
2872         for (i = 0; UNSET == core->boardnr && i < ARRAY_SIZE(cx88_subids); i++)
2873                 if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
2874                     pci->subsystem_device == cx88_subids[i].subdevice)
2875                         core->boardnr = cx88_subids[i].card;
2876         if (UNSET == core->boardnr) {
2877                 core->boardnr = CX88_BOARD_UNKNOWN;
2878                 cx88_card_list(core, pci);
2879         }
2880
2881         memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
2882
2883         info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
2884                 pci->subsystem_vendor, pci->subsystem_device, core->board.name,
2885                 core->boardnr, card[core->nr] == core->boardnr ?
2886                 "insmod option" : "autodetected");
2887
2888         if (tuner[core->nr] != UNSET)
2889                 core->board.tuner_type = tuner[core->nr];
2890         if (radio[core->nr] != UNSET)
2891                 core->board.radio_type = radio[core->nr];
2892
2893         info_printk(core, "TV tuner type %d, Radio tuner type %d\n",
2894                     core->board.tuner_type, core->board.radio_type);
2895
2896         /* init hardware */
2897         cx88_reset(core);
2898         cx88_card_setup_pre_i2c(core);
2899         cx88_i2c_init(core, pci);
2900
2901         /* load tuner module, if needed */
2902         if (TUNER_ABSENT != core->board.tuner_type)
2903                 request_module("tuner");
2904
2905         cx88_card_setup(core);
2906         cx88_ir_init(core, pci);
2907
2908         return core;
2909 }