Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[pandora-kernel.git] / 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 #include <linux/slab.h>
28
29 #include "cx88.h"
30 #include "tea5767.h"
31 #include "xc4000.h"
32
33 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
34 static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
35 static unsigned int card[]  = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
36
37 module_param_array(tuner, int, NULL, 0444);
38 module_param_array(radio, int, NULL, 0444);
39 module_param_array(card,  int, NULL, 0444);
40
41 MODULE_PARM_DESC(tuner,"tuner type");
42 MODULE_PARM_DESC(radio,"radio tuner type");
43 MODULE_PARM_DESC(card,"card type");
44
45 static unsigned int latency = UNSET;
46 module_param(latency,int,0444);
47 MODULE_PARM_DESC(latency,"pci latency timer");
48
49 static int disable_ir;
50 module_param(disable_ir, int, 0444);
51 MODULE_PARM_DESC(disable_ir, "Disable IR support");
52
53 #define info_printk(core, fmt, arg...) \
54         printk(KERN_INFO "%s: " fmt, core->name , ## arg)
55
56 #define warn_printk(core, fmt, arg...) \
57         printk(KERN_WARNING "%s: " fmt, core->name , ## arg)
58
59 #define err_printk(core, fmt, arg...) \
60         printk(KERN_ERR "%s: " fmt, core->name , ## arg)
61
62
63 /* ------------------------------------------------------------------ */
64 /* board config info                                                  */
65
66 /* If radio_type !=UNSET, radio_addr should be specified
67  */
68
69 static const struct cx88_board cx88_boards[] = {
70         [CX88_BOARD_UNKNOWN] = {
71                 .name           = "UNKNOWN/GENERIC",
72                 .tuner_type     = UNSET,
73                 .radio_type     = UNSET,
74                 .tuner_addr     = ADDR_UNSET,
75                 .radio_addr     = ADDR_UNSET,
76                 .input          = {{
77                         .type   = CX88_VMUX_COMPOSITE1,
78                         .vmux   = 0,
79                 },{
80                         .type   = CX88_VMUX_COMPOSITE2,
81                         .vmux   = 1,
82                 },{
83                         .type   = CX88_VMUX_COMPOSITE3,
84                         .vmux   = 2,
85                 },{
86                         .type   = CX88_VMUX_COMPOSITE4,
87                         .vmux   = 3,
88                 }},
89         },
90         [CX88_BOARD_HAUPPAUGE] = {
91                 .name           = "Hauppauge WinTV 34xxx models",
92                 .tuner_type     = UNSET,
93                 .radio_type     = UNSET,
94                 .tuner_addr     = ADDR_UNSET,
95                 .radio_addr     = ADDR_UNSET,
96                 .tda9887_conf   = TDA9887_PRESENT,
97                 .input          = {{
98                         .type   = CX88_VMUX_TELEVISION,
99                         .vmux   = 0,
100                         .gpio0  = 0xff00,  // internal decoder
101                 },{
102                         .type   = CX88_VMUX_DEBUG,
103                         .vmux   = 0,
104                         .gpio0  = 0xff01,  // mono from tuner chip
105                 },{
106                         .type   = CX88_VMUX_COMPOSITE1,
107                         .vmux   = 1,
108                         .gpio0  = 0xff02,
109                 },{
110                         .type   = CX88_VMUX_SVIDEO,
111                         .vmux   = 2,
112                         .gpio0  = 0xff02,
113                 }},
114                 .radio = {
115                         .type   = CX88_RADIO,
116                         .gpio0  = 0xff01,
117                 },
118         },
119         [CX88_BOARD_GDI] = {
120                 .name           = "GDI Black Gold",
121                 .tuner_type     = UNSET,
122                 .radio_type     = UNSET,
123                 .tuner_addr     = ADDR_UNSET,
124                 .radio_addr     = ADDR_UNSET,
125                 .input          = {{
126                         .type   = CX88_VMUX_TELEVISION,
127                         .vmux   = 0,
128                 },{
129                         .type   = CX88_VMUX_SVIDEO,
130                         .vmux   = 2,
131                 }},
132         },
133         [CX88_BOARD_PIXELVIEW] = {
134                 .name           = "PixelView",
135                 .tuner_type     = TUNER_PHILIPS_PAL,
136                 .radio_type     = UNSET,
137                 .tuner_addr     = ADDR_UNSET,
138                 .radio_addr     = ADDR_UNSET,
139                 .input          = {{
140                         .type   = CX88_VMUX_TELEVISION,
141                         .vmux   = 0,
142                         .gpio0  = 0xff00,  // internal decoder
143                 },{
144                         .type   = CX88_VMUX_COMPOSITE1,
145                         .vmux   = 1,
146                 },{
147                         .type   = CX88_VMUX_SVIDEO,
148                         .vmux   = 2,
149                 }},
150                 .radio = {
151                          .type  = CX88_RADIO,
152                          .gpio0 = 0xff10,
153                 },
154         },
155         [CX88_BOARD_ATI_WONDER_PRO] = {
156                 .name           = "ATI TV Wonder Pro",
157                 .tuner_type     = TUNER_PHILIPS_4IN1,
158                 .radio_type     = UNSET,
159                 .tuner_addr     = ADDR_UNSET,
160                 .radio_addr     = ADDR_UNSET,
161                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
162                 .input          = {{
163                         .type   = CX88_VMUX_TELEVISION,
164                         .vmux   = 0,
165                         .gpio0  = 0x03ff,
166                 },{
167                         .type   = CX88_VMUX_COMPOSITE1,
168                         .vmux   = 1,
169                         .gpio0  = 0x03fe,
170                 },{
171                         .type   = CX88_VMUX_SVIDEO,
172                         .vmux   = 2,
173                         .gpio0  = 0x03fe,
174                 }},
175         },
176         [CX88_BOARD_WINFAST2000XP_EXPERT] = {
177                 .name           = "Leadtek Winfast 2000XP Expert",
178                 .tuner_type     = TUNER_PHILIPS_4IN1,
179                 .radio_type     = UNSET,
180                 .tuner_addr     = ADDR_UNSET,
181                 .radio_addr     = ADDR_UNSET,
182                 .tda9887_conf   = TDA9887_PRESENT,
183                 .input          = {{
184                         .type   = CX88_VMUX_TELEVISION,
185                         .vmux   = 0,
186                         .gpio0  = 0x00F5e700,
187                         .gpio1  = 0x00003004,
188                         .gpio2  = 0x00F5e700,
189                         .gpio3  = 0x02000000,
190                 },{
191                         .type   = CX88_VMUX_COMPOSITE1,
192                         .vmux   = 1,
193                         .gpio0  = 0x00F5c700,
194                         .gpio1  = 0x00003004,
195                         .gpio2  = 0x00F5c700,
196                         .gpio3  = 0x02000000,
197                 },{
198                         .type   = CX88_VMUX_SVIDEO,
199                         .vmux   = 2,
200                         .gpio0  = 0x00F5c700,
201                         .gpio1  = 0x00003004,
202                         .gpio2  = 0x00F5c700,
203                         .gpio3  = 0x02000000,
204                 }},
205                 .radio = {
206                         .type   = CX88_RADIO,
207                         .gpio0  = 0x00F5d700,
208                         .gpio1  = 0x00003004,
209                         .gpio2  = 0x00F5d700,
210                         .gpio3  = 0x02000000,
211                 },
212         },
213         [CX88_BOARD_AVERTV_STUDIO_303] = {
214                 .name           = "AverTV Studio 303 (M126)",
215                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
216                 .radio_type     = UNSET,
217                 .tuner_addr     = ADDR_UNSET,
218                 .radio_addr     = ADDR_UNSET,
219                 .tda9887_conf   = TDA9887_PRESENT,
220                 .input          = {{
221                         .type   = CX88_VMUX_TELEVISION,
222                         .vmux   = 0,
223                         .gpio1  = 0xe09f,
224                 },{
225                         .type   = CX88_VMUX_COMPOSITE1,
226                         .vmux   = 1,
227                         .gpio1  = 0xe05f,
228                 },{
229                         .type   = CX88_VMUX_SVIDEO,
230                         .vmux   = 2,
231                         .gpio1  = 0xe05f,
232                 }},
233                 .radio = {
234                         .gpio1  = 0xe0df,
235                         .type   = CX88_RADIO,
236                 },
237         },
238         [CX88_BOARD_MSI_TVANYWHERE_MASTER] = {
239                 // added gpio values thanks to Michal
240                 // values for PAL from DScaler
241                 .name           = "MSI TV-@nywhere Master",
242                 .tuner_type     = TUNER_MT2032,
243                 .radio_type     = UNSET,
244                 .tuner_addr     = ADDR_UNSET,
245                 .radio_addr     = ADDR_UNSET,
246                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER_NTSC,
247                 .input          = {{
248                         .type   = CX88_VMUX_TELEVISION,
249                         .vmux   = 0,
250                         .gpio0  = 0x000040bf,
251                         .gpio1  = 0x000080c0,
252                         .gpio2  = 0x0000ff40,
253                 },{
254                         .type   = CX88_VMUX_COMPOSITE1,
255                         .vmux   = 1,
256                         .gpio0  = 0x000040bf,
257                         .gpio1  = 0x000080c0,
258                         .gpio2  = 0x0000ff40,
259                 },{
260                         .type   = CX88_VMUX_SVIDEO,
261                         .vmux   = 2,
262                         .gpio0  = 0x000040bf,
263                         .gpio1  = 0x000080c0,
264                         .gpio2  = 0x0000ff40,
265                 }},
266                 .radio = {
267                          .type   = CX88_RADIO,
268                          .vmux   = 3,
269                          .gpio0  = 0x000040bf,
270                          .gpio1  = 0x000080c0,
271                          .gpio2  = 0x0000ff20,
272                 },
273         },
274         [CX88_BOARD_WINFAST_DV2000] = {
275                 .name           = "Leadtek Winfast DV2000",
276                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
277                 .radio_type     = UNSET,
278                 .tuner_addr     = ADDR_UNSET,
279                 .radio_addr     = ADDR_UNSET,
280                 .tda9887_conf   = TDA9887_PRESENT,
281                 .input          = {{
282                         .type   = CX88_VMUX_TELEVISION,
283                         .vmux   = 0,
284                         .gpio0  = 0x0035e700,
285                         .gpio1  = 0x00003004,
286                         .gpio2  = 0x0035e700,
287                         .gpio3  = 0x02000000,
288                 },{
289
290                         .type   = CX88_VMUX_COMPOSITE1,
291                         .vmux   = 1,
292                         .gpio0  = 0x0035c700,
293                         .gpio1  = 0x00003004,
294                         .gpio2  = 0x0035c700,
295                         .gpio3  = 0x02000000,
296                 },{
297                         .type   = CX88_VMUX_SVIDEO,
298                         .vmux   = 2,
299                         .gpio0  = 0x0035c700,
300                         .gpio1  = 0x0035c700,
301                         .gpio2  = 0x02000000,
302                         .gpio3  = 0x02000000,
303                 }},
304                 .radio = {
305                         .type   = CX88_RADIO,
306                         .gpio0  = 0x0035d700,
307                         .gpio1  = 0x00007004,
308                         .gpio2  = 0x0035d700,
309                         .gpio3  = 0x02000000,
310                 },
311         },
312         [CX88_BOARD_LEADTEK_PVR2000] = {
313                 // gpio values for PAL version from regspy by DScaler
314                 .name           = "Leadtek PVR 2000",
315                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
316                 .radio_type     = UNSET,
317                 .tuner_addr     = ADDR_UNSET,
318                 .radio_addr     = ADDR_UNSET,
319                 .tda9887_conf   = TDA9887_PRESENT,
320                 .input          = {{
321                         .type   = CX88_VMUX_TELEVISION,
322                         .vmux   = 0,
323                         .gpio0  = 0x0000bde2,
324                         .audioroute = 1,
325                 },{
326                         .type   = CX88_VMUX_COMPOSITE1,
327                         .vmux   = 1,
328                         .gpio0  = 0x0000bde6,
329                         .audioroute = 1,
330                 },{
331                         .type   = CX88_VMUX_SVIDEO,
332                         .vmux   = 2,
333                         .gpio0  = 0x0000bde6,
334                         .audioroute = 1,
335                 }},
336                 .radio = {
337                         .type   = CX88_RADIO,
338                         .gpio0  = 0x0000bd62,
339                         .audioroute = 1,
340                 },
341                 .mpeg           = CX88_MPEG_BLACKBIRD,
342         },
343         [CX88_BOARD_IODATA_GVVCP3PCI] = {
344                 .name           = "IODATA GV-VCP3/PCI",
345                 .tuner_type     = TUNER_ABSENT,
346                 .radio_type     = UNSET,
347                 .tuner_addr     = ADDR_UNSET,
348                 .radio_addr     = ADDR_UNSET,
349                 .input          = {{
350                         .type   = CX88_VMUX_COMPOSITE1,
351                         .vmux   = 0,
352                 },{
353                         .type   = CX88_VMUX_COMPOSITE2,
354                         .vmux   = 1,
355                 },{
356                         .type   = CX88_VMUX_SVIDEO,
357                         .vmux   = 2,
358                 }},
359         },
360         [CX88_BOARD_PROLINK_PLAYTVPVR] = {
361                 .name           = "Prolink PlayTV PVR",
362                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
363                 .radio_type     = UNSET,
364                 .tuner_addr     = ADDR_UNSET,
365                 .radio_addr     = ADDR_UNSET,
366                 .tda9887_conf   = TDA9887_PRESENT,
367                 .input          = {{
368                         .type   = CX88_VMUX_TELEVISION,
369                         .vmux   = 0,
370                         .gpio0  = 0xbff0,
371                 },{
372                         .type   = CX88_VMUX_COMPOSITE1,
373                         .vmux   = 1,
374                         .gpio0  = 0xbff3,
375                 },{
376                         .type   = CX88_VMUX_SVIDEO,
377                         .vmux   = 2,
378                         .gpio0  = 0xbff3,
379                 }},
380                 .radio = {
381                         .type   = CX88_RADIO,
382                         .gpio0  = 0xbff0,
383                 },
384         },
385         [CX88_BOARD_ASUS_PVR_416] = {
386                 .name           = "ASUS PVR-416",
387                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
388                 .radio_type     = UNSET,
389                 .tuner_addr     = ADDR_UNSET,
390                 .radio_addr     = ADDR_UNSET,
391                 .tda9887_conf   = TDA9887_PRESENT,
392                 .input          = {{
393                         .type   = CX88_VMUX_TELEVISION,
394                         .vmux   = 0,
395                         .gpio0  = 0x0000fde6,
396                 },{
397                         .type   = CX88_VMUX_SVIDEO,
398                         .vmux   = 2,
399                         .gpio0  = 0x0000fde6, // 0x0000fda6 L,R RCA audio in?
400                         .audioroute = 1,
401                 }},
402                 .radio = {
403                         .type   = CX88_RADIO,
404                         .gpio0  = 0x0000fde2,
405                 },
406                 .mpeg           = CX88_MPEG_BLACKBIRD,
407         },
408         [CX88_BOARD_MSI_TVANYWHERE] = {
409                 .name           = "MSI TV-@nywhere",
410                 .tuner_type     = TUNER_MT2032,
411                 .radio_type     = UNSET,
412                 .tuner_addr     = ADDR_UNSET,
413                 .radio_addr     = ADDR_UNSET,
414                 .tda9887_conf   = TDA9887_PRESENT,
415                 .input          = {{
416                         .type   = CX88_VMUX_TELEVISION,
417                         .vmux   = 0,
418                         .gpio0  = 0x00000fbf,
419                         .gpio2  = 0x0000fc08,
420                 },{
421                         .type   = CX88_VMUX_COMPOSITE1,
422                         .vmux   = 1,
423                         .gpio0  = 0x00000fbf,
424                         .gpio2  = 0x0000fc68,
425                 },{
426                         .type   = CX88_VMUX_SVIDEO,
427                         .vmux   = 2,
428                         .gpio0  = 0x00000fbf,
429                         .gpio2  = 0x0000fc68,
430                 }},
431         },
432         [CX88_BOARD_KWORLD_DVB_T] = {
433                 .name           = "KWorld/VStream XPert DVB-T",
434                 .tuner_type     = TUNER_ABSENT,
435                 .radio_type     = UNSET,
436                 .tuner_addr     = ADDR_UNSET,
437                 .radio_addr     = ADDR_UNSET,
438                 .input          = {{
439                         .type   = CX88_VMUX_COMPOSITE1,
440                         .vmux   = 1,
441                         .gpio0  = 0x0700,
442                         .gpio2  = 0x0101,
443                 },{
444                         .type   = CX88_VMUX_SVIDEO,
445                         .vmux   = 2,
446                         .gpio0  = 0x0700,
447                         .gpio2  = 0x0101,
448                 }},
449                 .mpeg           = CX88_MPEG_DVB,
450         },
451         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = {
452                 .name           = "DViCO FusionHDTV DVB-T1",
453                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
454                 .radio_type     = UNSET,
455                 .tuner_addr     = ADDR_UNSET,
456                 .radio_addr     = ADDR_UNSET,
457                 .input          = {{
458                         .type   = CX88_VMUX_COMPOSITE1,
459                         .vmux   = 1,
460                         .gpio0  = 0x000027df,
461                 },{
462                         .type   = CX88_VMUX_SVIDEO,
463                         .vmux   = 2,
464                         .gpio0  = 0x000027df,
465                 }},
466                 .mpeg           = CX88_MPEG_DVB,
467         },
468         [CX88_BOARD_KWORLD_LTV883] = {
469                 .name           = "KWorld LTV883RF",
470                 .tuner_type     = TUNER_TNF_8831BGFF,
471                 .radio_type     = UNSET,
472                 .tuner_addr     = ADDR_UNSET,
473                 .radio_addr     = ADDR_UNSET,
474                 .input          = {{
475                         .type   = CX88_VMUX_TELEVISION,
476                         .vmux   = 0,
477                         .gpio0  = 0x07f8,
478                 },{
479                         .type   = CX88_VMUX_DEBUG,
480                         .vmux   = 0,
481                         .gpio0  = 0x07f9,  // mono from tuner chip
482                 },{
483                         .type   = CX88_VMUX_COMPOSITE1,
484                         .vmux   = 1,
485                         .gpio0  = 0x000007fa,
486                 },{
487                         .type   = CX88_VMUX_SVIDEO,
488                         .vmux   = 2,
489                         .gpio0  = 0x000007fa,
490                 }},
491                 .radio = {
492                         .type   = CX88_RADIO,
493                         .gpio0  = 0x000007f8,
494                 },
495         },
496         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q] = {
497                 .name           = "DViCO FusionHDTV 3 Gold-Q",
498                 .tuner_type     = TUNER_MICROTUNE_4042FI5,
499                 .radio_type     = UNSET,
500                 .tuner_addr     = ADDR_UNSET,
501                 .radio_addr     = ADDR_UNSET,
502                 /*
503                    GPIO[0] resets DT3302 DTV receiver
504                     0 - reset asserted
505                     1 - normal operation
506                    GPIO[1] mutes analog audio output connector
507                     0 - enable selected source
508                     1 - mute
509                    GPIO[2] selects source for analog audio output connector
510                     0 - analog audio input connector on tab
511                     1 - analog DAC output from CX23881 chip
512                    GPIO[3] selects RF input connector on tuner module
513                     0 - RF connector labeled CABLE
514                     1 - RF connector labeled ANT
515                    GPIO[4] selects high RF for QAM256 mode
516                     0 - normal RF
517                     1 - high RF
518                 */
519                 .input          = {{
520                         .type   = CX88_VMUX_TELEVISION,
521                         .vmux   = 0,
522                         .gpio0  = 0x0f0d,
523                 },{
524                         .type   = CX88_VMUX_CABLE,
525                         .vmux   = 0,
526                         .gpio0  = 0x0f05,
527                 },{
528                         .type   = CX88_VMUX_COMPOSITE1,
529                         .vmux   = 1,
530                         .gpio0  = 0x0f00,
531                 },{
532                         .type   = CX88_VMUX_SVIDEO,
533                         .vmux   = 2,
534                         .gpio0  = 0x0f00,
535                 }},
536                 .mpeg           = CX88_MPEG_DVB,
537         },
538         [CX88_BOARD_HAUPPAUGE_DVB_T1] = {
539                 .name           = "Hauppauge Nova-T DVB-T",
540                 .tuner_type     = TUNER_ABSENT,
541                 .radio_type     = UNSET,
542                 .tuner_addr     = ADDR_UNSET,
543                 .radio_addr     = ADDR_UNSET,
544                 .input          = {{
545                         .type   = CX88_VMUX_DVB,
546                         .vmux   = 0,
547                 }},
548                 .mpeg           = CX88_MPEG_DVB,
549         },
550         [CX88_BOARD_CONEXANT_DVB_T1] = {
551                 .name           = "Conexant DVB-T reference design",
552                 .tuner_type     = TUNER_ABSENT,
553                 .radio_type     = UNSET,
554                 .tuner_addr     = ADDR_UNSET,
555                 .radio_addr     = ADDR_UNSET,
556                 .input          = {{
557                         .type   = CX88_VMUX_DVB,
558                         .vmux   = 0,
559                 }},
560                 .mpeg           = CX88_MPEG_DVB,
561         },
562         [CX88_BOARD_PROVIDEO_PV259] = {
563                 .name           = "Provideo PV259",
564                 .tuner_type     = TUNER_PHILIPS_FQ1216ME,
565                 .radio_type     = UNSET,
566                 .tuner_addr     = ADDR_UNSET,
567                 .radio_addr     = ADDR_UNSET,
568                 .input          = {{
569                         .type   = CX88_VMUX_TELEVISION,
570                         .vmux   = 0,
571                         .audioroute = 1,
572                 }},
573                 .mpeg           = CX88_MPEG_BLACKBIRD,
574         },
575         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
576                 .name           = "DViCO FusionHDTV DVB-T Plus",
577                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
578                 .radio_type     = UNSET,
579                 .tuner_addr     = ADDR_UNSET,
580                 .radio_addr     = ADDR_UNSET,
581                 .input          = {{
582                         .type   = CX88_VMUX_COMPOSITE1,
583                         .vmux   = 1,
584                         .gpio0  = 0x000027df,
585                 },{
586                         .type   = CX88_VMUX_SVIDEO,
587                         .vmux   = 2,
588                         .gpio0  = 0x000027df,
589                 }},
590                 .mpeg           = CX88_MPEG_DVB,
591         },
592         [CX88_BOARD_DNTV_LIVE_DVB_T] = {
593                 .name           = "digitalnow DNTV Live! DVB-T",
594                 .tuner_type     = TUNER_ABSENT,
595                 .radio_type     = UNSET,
596                 .tuner_addr     = ADDR_UNSET,
597                 .radio_addr     = ADDR_UNSET,
598                 .input          = {{
599                         .type   = CX88_VMUX_COMPOSITE1,
600                         .vmux   = 1,
601                         .gpio0  = 0x00000700,
602                         .gpio2  = 0x00000101,
603                 },{
604                         .type   = CX88_VMUX_SVIDEO,
605                         .vmux   = 2,
606                         .gpio0  = 0x00000700,
607                         .gpio2  = 0x00000101,
608                 }},
609                 .mpeg           = CX88_MPEG_DVB,
610         },
611         [CX88_BOARD_PCHDTV_HD3000] = {
612                 .name           = "pcHDTV HD3000 HDTV",
613                 .tuner_type     = TUNER_THOMSON_DTT761X,
614                 .radio_type     = UNSET,
615                 .tuner_addr     = ADDR_UNSET,
616                 .radio_addr     = ADDR_UNSET,
617                 .tda9887_conf   = TDA9887_PRESENT,
618                 /* GPIO[2] = audio source for analog audio out connector
619                  *  0 = analog audio input connector
620                  *  1 = CX88 audio DACs
621                  *
622                  * GPIO[7] = input to CX88's audio/chroma ADC
623                  *  0 = FM 10.7 MHz IF
624                  *  1 = Sound 4.5 MHz IF
625                  *
626                  * GPIO[1,5,6] = Oren 51132 pins 27,35,28 respectively
627                  *
628                  * GPIO[16] = Remote control input
629                  */
630                 .input          = {{
631                         .type   = CX88_VMUX_TELEVISION,
632                         .vmux   = 0,
633                         .gpio0  = 0x00008484,
634                 },{
635                         .type   = CX88_VMUX_COMPOSITE1,
636                         .vmux   = 1,
637                         .gpio0  = 0x00008400,
638                 },{
639                         .type   = CX88_VMUX_SVIDEO,
640                         .vmux   = 2,
641                         .gpio0  = 0x00008400,
642                 }},
643                 .radio = {
644                         .type   = CX88_RADIO,
645                         .gpio0  = 0x00008404,
646                 },
647                 .mpeg           = CX88_MPEG_DVB,
648         },
649         [CX88_BOARD_HAUPPAUGE_ROSLYN] = {
650                 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu>
651                 // GPIO values obtained from regspy, courtesy Sean Covel
652                 .name           = "Hauppauge WinTV 28xxx (Roslyn) models",
653                 .tuner_type     = UNSET,
654                 .radio_type     = UNSET,
655                 .tuner_addr     = ADDR_UNSET,
656                 .radio_addr     = ADDR_UNSET,
657                 .input          = {{
658                         .type   = CX88_VMUX_TELEVISION,
659                         .vmux   = 0,
660                         .gpio0  = 0xed1a,
661                         .gpio2  = 0x00ff,
662                 },{
663                         .type   = CX88_VMUX_DEBUG,
664                         .vmux   = 0,
665                         .gpio0  = 0xff01,
666                 },{
667                         .type   = CX88_VMUX_COMPOSITE1,
668                         .vmux   = 1,
669                         .gpio0  = 0xff02,
670                 },{
671                         .type   = CX88_VMUX_SVIDEO,
672                         .vmux   = 2,
673                         .gpio0  = 0xed92,
674                         .gpio2  = 0x00ff,
675                 }},
676                 .radio = {
677                          .type   = CX88_RADIO,
678                          .gpio0  = 0xed96,
679                          .gpio2  = 0x00ff,
680                  },
681                 .mpeg           = CX88_MPEG_BLACKBIRD,
682         },
683         [CX88_BOARD_DIGITALLOGIC_MEC] = {
684                 .name           = "Digital-Logic MICROSPACE Entertainment Center (MEC)",
685                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
686                 .radio_type     = UNSET,
687                 .tuner_addr     = ADDR_UNSET,
688                 .radio_addr     = ADDR_UNSET,
689                 .tda9887_conf   = TDA9887_PRESENT,
690                 .input          = {{
691                         .type   = CX88_VMUX_TELEVISION,
692                         .vmux   = 0,
693                         .gpio0  = 0x00009d80,
694                         .audioroute = 1,
695                 },{
696                         .type   = CX88_VMUX_COMPOSITE1,
697                         .vmux   = 1,
698                         .gpio0  = 0x00009d76,
699                         .audioroute = 1,
700                 },{
701                         .type   = CX88_VMUX_SVIDEO,
702                         .vmux   = 2,
703                         .gpio0  = 0x00009d76,
704                         .audioroute = 1,
705                 }},
706                 .radio = {
707                         .type   = CX88_RADIO,
708                         .gpio0  = 0x00009d00,
709                         .audioroute = 1,
710                 },
711                 .mpeg           = CX88_MPEG_BLACKBIRD,
712         },
713         [CX88_BOARD_IODATA_GVBCTV7E] = {
714                 .name           = "IODATA GV/BCTV7E",
715                 .tuner_type     = TUNER_PHILIPS_FQ1286,
716                 .radio_type     = UNSET,
717                 .tuner_addr     = ADDR_UNSET,
718                 .radio_addr     = ADDR_UNSET,
719                 .tda9887_conf   = TDA9887_PRESENT,
720                 .input          = {{
721                         .type   = CX88_VMUX_TELEVISION,
722                         .vmux   = 1,
723                         .gpio1  = 0x0000e03f,
724                 },{
725                         .type   = CX88_VMUX_COMPOSITE1,
726                         .vmux   = 2,
727                         .gpio1  = 0x0000e07f,
728                 },{
729                         .type   = CX88_VMUX_SVIDEO,
730                         .vmux   = 3,
731                         .gpio1  = 0x0000e07f,
732                 }}
733         },
734         [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = {
735                 .name           = "PixelView PlayTV Ultra Pro (Stereo)",
736                 /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */
737                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
738                 .radio_type     = UNSET,
739                 .tuner_addr     = ADDR_UNSET,
740                 .radio_addr     = ADDR_UNSET,
741                 /* Some variants use a tda9874 and so need the tvaudio module. */
742                 .audio_chip     = V4L2_IDENT_TVAUDIO,
743                 .input          = {{
744                         .type   = CX88_VMUX_TELEVISION,
745                         .vmux   = 0,
746                         .gpio0  = 0xbf61,  /* internal decoder */
747                 },{
748                         .type   = CX88_VMUX_COMPOSITE1,
749                         .vmux   = 1,
750                         .gpio0  = 0xbf63,
751                 },{
752                         .type   = CX88_VMUX_SVIDEO,
753                         .vmux   = 2,
754                         .gpio0  = 0xbf63,
755                 }},
756                 .radio = {
757                          .type  = CX88_RADIO,
758                          .gpio0 = 0xbf60,
759                  },
760         },
761         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = {
762                 .name           = "DViCO FusionHDTV 3 Gold-T",
763                 .tuner_type     = TUNER_THOMSON_DTT761X,
764                 .radio_type     = UNSET,
765                 .tuner_addr     = ADDR_UNSET,
766                 .radio_addr     = ADDR_UNSET,
767                 .tda9887_conf   = TDA9887_PRESENT,
768                 .input          = {{
769                         .type   = CX88_VMUX_TELEVISION,
770                         .vmux   = 0,
771                         .gpio0  = 0x97ed,
772                 },{
773                         .type   = CX88_VMUX_COMPOSITE1,
774                         .vmux   = 1,
775                         .gpio0  = 0x97e9,
776                 },{
777                         .type   = CX88_VMUX_SVIDEO,
778                         .vmux   = 2,
779                         .gpio0  = 0x97e9,
780                 }},
781                 .mpeg           = CX88_MPEG_DVB,
782         },
783         [CX88_BOARD_ADSTECH_DVB_T_PCI] = {
784                 .name           = "ADS Tech Instant TV DVB-T PCI",
785                 .tuner_type     = TUNER_ABSENT,
786                 .radio_type     = UNSET,
787                 .tuner_addr     = ADDR_UNSET,
788                 .radio_addr     = ADDR_UNSET,
789                 .input          = {{
790                         .type   = CX88_VMUX_COMPOSITE1,
791                         .vmux   = 1,
792                         .gpio0  = 0x0700,
793                         .gpio2  = 0x0101,
794                 },{
795                         .type   = CX88_VMUX_SVIDEO,
796                         .vmux   = 2,
797                         .gpio0  = 0x0700,
798                         .gpio2  = 0x0101,
799                 }},
800                 .mpeg           = CX88_MPEG_DVB,
801         },
802         [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = {
803                 .name           = "TerraTec Cinergy 1400 DVB-T",
804                 .tuner_type     = TUNER_ABSENT,
805                 .input          = {{
806                         .type   = CX88_VMUX_DVB,
807                         .vmux   = 0,
808                 },{
809                         .type   = CX88_VMUX_COMPOSITE1,
810                         .vmux   = 2,
811                 },{
812                         .type   = CX88_VMUX_SVIDEO,
813                         .vmux   = 2,
814                 }},
815                 .mpeg           = CX88_MPEG_DVB,
816         },
817         [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = {
818                 .name           = "DViCO FusionHDTV 5 Gold",
819                 .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H062F */
820                 .radio_type     = UNSET,
821                 .tuner_addr     = ADDR_UNSET,
822                 .radio_addr     = ADDR_UNSET,
823                 .tda9887_conf   = TDA9887_PRESENT,
824                 .input          = {{
825                         .type   = CX88_VMUX_TELEVISION,
826                         .vmux   = 0,
827                         .gpio0  = 0x87fd,
828                 },{
829                         .type   = CX88_VMUX_COMPOSITE1,
830                         .vmux   = 1,
831                         .gpio0  = 0x87f9,
832                 },{
833                         .type   = CX88_VMUX_SVIDEO,
834                         .vmux   = 2,
835                         .gpio0  = 0x87f9,
836                 }},
837                 .mpeg           = CX88_MPEG_DVB,
838         },
839         [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = {
840                 .name           = "AverMedia UltraTV Media Center PCI 550",
841                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
842                 .radio_type     = UNSET,
843                 .tuner_addr     = ADDR_UNSET,
844                 .radio_addr     = ADDR_UNSET,
845                 .tda9887_conf   = TDA9887_PRESENT,
846                 .input          = {{
847                         .type   = CX88_VMUX_COMPOSITE1,
848                         .vmux   = 0,
849                         .gpio0  = 0x0000cd73,
850                         .audioroute = 1,
851                 },{
852                         .type   = CX88_VMUX_SVIDEO,
853                         .vmux   = 1,
854                         .gpio0  = 0x0000cd73,
855                         .audioroute = 1,
856                 },{
857                         .type   = CX88_VMUX_TELEVISION,
858                         .vmux   = 3,
859                         .gpio0  = 0x0000cdb3,
860                         .audioroute = 1,
861                 }},
862                 .radio = {
863                         .type   = CX88_RADIO,
864                         .vmux   = 2,
865                         .gpio0  = 0x0000cdf3,
866                         .audioroute = 1,
867                 },
868                 .mpeg           = CX88_MPEG_BLACKBIRD,
869         },
870         [CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD] = {
871                  /* Alexander Wold <awold@bigfoot.com> */
872                  .name           = "Kworld V-Stream Xpert DVD",
873                  .tuner_type     = UNSET,
874                  .input          = {{
875                          .type   = CX88_VMUX_COMPOSITE1,
876                          .vmux   = 1,
877                          .gpio0  = 0x03000000,
878                          .gpio1  = 0x01000000,
879                          .gpio2  = 0x02000000,
880                          .gpio3  = 0x00100000,
881                  },{
882                          .type   = CX88_VMUX_SVIDEO,
883                          .vmux   = 2,
884                          .gpio0  = 0x03000000,
885                          .gpio1  = 0x01000000,
886                          .gpio2  = 0x02000000,
887                          .gpio3  = 0x00100000,
888                  }},
889         },
890         [CX88_BOARD_ATI_HDTVWONDER] = {
891                 .name           = "ATI HDTV Wonder",
892                 .tuner_type     = TUNER_PHILIPS_TUV1236D,
893                 .radio_type     = UNSET,
894                 .tuner_addr     = ADDR_UNSET,
895                 .radio_addr     = ADDR_UNSET,
896                 .input          = {{
897                         .type   = CX88_VMUX_TELEVISION,
898                         .vmux   = 0,
899                         .gpio0  = 0x00000ff7,
900                         .gpio1  = 0x000000ff,
901                         .gpio2  = 0x00000001,
902                         .gpio3  = 0x00000000,
903                 },{
904                         .type   = CX88_VMUX_COMPOSITE1,
905                         .vmux   = 1,
906                         .gpio0  = 0x00000ffe,
907                         .gpio1  = 0x000000ff,
908                         .gpio2  = 0x00000001,
909                         .gpio3  = 0x00000000,
910                 },{
911                         .type   = CX88_VMUX_SVIDEO,
912                         .vmux   = 2,
913                         .gpio0  = 0x00000ffe,
914                         .gpio1  = 0x000000ff,
915                         .gpio2  = 0x00000001,
916                         .gpio3  = 0x00000000,
917                 }},
918                 .mpeg           = CX88_MPEG_DVB,
919         },
920         [CX88_BOARD_WINFAST_DTV1000] = {
921                 .name           = "WinFast DTV1000-T",
922                 .tuner_type     = TUNER_ABSENT,
923                 .radio_type     = UNSET,
924                 .tuner_addr     = ADDR_UNSET,
925                 .radio_addr     = ADDR_UNSET,
926                 .input          = {{
927                         .type   = CX88_VMUX_DVB,
928                         .vmux   = 0,
929                 },{
930                         .type   = CX88_VMUX_COMPOSITE1,
931                         .vmux   = 1,
932                 },{
933                         .type   = CX88_VMUX_SVIDEO,
934                         .vmux   = 2,
935                 }},
936                 .mpeg           = CX88_MPEG_DVB,
937         },
938         [CX88_BOARD_AVERTV_303] = {
939                 .name           = "AVerTV 303 (M126)",
940                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
941                 .radio_type     = UNSET,
942                 .tuner_addr     = ADDR_UNSET,
943                 .radio_addr     = ADDR_UNSET,
944                 .tda9887_conf   = TDA9887_PRESENT,
945                 .input          = {{
946                         .type   = CX88_VMUX_TELEVISION,
947                         .vmux   = 0,
948                         .gpio0  = 0x00ff,
949                         .gpio1  = 0xe09f,
950                         .gpio2  = 0x0010,
951                         .gpio3  = 0x0000,
952                 },{
953                         .type   = CX88_VMUX_COMPOSITE1,
954                         .vmux   = 1,
955                         .gpio0  = 0x00ff,
956                         .gpio1  = 0xe05f,
957                         .gpio2  = 0x0010,
958                         .gpio3  = 0x0000,
959                 },{
960                         .type   = CX88_VMUX_SVIDEO,
961                         .vmux   = 2,
962                         .gpio0  = 0x00ff,
963                         .gpio1  = 0xe05f,
964                         .gpio2  = 0x0010,
965                         .gpio3  = 0x0000,
966                 }},
967         },
968         [CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1] = {
969                 .name           = "Hauppauge Nova-S-Plus DVB-S",
970                 .tuner_type     = TUNER_ABSENT,
971                 .radio_type     = UNSET,
972                 .tuner_addr     = ADDR_UNSET,
973                 .radio_addr     = ADDR_UNSET,
974                 .audio_chip     = V4L2_IDENT_WM8775,
975                 .i2sinputcntl   = 2,
976                 .input          = {{
977                         .type   = CX88_VMUX_DVB,
978                         .vmux   = 0,
979                         /* 2: Line-In */
980                         .audioroute = 2,
981                 },{
982                         .type   = CX88_VMUX_COMPOSITE1,
983                         .vmux   = 1,
984                         /* 2: Line-In */
985                         .audioroute = 2,
986                 },{
987                         .type   = CX88_VMUX_SVIDEO,
988                         .vmux   = 2,
989                         /* 2: Line-In */
990                         .audioroute = 2,
991                 }},
992                 .mpeg           = CX88_MPEG_DVB,
993         },
994         [CX88_BOARD_HAUPPAUGE_NOVASE2_S1] = {
995                 .name           = "Hauppauge Nova-SE2 DVB-S",
996                 .tuner_type     = TUNER_ABSENT,
997                 .radio_type     = UNSET,
998                 .tuner_addr     = ADDR_UNSET,
999                 .radio_addr     = ADDR_UNSET,
1000                 .input          = {{
1001                         .type   = CX88_VMUX_DVB,
1002                         .vmux   = 0,
1003                 }},
1004                 .mpeg           = CX88_MPEG_DVB,
1005         },
1006         [CX88_BOARD_KWORLD_DVBS_100] = {
1007                 .name           = "KWorld DVB-S 100",
1008                 .tuner_type     = TUNER_ABSENT,
1009                 .radio_type     = UNSET,
1010                 .tuner_addr     = ADDR_UNSET,
1011                 .radio_addr     = ADDR_UNSET,
1012                 .audio_chip = V4L2_IDENT_WM8775,
1013                 .input          = {{
1014                         .type   = CX88_VMUX_DVB,
1015                         .vmux   = 0,
1016                         /* 2: Line-In */
1017                         .audioroute = 2,
1018                 },{
1019                         .type   = CX88_VMUX_COMPOSITE1,
1020                         .vmux   = 1,
1021                         /* 2: Line-In */
1022                         .audioroute = 2,
1023                 },{
1024                         .type   = CX88_VMUX_SVIDEO,
1025                         .vmux   = 2,
1026                         /* 2: Line-In */
1027                         .audioroute = 2,
1028                 }},
1029                 .mpeg           = CX88_MPEG_DVB,
1030         },
1031         [CX88_BOARD_HAUPPAUGE_HVR1100] = {
1032                 .name           = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid",
1033                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1034                 .radio_type     = UNSET,
1035                 .tuner_addr     = ADDR_UNSET,
1036                 .radio_addr     = ADDR_UNSET,
1037                 .tda9887_conf   = TDA9887_PRESENT,
1038                 .input          = {{
1039                         .type   = CX88_VMUX_TELEVISION,
1040                         .vmux   = 0,
1041                 },{
1042                         .type   = CX88_VMUX_COMPOSITE1,
1043                         .vmux   = 1,
1044                 },{
1045                         .type   = CX88_VMUX_SVIDEO,
1046                         .vmux   = 2,
1047                 }},
1048                 /* fixme: Add radio support */
1049                 .mpeg           = CX88_MPEG_DVB,
1050         },
1051         [CX88_BOARD_HAUPPAUGE_HVR1100LP] = {
1052                 .name           = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)",
1053                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1054                 .radio_type     = UNSET,
1055                 .tuner_addr     = ADDR_UNSET,
1056                 .radio_addr     = ADDR_UNSET,
1057                 .tda9887_conf   = TDA9887_PRESENT,
1058                 .input          = {{
1059                         .type   = CX88_VMUX_TELEVISION,
1060                         .vmux   = 0,
1061                 },{
1062                         .type   = CX88_VMUX_COMPOSITE1,
1063                         .vmux   = 1,
1064                 }},
1065                 /* fixme: Add radio support */
1066                 .mpeg           = CX88_MPEG_DVB,
1067         },
1068         [CX88_BOARD_DNTV_LIVE_DVB_T_PRO] = {
1069                 .name           = "digitalnow DNTV Live! DVB-T Pro",
1070                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1071                 .radio_type     = UNSET,
1072                 .tuner_addr     = ADDR_UNSET,
1073                 .radio_addr     = ADDR_UNSET,
1074                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE |
1075                                   TDA9887_PORT2_ACTIVE,
1076                 .input          = {{
1077                         .type   = CX88_VMUX_TELEVISION,
1078                         .vmux   = 0,
1079                         .gpio0  = 0xf80808,
1080                 },{
1081                         .type   = CX88_VMUX_COMPOSITE1,
1082                         .vmux   = 1,
1083                         .gpio0  = 0xf80808,
1084                 },{
1085                         .type   = CX88_VMUX_SVIDEO,
1086                         .vmux   = 2,
1087                         .gpio0  = 0xf80808,
1088                 }},
1089                 .radio = {
1090                          .type  = CX88_RADIO,
1091                          .gpio0 = 0xf80808,
1092                 },
1093                 .mpeg           = CX88_MPEG_DVB,
1094         },
1095         [CX88_BOARD_KWORLD_DVB_T_CX22702] = {
1096                 /* Kworld V-stream Xpert DVB-T with Thomson tuner */
1097                 /* DTT 7579 Conexant CX22702-19 Conexant CX2388x  */
1098                 /* Manenti Marco <marco_manenti@colman.it> */
1099                 .name           = "KWorld/VStream XPert DVB-T with cx22702",
1100                 .tuner_type     = TUNER_ABSENT,
1101                 .radio_type     = UNSET,
1102                 .tuner_addr     = ADDR_UNSET,
1103                 .radio_addr     = ADDR_UNSET,
1104                 .input          = {{
1105                         .type   = CX88_VMUX_COMPOSITE1,
1106                         .vmux   = 1,
1107                         .gpio0  = 0x0700,
1108                         .gpio2  = 0x0101,
1109                 },{
1110                         .type   = CX88_VMUX_SVIDEO,
1111                         .vmux   = 2,
1112                         .gpio0  = 0x0700,
1113                         .gpio2  = 0x0101,
1114                 }},
1115                 .mpeg           = CX88_MPEG_DVB,
1116         },
1117         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL] = {
1118                 .name           = "DViCO FusionHDTV DVB-T Dual Digital",
1119                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
1120                 .radio_type     = UNSET,
1121                 .tuner_addr     = ADDR_UNSET,
1122                 .radio_addr     = ADDR_UNSET,
1123                 .input          = {{
1124                         .type   = CX88_VMUX_COMPOSITE1,
1125                         .vmux   = 1,
1126                         .gpio0  = 0x000067df,
1127                  },{
1128                         .type   = CX88_VMUX_SVIDEO,
1129                         .vmux   = 2,
1130                         .gpio0  = 0x000067df,
1131                 }},
1132                 .mpeg           = CX88_MPEG_DVB,
1133         },
1134         [CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT] = {
1135                 .name           = "KWorld HardwareMpegTV XPert",
1136                 .tuner_type     = TUNER_PHILIPS_TDA8290,
1137                 .radio_type     = UNSET,
1138                 .tuner_addr     = ADDR_UNSET,
1139                 .radio_addr     = ADDR_UNSET,
1140                 .input          = {{
1141                         .type   = CX88_VMUX_TELEVISION,
1142                         .vmux   = 0,
1143                         .gpio0  = 0x3de2,
1144                         .gpio2  = 0x00ff,
1145                 },{
1146                         .type   = CX88_VMUX_COMPOSITE1,
1147                         .vmux   = 1,
1148                         .gpio0  = 0x3de6,
1149                         .audioroute = 1,
1150                 },{
1151                         .type   = CX88_VMUX_SVIDEO,
1152                         .vmux   = 2,
1153                         .gpio0  = 0x3de6,
1154                         .audioroute = 1,
1155                 }},
1156                 .radio = {
1157                         .type   = CX88_RADIO,
1158                         .gpio0  = 0x3de6,
1159                         .gpio2  = 0x00ff,
1160                 },
1161                 .mpeg           = CX88_MPEG_BLACKBIRD,
1162         },
1163         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID] = {
1164                 .name           = "DViCO FusionHDTV DVB-T Hybrid",
1165                 .tuner_type     = TUNER_THOMSON_FE6600,
1166                 .radio_type     = UNSET,
1167                 .tuner_addr     = ADDR_UNSET,
1168                 .radio_addr     = ADDR_UNSET,
1169                 .input          = {{
1170                         .type   = CX88_VMUX_TELEVISION,
1171                         .vmux   = 0,
1172                         .gpio0  = 0x0000a75f,
1173                 },{
1174                         .type   = CX88_VMUX_COMPOSITE1,
1175                         .vmux   = 1,
1176                         .gpio0  = 0x0000a75b,
1177                 },{
1178                         .type   = CX88_VMUX_SVIDEO,
1179                         .vmux   = 2,
1180                         .gpio0  = 0x0000a75b,
1181                 }},
1182                 .mpeg           = CX88_MPEG_DVB,
1183         },
1184         [CX88_BOARD_PCHDTV_HD5500] = {
1185                 .name           = "pcHDTV HD5500 HDTV",
1186                 .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H064F */
1187                 .radio_type     = UNSET,
1188                 .tuner_addr     = ADDR_UNSET,
1189                 .radio_addr     = ADDR_UNSET,
1190                 .tda9887_conf   = TDA9887_PRESENT,
1191                 .input          = {{
1192                         .type   = CX88_VMUX_TELEVISION,
1193                         .vmux   = 0,
1194                         .gpio0  = 0x87fd,
1195                 },{
1196                         .type   = CX88_VMUX_COMPOSITE1,
1197                         .vmux   = 1,
1198                         .gpio0  = 0x87f9,
1199                 },{
1200                         .type   = CX88_VMUX_SVIDEO,
1201                         .vmux   = 2,
1202                         .gpio0  = 0x87f9,
1203                 }},
1204                 .mpeg           = CX88_MPEG_DVB,
1205         },
1206         [CX88_BOARD_KWORLD_MCE200_DELUXE] = {
1207                 /* FIXME: tested TV input only, disabled composite,
1208                    svideo and radio until they can be tested also. */
1209                 .name           = "Kworld MCE 200 Deluxe",
1210                 .tuner_type     = TUNER_TENA_9533_DI,
1211                 .radio_type     = UNSET,
1212                 .tda9887_conf   = TDA9887_PRESENT,
1213                 .tuner_addr     = ADDR_UNSET,
1214                 .radio_addr     = ADDR_UNSET,
1215                 .input          = {{
1216                         .type   = CX88_VMUX_TELEVISION,
1217                         .vmux   = 0,
1218                         .gpio0  = 0x0000BDE6
1219                 }},
1220                 .mpeg           = CX88_MPEG_BLACKBIRD,
1221         },
1222         [CX88_BOARD_PIXELVIEW_PLAYTV_P7000] = {
1223                 /* FIXME: SVideo, Composite and FM inputs are untested */
1224                 .name           = "PixelView PlayTV P7000",
1225                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
1226                 .radio_type     = UNSET,
1227                 .tuner_addr     = ADDR_UNSET,
1228                 .radio_addr     = ADDR_UNSET,
1229                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE |
1230                                   TDA9887_PORT2_ACTIVE,
1231                 .input          = {{
1232                         .type   = CX88_VMUX_TELEVISION,
1233                         .vmux   = 0,
1234                         .gpio0  = 0x5da6,
1235                 }},
1236                 .mpeg           = CX88_MPEG_BLACKBIRD,
1237         },
1238         [CX88_BOARD_NPGTECH_REALTV_TOP10FM] = {
1239                 .name           = "NPG Tech Real TV FM Top 10",
1240                 .tuner_type     = TUNER_TNF_5335MF, /* Actually a TNF9535 */
1241                 .radio_type     = UNSET,
1242                 .tuner_addr     = ADDR_UNSET,
1243                 .radio_addr     = ADDR_UNSET,
1244                 .input          = {{
1245                         .type   = CX88_VMUX_TELEVISION,
1246                         .vmux   = 0,
1247                         .gpio0  = 0x0788,
1248                 },{
1249                         .type   = CX88_VMUX_COMPOSITE1,
1250                         .vmux   = 1,
1251                         .gpio0  = 0x078b,
1252                 },{
1253                         .type   = CX88_VMUX_SVIDEO,
1254                         .vmux   = 2,
1255                         .gpio0  = 0x078b,
1256                 }},
1257                 .radio = {
1258                          .type  = CX88_RADIO,
1259                          .gpio0 = 0x074a,
1260                 },
1261         },
1262         [CX88_BOARD_WINFAST_DTV2000H] = {
1263                 .name           = "WinFast DTV2000 H",
1264                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1265                 .radio_type     = UNSET,
1266                 .tuner_addr     = ADDR_UNSET,
1267                 .radio_addr     = ADDR_UNSET,
1268                 .tda9887_conf   = TDA9887_PRESENT,
1269                 .input          = {{
1270                         .type   = CX88_VMUX_TELEVISION,
1271                         .vmux   = 0,
1272                         .gpio0  = 0x00017304,
1273                         .gpio1  = 0x00008203,
1274                         .gpio2  = 0x00017304,
1275                         .gpio3  = 0x02000000,
1276                 }, {
1277                         .type   = CX88_VMUX_COMPOSITE1,
1278                         .vmux   = 1,
1279                         .gpio0  = 0x0001d701,
1280                         .gpio1  = 0x0000b207,
1281                         .gpio2  = 0x0001d701,
1282                         .gpio3  = 0x02000000,
1283                 }, {
1284                         .type   = CX88_VMUX_COMPOSITE2,
1285                         .vmux   = 2,
1286                         .gpio0  = 0x0001d503,
1287                         .gpio1  = 0x0000b207,
1288                         .gpio2  = 0x0001d503,
1289                         .gpio3  = 0x02000000,
1290                 }, {
1291                         .type   = CX88_VMUX_SVIDEO,
1292                         .vmux   = 3,
1293                         .gpio0  = 0x0001d701,
1294                         .gpio1  = 0x0000b207,
1295                         .gpio2  = 0x0001d701,
1296                         .gpio3  = 0x02000000,
1297                 }},
1298                 .radio = {
1299                          .type  = CX88_RADIO,
1300                          .gpio0 = 0x00015702,
1301                          .gpio1 = 0x0000f207,
1302                          .gpio2 = 0x00015702,
1303                          .gpio3 = 0x02000000,
1304                 },
1305                 .mpeg           = CX88_MPEG_DVB,
1306         },
1307         [CX88_BOARD_WINFAST_DTV2000H_J] = {
1308                 .name           = "WinFast DTV2000 H rev. J",
1309                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1310                 .radio_type     = UNSET,
1311                 .tuner_addr     = ADDR_UNSET,
1312                 .radio_addr     = ADDR_UNSET,
1313                 .tda9887_conf   = TDA9887_PRESENT,
1314                 .input          = {{
1315                         .type   = CX88_VMUX_TELEVISION,
1316                         .vmux   = 0,
1317                         .gpio0  = 0x00017300,
1318                         .gpio1  = 0x00008207,
1319                         .gpio2  = 0x00000000,
1320                         .gpio3  = 0x02000000,
1321                 },{
1322                         .type   = CX88_VMUX_TELEVISION,
1323                         .vmux   = 0,
1324                         .gpio0  = 0x00018300,
1325                         .gpio1  = 0x0000f207,
1326                         .gpio2  = 0x00017304,
1327                         .gpio3  = 0x02000000,
1328                 },{
1329                         .type   = CX88_VMUX_COMPOSITE1,
1330                         .vmux   = 1,
1331                         .gpio0  = 0x00018301,
1332                         .gpio1  = 0x0000f207,
1333                         .gpio2  = 0x00017304,
1334                         .gpio3  = 0x02000000,
1335                 },{
1336                         .type   = CX88_VMUX_SVIDEO,
1337                         .vmux   = 2,
1338                         .gpio0  = 0x00018301,
1339                         .gpio1  = 0x0000f207,
1340                         .gpio2  = 0x00017304,
1341                         .gpio3  = 0x02000000,
1342                 }},
1343                 .radio = {
1344                          .type  = CX88_RADIO,
1345                          .gpio0 = 0x00015702,
1346                          .gpio1 = 0x0000f207,
1347                          .gpio2 = 0x00015702,
1348                          .gpio3 = 0x02000000,
1349                 },
1350                 .mpeg           = CX88_MPEG_DVB,
1351         },
1352         [CX88_BOARD_GENIATECH_DVBS] = {
1353                 .name          = "Geniatech DVB-S",
1354                 .tuner_type    = TUNER_ABSENT,
1355                 .radio_type    = UNSET,
1356                 .tuner_addr    = ADDR_UNSET,
1357                 .radio_addr    = ADDR_UNSET,
1358                 .input  = {{
1359                         .type  = CX88_VMUX_DVB,
1360                         .vmux  = 0,
1361                 },{
1362                         .type  = CX88_VMUX_COMPOSITE1,
1363                         .vmux  = 1,
1364                 }},
1365                 .mpeg           = CX88_MPEG_DVB,
1366         },
1367         [CX88_BOARD_HAUPPAUGE_HVR3000] = {
1368                 .name           = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T",
1369                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1370                 .radio_type     = UNSET,
1371                 .tuner_addr     = ADDR_UNSET,
1372                 .radio_addr     = ADDR_UNSET,
1373                 .tda9887_conf   = TDA9887_PRESENT,
1374                 .audio_chip     = V4L2_IDENT_WM8775,
1375                 .input          = {{
1376                         .type   = CX88_VMUX_TELEVISION,
1377                         .vmux   = 0,
1378                         .gpio0  = 0x84bf,
1379                         /* 1: TV Audio / FM Mono */
1380                         .audioroute = 1,
1381                 },{
1382                         .type   = CX88_VMUX_COMPOSITE1,
1383                         .vmux   = 1,
1384                         .gpio0  = 0x84bf,
1385                         /* 2: Line-In */
1386                         .audioroute = 2,
1387                 },{
1388                         .type   = CX88_VMUX_SVIDEO,
1389                         .vmux   = 2,
1390                         .gpio0  = 0x84bf,
1391                         /* 2: Line-In */
1392                         .audioroute = 2,
1393                 }},
1394                 .radio = {
1395                         .type   = CX88_RADIO,
1396                         .gpio0  = 0x84bf,
1397                         /* 4: FM Stereo (untested) */
1398                         .audioroute = 8,
1399                 },
1400                 .mpeg           = CX88_MPEG_DVB,
1401                 .num_frontends  = 2,
1402         },
1403         [CX88_BOARD_NORWOOD_MICRO] = {
1404                 .name           = "Norwood Micro TV Tuner",
1405                 .tuner_type     = TUNER_TNF_5335MF,
1406                 .radio_type     = UNSET,
1407                 .tuner_addr     = ADDR_UNSET,
1408                 .radio_addr     = ADDR_UNSET,
1409                 .input          = {{
1410                         .type   = CX88_VMUX_TELEVISION,
1411                         .vmux   = 0,
1412                         .gpio0  = 0x0709,
1413                 },{
1414                         .type   = CX88_VMUX_COMPOSITE1,
1415                         .vmux   = 1,
1416                         .gpio0  = 0x070b,
1417                 },{
1418                         .type   = CX88_VMUX_SVIDEO,
1419                         .vmux   = 2,
1420                         .gpio0  = 0x070b,
1421                 }},
1422         },
1423         [CX88_BOARD_TE_DTV_250_OEM_SWANN] = {
1424                 .name           = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM",
1425                 .tuner_type     = TUNER_LG_PAL_NEW_TAPC,
1426                 .radio_type     = UNSET,
1427                 .tuner_addr     = ADDR_UNSET,
1428                 .radio_addr     = ADDR_UNSET,
1429                 .input          = {{
1430                         .type   = CX88_VMUX_TELEVISION,
1431                         .vmux   = 0,
1432                         .gpio0  = 0x003fffff,
1433                         .gpio1  = 0x00e00000,
1434                         .gpio2  = 0x003fffff,
1435                         .gpio3  = 0x02000000,
1436                 },{
1437                         .type   = CX88_VMUX_COMPOSITE1,
1438                         .vmux   = 1,
1439                         .gpio0  = 0x003fffff,
1440                         .gpio1  = 0x00e00000,
1441                         .gpio2  = 0x003fffff,
1442                         .gpio3  = 0x02000000,
1443                 },{
1444                         .type   = CX88_VMUX_SVIDEO,
1445                         .vmux   = 2,
1446                         .gpio0  = 0x003fffff,
1447                         .gpio1  = 0x00e00000,
1448                         .gpio2  = 0x003fffff,
1449                         .gpio3  = 0x02000000,
1450                 }},
1451         },
1452         [CX88_BOARD_HAUPPAUGE_HVR1300] = {
1453                 .name           = "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder",
1454                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1455                 .radio_type     = UNSET,
1456                 .tuner_addr     = ADDR_UNSET,
1457                 .radio_addr     = ADDR_UNSET,
1458                 .tda9887_conf   = TDA9887_PRESENT,
1459                 .audio_chip     = V4L2_IDENT_WM8775,
1460                 /*
1461                  * gpio0 as reported by Mike Crash <mike AT mikecrash.com>
1462                  */
1463                 .input          = {{
1464                         .type   = CX88_VMUX_TELEVISION,
1465                         .vmux   = 0,
1466                         .gpio0  = 0xef88,
1467                         /* 1: TV Audio / FM Mono */
1468                         .audioroute = 1,
1469                 },{
1470                         .type   = CX88_VMUX_COMPOSITE1,
1471                         .vmux   = 1,
1472                         .gpio0  = 0xef88,
1473                         /* 2: Line-In */
1474                         .audioroute = 2,
1475                 },{
1476                         .type   = CX88_VMUX_SVIDEO,
1477                         .vmux   = 2,
1478                         .gpio0  = 0xef88,
1479                         /* 2: Line-In */
1480                         .audioroute = 2,
1481                 }},
1482                 .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
1483                 .radio = {
1484                         .type   = CX88_RADIO,
1485                         .gpio0  = 0xef88,
1486                         /* 4: FM Stereo (untested) */
1487                         .audioroute = 8,
1488                 },
1489         },
1490         [CX88_BOARD_SAMSUNG_SMT_7020] = {
1491                 .name           = "Samsung SMT 7020 DVB-S",
1492                 .tuner_type     = TUNER_ABSENT,
1493                 .radio_type     = UNSET,
1494                 .tuner_addr     = ADDR_UNSET,
1495                 .radio_addr     = ADDR_UNSET,
1496                 .input          = { {
1497                         .type   = CX88_VMUX_DVB,
1498                         .vmux   = 0,
1499                 } },
1500                 .mpeg           = CX88_MPEG_DVB,
1501         },
1502         [CX88_BOARD_ADSTECH_PTV_390] = {
1503                 .name           = "ADS Tech Instant Video PCI",
1504                 .tuner_type     = TUNER_ABSENT,
1505                 .radio_type     = UNSET,
1506                 .tuner_addr     = ADDR_UNSET,
1507                 .radio_addr     = ADDR_UNSET,
1508                 .input          = {{
1509                         .type   = CX88_VMUX_DEBUG,
1510                         .vmux   = 3,
1511                         .gpio0  = 0x04ff,
1512                 },{
1513                         .type   = CX88_VMUX_COMPOSITE1,
1514                         .vmux   = 1,
1515                         .gpio0  = 0x07fa,
1516                 },{
1517                         .type   = CX88_VMUX_SVIDEO,
1518                         .vmux   = 2,
1519                         .gpio0  = 0x07fa,
1520                 }},
1521         },
1522         [CX88_BOARD_PINNACLE_PCTV_HD_800i] = {
1523                 .name           = "Pinnacle PCTV HD 800i",
1524                 .tuner_type     = TUNER_XC5000,
1525                 .radio_type     = UNSET,
1526                 .tuner_addr     = ADDR_UNSET,
1527                 .radio_addr     = ADDR_UNSET,
1528                 .input          = {{
1529                         .type   = CX88_VMUX_TELEVISION,
1530                         .vmux   = 0,
1531                         .gpio0  = 0x04fb,
1532                         .gpio1  = 0x10ff,
1533                 },{
1534                         .type   = CX88_VMUX_COMPOSITE1,
1535                         .vmux   = 1,
1536                         .gpio0  = 0x04fb,
1537                         .gpio1  = 0x10ef,
1538                         .audioroute = 1,
1539                 },{
1540                         .type   = CX88_VMUX_SVIDEO,
1541                         .vmux   = 2,
1542                         .gpio0  = 0x04fb,
1543                         .gpio1  = 0x10ef,
1544                         .audioroute = 1,
1545                 }},
1546                 .mpeg           = CX88_MPEG_DVB,
1547         },
1548         [CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO] = {
1549                 .name           = "DViCO FusionHDTV 5 PCI nano",
1550                 /* xc3008 tuner, digital only for now */
1551                 .tuner_type     = TUNER_ABSENT,
1552                 .radio_type     = UNSET,
1553                 .tuner_addr     = ADDR_UNSET,
1554                 .radio_addr     = ADDR_UNSET,
1555                 .input          = {{
1556                         .type   = CX88_VMUX_TELEVISION,
1557                         .vmux   = 0,
1558                         .gpio0  = 0x000027df, /* Unconfirmed */
1559                 }, {
1560                         .type   = CX88_VMUX_COMPOSITE1,
1561                         .vmux   = 1,
1562                         .gpio0  = 0x000027df, /* Unconfirmed */
1563                         .audioroute = 1,
1564                 }, {
1565                         .type   = CX88_VMUX_SVIDEO,
1566                         .vmux   = 2,
1567                         .gpio0  = 0x000027df, /* Unconfirmed */
1568                         .audioroute = 1,
1569                 } },
1570                 .mpeg           = CX88_MPEG_DVB,
1571         },
1572         [CX88_BOARD_PINNACLE_HYBRID_PCTV] = {
1573                 .name           = "Pinnacle Hybrid PCTV",
1574                 .tuner_type     = TUNER_XC2028,
1575                 .tuner_addr     = 0x61,
1576                 .radio_type     = TUNER_XC2028,
1577                 .radio_addr     = 0x61,
1578                 .input          = { {
1579                         .type   = CX88_VMUX_TELEVISION,
1580                         .vmux   = 0,
1581                         .gpio0  = 0x004ff,
1582                         .gpio1  = 0x010ff,
1583                         .gpio2  = 0x00001,
1584                 }, {
1585                         .type   = CX88_VMUX_COMPOSITE1,
1586                         .vmux   = 1,
1587                         .gpio0  = 0x004fb,
1588                         .gpio1  = 0x010ef,
1589                         .audioroute = 1,
1590                 }, {
1591                         .type   = CX88_VMUX_SVIDEO,
1592                         .vmux   = 2,
1593                         .gpio0  = 0x004fb,
1594                         .gpio1  = 0x010ef,
1595                         .audioroute = 1,
1596                 } },
1597                 .radio = {
1598                         .type   = CX88_RADIO,
1599                         .gpio0  = 0x004ff,
1600                         .gpio1  = 0x010ff,
1601                         .gpio2  = 0x0ff,
1602                 },
1603                 .mpeg           = CX88_MPEG_DVB,
1604         },
1605         /* Terry Wu <terrywu2009@gmail.com> */
1606         /* TV Audio :      set GPIO 2, 18, 19 value to 0, 1, 0 */
1607         /* FM Audio :      set GPIO 2, 18, 19 value to 0, 0, 0 */
1608         /* Line-in Audio : set GPIO 2, 18, 19 value to 0, 1, 1 */
1609         /* Mute Audio :    set GPIO 2 value to 1               */
1610         [CX88_BOARD_WINFAST_TV2000_XP_GLOBAL] = {
1611                 .name           = "Leadtek TV2000 XP Global",
1612                 .tuner_type     = TUNER_XC2028,
1613                 .tuner_addr     = 0x61,
1614                 .radio_type     = TUNER_XC2028,
1615                 .radio_addr     = 0x61,
1616                 .input          = { {
1617                         .type   = CX88_VMUX_TELEVISION,
1618                         .vmux   = 0,
1619                         .gpio0  = 0x0400,       /* pin 2 = 0 */
1620                         .gpio1  = 0x0000,
1621                         .gpio2  = 0x0C04,       /* pin 18 = 1, pin 19 = 0 */
1622                         .gpio3  = 0x0000,
1623                 }, {
1624                         .type   = CX88_VMUX_COMPOSITE1,
1625                         .vmux   = 1,
1626                         .gpio0  = 0x0400,       /* pin 2 = 0 */
1627                         .gpio1  = 0x0000,
1628                         .gpio2  = 0x0C0C,       /* pin 18 = 1, pin 19 = 1 */
1629                         .gpio3  = 0x0000,
1630                 }, {
1631                         .type   = CX88_VMUX_SVIDEO,
1632                         .vmux   = 2,
1633                         .gpio0  = 0x0400,       /* pin 2 = 0 */
1634                         .gpio1  = 0x0000,
1635                         .gpio2  = 0x0C0C,       /* pin 18 = 1, pin 19 = 1 */
1636                         .gpio3  = 0x0000,
1637                 } },
1638                 .radio = {
1639                         .type   = CX88_RADIO,
1640                         .gpio0  = 0x0400,        /* pin 2 = 0 */
1641                         .gpio1  = 0x0000,
1642                         .gpio2  = 0x0C00,       /* pin 18 = 0, pin 19 = 0 */
1643                         .gpio3  = 0x0000,
1644                 },
1645         },
1646         [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
1647                 .name           = "PowerColor RA330",   /* Long names may confuse LIRC. */
1648                 .tuner_type     = TUNER_XC2028,
1649                 .tuner_addr     = 0x61,
1650                 .input          = { {
1651                         .type   = CX88_VMUX_DEBUG,
1652                         .vmux   = 3,            /* Due to the way the cx88 driver is written,   */
1653                         .gpio0 = 0x00ff,        /* there is no way to deactivate audio pass-    */
1654                         .gpio1 = 0xf39d,        /* through without this entry. Furthermore, if  */
1655                         .gpio3 = 0x0000,        /* the TV mux entry is first, you get audio     */
1656                 }, {                            /* from the tuner on boot for a little while.   */
1657                         .type   = CX88_VMUX_TELEVISION,
1658                         .vmux   = 0,
1659                         .gpio0 = 0x00ff,
1660                         .gpio1 = 0xf35d,
1661                         .gpio3 = 0x0000,
1662                 }, {
1663                         .type   = CX88_VMUX_COMPOSITE1,
1664                         .vmux   = 1,
1665                         .gpio0 = 0x00ff,
1666                         .gpio1 = 0xf37d,
1667                         .gpio3 = 0x0000,
1668                 }, {
1669                         .type   = CX88_VMUX_SVIDEO,
1670                         .vmux   = 2,
1671                         .gpio0  = 0x000ff,
1672                         .gpio1  = 0x0f37d,
1673                         .gpio3  = 0x00000,
1674                 } },
1675                 .radio = {
1676                         .type   = CX88_RADIO,
1677                         .gpio0  = 0x000ff,
1678                         .gpio1  = 0x0f35d,
1679                         .gpio3  = 0x00000,
1680                 },
1681         },
1682         [CX88_BOARD_GENIATECH_X8000_MT] = {
1683                 /* Also PowerColor Real Angel 330 and Geniatech X800 OEM */
1684                 .name           = "Geniatech X8000-MT DVBT",
1685                 .tuner_type     = TUNER_XC2028,
1686                 .tuner_addr     = 0x61,
1687                 .input          = { {
1688                         .type   = CX88_VMUX_TELEVISION,
1689                         .vmux   = 0,
1690                         .gpio0  = 0x00000000,
1691                         .gpio1  = 0x00e3e341,
1692                         .gpio2  = 0x00000000,
1693                         .gpio3  = 0x00000000,
1694                 }, {
1695                         .type   = CX88_VMUX_COMPOSITE1,
1696                         .vmux   = 1,
1697                         .gpio0  = 0x00000000,
1698                         .gpio1  = 0x00e3e361,
1699                         .gpio2  = 0x00000000,
1700                         .gpio3  = 0x00000000,
1701                 }, {
1702                         .type   = CX88_VMUX_SVIDEO,
1703                         .vmux   = 2,
1704                         .gpio0  = 0x00000000,
1705                         .gpio1  = 0x00e3e361,
1706                         .gpio2  = 0x00000000,
1707                         .gpio3  = 0x00000000,
1708                 } },
1709                 .radio = {
1710                         .type   = CX88_RADIO,
1711                         .gpio0  = 0x00000000,
1712                         .gpio1  = 0x00e3e341,
1713                         .gpio2  = 0x00000000,
1714                         .gpio3  = 0x00000000,
1715                 },
1716                 .mpeg           = CX88_MPEG_DVB,
1717         },
1718         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO] = {
1719                 .name           = "DViCO FusionHDTV DVB-T PRO",
1720                 .tuner_type     = TUNER_XC2028,
1721                 .tuner_addr     = 0x61,
1722                 .radio_type     = UNSET,
1723                 .radio_addr     = ADDR_UNSET,
1724                 .input          = { {
1725                         .type   = CX88_VMUX_COMPOSITE1,
1726                         .vmux   = 1,
1727                         .gpio0  = 0x000067df,
1728                 }, {
1729                         .type   = CX88_VMUX_SVIDEO,
1730                         .vmux   = 2,
1731                         .gpio0  = 0x000067df,
1732                 } },
1733                 .mpeg           = CX88_MPEG_DVB,
1734         },
1735         [CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD] = {
1736                 .name           = "DViCO FusionHDTV 7 Gold",
1737                 .tuner_type     = TUNER_XC5000,
1738                 .radio_type     = UNSET,
1739                 .tuner_addr     = ADDR_UNSET,
1740                 .radio_addr     = ADDR_UNSET,
1741                 .input          = {{
1742                         .type   = CX88_VMUX_TELEVISION,
1743                         .vmux   = 0,
1744                         .gpio0  = 0x10df,
1745                 },{
1746                         .type   = CX88_VMUX_COMPOSITE1,
1747                         .vmux   = 1,
1748                         .gpio0  = 0x16d9,
1749                 },{
1750                         .type   = CX88_VMUX_SVIDEO,
1751                         .vmux   = 2,
1752                         .gpio0  = 0x16d9,
1753                 }},
1754                 .mpeg           = CX88_MPEG_DVB,
1755         },
1756         [CX88_BOARD_PROLINK_PV_8000GT] = {
1757                 .name           = "Prolink Pixelview MPEG 8000GT",
1758                 .tuner_type     = TUNER_XC2028,
1759                 .tuner_addr     = 0x61,
1760                 .input          = { {
1761                         .type   = CX88_VMUX_TELEVISION,
1762                         .vmux   = 0,
1763                         .gpio0 = 0x0ff,
1764                         .gpio2 = 0x0cfb,
1765                 }, {
1766                         .type   = CX88_VMUX_COMPOSITE1,
1767                         .vmux   = 1,
1768                         .gpio2 = 0x0cfb,
1769                 }, {
1770                         .type   = CX88_VMUX_SVIDEO,
1771                         .vmux   = 2,
1772                         .gpio2 = 0x0cfb,
1773                 } },
1774                 .radio = {
1775                         .type   = CX88_RADIO,
1776                         .gpio2 = 0x0cfb,
1777                 },
1778         },
1779         [CX88_BOARD_PROLINK_PV_GLOBAL_XTREME] = {
1780                 .name           = "Prolink Pixelview Global Extreme",
1781                 .tuner_type     = TUNER_XC2028,
1782                 .tuner_addr     = 0x61,
1783                 .input          = { {
1784                         .type   = CX88_VMUX_TELEVISION,
1785                         .vmux   = 0,
1786                         .gpio0 = 0x04fb,
1787                         .gpio1 = 0x04080,
1788                         .gpio2 = 0x0cf7,
1789                 }, {
1790                         .type   = CX88_VMUX_COMPOSITE1,
1791                         .vmux   = 1,
1792                         .gpio0 = 0x04fb,
1793                         .gpio1 = 0x04080,
1794                         .gpio2 = 0x0cfb,
1795                 }, {
1796                         .type   = CX88_VMUX_SVIDEO,
1797                         .vmux   = 2,
1798                         .gpio0 = 0x04fb,
1799                         .gpio1 = 0x04080,
1800                         .gpio2 = 0x0cfb,
1801                 } },
1802                 .radio = {
1803                         .type   = CX88_RADIO,
1804                         .gpio0 = 0x04ff,
1805                         .gpio1 = 0x04080,
1806                         .gpio2 = 0x0cf7,
1807                 },
1808         },
1809         /* Both radio, analog and ATSC work with this board.
1810            However, for analog to work, s5h1409 gate should be open,
1811            otherwise, tuner-xc3028 won't be detected.
1812            A proper fix require using the newer i2c methods to add
1813            tuner-xc3028 without doing an i2c probe.
1814          */
1815         [CX88_BOARD_KWORLD_ATSC_120] = {
1816                 .name           = "Kworld PlusTV HD PCI 120 (ATSC 120)",
1817                 .tuner_type     = TUNER_XC2028,
1818                 .radio_type     = UNSET,
1819                 .tuner_addr     = ADDR_UNSET,
1820                 .radio_addr     = ADDR_UNSET,
1821                 .input          = { {
1822                         .type   = CX88_VMUX_TELEVISION,
1823                         .vmux   = 0,
1824                         .gpio0  = 0x000000ff,
1825                         .gpio1  = 0x0000f35d,
1826                         .gpio2  = 0x00000000,
1827                 }, {
1828                         .type   = CX88_VMUX_COMPOSITE1,
1829                         .vmux   = 1,
1830                         .gpio0  = 0x000000ff,
1831                         .gpio1  = 0x0000f37e,
1832                         .gpio2  = 0x00000000,
1833                 }, {
1834                         .type   = CX88_VMUX_SVIDEO,
1835                         .vmux   = 2,
1836                         .gpio0  = 0x000000ff,
1837                         .gpio1  = 0x0000f37e,
1838                         .gpio2  = 0x00000000,
1839                 } },
1840                 .radio = {
1841                         .type   = CX88_RADIO,
1842                         .gpio0  = 0x000000ff,
1843                         .gpio1  = 0x0000f35d,
1844                         .gpio2  = 0x00000000,
1845                 },
1846                 .mpeg           = CX88_MPEG_DVB,
1847         },
1848         [CX88_BOARD_HAUPPAUGE_HVR4000] = {
1849                 .name           = "Hauppauge WinTV-HVR4000 DVB-S/S2/T/Hybrid",
1850                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1851                 .radio_type     = UNSET,
1852                 .tuner_addr     = ADDR_UNSET,
1853                 .radio_addr     = ADDR_UNSET,
1854                 .tda9887_conf   = TDA9887_PRESENT,
1855                 .audio_chip     = V4L2_IDENT_WM8775,
1856                 /*
1857                  * GPIO0 (WINTV2000)
1858                  *
1859                  * Analogue     SAT     DVB-T
1860                  * Antenna      0xc4bf  0xc4bb
1861                  * Composite    0xc4bf  0xc4bb
1862                  * S-Video      0xc4bf  0xc4bb
1863                  * Composite1   0xc4ff  0xc4fb
1864                  * S-Video1     0xc4ff  0xc4fb
1865                  *
1866                  * BIT  VALUE   FUNCTION GP{x}_IO
1867                  * 0    1       I:?
1868                  * 1    1       I:?
1869                  * 2    1       O:MPEG PORT 0=DVB-T 1=DVB-S
1870                  * 3    1       I:?
1871                  * 4    1       I:?
1872                  * 5    1       I:?
1873                  * 6    0       O:INPUT SELECTOR 0=INTERNAL 1=EXPANSION
1874                  * 7    1       O:DVB-T DEMOD RESET LOW
1875                  *
1876                  * BIT  VALUE   FUNCTION GP{x}_OE
1877                  * 8    0       I
1878                  * 9    0       I
1879                  * a    1       O
1880                  * b    0       I
1881                  * c    0       I
1882                  * d    0       I
1883                  * e    1       O
1884                  * f    1       O
1885                  *
1886                  * WM8775 ADC
1887                  *
1888                  * 1: TV Audio / FM Mono
1889                  * 2: Line-In
1890                  * 3: Line-In Expansion
1891                  * 4: FM Stereo
1892                  */
1893                 .input          = {{
1894                         .type   = CX88_VMUX_TELEVISION,
1895                         .vmux   = 0,
1896                         .gpio0  = 0xc4bf,
1897                         /* 1: TV Audio / FM Mono */
1898                         .audioroute = 1,
1899                 }, {
1900                         .type   = CX88_VMUX_COMPOSITE1,
1901                         .vmux   = 1,
1902                         .gpio0  = 0xc4bf,
1903                         /* 2: Line-In */
1904                         .audioroute = 2,
1905                 }, {
1906                         .type   = CX88_VMUX_SVIDEO,
1907                         .vmux   = 2,
1908                         .gpio0  = 0xc4bf,
1909                         /* 2: Line-In */
1910                         .audioroute = 2,
1911                 } },
1912                 .radio = {
1913                         .type   = CX88_RADIO,
1914                         .gpio0  = 0xc4bf,
1915                         /* 4: FM Stereo */
1916                         .audioroute = 8,
1917                 },
1918                 .mpeg           = CX88_MPEG_DVB,
1919                 .num_frontends  = 2,
1920         },
1921         [CX88_BOARD_HAUPPAUGE_HVR4000LITE] = {
1922                 .name           = "Hauppauge WinTV-HVR4000(Lite) DVB-S/S2",
1923                 .tuner_type     = UNSET,
1924                 .radio_type     = UNSET,
1925                 .tuner_addr     = ADDR_UNSET,
1926                 .radio_addr     = ADDR_UNSET,
1927                 .input          = {{
1928                         .type   = CX88_VMUX_DVB,
1929                         .vmux   = 0,
1930                 } },
1931                 .mpeg           = CX88_MPEG_DVB,
1932         },
1933         [CX88_BOARD_TEVII_S420] = {
1934                 .name           = "TeVii S420 DVB-S",
1935                 .tuner_type     = UNSET,
1936                 .radio_type     = UNSET,
1937                 .tuner_addr     = ADDR_UNSET,
1938                 .radio_addr     = ADDR_UNSET,
1939                 .input          = {{
1940                         .type   = CX88_VMUX_DVB,
1941                         .vmux   = 0,
1942                 } },
1943                 .mpeg           = CX88_MPEG_DVB,
1944         },
1945         [CX88_BOARD_TEVII_S460] = {
1946                 .name           = "TeVii S460 DVB-S/S2",
1947                 .tuner_type     = UNSET,
1948                 .radio_type     = UNSET,
1949                 .tuner_addr     = ADDR_UNSET,
1950                 .radio_addr     = ADDR_UNSET,
1951                 .input          = {{
1952                         .type   = CX88_VMUX_DVB,
1953                         .vmux   = 0,
1954                 } },
1955                 .mpeg           = CX88_MPEG_DVB,
1956         },
1957         [CX88_BOARD_TEVII_S464] = {
1958                 .name           = "TeVii S464 DVB-S/S2",
1959                 .tuner_type     = UNSET,
1960                 .radio_type     = UNSET,
1961                 .tuner_addr     = ADDR_UNSET,
1962                 .radio_addr     = ADDR_UNSET,
1963                 .input          = {{
1964                         .type   = CX88_VMUX_DVB,
1965                         .vmux   = 0,
1966                 } },
1967                 .mpeg           = CX88_MPEG_DVB,
1968         },
1969         [CX88_BOARD_OMICOM_SS4_PCI] = {
1970                 .name           = "Omicom SS4 DVB-S/S2 PCI",
1971                 .tuner_type     = UNSET,
1972                 .radio_type     = UNSET,
1973                 .tuner_addr     = ADDR_UNSET,
1974                 .radio_addr     = ADDR_UNSET,
1975                 .input          = {{
1976                         .type   = CX88_VMUX_DVB,
1977                         .vmux   = 0,
1978                 } },
1979                 .mpeg           = CX88_MPEG_DVB,
1980         },
1981         [CX88_BOARD_TBS_8910] = {
1982                 .name           = "TBS 8910 DVB-S",
1983                 .tuner_type     = UNSET,
1984                 .radio_type     = UNSET,
1985                 .tuner_addr     = ADDR_UNSET,
1986                 .radio_addr     = ADDR_UNSET,
1987                 .input          = {{
1988                         .type   = CX88_VMUX_DVB,
1989                         .vmux   = 0,
1990                 } },
1991                 .mpeg           = CX88_MPEG_DVB,
1992         },
1993         [CX88_BOARD_TBS_8920] = {
1994                 .name           = "TBS 8920 DVB-S/S2",
1995                 .tuner_type     = TUNER_ABSENT,
1996                 .radio_type     = UNSET,
1997                 .tuner_addr     = ADDR_UNSET,
1998                 .radio_addr     = ADDR_UNSET,
1999                 .input          = {{
2000                         .type   = CX88_VMUX_DVB,
2001                         .vmux   = 0,
2002                         .gpio0  = 0x8080,
2003                 } },
2004                 .mpeg           = CX88_MPEG_DVB,
2005         },
2006         [CX88_BOARD_PROF_6200] = {
2007                 .name           = "Prof 6200 DVB-S",
2008                 .tuner_type     = UNSET,
2009                 .radio_type     = UNSET,
2010                 .tuner_addr     = ADDR_UNSET,
2011                 .radio_addr     = ADDR_UNSET,
2012                 .input          = {{
2013                         .type   = CX88_VMUX_DVB,
2014                         .vmux   = 0,
2015                 } },
2016                 .mpeg           = CX88_MPEG_DVB,
2017         },
2018         [CX88_BOARD_PROF_7300] = {
2019                 .name           = "PROF 7300 DVB-S/S2",
2020                 .tuner_type     = UNSET,
2021                 .radio_type     = UNSET,
2022                 .tuner_addr     = ADDR_UNSET,
2023                 .radio_addr     = ADDR_UNSET,
2024                 .input          = {{
2025                         .type   = CX88_VMUX_DVB,
2026                         .vmux   = 0,
2027                 } },
2028                 .mpeg           = CX88_MPEG_DVB,
2029         },
2030         [CX88_BOARD_SATTRADE_ST4200] = {
2031                 .name           = "SATTRADE ST4200 DVB-S/S2",
2032                 .tuner_type     = UNSET,
2033                 .radio_type     = UNSET,
2034                 .tuner_addr     = ADDR_UNSET,
2035                 .radio_addr     = ADDR_UNSET,
2036                 .input          = {{
2037                         .type   = CX88_VMUX_DVB,
2038                         .vmux   = 0,
2039                 } },
2040                 .mpeg           = CX88_MPEG_DVB,
2041         },
2042         [CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII] = {
2043                 .name           = "Terratec Cinergy HT PCI MKII",
2044                 .tuner_type     = TUNER_XC2028,
2045                 .tuner_addr     = 0x61,
2046                 .radio_type     = TUNER_XC2028,
2047                 .radio_addr     = 0x61,
2048                 .input          = { {
2049                         .type   = CX88_VMUX_TELEVISION,
2050                         .vmux   = 0,
2051                         .gpio0  = 0x004ff,
2052                         .gpio1  = 0x010ff,
2053                         .gpio2  = 0x00001,
2054                 }, {
2055                         .type   = CX88_VMUX_COMPOSITE1,
2056                         .vmux   = 1,
2057                         .gpio0  = 0x004fb,
2058                         .gpio1  = 0x010ef,
2059                         .audioroute = 1,
2060                 }, {
2061                         .type   = CX88_VMUX_SVIDEO,
2062                         .vmux   = 2,
2063                         .gpio0  = 0x004fb,
2064                         .gpio1  = 0x010ef,
2065                         .audioroute = 1,
2066                 } },
2067                 .radio = {
2068                         .type   = CX88_RADIO,
2069                         .gpio0  = 0x004ff,
2070                         .gpio1  = 0x010ff,
2071                         .gpio2  = 0x0ff,
2072                 },
2073                 .mpeg           = CX88_MPEG_DVB,
2074         },
2075         [CX88_BOARD_HAUPPAUGE_IRONLY] = {
2076                 .name           = "Hauppauge WinTV-IR Only",
2077                 .tuner_type     = UNSET,
2078                 .radio_type     = UNSET,
2079                 .tuner_addr     = ADDR_UNSET,
2080                 .radio_addr     = ADDR_UNSET,
2081         },
2082         [CX88_BOARD_WINFAST_DTV1800H] = {
2083                 .name           = "Leadtek WinFast DTV1800 Hybrid",
2084                 .tuner_type     = TUNER_XC2028,
2085                 .radio_type     = TUNER_XC2028,
2086                 .tuner_addr     = 0x61,
2087                 .radio_addr     = 0x61,
2088                 /*
2089                  * GPIO setting
2090                  *
2091                  *  2: mute (0=off,1=on)
2092                  * 12: tuner reset pin
2093                  * 13: audio source (0=tuner audio,1=line in)
2094                  * 14: FM (0=on,1=off ???)
2095                  */
2096                 .input          = {{
2097                         .type   = CX88_VMUX_TELEVISION,
2098                         .vmux   = 0,
2099                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2100                         .gpio1  = 0x6040,       /* pin 13 = 0, pin 14 = 1 */
2101                         .gpio2  = 0x0000,
2102                 }, {
2103                         .type   = CX88_VMUX_COMPOSITE1,
2104                         .vmux   = 1,
2105                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2106                         .gpio1  = 0x6060,       /* pin 13 = 1, pin 14 = 1 */
2107                         .gpio2  = 0x0000,
2108                 }, {
2109                         .type   = CX88_VMUX_SVIDEO,
2110                         .vmux   = 2,
2111                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2112                         .gpio1  = 0x6060,       /* pin 13 = 1, pin 14 = 1 */
2113                         .gpio2  = 0x0000,
2114                 } },
2115                 .radio = {
2116                         .type   = CX88_RADIO,
2117                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2118                         .gpio1  = 0x6000,       /* pin 13 = 0, pin 14 = 0 */
2119                         .gpio2  = 0x0000,
2120                 },
2121                 .mpeg           = CX88_MPEG_DVB,
2122         },
2123         [CX88_BOARD_WINFAST_DTV1800H_XC4000] = {
2124                 .name           = "Leadtek WinFast DTV1800 H (XC4000)",
2125                 .tuner_type     = TUNER_XC4000,
2126                 .radio_type     = TUNER_XC4000,
2127                 .tuner_addr     = 0x61,
2128                 .radio_addr     = 0x61,
2129                 /*
2130                  * GPIO setting
2131                  *
2132                  *  2: mute (0=off,1=on)
2133                  * 12: tuner reset pin
2134                  * 13: audio source (0=tuner audio,1=line in)
2135                  * 14: FM (0=on,1=off ???)
2136                  */
2137                 .input          = {{
2138                         .type   = CX88_VMUX_TELEVISION,
2139                         .vmux   = 0,
2140                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2141                         .gpio1  = 0x6040,       /* pin 13 = 0, pin 14 = 1 */
2142                         .gpio2  = 0x0000,
2143                 }, {
2144                         .type   = CX88_VMUX_COMPOSITE1,
2145                         .vmux   = 1,
2146                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2147                         .gpio1  = 0x6060,       /* pin 13 = 1, pin 14 = 1 */
2148                         .gpio2  = 0x0000,
2149                 }, {
2150                         .type   = CX88_VMUX_SVIDEO,
2151                         .vmux   = 2,
2152                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2153                         .gpio1  = 0x6060,       /* pin 13 = 1, pin 14 = 1 */
2154                         .gpio2  = 0x0000,
2155                 }},
2156                 .radio = {
2157                         .type   = CX88_RADIO,
2158                         .gpio0  = 0x0400,       /* pin 2 = 0 */
2159                         .gpio1  = 0x6000,       /* pin 13 = 0, pin 14 = 0 */
2160                         .gpio2  = 0x0000,
2161                 },
2162                 .mpeg           = CX88_MPEG_DVB,
2163         },
2164         [CX88_BOARD_WINFAST_DTV2000H_PLUS] = {
2165                 .name           = "Leadtek WinFast DTV2000 H PLUS",
2166                 .tuner_type     = TUNER_XC4000,
2167                 .radio_type     = TUNER_XC4000,
2168                 .tuner_addr     = 0x61,
2169                 .radio_addr     = 0x61,
2170                 /*
2171                  * GPIO
2172                  *   2: 1: mute audio
2173                  *  12: 0: reset XC4000
2174                  *  13: 1: audio input is line in (0: tuner)
2175                  *  14: 0: FM radio
2176                  *  16: 0: RF input is cable
2177                  */
2178                 .input          = {{
2179                         .type   = CX88_VMUX_TELEVISION,
2180                         .vmux   = 0,
2181                         .gpio0  = 0x0403,
2182                         .gpio1  = 0xF0D7,
2183                         .gpio2  = 0x0101,
2184                         .gpio3  = 0x0000,
2185                 }, {
2186                         .type   = CX88_VMUX_CABLE,
2187                         .vmux   = 0,
2188                         .gpio0  = 0x0403,
2189                         .gpio1  = 0xF0D7,
2190                         .gpio2  = 0x0100,
2191                         .gpio3  = 0x0000,
2192                 }, {
2193                         .type   = CX88_VMUX_COMPOSITE1,
2194                         .vmux   = 1,
2195                         .gpio0  = 0x0403,       /* was 0x0407 */
2196                         .gpio1  = 0xF0F7,
2197                         .gpio2  = 0x0101,
2198                         .gpio3  = 0x0000,
2199                 }, {
2200                         .type   = CX88_VMUX_SVIDEO,
2201                         .vmux   = 2,
2202                         .gpio0  = 0x0403,       /* was 0x0407 */
2203                         .gpio1  = 0xF0F7,
2204                         .gpio2  = 0x0101,
2205                         .gpio3  = 0x0000,
2206                 }},
2207                 .radio = {
2208                         .type   = CX88_RADIO,
2209                         .gpio0  = 0x0403,
2210                         .gpio1  = 0xF097,
2211                         .gpio2  = 0x0100,
2212                         .gpio3  = 0x0000,
2213                 },
2214                 .mpeg           = CX88_MPEG_DVB,
2215         },
2216         [CX88_BOARD_PROF_7301] = {
2217                 .name           = "Prof 7301 DVB-S/S2",
2218                 .tuner_type     = UNSET,
2219                 .radio_type     = UNSET,
2220                 .tuner_addr     = ADDR_UNSET,
2221                 .radio_addr     = ADDR_UNSET,
2222                 .input          = { {
2223                         .type   = CX88_VMUX_DVB,
2224                         .vmux   = 0,
2225                 } },
2226                 .mpeg           = CX88_MPEG_DVB,
2227         },
2228         [CX88_BOARD_TWINHAN_VP1027_DVBS] = {
2229                 .name           = "Twinhan VP-1027 DVB-S",
2230                 .tuner_type     = TUNER_ABSENT,
2231                 .radio_type     = UNSET,
2232                 .tuner_addr     = ADDR_UNSET,
2233                 .radio_addr     = ADDR_UNSET,
2234                 .input          = {{
2235                        .type   = CX88_VMUX_DVB,
2236                        .vmux   = 0,
2237                 } },
2238                 .mpeg           = CX88_MPEG_DVB,
2239         },
2240 };
2241
2242 /* ------------------------------------------------------------------ */
2243 /* PCI subsystem IDs                                                  */
2244
2245 static const struct cx88_subid cx88_subids[] = {
2246         {
2247                 .subvendor = 0x0070,
2248                 .subdevice = 0x3400,
2249                 .card      = CX88_BOARD_HAUPPAUGE,
2250         },{
2251                 .subvendor = 0x0070,
2252                 .subdevice = 0x3401,
2253                 .card      = CX88_BOARD_HAUPPAUGE,
2254         },{
2255                 .subvendor = 0x14c7,
2256                 .subdevice = 0x0106,
2257                 .card      = CX88_BOARD_GDI,
2258         },{
2259                 .subvendor = 0x14c7,
2260                 .subdevice = 0x0107, /* with mpeg encoder */
2261                 .card      = CX88_BOARD_GDI,
2262         },{
2263                 .subvendor = PCI_VENDOR_ID_ATI,
2264                 .subdevice = 0x00f8,
2265                 .card      = CX88_BOARD_ATI_WONDER_PRO,
2266         }, {
2267                 .subvendor = PCI_VENDOR_ID_ATI,
2268                 .subdevice = 0x00f9,
2269                 .card      = CX88_BOARD_ATI_WONDER_PRO,
2270         }, {
2271                 .subvendor = 0x107d,
2272                 .subdevice = 0x6611,
2273                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
2274         },{
2275                 .subvendor = 0x107d,
2276                 .subdevice = 0x6613,    /* NTSC */
2277                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
2278         },{
2279                 .subvendor = 0x107d,
2280                 .subdevice = 0x6620,
2281                 .card      = CX88_BOARD_WINFAST_DV2000,
2282         },{
2283                 .subvendor = 0x107d,
2284                 .subdevice = 0x663b,
2285                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2286         },{
2287                 .subvendor = 0x107d,
2288                 .subdevice = 0x663c,
2289                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2290         },{
2291                 .subvendor = 0x1461,
2292                 .subdevice = 0x000b,
2293                 .card      = CX88_BOARD_AVERTV_STUDIO_303,
2294         },{
2295                 .subvendor = 0x1462,
2296                 .subdevice = 0x8606,
2297                 .card      = CX88_BOARD_MSI_TVANYWHERE_MASTER,
2298         },{
2299                 .subvendor = 0x10fc,
2300                 .subdevice = 0xd003,
2301                 .card      = CX88_BOARD_IODATA_GVVCP3PCI,
2302         },{
2303                 .subvendor = 0x1043,
2304                 .subdevice = 0x4823,  /* with mpeg encoder */
2305                 .card      = CX88_BOARD_ASUS_PVR_416,
2306         },{
2307                 .subvendor = 0x17de,
2308                 .subdevice = 0x08a6,
2309                 .card      = CX88_BOARD_KWORLD_DVB_T,
2310         },{
2311                 .subvendor = 0x18ac,
2312                 .subdevice = 0xd810,
2313                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
2314         },{
2315                 .subvendor = 0x18ac,
2316                 .subdevice = 0xd820,
2317                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T,
2318         },{
2319                 .subvendor = 0x18ac,
2320                 .subdevice = 0xdb00,
2321                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1,
2322         },{
2323                 .subvendor = 0x0070,
2324                 .subdevice = 0x9002,
2325                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2326         },{
2327                 .subvendor = 0x14f1,
2328                 .subdevice = 0x0187,
2329                 .card      = CX88_BOARD_CONEXANT_DVB_T1,
2330         },{
2331                 .subvendor = 0x1540,
2332                 .subdevice = 0x2580,
2333                 .card      = CX88_BOARD_PROVIDEO_PV259,
2334         },{
2335                 .subvendor = 0x18ac,
2336                 .subdevice = 0xdb10,
2337                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
2338         },{
2339                 .subvendor = 0x1554,
2340                 .subdevice = 0x4811,
2341                 .card      = CX88_BOARD_PIXELVIEW,
2342         },{
2343                 .subvendor = 0x7063,
2344                 .subdevice = 0x3000, /* HD-3000 card */
2345                 .card      = CX88_BOARD_PCHDTV_HD3000,
2346         },{
2347                 .subvendor = 0x17de,
2348                 .subdevice = 0xa8a6,
2349                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T,
2350         },{
2351                 .subvendor = 0x0070,
2352                 .subdevice = 0x2801,
2353                 .card      = CX88_BOARD_HAUPPAUGE_ROSLYN,
2354         },{
2355                 .subvendor = 0x14f1,
2356                 .subdevice = 0x0342,
2357                 .card      = CX88_BOARD_DIGITALLOGIC_MEC,
2358         },{
2359                 .subvendor = 0x10fc,
2360                 .subdevice = 0xd035,
2361                 .card      = CX88_BOARD_IODATA_GVBCTV7E,
2362         },{
2363                 .subvendor = 0x1421,
2364                 .subdevice = 0x0334,
2365                 .card      = CX88_BOARD_ADSTECH_DVB_T_PCI,
2366         },{
2367                 .subvendor = 0x153b,
2368                 .subdevice = 0x1166,
2369                 .card      = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1,
2370         },{
2371                 .subvendor = 0x18ac,
2372                 .subdevice = 0xd500,
2373                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD,
2374         },{
2375                 .subvendor = 0x1461,
2376                 .subdevice = 0x8011,
2377                 .card      = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550,
2378         },{
2379                 .subvendor = PCI_VENDOR_ID_ATI,
2380                 .subdevice = 0xa101,
2381                 .card      = CX88_BOARD_ATI_HDTVWONDER,
2382         },{
2383                 .subvendor = 0x107d,
2384                 .subdevice = 0x665f,
2385                 .card      = CX88_BOARD_WINFAST_DTV1000,
2386         },{
2387                 .subvendor = 0x1461,
2388                 .subdevice = 0x000a,
2389                 .card      = CX88_BOARD_AVERTV_303,
2390         },{
2391                 .subvendor = 0x0070,
2392                 .subdevice = 0x9200,
2393                 .card      = CX88_BOARD_HAUPPAUGE_NOVASE2_S1,
2394         },{
2395                 .subvendor = 0x0070,
2396                 .subdevice = 0x9201,
2397                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
2398         },{
2399                 .subvendor = 0x0070,
2400                 .subdevice = 0x9202,
2401                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
2402         },{
2403                 .subvendor = 0x17de,
2404                 .subdevice = 0x08b2,
2405                 .card      = CX88_BOARD_KWORLD_DVBS_100,
2406         },{
2407                 .subvendor = 0x0070,
2408                 .subdevice = 0x9400,
2409                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
2410         },{
2411                 .subvendor = 0x0070,
2412                 .subdevice = 0x9402,
2413                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
2414         },{
2415                 .subvendor = 0x0070,
2416                 .subdevice = 0x9800,
2417                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
2418         },{
2419                 .subvendor = 0x0070,
2420                 .subdevice = 0x9802,
2421                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
2422         },{
2423                 .subvendor = 0x0070,
2424                 .subdevice = 0x9001,
2425                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2426         },{
2427                 .subvendor = 0x1822,
2428                 .subdevice = 0x0025,
2429                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
2430         },{
2431                 .subvendor = 0x17de,
2432                 .subdevice = 0x08a1,
2433                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
2434         },{
2435                 .subvendor = 0x18ac,
2436                 .subdevice = 0xdb50,
2437                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
2438         },{
2439                 .subvendor = 0x18ac,
2440                 .subdevice = 0xdb54,
2441                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
2442                 /* Re-branded DViCO: DigitalNow DVB-T Dual */
2443         },{
2444                 .subvendor = 0x18ac,
2445                 .subdevice = 0xdb11,
2446                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
2447                 /* Re-branded DViCO: UltraView DVB-T Plus */
2448         }, {
2449                 .subvendor = 0x18ac,
2450                 .subdevice = 0xdb30,
2451                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO,
2452         }, {
2453                 .subvendor = 0x17de,
2454                 .subdevice = 0x0840,
2455                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
2456         },{
2457                 .subvendor = 0x1421,
2458                 .subdevice = 0x0305,
2459                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
2460         },{
2461                 .subvendor = 0x18ac,
2462                 .subdevice = 0xdb40,
2463                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
2464         },{
2465                 .subvendor = 0x18ac,
2466                 .subdevice = 0xdb44,
2467                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
2468         },{
2469                 .subvendor = 0x7063,
2470                 .subdevice = 0x5500,
2471                 .card      = CX88_BOARD_PCHDTV_HD5500,
2472         },{
2473                 .subvendor = 0x17de,
2474                 .subdevice = 0x0841,
2475                 .card      = CX88_BOARD_KWORLD_MCE200_DELUXE,
2476         },{
2477                 .subvendor = 0x1822,
2478                 .subdevice = 0x0019,
2479                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
2480         },{
2481                 .subvendor = 0x1554,
2482                 .subdevice = 0x4813,
2483                 .card      = CX88_BOARD_PIXELVIEW_PLAYTV_P7000,
2484         },{
2485                 .subvendor = 0x14f1,
2486                 .subdevice = 0x0842,
2487                 .card      = CX88_BOARD_NPGTECH_REALTV_TOP10FM,
2488         },{
2489                 .subvendor = 0x107d,
2490                 .subdevice = 0x665e,
2491                 .card      = CX88_BOARD_WINFAST_DTV2000H,
2492         },{
2493                 .subvendor = 0x107d,
2494                 .subdevice = 0x6f2b,
2495                 .card      = CX88_BOARD_WINFAST_DTV2000H_J,
2496         },{
2497                 .subvendor = 0x18ac,
2498                 .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */
2499                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
2500         },{
2501                 .subvendor = 0x14f1,
2502                 .subdevice = 0x0084,
2503                 .card      = CX88_BOARD_GENIATECH_DVBS,
2504         },{
2505                 .subvendor = 0x0070,
2506                 .subdevice = 0x1404,
2507                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2508         }, {
2509                 .subvendor = 0x18ac,
2510                 .subdevice = 0xdc00,
2511                 .card      = CX88_BOARD_SAMSUNG_SMT_7020,
2512         }, {
2513                 .subvendor = 0x18ac,
2514                 .subdevice = 0xdccd,
2515                 .card      = CX88_BOARD_SAMSUNG_SMT_7020,
2516         },{
2517                 .subvendor = 0x1461,
2518                 .subdevice = 0xc111, /* AverMedia M150-D */
2519                 /* This board is known to work with the ASUS PVR416 config */
2520                 .card      = CX88_BOARD_ASUS_PVR_416,
2521         },{
2522                 .subvendor = 0xc180,
2523                 .subdevice = 0xc980,
2524                 .card      = CX88_BOARD_TE_DTV_250_OEM_SWANN,
2525         },{
2526                 .subvendor = 0x0070,
2527                 .subdevice = 0x9600,
2528                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2529         },{
2530                 .subvendor = 0x0070,
2531                 .subdevice = 0x9601,
2532                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2533         },{
2534                 .subvendor = 0x0070,
2535                 .subdevice = 0x9602,
2536                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2537         },{
2538                 .subvendor = 0x107d,
2539                 .subdevice = 0x6632,
2540                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2541         },{
2542                 .subvendor = 0x12ab,
2543                 .subdevice = 0x2300, /* Club3D Zap TV2100 */
2544                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
2545         },{
2546                 .subvendor = 0x0070,
2547                 .subdevice = 0x9000,
2548                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2549         },{
2550                 .subvendor = 0x0070,
2551                 .subdevice = 0x1400,
2552                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2553         },{
2554                 .subvendor = 0x0070,
2555                 .subdevice = 0x1401,
2556                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2557         },{
2558                 .subvendor = 0x0070,
2559                 .subdevice = 0x1402,
2560                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2561         },{
2562                 .subvendor = 0x1421,
2563                 .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */
2564                 .card      = CX88_BOARD_KWORLD_DVBS_100,
2565         },{
2566                 .subvendor = 0x1421,
2567                 .subdevice = 0x0390,
2568                 .card      = CX88_BOARD_ADSTECH_PTV_390,
2569         },{
2570                 .subvendor = 0x11bd,
2571                 .subdevice = 0x0051,
2572                 .card      = CX88_BOARD_PINNACLE_PCTV_HD_800i,
2573         }, {
2574                 .subvendor = 0x18ac,
2575                 .subdevice = 0xd530,
2576                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO,
2577         }, {
2578                 .subvendor = 0x12ab,
2579                 .subdevice = 0x1788,
2580                 .card      = CX88_BOARD_PINNACLE_HYBRID_PCTV,
2581         }, {
2582                 .subvendor = 0x14f1,
2583                 .subdevice = 0xea3d,
2584                 .card      = CX88_BOARD_POWERCOLOR_REAL_ANGEL,
2585         }, {
2586                 .subvendor = 0x107d,
2587                 .subdevice = 0x6f18,
2588                 .card      = CX88_BOARD_WINFAST_TV2000_XP_GLOBAL,
2589         }, {
2590                 .subvendor = 0x14f1,
2591                 .subdevice = 0x8852,
2592                 .card      = CX88_BOARD_GENIATECH_X8000_MT,
2593         }, {
2594                 .subvendor = 0x18ac,
2595                 .subdevice = 0xd610,
2596                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD,
2597         }, {
2598                 .subvendor = 0x1554,
2599                 .subdevice = 0x4935,
2600                 .card      = CX88_BOARD_PROLINK_PV_8000GT,
2601         }, {
2602                 .subvendor = 0x1554,
2603                 .subdevice = 0x4976,
2604                 .card      = CX88_BOARD_PROLINK_PV_GLOBAL_XTREME,
2605         }, {
2606                 .subvendor = 0x17de,
2607                 .subdevice = 0x08c1,
2608                 .card      = CX88_BOARD_KWORLD_ATSC_120,
2609         }, {
2610                 .subvendor = 0x0070,
2611                 .subdevice = 0x6900,
2612                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2613         }, {
2614                 .subvendor = 0x0070,
2615                 .subdevice = 0x6904,
2616                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2617         }, {
2618                 .subvendor = 0x0070,
2619                 .subdevice = 0x6902,
2620                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2621         }, {
2622                 .subvendor = 0x0070,
2623                 .subdevice = 0x6905,
2624                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000LITE,
2625         }, {
2626                 .subvendor = 0x0070,
2627                 .subdevice = 0x6906,
2628                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000LITE,
2629         }, {
2630                 .subvendor = 0xd420,
2631                 .subdevice = 0x9022,
2632                 .card      = CX88_BOARD_TEVII_S420,
2633         }, {
2634                 .subvendor = 0xd460,
2635                 .subdevice = 0x9022,
2636                 .card      = CX88_BOARD_TEVII_S460,
2637         }, {
2638                 .subvendor = 0xd464,
2639                 .subdevice = 0x9022,
2640                 .card      = CX88_BOARD_TEVII_S464,
2641         }, {
2642                 .subvendor = 0xA044,
2643                 .subdevice = 0x2011,
2644                 .card      = CX88_BOARD_OMICOM_SS4_PCI,
2645         }, {
2646                 .subvendor = 0x8910,
2647                 .subdevice = 0x8888,
2648                 .card      = CX88_BOARD_TBS_8910,
2649         }, {
2650                 .subvendor = 0x8920,
2651                 .subdevice = 0x8888,
2652                 .card      = CX88_BOARD_TBS_8920,
2653         }, {
2654                 .subvendor = 0xb022,
2655                 .subdevice = 0x3022,
2656                 .card      = CX88_BOARD_PROF_6200,
2657         }, {
2658                 .subvendor = 0xB033,
2659                 .subdevice = 0x3033,
2660                 .card      = CX88_BOARD_PROF_7300,
2661         }, {
2662                 .subvendor = 0xb200,
2663                 .subdevice = 0x4200,
2664                 .card      = CX88_BOARD_SATTRADE_ST4200,
2665         }, {
2666                 .subvendor = 0x153b,
2667                 .subdevice = 0x1177,
2668                 .card      = CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII,
2669         }, {
2670                 .subvendor = 0x0070,
2671                 .subdevice = 0x9290,
2672                 .card      = CX88_BOARD_HAUPPAUGE_IRONLY,
2673         }, {
2674                 .subvendor = 0x107d,
2675                 .subdevice = 0x6654,
2676                 .card      = CX88_BOARD_WINFAST_DTV1800H,
2677         }, {
2678                 /* WinFast DTV1800 H with XC4000 tuner */
2679                 .subvendor = 0x107d,
2680                 .subdevice = 0x6f38,
2681                 .card      = CX88_BOARD_WINFAST_DTV1800H_XC4000,
2682         }, {
2683                 .subvendor = 0x107d,
2684                 .subdevice = 0x6f42,
2685                 .card      = CX88_BOARD_WINFAST_DTV2000H_PLUS,
2686         }, {
2687                 /* PVR2000 PAL Model [107d:6630] */
2688                 .subvendor = 0x107d,
2689                 .subdevice = 0x6630,
2690                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2691         }, {
2692                 /* PVR2000 PAL Model [107d:6638] */
2693                 .subvendor = 0x107d,
2694                 .subdevice = 0x6638,
2695                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2696         }, {
2697                 /* PVR2000 NTSC Model [107d:6631] */
2698                 .subvendor = 0x107d,
2699                 .subdevice = 0x6631,
2700                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2701         }, {
2702                 /* PVR2000 NTSC Model [107d:6637] */
2703                 .subvendor = 0x107d,
2704                 .subdevice = 0x6637,
2705                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2706         }, {
2707                 /* PVR2000 NTSC Model [107d:663d] */
2708                 .subvendor = 0x107d,
2709                 .subdevice = 0x663d,
2710                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2711         }, {
2712                 /* DV2000 NTSC Model [107d:6621] */
2713                 .subvendor = 0x107d,
2714                 .subdevice = 0x6621,
2715                 .card      = CX88_BOARD_WINFAST_DV2000,
2716         }, {
2717                 /* TV2000 XP Global [107d:6618]  */
2718                 .subvendor = 0x107d,
2719                 .subdevice = 0x6618,
2720                 .card      = CX88_BOARD_WINFAST_TV2000_XP_GLOBAL,
2721         }, {
2722                 .subvendor = 0xb034,
2723                 .subdevice = 0x3034,
2724                 .card      = CX88_BOARD_PROF_7301,
2725         }, {
2726                 .subvendor = 0x1822,
2727                 .subdevice = 0x0023,
2728                 .card      = CX88_BOARD_TWINHAN_VP1027_DVBS,
2729         },
2730 };
2731
2732 /* ----------------------------------------------------------------------- */
2733 /* some leadtek specific stuff                                             */
2734
2735 static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
2736 {
2737         if (eeprom_data[4] != 0x7d ||
2738             eeprom_data[5] != 0x10 ||
2739             eeprom_data[7] != 0x66) {
2740                 warn_printk(core, "Leadtek eeprom invalid.\n");
2741                 return;
2742         }
2743
2744         /* Terry Wu <terrywu2009@gmail.com> */
2745         switch (eeprom_data[6]) {
2746         case 0x13: /* SSID 6613 for TV2000 XP Expert NTSC Model */
2747         case 0x21: /* SSID 6621 for DV2000 NTSC Model */
2748         case 0x31: /* SSID 6631 for PVR2000 NTSC Model */
2749         case 0x37: /* SSID 6637 for PVR2000 NTSC Model */
2750         case 0x3d: /* SSID 6637 for PVR2000 NTSC Model */
2751                 core->board.tuner_type = TUNER_PHILIPS_FM1236_MK3;
2752                 break;
2753         default:
2754                 core->board.tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
2755                 break;
2756         }
2757
2758         info_printk(core, "Leadtek Winfast 2000XP Expert config: "
2759                     "tuner=%d, eeprom[0]=0x%02x\n",
2760                     core->board.tuner_type, eeprom_data[0]);
2761 }
2762
2763 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
2764 {
2765         struct tveeprom tv;
2766
2767         tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data);
2768         core->board.tuner_type = tv.tuner_type;
2769         core->tuner_formats = tv.tuner_formats;
2770         core->board.radio.type = tv.has_radio ? CX88_RADIO : 0;
2771
2772         /* Make sure we support the board model */
2773         switch (tv.model)
2774         {
2775         case 14009: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in) */
2776         case 14019: /* WinTV-HVR3000 (Retail, IR Blaster, b/panel video, 3.5mm audio in) */
2777         case 14029: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge) */
2778         case 14109: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - low profile) */
2779         case 14129: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge - LP) */
2780         case 14559: /* WinTV-HVR3000 (OEM, no IR, b/panel video, 3.5mm audio in) */
2781         case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */
2782         case 14659: /* WinTV-HVR3000 (OEM, no IR, b/panel video, RCA audio in - Low profile) */
2783         case 14669: /* WinTV-HVR3000 (OEM, no IR, no b/panel video - Low profile) */
2784         case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
2785         case 34519: /* WinTV-PCI-FM */
2786         case 69009:
2787                 /* WinTV-HVR4000 (DVBS/S2/T, Video and IR, back panel inputs) */
2788         case 69100: /* WinTV-HVR4000LITE (DVBS/S2, IR) */
2789         case 69500: /* WinTV-HVR4000LITE (DVBS/S2, No IR) */
2790         case 69559:
2791                 /* WinTV-HVR4000 (DVBS/S2/T, Video no IR, back panel inputs) */
2792         case 69569: /* WinTV-HVR4000 (DVBS/S2/T, Video no IR) */
2793         case 90002: /* Nova-T-PCI (9002) */
2794         case 92001: /* Nova-S-Plus (Video and IR) */
2795         case 92002: /* Nova-S-Plus (Video and IR) */
2796         case 90003: /* Nova-T-PCI (9002 No RF out) */
2797         case 90500: /* Nova-T-PCI (oem) */
2798         case 90501: /* Nova-T-PCI (oem/IR) */
2799         case 92000: /* Nova-SE2 (OEM, No Video or IR) */
2800         case 92900: /* WinTV-IROnly (No analog or digital Video inputs) */
2801         case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
2802         case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
2803         case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */
2804         case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */
2805         case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */
2806         case 96569: /* WinTV-HVR1300 () */
2807         case 96659: /* WinTV-HVR1300 () */
2808         case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
2809                 /* known */
2810                 break;
2811         case CX88_BOARD_SAMSUNG_SMT_7020:
2812                 cx_set(MO_GP0_IO, 0x008989FF);
2813                 break;
2814         default:
2815                 warn_printk(core, "warning: unknown hauppauge model #%d\n",
2816                             tv.model);
2817                 break;
2818         }
2819
2820         info_printk(core, "hauppauge eeprom: model=%d\n", tv.model);
2821 }
2822
2823 /* ----------------------------------------------------------------------- */
2824 /* some GDI (was: Modular Technology) specific stuff                       */
2825
2826 static const struct {
2827         int  id;
2828         int  fm;
2829         const char *name;
2830 } gdi_tuner[] = {
2831         [ 0x01 ] = { .id   = TUNER_ABSENT,
2832                      .name = "NTSC_M" },
2833         [ 0x02 ] = { .id   = TUNER_ABSENT,
2834                      .name = "PAL_B" },
2835         [ 0x03 ] = { .id   = TUNER_ABSENT,
2836                      .name = "PAL_I" },
2837         [ 0x04 ] = { .id   = TUNER_ABSENT,
2838                      .name = "PAL_D" },
2839         [ 0x05 ] = { .id   = TUNER_ABSENT,
2840                      .name = "SECAM" },
2841
2842         [ 0x10 ] = { .id   = TUNER_ABSENT,
2843                      .fm   = 1,
2844                      .name = "TEMIC_4049" },
2845         [ 0x11 ] = { .id   = TUNER_TEMIC_4136FY5,
2846                      .name = "TEMIC_4136" },
2847         [ 0x12 ] = { .id   = TUNER_ABSENT,
2848                      .name = "TEMIC_4146" },
2849
2850         [ 0x20 ] = { .id   = TUNER_PHILIPS_FQ1216ME,
2851                      .fm   = 1,
2852                      .name = "PHILIPS_FQ1216_MK3" },
2853         [ 0x21 ] = { .id   = TUNER_ABSENT, .fm = 1,
2854                      .name = "PHILIPS_FQ1236_MK3" },
2855         [ 0x22 ] = { .id   = TUNER_ABSENT,
2856                      .name = "PHILIPS_FI1236_MK3" },
2857         [ 0x23 ] = { .id   = TUNER_ABSENT,
2858                      .name = "PHILIPS_FI1216_MK3" },
2859 };
2860
2861 static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
2862 {
2863         const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
2864                 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
2865
2866         info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
2867         if (NULL == name)
2868                 return;
2869         core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
2870         core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
2871                 CX88_RADIO : 0;
2872 }
2873
2874 /* ------------------------------------------------------------------- */
2875 /* some Divco specific stuff                                           */
2876 static int cx88_dvico_xc2028_callback(struct cx88_core *core,
2877                                       int command, int arg)
2878 {
2879         switch (command) {
2880         case XC2028_TUNER_RESET:
2881                 switch (core->boardnr) {
2882                 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2883                         /* GPIO-4 xc3028 tuner */
2884
2885                         cx_set(MO_GP0_IO, 0x00001000);
2886                         cx_clear(MO_GP0_IO, 0x00000010);
2887                         msleep(100);
2888                         cx_set(MO_GP0_IO, 0x00000010);
2889                         msleep(100);
2890                         break;
2891                 default:
2892                         cx_write(MO_GP0_IO, 0x101000);
2893                         mdelay(5);
2894                         cx_set(MO_GP0_IO, 0x101010);
2895                 }
2896                 break;
2897         default:
2898                 return -EINVAL;
2899         }
2900
2901         return 0;
2902 }
2903
2904
2905 /* ----------------------------------------------------------------------- */
2906 /* some Geniatech specific stuff                                           */
2907
2908 static int cx88_xc3028_geniatech_tuner_callback(struct cx88_core *core,
2909                                                 int command, int mode)
2910 {
2911         switch (command) {
2912         case XC2028_TUNER_RESET:
2913                 switch (INPUT(core->input).type) {
2914                 case CX88_RADIO:
2915                         break;
2916                 case CX88_VMUX_DVB:
2917                         cx_write(MO_GP1_IO, 0x030302);
2918                         mdelay(50);
2919                         break;
2920                 default:
2921                         cx_write(MO_GP1_IO, 0x030301);
2922                         mdelay(50);
2923                 }
2924                 cx_write(MO_GP1_IO, 0x101010);
2925                 mdelay(50);
2926                 cx_write(MO_GP1_IO, 0x101000);
2927                 mdelay(50);
2928                 cx_write(MO_GP1_IO, 0x101010);
2929                 mdelay(50);
2930                 return 0;
2931         }
2932         return -EINVAL;
2933 }
2934
2935 static int cx88_xc3028_winfast1800h_callback(struct cx88_core *core,
2936                                              int command, int arg)
2937 {
2938         switch (command) {
2939         case XC2028_TUNER_RESET:
2940                 /* GPIO 12 (xc3028 tuner reset) */
2941                 cx_set(MO_GP1_IO, 0x1010);
2942                 mdelay(50);
2943                 cx_clear(MO_GP1_IO, 0x10);
2944                 mdelay(50);
2945                 cx_set(MO_GP1_IO, 0x10);
2946                 mdelay(50);
2947                 return 0;
2948         }
2949         return -EINVAL;
2950 }
2951
2952 static int cx88_xc4000_winfast2000h_plus_callback(struct cx88_core *core,
2953                                                   int command, int arg)
2954 {
2955         switch (command) {
2956         case XC4000_TUNER_RESET:
2957                 /* GPIO 12 (xc4000 tuner reset) */
2958                 cx_set(MO_GP1_IO, 0x1010);
2959                 mdelay(50);
2960                 cx_clear(MO_GP1_IO, 0x10);
2961                 mdelay(75);
2962                 cx_set(MO_GP1_IO, 0x10);
2963                 mdelay(75);
2964                 return 0;
2965         }
2966         return -EINVAL;
2967 }
2968
2969 /* ------------------------------------------------------------------- */
2970 /* some Divco specific stuff                                           */
2971 static int cx88_pv_8000gt_callback(struct cx88_core *core,
2972                                    int command, int arg)
2973 {
2974         switch (command) {
2975         case XC2028_TUNER_RESET:
2976                 cx_write(MO_GP2_IO, 0xcf7);
2977                 mdelay(50);
2978                 cx_write(MO_GP2_IO, 0xef5);
2979                 mdelay(50);
2980                 cx_write(MO_GP2_IO, 0xcf7);
2981                 break;
2982         default:
2983                 return -EINVAL;
2984         }
2985
2986         return 0;
2987 }
2988
2989 /* ----------------------------------------------------------------------- */
2990 /* some DViCO specific stuff                                               */
2991
2992 static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
2993 {
2994         struct i2c_msg msg = { .addr = 0x45, .flags = 0 };
2995         int i, err;
2996         static u8 init_bufs[13][5] = {
2997                 { 0x10, 0x00, 0x20, 0x01, 0x03 },
2998                 { 0x10, 0x10, 0x01, 0x00, 0x21 },
2999                 { 0x10, 0x10, 0x10, 0x00, 0xCA },
3000                 { 0x10, 0x10, 0x12, 0x00, 0x08 },
3001                 { 0x10, 0x10, 0x13, 0x00, 0x0A },
3002                 { 0x10, 0x10, 0x16, 0x01, 0xC0 },
3003                 { 0x10, 0x10, 0x22, 0x01, 0x3D },
3004                 { 0x10, 0x10, 0x73, 0x01, 0x2E },
3005                 { 0x10, 0x10, 0x72, 0x00, 0xC5 },
3006                 { 0x10, 0x10, 0x71, 0x01, 0x97 },
3007                 { 0x10, 0x10, 0x70, 0x00, 0x0F },
3008                 { 0x10, 0x10, 0xB0, 0x00, 0x01 },
3009                 { 0x03, 0x0C },
3010         };
3011
3012         for (i = 0; i < ARRAY_SIZE(init_bufs); i++) {
3013                 msg.buf = init_bufs[i];
3014                 msg.len = (i != 12 ? 5 : 2);
3015                 err = i2c_transfer(&core->i2c_adap, &msg, 1);
3016                 if (err != 1) {
3017                         warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d "
3018                                           "failed (err = %d)!\n", i, err);
3019                         return;
3020                 }
3021         }
3022 }
3023
3024 static int cx88_xc2028_tuner_callback(struct cx88_core *core,
3025                                       int command, int arg)
3026 {
3027         /* Board-specific callbacks */
3028         switch (core->boardnr) {
3029         case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
3030         case CX88_BOARD_GENIATECH_X8000_MT:
3031         case CX88_BOARD_KWORLD_ATSC_120:
3032                 return cx88_xc3028_geniatech_tuner_callback(core,
3033                                                         command, arg);
3034         case CX88_BOARD_PROLINK_PV_8000GT:
3035         case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
3036                 return cx88_pv_8000gt_callback(core, command, arg);
3037         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
3038         case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
3039                 return cx88_dvico_xc2028_callback(core, command, arg);
3040         case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
3041         case CX88_BOARD_WINFAST_DTV1800H:
3042                 return cx88_xc3028_winfast1800h_callback(core, command, arg);
3043         }
3044
3045         switch (command) {
3046         case XC2028_TUNER_RESET:
3047                 switch (INPUT(core->input).type) {
3048                 case CX88_RADIO:
3049                         info_printk(core, "setting GPIO to radio!\n");
3050                         cx_write(MO_GP0_IO, 0x4ff);
3051                         mdelay(250);
3052                         cx_write(MO_GP2_IO, 0xff);
3053                         mdelay(250);
3054                         break;
3055                 case CX88_VMUX_DVB:     /* Digital TV*/
3056                 default:                /* Analog TV */
3057                         info_printk(core, "setting GPIO to TV!\n");
3058                         break;
3059                 }
3060                 cx_write(MO_GP1_IO, 0x101010);
3061                 mdelay(250);
3062                 cx_write(MO_GP1_IO, 0x101000);
3063                 mdelay(250);
3064                 cx_write(MO_GP1_IO, 0x101010);
3065                 mdelay(250);
3066                 return 0;
3067         }
3068         return -EINVAL;
3069 }
3070
3071 static int cx88_xc4000_tuner_callback(struct cx88_core *core,
3072                                       int command, int arg)
3073 {
3074         /* Board-specific callbacks */
3075         switch (core->boardnr) {
3076         case CX88_BOARD_WINFAST_DTV1800H_XC4000:
3077         case CX88_BOARD_WINFAST_DTV2000H_PLUS:
3078                 return cx88_xc4000_winfast2000h_plus_callback(core,
3079                                                               command, arg);
3080         }
3081         return -EINVAL;
3082 }
3083
3084 /* ----------------------------------------------------------------------- */
3085 /* Tuner callback function. Currently only needed for the Pinnacle         *
3086  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both       *
3087  * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c)    */
3088
3089 static int cx88_xc5000_tuner_callback(struct cx88_core *core,
3090                                       int command, int arg)
3091 {
3092         switch (core->boardnr) {
3093         case CX88_BOARD_PINNACLE_PCTV_HD_800i:
3094                 if (command == 0) { /* This is the reset command from xc5000 */
3095
3096                         /* djh - According to the engineer at PCTV Systems,
3097                            the xc5000 reset pin is supposed to be on GPIO12.
3098                            However, despite three nights of effort, pulling
3099                            that GPIO low didn't reset the xc5000.  While
3100                            pulling MO_SRST_IO low does reset the xc5000, this
3101                            also resets in the s5h1409 being reset as well.
3102                            This causes tuning to always fail since the internal
3103                            state of the s5h1409 does not match the driver's
3104                            state.  Given that the only two conditions in which
3105                            the driver performs a reset is during firmware load
3106                            and powering down the chip, I am taking out the
3107                            reset.  We know that the chip is being reset
3108                            when the cx88 comes online, and not being able to
3109                            do power management for this board is worse than
3110                            not having any tuning at all. */
3111                         return 0;
3112                 } else {
3113                         err_printk(core, "xc5000: unknown tuner "
3114                                    "callback command.\n");
3115                         return -EINVAL;
3116                 }
3117                 break;
3118         case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
3119                 if (command == 0) { /* This is the reset command from xc5000 */
3120                         cx_clear(MO_GP0_IO, 0x00000010);
3121                         msleep(10);
3122                         cx_set(MO_GP0_IO, 0x00000010);
3123                         return 0;
3124                 } else {
3125                         printk(KERN_ERR
3126                                 "xc5000: unknown tuner callback command.\n");
3127                         return -EINVAL;
3128                 }
3129                 break;
3130         }
3131         return 0; /* Should never be here */
3132 }
3133
3134 int cx88_tuner_callback(void *priv, int component, int command, int arg)
3135 {
3136         struct i2c_algo_bit_data *i2c_algo = priv;
3137         struct cx88_core *core;
3138
3139         if (!i2c_algo) {
3140                 printk(KERN_ERR "cx88: Error - i2c private data undefined.\n");
3141                 return -EINVAL;
3142         }
3143
3144         core = i2c_algo->data;
3145
3146         if (!core) {
3147                 printk(KERN_ERR "cx88: Error - device struct undefined.\n");
3148                 return -EINVAL;
3149         }
3150
3151         if (component != DVB_FRONTEND_COMPONENT_TUNER)
3152                 return -EINVAL;
3153
3154         switch (core->board.tuner_type) {
3155                 case TUNER_XC2028:
3156                         info_printk(core, "Calling XC2028/3028 callback\n");
3157                         return cx88_xc2028_tuner_callback(core, command, arg);
3158                 case TUNER_XC4000:
3159                         info_printk(core, "Calling XC4000 callback\n");
3160                         return cx88_xc4000_tuner_callback(core, command, arg);
3161                 case TUNER_XC5000:
3162                         info_printk(core, "Calling XC5000 callback\n");
3163                         return cx88_xc5000_tuner_callback(core, command, arg);
3164         }
3165         err_printk(core, "Error: Calling callback for tuner %d\n",
3166                    core->board.tuner_type);
3167         return -EINVAL;
3168 }
3169 EXPORT_SYMBOL(cx88_tuner_callback);
3170
3171 /* ----------------------------------------------------------------------- */
3172
3173 static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
3174 {
3175         int i;
3176
3177         if (0 == pci->subsystem_vendor &&
3178             0 == pci->subsystem_device) {
3179                 printk(KERN_ERR
3180                        "%s: Your board has no valid PCI Subsystem ID and thus can't\n"
3181                        "%s: be autodetected.  Please pass card=<n> insmod option to\n"
3182                        "%s: workaround that.  Redirect complaints to the vendor of\n"
3183                        "%s: the TV card.  Best regards,\n"
3184                        "%s:         -- tux\n",
3185                        core->name,core->name,core->name,core->name,core->name);
3186         } else {
3187                 printk(KERN_ERR
3188                        "%s: Your board isn't known (yet) to the driver.  You can\n"
3189                        "%s: try to pick one of the existing card configs via\n"
3190                        "%s: card=<n> insmod option.  Updating to the latest\n"
3191                        "%s: version might help as well.\n",
3192                        core->name,core->name,core->name,core->name);
3193         }
3194         err_printk(core, "Here is a list of valid choices for the card=<n> "
3195                    "insmod option:\n");
3196         for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
3197                 printk(KERN_ERR "%s:    card=%d -> %s\n",
3198                        core->name, i, cx88_boards[i].name);
3199 }
3200
3201 static void cx88_card_setup_pre_i2c(struct cx88_core *core)
3202 {
3203         switch (core->boardnr) {
3204         case CX88_BOARD_HAUPPAUGE_HVR1300:
3205                 /*
3206                  * Bring the 702 demod up before i2c scanning/attach or devices are hidden
3207                  * We leave here with the 702 on the bus
3208                  *
3209                  * "reset the IR receiver on GPIO[3]"
3210                  * Reported by Mike Crash <mike AT mikecrash.com>
3211                  */
3212                 cx_write(MO_GP0_IO, 0x0000ef88);
3213                 udelay(1000);
3214                 cx_clear(MO_GP0_IO, 0x00000088);
3215                 udelay(50);
3216                 cx_set(MO_GP0_IO, 0x00000088); /* 702 out of reset */
3217                 udelay(1000);
3218                 break;
3219
3220         case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
3221         case CX88_BOARD_PROLINK_PV_8000GT:
3222                 cx_write(MO_GP2_IO, 0xcf7);
3223                 mdelay(50);
3224                 cx_write(MO_GP2_IO, 0xef5);
3225                 mdelay(50);
3226                 cx_write(MO_GP2_IO, 0xcf7);
3227                 msleep(10);
3228                 break;
3229
3230         case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
3231                 /* Enable the xc5000 tuner */
3232                 cx_set(MO_GP0_IO, 0x00001010);
3233                 break;
3234
3235         case CX88_BOARD_HAUPPAUGE_HVR3000:
3236         case CX88_BOARD_HAUPPAUGE_HVR4000:
3237                 /* Init GPIO */
3238                 cx_write(MO_GP0_IO, core->board.input[0].gpio0);
3239                 udelay(1000);
3240                 cx_clear(MO_GP0_IO, 0x00000080);
3241                 udelay(50);
3242                 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
3243                 udelay(1000);
3244                 break;
3245
3246         case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
3247         case CX88_BOARD_WINFAST_DTV1800H:
3248                 cx88_xc3028_winfast1800h_callback(core, XC2028_TUNER_RESET, 0);
3249                 break;
3250
3251         case CX88_BOARD_WINFAST_DTV1800H_XC4000:
3252         case CX88_BOARD_WINFAST_DTV2000H_PLUS:
3253                 cx88_xc4000_winfast2000h_plus_callback(core,
3254                                                        XC4000_TUNER_RESET, 0);
3255                 break;
3256
3257         case CX88_BOARD_TWINHAN_VP1027_DVBS:
3258                 cx_write(MO_GP0_IO, 0x00003230);
3259                 cx_write(MO_GP0_IO, 0x00003210);
3260                 msleep(1);
3261                 cx_write(MO_GP0_IO, 0x00001230);
3262                 break;
3263         }
3264 }
3265
3266 /*
3267  * Sets board-dependent xc3028 configuration
3268  */
3269 void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl)
3270 {
3271         memset(ctl, 0, sizeof(*ctl));
3272
3273         ctl->fname   = XC2028_DEFAULT_FIRMWARE;
3274         ctl->max_len = 64;
3275
3276         switch (core->boardnr) {
3277         case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
3278                 /* Now works with firmware version 2.7 */
3279                 if (core->i2c_algo.udelay < 16)
3280                         core->i2c_algo.udelay = 16;
3281                 break;
3282         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
3283         case CX88_BOARD_WINFAST_DTV1800H:
3284                 ctl->demod = XC3028_FE_ZARLINK456;
3285                 break;
3286         case CX88_BOARD_KWORLD_ATSC_120:
3287         case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
3288                 ctl->demod = XC3028_FE_OREN538;
3289                 break;
3290         case CX88_BOARD_GENIATECH_X8000_MT:
3291                 /* FIXME: For this board, the xc3028 never recovers after being
3292                    powered down (the reset GPIO probably is not set properly).
3293                    We don't have access to the hardware so we cannot determine
3294                    which GPIO is used for xc3028, so just disable power xc3028
3295                    power management for now */
3296                 ctl->disable_power_mgmt = 1;
3297                 break;
3298         case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
3299         case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
3300         case CX88_BOARD_PROLINK_PV_8000GT:
3301                 /*
3302                  * Those boards uses non-MTS firmware
3303                  */
3304                 break;
3305         case CX88_BOARD_PINNACLE_HYBRID_PCTV:
3306         case CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII:
3307                 ctl->demod = XC3028_FE_ZARLINK456;
3308                 ctl->mts = 1;
3309                 break;
3310         default:
3311                 ctl->demod = XC3028_FE_OREN538;
3312                 ctl->mts = 1;
3313         }
3314 }
3315 EXPORT_SYMBOL_GPL(cx88_setup_xc3028);
3316
3317 static void cx88_card_setup(struct cx88_core *core)
3318 {
3319         static u8 eeprom[256];
3320         struct tuner_setup tun_setup;
3321         unsigned int mode_mask = T_RADIO | T_ANALOG_TV;
3322
3323         memset(&tun_setup, 0, sizeof(tun_setup));
3324
3325         if (0 == core->i2c_rc) {
3326                 core->i2c_client.addr = 0xa0 >> 1;
3327                 tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom));
3328         }
3329
3330         switch (core->boardnr) {
3331         case CX88_BOARD_HAUPPAUGE:
3332         case CX88_BOARD_HAUPPAUGE_ROSLYN:
3333                 if (0 == core->i2c_rc)
3334                         hauppauge_eeprom(core, eeprom+8);
3335                 break;
3336         case CX88_BOARD_GDI:
3337                 if (0 == core->i2c_rc)
3338                         gdi_eeprom(core, eeprom);
3339                 break;
3340         case CX88_BOARD_LEADTEK_PVR2000:
3341         case CX88_BOARD_WINFAST_DV2000:
3342         case CX88_BOARD_WINFAST2000XP_EXPERT:
3343                 if (0 == core->i2c_rc)
3344                         leadtek_eeprom(core, eeprom);
3345                 break;
3346         case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
3347         case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
3348         case CX88_BOARD_HAUPPAUGE_DVB_T1:
3349         case CX88_BOARD_HAUPPAUGE_HVR1100:
3350         case CX88_BOARD_HAUPPAUGE_HVR1100LP:
3351         case CX88_BOARD_HAUPPAUGE_HVR3000:
3352         case CX88_BOARD_HAUPPAUGE_HVR1300:
3353         case CX88_BOARD_HAUPPAUGE_HVR4000:
3354         case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
3355         case CX88_BOARD_HAUPPAUGE_IRONLY:
3356                 if (0 == core->i2c_rc)
3357                         hauppauge_eeprom(core, eeprom);
3358                 break;
3359         case CX88_BOARD_KWORLD_DVBS_100:
3360                 cx_write(MO_GP0_IO, 0x000007f8);
3361                 cx_write(MO_GP1_IO, 0x00000001);
3362                 break;
3363         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
3364                 /* GPIO0:0 is hooked to demod reset */
3365                 /* GPIO0:4 is hooked to xc3028 reset */
3366                 cx_write(MO_GP0_IO, 0x00111100);
3367                 msleep(1);
3368                 cx_write(MO_GP0_IO, 0x00111111);
3369                 break;
3370         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
3371                 /* GPIO0:6 is hooked to FX2 reset pin */
3372                 cx_set(MO_GP0_IO, 0x00004040);
3373                 cx_clear(MO_GP0_IO, 0x00000040);
3374                 msleep(1000);
3375                 cx_set(MO_GP0_IO, 0x00004040);
3376                 /* FALLTHROUGH */
3377         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
3378         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
3379         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
3380                 /* GPIO0:0 is hooked to mt352 reset pin */
3381                 cx_set(MO_GP0_IO, 0x00000101);
3382                 cx_clear(MO_GP0_IO, 0x00000001);
3383                 msleep(1);
3384                 cx_set(MO_GP0_IO, 0x00000101);
3385                 if (0 == core->i2c_rc &&
3386                     core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
3387                         dvico_fusionhdtv_hybrid_init(core);
3388                 break;
3389         case CX88_BOARD_KWORLD_DVB_T:
3390         case CX88_BOARD_DNTV_LIVE_DVB_T:
3391                 cx_set(MO_GP0_IO, 0x00000707);
3392                 cx_set(MO_GP2_IO, 0x00000101);
3393                 cx_clear(MO_GP2_IO, 0x00000001);
3394                 msleep(1);
3395                 cx_clear(MO_GP0_IO, 0x00000007);
3396                 cx_set(MO_GP2_IO, 0x00000101);
3397                 break;
3398         case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
3399                 cx_write(MO_GP0_IO, 0x00080808);
3400                 break;
3401         case CX88_BOARD_ATI_HDTVWONDER:
3402                 if (0 == core->i2c_rc) {
3403                         /* enable tuner */
3404                         int i;
3405                         static const u8 buffer [][2] = {
3406                                 {0x10,0x12},
3407                                 {0x13,0x04},
3408                                 {0x16,0x00},
3409                                 {0x14,0x04},
3410                                 {0x17,0x00}
3411                         };
3412                         core->i2c_client.addr = 0x0a;
3413
3414                         for (i = 0; i < ARRAY_SIZE(buffer); i++)
3415                                 if (2 != i2c_master_send(&core->i2c_client,
3416                                                         buffer[i],2))
3417                                         warn_printk(core, "Unable to enable "
3418                                                     "tuner(%i).\n", i);
3419                 }
3420                 break;
3421         case CX88_BOARD_MSI_TVANYWHERE_MASTER:
3422         {
3423                 struct v4l2_priv_tun_config tea5767_cfg;
3424                 struct tea5767_ctrl ctl;
3425
3426                 memset(&ctl, 0, sizeof(ctl));
3427
3428                 ctl.high_cut  = 1;
3429                 ctl.st_noise  = 1;
3430                 ctl.deemph_75 = 1;
3431                 ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
3432
3433                 tea5767_cfg.tuner = TUNER_TEA5767;
3434                 tea5767_cfg.priv  = &ctl;
3435
3436                 call_all(core, tuner, s_config, &tea5767_cfg);
3437                 break;
3438         }
3439         case  CX88_BOARD_TEVII_S420:
3440         case  CX88_BOARD_TEVII_S460:
3441         case  CX88_BOARD_TEVII_S464:
3442         case  CX88_BOARD_OMICOM_SS4_PCI:
3443         case  CX88_BOARD_TBS_8910:
3444         case  CX88_BOARD_TBS_8920:
3445         case  CX88_BOARD_PROF_6200:
3446         case  CX88_BOARD_PROF_7300:
3447         case  CX88_BOARD_PROF_7301:
3448         case  CX88_BOARD_SATTRADE_ST4200:
3449                 cx_write(MO_GP0_IO, 0x8000);
3450                 msleep(100);
3451                 cx_write(MO_SRST_IO, 0);
3452                 msleep(10);
3453                 cx_write(MO_GP0_IO, 0x8080);
3454                 msleep(100);
3455                 cx_write(MO_SRST_IO, 1);
3456                 msleep(100);
3457                 break;
3458         } /*end switch() */
3459
3460
3461         /* Setup tuners */
3462         if ((core->board.radio_type != UNSET)) {
3463                 tun_setup.mode_mask      = T_RADIO;
3464                 tun_setup.type           = core->board.radio_type;
3465                 tun_setup.addr           = core->board.radio_addr;
3466                 tun_setup.tuner_callback = cx88_tuner_callback;
3467                 call_all(core, tuner, s_type_addr, &tun_setup);
3468                 mode_mask &= ~T_RADIO;
3469         }
3470
3471         if (core->board.tuner_type != TUNER_ABSENT) {
3472                 tun_setup.mode_mask      = mode_mask;
3473                 tun_setup.type           = core->board.tuner_type;
3474                 tun_setup.addr           = core->board.tuner_addr;
3475                 tun_setup.tuner_callback = cx88_tuner_callback;
3476
3477                 call_all(core, tuner, s_type_addr, &tun_setup);
3478         }
3479
3480         if (core->board.tda9887_conf) {
3481                 struct v4l2_priv_tun_config tda9887_cfg;
3482
3483                 tda9887_cfg.tuner = TUNER_TDA9887;
3484                 tda9887_cfg.priv  = &core->board.tda9887_conf;
3485
3486                 call_all(core, tuner, s_config, &tda9887_cfg);
3487         }
3488
3489         if (core->board.tuner_type == TUNER_XC2028) {
3490                 struct v4l2_priv_tun_config  xc2028_cfg;
3491                 struct xc2028_ctrl           ctl;
3492
3493                 /* Fills device-dependent initialization parameters */
3494                 cx88_setup_xc3028(core, &ctl);
3495
3496                 /* Sends parameters to xc2028/3028 tuner */
3497                 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
3498                 xc2028_cfg.tuner = TUNER_XC2028;
3499                 xc2028_cfg.priv  = &ctl;
3500                 info_printk(core, "Asking xc2028/3028 to load firmware %s\n",
3501                             ctl.fname);
3502                 call_all(core, tuner, s_config, &xc2028_cfg);
3503         }
3504         call_all(core, core, s_power, 0);
3505 }
3506
3507 /* ------------------------------------------------------------------ */
3508
3509 static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
3510 {
3511         unsigned int lat = UNSET;
3512         u8 ctrl = 0;
3513         u8 value;
3514
3515         /* check pci quirks */
3516         if (pci_pci_problems & PCIPCI_TRITON) {
3517                 printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n",
3518                        name);
3519                 ctrl |= CX88X_EN_TBFX;
3520         }
3521         if (pci_pci_problems & PCIPCI_NATOMA) {
3522                 printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n",
3523                        name);
3524                 ctrl |= CX88X_EN_TBFX;
3525         }
3526         if (pci_pci_problems & PCIPCI_VIAETBF) {
3527                 printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n",
3528                        name);
3529                 ctrl |= CX88X_EN_TBFX;
3530         }
3531         if (pci_pci_problems & PCIPCI_VSFX) {
3532                 printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n",
3533                        name);
3534                 ctrl |= CX88X_EN_VSFX;
3535         }
3536 #ifdef PCIPCI_ALIMAGIK
3537         if (pci_pci_problems & PCIPCI_ALIMAGIK) {
3538                 printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
3539                        name);
3540                 lat = 0x0A;
3541         }
3542 #endif
3543
3544         /* check insmod options */
3545         if (UNSET != latency)
3546                 lat = latency;
3547
3548         /* apply stuff */
3549         if (ctrl) {
3550                 pci_read_config_byte(pci, CX88X_DEVCTRL, &value);
3551                 value |= ctrl;
3552                 pci_write_config_byte(pci, CX88X_DEVCTRL, value);
3553         }
3554         if (UNSET != lat) {
3555                 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
3556                        name, latency);
3557                 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
3558         }
3559         return 0;
3560 }
3561
3562 int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
3563 {
3564         if (request_mem_region(pci_resource_start(pci,0),
3565                                pci_resource_len(pci,0),
3566                                core->name))
3567                 return 0;
3568         printk(KERN_ERR
3569                "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
3570                core->name, PCI_FUNC(pci->devfn),
3571                (unsigned long long)pci_resource_start(pci, 0),
3572                pci->subsystem_vendor, pci->subsystem_device);
3573         return -EBUSY;
3574 }
3575
3576 /* Allocate and initialize the cx88 core struct.  One should hold the
3577  * devlist mutex before calling this.  */
3578 struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
3579 {
3580         struct cx88_core *core;
3581         int i;
3582
3583         core = kzalloc(sizeof(*core), GFP_KERNEL);
3584         if (core == NULL)
3585                 return NULL;
3586
3587         atomic_inc(&core->refcount);
3588         core->pci_bus  = pci->bus->number;
3589         core->pci_slot = PCI_SLOT(pci->devfn);
3590         core->pci_irqmask = PCI_INT_RISC_RD_BERRINT | PCI_INT_RISC_WR_BERRINT |
3591                             PCI_INT_BRDG_BERRINT | PCI_INT_SRC_DMA_BERRINT |
3592                             PCI_INT_DST_DMA_BERRINT | PCI_INT_IPB_DMA_BERRINT;
3593         mutex_init(&core->lock);
3594
3595         core->nr = nr;
3596         sprintf(core->name, "cx88[%d]", core->nr);
3597
3598         strcpy(core->v4l2_dev.name, core->name);
3599         if (v4l2_device_register(NULL, &core->v4l2_dev)) {
3600                 kfree(core);
3601                 return NULL;
3602         }
3603
3604         if (0 != cx88_get_resources(core, pci)) {
3605                 v4l2_device_unregister(&core->v4l2_dev);
3606                 kfree(core);
3607                 return NULL;
3608         }
3609
3610         /* PCI stuff */
3611         cx88_pci_quirks(core->name, pci);
3612         core->lmmio = ioremap(pci_resource_start(pci, 0),
3613                               pci_resource_len(pci, 0));
3614         core->bmmio = (u8 __iomem *)core->lmmio;
3615
3616         if (core->lmmio == NULL) {
3617                 kfree(core);
3618                 return NULL;
3619         }
3620
3621         /* board config */
3622         core->boardnr = UNSET;
3623         if (card[core->nr] < ARRAY_SIZE(cx88_boards))
3624                 core->boardnr = card[core->nr];
3625         for (i = 0; UNSET == core->boardnr && i < ARRAY_SIZE(cx88_subids); i++)
3626                 if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
3627                     pci->subsystem_device == cx88_subids[i].subdevice)
3628                         core->boardnr = cx88_subids[i].card;
3629         if (UNSET == core->boardnr) {
3630                 core->boardnr = CX88_BOARD_UNKNOWN;
3631                 cx88_card_list(core, pci);
3632         }
3633
3634         memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
3635
3636         if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB))
3637                 core->board.num_frontends = 1;
3638
3639         info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
3640                 pci->subsystem_vendor, pci->subsystem_device, core->board.name,
3641                 core->boardnr, card[core->nr] == core->boardnr ?
3642                 "insmod option" : "autodetected",
3643                 core->board.num_frontends);
3644
3645         if (tuner[core->nr] != UNSET)
3646                 core->board.tuner_type = tuner[core->nr];
3647         if (radio[core->nr] != UNSET)
3648                 core->board.radio_type = radio[core->nr];
3649
3650         info_printk(core, "TV tuner type %d, Radio tuner type %d\n",
3651                     core->board.tuner_type, core->board.radio_type);
3652
3653         /* init hardware */
3654         cx88_reset(core);
3655         cx88_card_setup_pre_i2c(core);
3656         cx88_i2c_init(core, pci);
3657
3658         /* load tuner module, if needed */
3659         if (TUNER_ABSENT != core->board.tuner_type) {
3660                 /* Ignore 0x6b and 0x6f on cx88 boards.
3661                  * FusionHDTV5 RT Gold has an ir receiver at 0x6b
3662                  * and an RTC at 0x6f which can get corrupted if probed. */
3663                 static const unsigned short tv_addrs[] = {
3664                         0x42, 0x43, 0x4a, 0x4b,         /* tda8290 */
3665                         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
3666                         0x68, 0x69, 0x6a, 0x6c, 0x6d, 0x6e,
3667                         I2C_CLIENT_END
3668                 };
3669                 int has_demod = (core->board.tda9887_conf & TDA9887_PRESENT);
3670
3671                 /* I don't trust the radio_type as is stored in the card
3672                    definitions, so we just probe for it.
3673                    The radio_type is sometimes missing, or set to UNSET but
3674                    later code configures a tea5767.
3675                  */
3676                 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
3677                                 "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
3678                 if (has_demod)
3679                         v4l2_i2c_new_subdev(&core->v4l2_dev,
3680                                 &core->i2c_adap, "tuner",
3681                                 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
3682                 if (core->board.tuner_addr == ADDR_UNSET) {
3683                         v4l2_i2c_new_subdev(&core->v4l2_dev,
3684                                 &core->i2c_adap, "tuner",
3685                                 0, has_demod ? tv_addrs + 4 : tv_addrs);
3686                 } else {
3687                         v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
3688                                 "tuner", core->board.tuner_addr, NULL);
3689                 }
3690         }
3691
3692         cx88_card_setup(core);
3693         if (!disable_ir) {
3694                 cx88_i2c_init_ir(core);
3695                 cx88_ir_init(core, pci);
3696         }
3697
3698         return core;
3699 }