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