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