Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6
[sfrench/cifs-2.6.git] / drivers / media / video / cx88 / cx88-cards.c
1 /*
2  *
3  * device driver for Conexant 2388x based TV cards
4  * card-specific stuff.
5  *
6  * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 #include <linux/init.h>
24 #include <linux/module.h>
25 #include <linux/pci.h>
26 #include <linux/delay.h>
27
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_GENIATECH_DVBS] = {
1287                 .name          = "Geniatech DVB-S",
1288                 .tuner_type    = TUNER_ABSENT,
1289                 .radio_type    = UNSET,
1290                 .tuner_addr    = ADDR_UNSET,
1291                 .radio_addr    = ADDR_UNSET,
1292                 .input  = {{
1293                         .type  = CX88_VMUX_DVB,
1294                         .vmux  = 0,
1295                 },{
1296                         .type  = CX88_VMUX_COMPOSITE1,
1297                         .vmux  = 1,
1298                 }},
1299                 .mpeg           = CX88_MPEG_DVB,
1300         },
1301         [CX88_BOARD_HAUPPAUGE_HVR3000] = {
1302                 .name           = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T",
1303                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1304                 .radio_type     = UNSET,
1305                 .tuner_addr     = ADDR_UNSET,
1306                 .radio_addr     = ADDR_UNSET,
1307                 .tda9887_conf   = TDA9887_PRESENT,
1308                 .audio_chip     = V4L2_IDENT_WM8775,
1309                 .input          = {{
1310                         .type   = CX88_VMUX_TELEVISION,
1311                         .vmux   = 0,
1312                         .gpio0  = 0x84bf,
1313                         /* 1: TV Audio / FM Mono */
1314                         .audioroute = 1,
1315                 },{
1316                         .type   = CX88_VMUX_COMPOSITE1,
1317                         .vmux   = 1,
1318                         .gpio0  = 0x84bf,
1319                         /* 2: Line-In */
1320                         .audioroute = 2,
1321                 },{
1322                         .type   = CX88_VMUX_SVIDEO,
1323                         .vmux   = 2,
1324                         .gpio0  = 0x84bf,
1325                         /* 2: Line-In */
1326                         .audioroute = 2,
1327                 }},
1328                 .radio = {
1329                         .type   = CX88_RADIO,
1330                         .gpio0  = 0x84bf,
1331                         /* 4: FM Stereo (untested) */
1332                         .audioroute = 8,
1333                 },
1334                 .mpeg           = CX88_MPEG_DVB,
1335                 .num_frontends  = 2,
1336         },
1337         [CX88_BOARD_NORWOOD_MICRO] = {
1338                 .name           = "Norwood Micro TV Tuner",
1339                 .tuner_type     = TUNER_TNF_5335MF,
1340                 .radio_type     = UNSET,
1341                 .tuner_addr     = ADDR_UNSET,
1342                 .radio_addr     = ADDR_UNSET,
1343                 .input          = {{
1344                         .type   = CX88_VMUX_TELEVISION,
1345                         .vmux   = 0,
1346                         .gpio0  = 0x0709,
1347                 },{
1348                         .type   = CX88_VMUX_COMPOSITE1,
1349                         .vmux   = 1,
1350                         .gpio0  = 0x070b,
1351                 },{
1352                         .type   = CX88_VMUX_SVIDEO,
1353                         .vmux   = 2,
1354                         .gpio0  = 0x070b,
1355                 }},
1356         },
1357         [CX88_BOARD_TE_DTV_250_OEM_SWANN] = {
1358                 .name           = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM",
1359                 .tuner_type     = TUNER_LG_PAL_NEW_TAPC,
1360                 .radio_type     = UNSET,
1361                 .tuner_addr     = ADDR_UNSET,
1362                 .radio_addr     = ADDR_UNSET,
1363                 .input          = {{
1364                         .type   = CX88_VMUX_TELEVISION,
1365                         .vmux   = 0,
1366                         .gpio0  = 0x003fffff,
1367                         .gpio1  = 0x00e00000,
1368                         .gpio2  = 0x003fffff,
1369                         .gpio3  = 0x02000000,
1370                 },{
1371                         .type   = CX88_VMUX_COMPOSITE1,
1372                         .vmux   = 1,
1373                         .gpio0  = 0x003fffff,
1374                         .gpio1  = 0x00e00000,
1375                         .gpio2  = 0x003fffff,
1376                         .gpio3  = 0x02000000,
1377                 },{
1378                         .type   = CX88_VMUX_SVIDEO,
1379                         .vmux   = 2,
1380                         .gpio0  = 0x003fffff,
1381                         .gpio1  = 0x00e00000,
1382                         .gpio2  = 0x003fffff,
1383                         .gpio3  = 0x02000000,
1384                 }},
1385         },
1386         [CX88_BOARD_HAUPPAUGE_HVR1300] = {
1387                 .name           = "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder",
1388                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1389                 .radio_type     = UNSET,
1390                 .tuner_addr     = ADDR_UNSET,
1391                 .radio_addr     = ADDR_UNSET,
1392                 .tda9887_conf   = TDA9887_PRESENT,
1393                 .audio_chip     = V4L2_IDENT_WM8775,
1394                 /*
1395                  * gpio0 as reported by Mike Crash <mike AT mikecrash.com>
1396                  */
1397                 .input          = {{
1398                         .type   = CX88_VMUX_TELEVISION,
1399                         .vmux   = 0,
1400                         .gpio0  = 0xef88,
1401                         /* 1: TV Audio / FM Mono */
1402                         .audioroute = 1,
1403                 },{
1404                         .type   = CX88_VMUX_COMPOSITE1,
1405                         .vmux   = 1,
1406                         .gpio0  = 0xef88,
1407                         /* 2: Line-In */
1408                         .audioroute = 2,
1409                 },{
1410                         .type   = CX88_VMUX_SVIDEO,
1411                         .vmux   = 2,
1412                         .gpio0  = 0xef88,
1413                         /* 2: Line-In */
1414                         .audioroute = 2,
1415                 }},
1416                 .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
1417                 .radio = {
1418                         .type   = CX88_RADIO,
1419                         .gpio0  = 0xef88,
1420                         /* 4: FM Stereo (untested) */
1421                         .audioroute = 8,
1422                 },
1423         },
1424         [CX88_BOARD_ADSTECH_PTV_390] = {
1425                 .name           = "ADS Tech Instant Video PCI",
1426                 .tuner_type     = TUNER_ABSENT,
1427                 .radio_type     = UNSET,
1428                 .tuner_addr     = ADDR_UNSET,
1429                 .radio_addr     = ADDR_UNSET,
1430                 .input          = {{
1431                         .type   = CX88_VMUX_DEBUG,
1432                         .vmux   = 3,
1433                         .gpio0  = 0x04ff,
1434                 },{
1435                         .type   = CX88_VMUX_COMPOSITE1,
1436                         .vmux   = 1,
1437                         .gpio0  = 0x07fa,
1438                 },{
1439                         .type   = CX88_VMUX_SVIDEO,
1440                         .vmux   = 2,
1441                         .gpio0  = 0x07fa,
1442                 }},
1443         },
1444         [CX88_BOARD_PINNACLE_PCTV_HD_800i] = {
1445                 .name           = "Pinnacle PCTV HD 800i",
1446                 .tuner_type     = TUNER_XC5000,
1447                 .radio_type     = UNSET,
1448                 .tuner_addr     = ADDR_UNSET,
1449                 .radio_addr     = ADDR_UNSET,
1450                 .input          = {{
1451                         .type   = CX88_VMUX_TELEVISION,
1452                         .vmux   = 0,
1453                         .gpio0  = 0x04fb,
1454                         .gpio1  = 0x10ff,
1455                 },{
1456                         .type   = CX88_VMUX_COMPOSITE1,
1457                         .vmux   = 1,
1458                         .gpio0  = 0x04fb,
1459                         .gpio1  = 0x10ef,
1460                         .audioroute = 1,
1461                 },{
1462                         .type   = CX88_VMUX_SVIDEO,
1463                         .vmux   = 2,
1464                         .gpio0  = 0x04fb,
1465                         .gpio1  = 0x10ef,
1466                         .audioroute = 1,
1467                 }},
1468                 .mpeg           = CX88_MPEG_DVB,
1469         },
1470         [CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO] = {
1471                 .name           = "DViCO FusionHDTV 5 PCI nano",
1472                 /* xc3008 tuner, digital only for now */
1473                 .tuner_type     = TUNER_ABSENT,
1474                 .radio_type     = UNSET,
1475                 .tuner_addr     = ADDR_UNSET,
1476                 .radio_addr     = ADDR_UNSET,
1477                 .input          = {{
1478                         .type   = CX88_VMUX_TELEVISION,
1479                         .vmux   = 0,
1480                         .gpio0  = 0x000027df, /* Unconfirmed */
1481                 }, {
1482                         .type   = CX88_VMUX_COMPOSITE1,
1483                         .vmux   = 1,
1484                         .gpio0  = 0x000027df, /* Unconfirmed */
1485                         .audioroute = 1,
1486                 }, {
1487                         .type   = CX88_VMUX_SVIDEO,
1488                         .vmux   = 2,
1489                         .gpio0  = 0x000027df, /* Unconfirmed */
1490                         .audioroute = 1,
1491                 } },
1492                 .mpeg           = CX88_MPEG_DVB,
1493         },
1494         [CX88_BOARD_PINNACLE_HYBRID_PCTV] = {
1495                 .name           = "Pinnacle Hybrid PCTV",
1496                 .tuner_type     = TUNER_XC2028,
1497                 .tuner_addr     = 0x61,
1498                 .radio_type     = TUNER_XC2028,
1499                 .radio_addr     = 0x61,
1500                 .input          = { {
1501                         .type   = CX88_VMUX_TELEVISION,
1502                         .vmux   = 0,
1503                         .gpio0  = 0x004ff,
1504                         .gpio1  = 0x010ff,
1505                         .gpio2  = 0x00001,
1506                 }, {
1507                         .type   = CX88_VMUX_COMPOSITE1,
1508                         .vmux   = 1,
1509                         .gpio0  = 0x004fb,
1510                         .gpio1  = 0x010ef,
1511                         .audioroute = 1,
1512                 }, {
1513                         .type   = CX88_VMUX_SVIDEO,
1514                         .vmux   = 2,
1515                         .gpio0  = 0x004fb,
1516                         .gpio1  = 0x010ef,
1517                         .audioroute = 1,
1518                 } },
1519                 .radio = {
1520                         .type   = CX88_RADIO,
1521                         .gpio0  = 0x004ff,
1522                         .gpio1  = 0x010ff,
1523                         .gpio2  = 0x0ff,
1524                 },
1525                 .mpeg           = CX88_MPEG_DVB,
1526         },
1527         [CX88_BOARD_WINFAST_TV2000_XP_GLOBAL] = {
1528                 .name           = "Winfast TV2000 XP Global",
1529                 .tuner_type     = TUNER_XC2028,
1530                 .tuner_addr     = 0x61,
1531                 .input          = { {
1532                         .type   = CX88_VMUX_TELEVISION,
1533                         .vmux   = 0,
1534                         .gpio0  = 0x0400, /* pin 2:mute = 0 (off?) */
1535                         .gpio1  = 0x0000,
1536                         .gpio2  = 0x0800, /* pin 19:audio = 0 (tv) */
1537
1538                 }, {
1539                         .type   = CX88_VMUX_COMPOSITE1,
1540                         .vmux   = 1,
1541                         .gpio0  = 0x0400, /* probably?  or 0x0404 to turn mute on */
1542                         .gpio1  = 0x0000,
1543                         .gpio2  = 0x0808, /* pin 19:audio = 1 (line) */
1544
1545                 }, {
1546                         .type   = CX88_VMUX_SVIDEO,
1547                         .vmux   = 2,
1548                 } },
1549                 .radio = {
1550                         .type   = CX88_RADIO,
1551                         .gpio0  = 0x004ff,
1552                         .gpio1  = 0x010ff,
1553                         .gpio2  = 0x0ff,
1554                 },
1555         },
1556         [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
1557                 .name           = "PowerColor RA330",   /* Long names may confuse LIRC. */
1558                 .tuner_type     = TUNER_XC2028,
1559                 .tuner_addr     = 0x61,
1560                 .input          = { {
1561                         .type   = CX88_VMUX_DEBUG,
1562                         .vmux   = 3,            /* Due to the way the cx88 driver is written,   */
1563                         .gpio0 = 0x00ff,        /* there is no way to deactivate audio pass-    */
1564                         .gpio1 = 0xf39d,        /* through without this entry. Furthermore, if  */
1565                         .gpio3 = 0x0000,        /* the TV mux entry is first, you get audio     */
1566                 }, {                            /* from the tuner on boot for a little while.   */
1567                         .type   = CX88_VMUX_TELEVISION,
1568                         .vmux   = 0,
1569                         .gpio0 = 0x00ff,
1570                         .gpio1 = 0xf35d,
1571                         .gpio3 = 0x0000,
1572                 }, {
1573                         .type   = CX88_VMUX_COMPOSITE1,
1574                         .vmux   = 1,
1575                         .gpio0 = 0x00ff,
1576                         .gpio1 = 0xf37d,
1577                         .gpio3 = 0x0000,
1578                 }, {
1579                         .type   = CX88_VMUX_SVIDEO,
1580                         .vmux   = 2,
1581                         .gpio0  = 0x000ff,
1582                         .gpio1  = 0x0f37d,
1583                         .gpio3  = 0x00000,
1584                 } },
1585                 .radio = {
1586                         .type   = CX88_RADIO,
1587                         .gpio0  = 0x000ff,
1588                         .gpio1  = 0x0f35d,
1589                         .gpio3  = 0x00000,
1590                 },
1591         },
1592         [CX88_BOARD_GENIATECH_X8000_MT] = {
1593                 /* Also PowerColor Real Angel 330 and Geniatech X800 OEM */
1594                 .name           = "Geniatech X8000-MT DVBT",
1595                 .tuner_type     = TUNER_XC2028,
1596                 .tuner_addr     = 0x61,
1597                 .input          = { {
1598                         .type   = CX88_VMUX_TELEVISION,
1599                         .vmux   = 0,
1600                         .gpio0  = 0x00000000,
1601                         .gpio1  = 0x00e3e341,
1602                         .gpio2  = 0x00000000,
1603                         .gpio3  = 0x00000000,
1604                 }, {
1605                         .type   = CX88_VMUX_COMPOSITE1,
1606                         .vmux   = 1,
1607                         .gpio0  = 0x00000000,
1608                         .gpio1  = 0x00e3e361,
1609                         .gpio2  = 0x00000000,
1610                         .gpio3  = 0x00000000,
1611                 }, {
1612                         .type   = CX88_VMUX_SVIDEO,
1613                         .vmux   = 2,
1614                         .gpio0  = 0x00000000,
1615                         .gpio1  = 0x00e3e361,
1616                         .gpio2  = 0x00000000,
1617                         .gpio3  = 0x00000000,
1618                 } },
1619                 .radio = {
1620                         .type   = CX88_RADIO,
1621                         .gpio0  = 0x00000000,
1622                         .gpio1  = 0x00e3e341,
1623                         .gpio2  = 0x00000000,
1624                         .gpio3  = 0x00000000,
1625                 },
1626                 .mpeg           = CX88_MPEG_DVB,
1627         },
1628         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO] = {
1629                 .name           = "DViCO FusionHDTV DVB-T PRO",
1630                 .tuner_type     = TUNER_XC2028,
1631                 .tuner_addr     = 0x61,
1632                 .radio_type     = UNSET,
1633                 .radio_addr     = ADDR_UNSET,
1634                 .input          = { {
1635                         .type   = CX88_VMUX_COMPOSITE1,
1636                         .vmux   = 1,
1637                         .gpio0  = 0x000067df,
1638                 }, {
1639                         .type   = CX88_VMUX_SVIDEO,
1640                         .vmux   = 2,
1641                         .gpio0  = 0x000067df,
1642                 } },
1643                 .mpeg           = CX88_MPEG_DVB,
1644         },
1645         [CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD] = {
1646                 .name           = "DViCO FusionHDTV 7 Gold",
1647                 .tuner_type     = TUNER_XC5000,
1648                 .radio_type     = UNSET,
1649                 .tuner_addr     = ADDR_UNSET,
1650                 .radio_addr     = ADDR_UNSET,
1651                 .input          = {{
1652                         .type   = CX88_VMUX_TELEVISION,
1653                         .vmux   = 0,
1654                         .gpio0  = 0x10df,
1655                 },{
1656                         .type   = CX88_VMUX_COMPOSITE1,
1657                         .vmux   = 1,
1658                         .gpio0  = 0x16d9,
1659                 },{
1660                         .type   = CX88_VMUX_SVIDEO,
1661                         .vmux   = 2,
1662                         .gpio0  = 0x16d9,
1663                 }},
1664                 .mpeg           = CX88_MPEG_DVB,
1665         },
1666         [CX88_BOARD_PROLINK_PV_8000GT] = {
1667                 .name           = "Prolink Pixelview MPEG 8000GT",
1668                 .tuner_type     = TUNER_XC2028,
1669                 .tuner_addr     = 0x61,
1670                 .input          = { {
1671                         .type   = CX88_VMUX_TELEVISION,
1672                         .vmux   = 0,
1673                         .gpio0 = 0x0ff,
1674                         .gpio2 = 0x0cfb,
1675                 }, {
1676                         .type   = CX88_VMUX_COMPOSITE1,
1677                         .vmux   = 1,
1678                         .gpio2 = 0x0cfb,
1679                 }, {
1680                         .type   = CX88_VMUX_SVIDEO,
1681                         .vmux   = 2,
1682                         .gpio2 = 0x0cfb,
1683                 } },
1684                 .radio = {
1685                         .type   = CX88_RADIO,
1686                         .gpio2 = 0x0cfb,
1687                 },
1688         },
1689         [CX88_BOARD_PROLINK_PV_GLOBAL_XTREME] = {
1690                 .name           = "Prolink Pixelview Global Extreme",
1691                 .tuner_type     = TUNER_XC2028,
1692                 .tuner_addr     = 0x61,
1693                 .input          = { {
1694                         .type   = CX88_VMUX_TELEVISION,
1695                         .vmux   = 0,
1696                         .gpio0 = 0x04fb,
1697                         .gpio1 = 0x04080,
1698                         .gpio2 = 0x0cf7,
1699                 }, {
1700                         .type   = CX88_VMUX_COMPOSITE1,
1701                         .vmux   = 1,
1702                         .gpio0 = 0x04fb,
1703                         .gpio1 = 0x04080,
1704                         .gpio2 = 0x0cfb,
1705                 }, {
1706                         .type   = CX88_VMUX_SVIDEO,
1707                         .vmux   = 2,
1708                         .gpio0 = 0x04fb,
1709                         .gpio1 = 0x04080,
1710                         .gpio2 = 0x0cfb,
1711                 } },
1712                 .radio = {
1713                         .type   = CX88_RADIO,
1714                         .gpio0 = 0x04ff,
1715                         .gpio1 = 0x04080,
1716                         .gpio2 = 0x0cf7,
1717                 },
1718         },
1719         /* Both radio, analog and ATSC work with this board.
1720            However, for analog to work, s5h1409 gate should be open,
1721            otherwise, tuner-xc3028 won't be detected.
1722            A proper fix require using the newer i2c methods to add
1723            tuner-xc3028 without doing an i2c probe.
1724          */
1725         [CX88_BOARD_KWORLD_ATSC_120] = {
1726                 .name           = "Kworld PlusTV HD PCI 120 (ATSC 120)",
1727                 .tuner_type     = TUNER_XC2028,
1728                 .radio_type     = UNSET,
1729                 .tuner_addr     = ADDR_UNSET,
1730                 .radio_addr     = ADDR_UNSET,
1731                 .input          = { {
1732                         .type   = CX88_VMUX_TELEVISION,
1733                         .vmux   = 0,
1734                         .gpio0  = 0x000000ff,
1735                         .gpio1  = 0x0000f35d,
1736                         .gpio2  = 0x00000000,
1737                 }, {
1738                         .type   = CX88_VMUX_COMPOSITE1,
1739                         .vmux   = 1,
1740                         .gpio0  = 0x000000ff,
1741                         .gpio1  = 0x0000f37e,
1742                         .gpio2  = 0x00000000,
1743                 }, {
1744                         .type   = CX88_VMUX_SVIDEO,
1745                         .vmux   = 2,
1746                         .gpio0  = 0x000000ff,
1747                         .gpio1  = 0x0000f37e,
1748                         .gpio2  = 0x00000000,
1749                 } },
1750                 .radio = {
1751                         .type   = CX88_RADIO,
1752                         .gpio0  = 0x000000ff,
1753                         .gpio1  = 0x0000f35d,
1754                         .gpio2  = 0x00000000,
1755                 },
1756                 .mpeg           = CX88_MPEG_DVB,
1757         },
1758         [CX88_BOARD_HAUPPAUGE_HVR4000] = {
1759                 .name           = "Hauppauge WinTV-HVR4000 DVB-S/S2/T/Hybrid",
1760                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1761                 .radio_type     = UNSET,
1762                 .tuner_addr     = ADDR_UNSET,
1763                 .radio_addr     = ADDR_UNSET,
1764                 .tda9887_conf   = TDA9887_PRESENT,
1765                 .audio_chip     = V4L2_IDENT_WM8775,
1766                 /*
1767                  * GPIO0 (WINTV2000)
1768                  *
1769                  * Analogue     SAT     DVB-T
1770                  * Antenna      0xc4bf  0xc4bb
1771                  * Composite    0xc4bf  0xc4bb
1772                  * S-Video      0xc4bf  0xc4bb
1773                  * Composite1   0xc4ff  0xc4fb
1774                  * S-Video1     0xc4ff  0xc4fb
1775                  *
1776                  * BIT  VALUE   FUNCTION GP{x}_IO
1777                  * 0    1       I:?
1778                  * 1    1       I:?
1779                  * 2    1       O:MPEG PORT 0=DVB-T 1=DVB-S
1780                  * 3    1       I:?
1781                  * 4    1       I:?
1782                  * 5    1       I:?
1783                  * 6    0       O:INPUT SELECTOR 0=INTERNAL 1=EXPANSION
1784                  * 7    1       O:DVB-T DEMOD RESET LOW
1785                  *
1786                  * BIT  VALUE   FUNCTION GP{x}_OE
1787                  * 8    0       I
1788                  * 9    0       I
1789                  * a    1       O
1790                  * b    0       I
1791                  * c    0       I
1792                  * d    0       I
1793                  * e    1       O
1794                  * f    1       O
1795                  *
1796                  * WM8775 ADC
1797                  *
1798                  * 1: TV Audio / FM Mono
1799                  * 2: Line-In
1800                  * 3: Line-In Expansion
1801                  * 4: FM Stereo
1802                  */
1803                 .input          = {{
1804                         .type   = CX88_VMUX_TELEVISION,
1805                         .vmux   = 0,
1806                         .gpio0  = 0xc4bf,
1807                         /* 1: TV Audio / FM Mono */
1808                         .audioroute = 1,
1809                 }, {
1810                         .type   = CX88_VMUX_COMPOSITE1,
1811                         .vmux   = 1,
1812                         .gpio0  = 0xc4bf,
1813                         /* 2: Line-In */
1814                         .audioroute = 2,
1815                 }, {
1816                         .type   = CX88_VMUX_SVIDEO,
1817                         .vmux   = 2,
1818                         .gpio0  = 0xc4bf,
1819                         /* 2: Line-In */
1820                         .audioroute = 2,
1821                 } },
1822                 .radio = {
1823                         .type   = CX88_RADIO,
1824                         .gpio0  = 0xc4bf,
1825                         /* 4: FM Stereo */
1826                         .audioroute = 8,
1827                 },
1828                 .mpeg           = CX88_MPEG_DVB,
1829                 .num_frontends  = 2,
1830         },
1831         [CX88_BOARD_HAUPPAUGE_HVR4000LITE] = {
1832                 .name           = "Hauppauge WinTV-HVR4000(Lite) DVB-S/S2",
1833                 .tuner_type     = UNSET,
1834                 .radio_type     = UNSET,
1835                 .tuner_addr     = ADDR_UNSET,
1836                 .radio_addr     = ADDR_UNSET,
1837                 .input          = {{
1838                         .type   = CX88_VMUX_DVB,
1839                         .vmux   = 0,
1840                 } },
1841                 .mpeg           = CX88_MPEG_DVB,
1842         },
1843         [CX88_BOARD_TEVII_S420] = {
1844                 .name           = "TeVii S420 DVB-S",
1845                 .tuner_type     = UNSET,
1846                 .radio_type     = UNSET,
1847                 .tuner_addr     = ADDR_UNSET,
1848                 .radio_addr     = ADDR_UNSET,
1849                 .input          = {{
1850                         .type   = CX88_VMUX_DVB,
1851                         .vmux   = 0,
1852                 } },
1853                 .mpeg           = CX88_MPEG_DVB,
1854         },
1855         [CX88_BOARD_TEVII_S460] = {
1856                 .name           = "TeVii S460 DVB-S/S2",
1857                 .tuner_type     = UNSET,
1858                 .radio_type     = UNSET,
1859                 .tuner_addr     = ADDR_UNSET,
1860                 .radio_addr     = ADDR_UNSET,
1861                 .input          = {{
1862                         .type   = CX88_VMUX_DVB,
1863                         .vmux   = 0,
1864                 } },
1865                 .mpeg           = CX88_MPEG_DVB,
1866         },
1867         [CX88_BOARD_OMICOM_SS4_PCI] = {
1868                 .name           = "Omicom SS4 DVB-S/S2 PCI",
1869                 .tuner_type     = UNSET,
1870                 .radio_type     = UNSET,
1871                 .tuner_addr     = ADDR_UNSET,
1872                 .radio_addr     = ADDR_UNSET,
1873                 .input          = {{
1874                         .type   = CX88_VMUX_DVB,
1875                         .vmux   = 0,
1876                 } },
1877                 .mpeg           = CX88_MPEG_DVB,
1878         },
1879         [CX88_BOARD_TBS_8910] = {
1880                 .name           = "TBS 8910 DVB-S",
1881                 .tuner_type     = UNSET,
1882                 .radio_type     = UNSET,
1883                 .tuner_addr     = ADDR_UNSET,
1884                 .radio_addr     = ADDR_UNSET,
1885                 .input          = {{
1886                         .type   = CX88_VMUX_DVB,
1887                         .vmux   = 0,
1888                 } },
1889                 .mpeg           = CX88_MPEG_DVB,
1890         },
1891         [CX88_BOARD_TBS_8920] = {
1892                 .name           = "TBS 8920 DVB-S/S2",
1893                 .tuner_type     = TUNER_ABSENT,
1894                 .radio_type     = UNSET,
1895                 .tuner_addr     = ADDR_UNSET,
1896                 .radio_addr     = ADDR_UNSET,
1897                 .input          = {{
1898                         .type   = CX88_VMUX_DVB,
1899                         .vmux   = 1,
1900                 } },
1901                 .mpeg           = CX88_MPEG_DVB,
1902         },
1903         [CX88_BOARD_PROF_6200] = {
1904                 .name           = "Prof 6200 DVB-S",
1905                 .tuner_type     = UNSET,
1906                 .radio_type     = UNSET,
1907                 .tuner_addr     = ADDR_UNSET,
1908                 .radio_addr     = ADDR_UNSET,
1909                 .input          = {{
1910                         .type   = CX88_VMUX_DVB,
1911                         .vmux   = 0,
1912                 } },
1913                 .mpeg           = CX88_MPEG_DVB,
1914         },
1915         [CX88_BOARD_PROF_7300] = {
1916                 .name           = "PROF 7300 DVB-S/S2",
1917                 .tuner_type     = UNSET,
1918                 .radio_type     = UNSET,
1919                 .tuner_addr     = ADDR_UNSET,
1920                 .radio_addr     = ADDR_UNSET,
1921                 .input          = {{
1922                         .type   = CX88_VMUX_DVB,
1923                         .vmux   = 0,
1924                 } },
1925                 .mpeg           = CX88_MPEG_DVB,
1926         },
1927         [CX88_BOARD_SATTRADE_ST4200] = {
1928                 .name           = "SATTRADE ST4200 DVB-S/S2",
1929                 .tuner_type     = UNSET,
1930                 .radio_type     = UNSET,
1931                 .tuner_addr     = ADDR_UNSET,
1932                 .radio_addr     = ADDR_UNSET,
1933                 .input          = {{
1934                         .type   = CX88_VMUX_DVB,
1935                         .vmux   = 0,
1936                 } },
1937                 .mpeg           = CX88_MPEG_DVB,
1938         },
1939         [CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII] = {
1940                 .name           = "Terratec Cinergy HT PCI MKII",
1941                 .tuner_type     = TUNER_XC2028,
1942                 .tuner_addr     = 0x61,
1943                 .radio_type     = TUNER_XC2028,
1944                 .radio_addr     = 0x61,
1945                 .input          = { {
1946                         .type   = CX88_VMUX_TELEVISION,
1947                         .vmux   = 0,
1948                         .gpio0  = 0x004ff,
1949                         .gpio1  = 0x010ff,
1950                         .gpio2  = 0x00001,
1951                 }, {
1952                         .type   = CX88_VMUX_COMPOSITE1,
1953                         .vmux   = 1,
1954                         .gpio0  = 0x004fb,
1955                         .gpio1  = 0x010ef,
1956                         .audioroute = 1,
1957                 }, {
1958                         .type   = CX88_VMUX_SVIDEO,
1959                         .vmux   = 2,
1960                         .gpio0  = 0x004fb,
1961                         .gpio1  = 0x010ef,
1962                         .audioroute = 1,
1963                 } },
1964                 .radio = {
1965                         .type   = CX88_RADIO,
1966                         .gpio0  = 0x004ff,
1967                         .gpio1  = 0x010ff,
1968                         .gpio2  = 0x0ff,
1969                 },
1970                 .mpeg           = CX88_MPEG_DVB,
1971         },
1972 };
1973
1974 /* ------------------------------------------------------------------ */
1975 /* PCI subsystem IDs                                                  */
1976
1977 static const struct cx88_subid cx88_subids[] = {
1978         {
1979                 .subvendor = 0x0070,
1980                 .subdevice = 0x3400,
1981                 .card      = CX88_BOARD_HAUPPAUGE,
1982         },{
1983                 .subvendor = 0x0070,
1984                 .subdevice = 0x3401,
1985                 .card      = CX88_BOARD_HAUPPAUGE,
1986         },{
1987                 .subvendor = 0x14c7,
1988                 .subdevice = 0x0106,
1989                 .card      = CX88_BOARD_GDI,
1990         },{
1991                 .subvendor = 0x14c7,
1992                 .subdevice = 0x0107, /* with mpeg encoder */
1993                 .card      = CX88_BOARD_GDI,
1994         },{
1995                 .subvendor = PCI_VENDOR_ID_ATI,
1996                 .subdevice = 0x00f8,
1997                 .card      = CX88_BOARD_ATI_WONDER_PRO,
1998         }, {
1999                 .subvendor = PCI_VENDOR_ID_ATI,
2000                 .subdevice = 0x00f9,
2001                 .card      = CX88_BOARD_ATI_WONDER_PRO,
2002         }, {
2003                 .subvendor = 0x107d,
2004                 .subdevice = 0x6611,
2005                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
2006         },{
2007                 .subvendor = 0x107d,
2008                 .subdevice = 0x6613,    /* NTSC */
2009                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
2010         },{
2011                 .subvendor = 0x107d,
2012                 .subdevice = 0x6620,
2013                 .card      = CX88_BOARD_WINFAST_DV2000,
2014         },{
2015                 .subvendor = 0x107d,
2016                 .subdevice = 0x663b,
2017                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2018         },{
2019                 .subvendor = 0x107d,
2020                 .subdevice = 0x663c,
2021                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2022         },{
2023                 .subvendor = 0x1461,
2024                 .subdevice = 0x000b,
2025                 .card      = CX88_BOARD_AVERTV_STUDIO_303,
2026         },{
2027                 .subvendor = 0x1462,
2028                 .subdevice = 0x8606,
2029                 .card      = CX88_BOARD_MSI_TVANYWHERE_MASTER,
2030         },{
2031                 .subvendor = 0x10fc,
2032                 .subdevice = 0xd003,
2033                 .card      = CX88_BOARD_IODATA_GVVCP3PCI,
2034         },{
2035                 .subvendor = 0x1043,
2036                 .subdevice = 0x4823,  /* with mpeg encoder */
2037                 .card      = CX88_BOARD_ASUS_PVR_416,
2038         },{
2039                 .subvendor = 0x17de,
2040                 .subdevice = 0x08a6,
2041                 .card      = CX88_BOARD_KWORLD_DVB_T,
2042         },{
2043                 .subvendor = 0x18ac,
2044                 .subdevice = 0xd810,
2045                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
2046         },{
2047                 .subvendor = 0x18ac,
2048                 .subdevice = 0xd820,
2049                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T,
2050         },{
2051                 .subvendor = 0x18ac,
2052                 .subdevice = 0xdb00,
2053                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1,
2054         },{
2055                 .subvendor = 0x0070,
2056                 .subdevice = 0x9002,
2057                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2058         },{
2059                 .subvendor = 0x14f1,
2060                 .subdevice = 0x0187,
2061                 .card      = CX88_BOARD_CONEXANT_DVB_T1,
2062         },{
2063                 .subvendor = 0x1540,
2064                 .subdevice = 0x2580,
2065                 .card      = CX88_BOARD_PROVIDEO_PV259,
2066         },{
2067                 .subvendor = 0x18ac,
2068                 .subdevice = 0xdb10,
2069                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
2070         },{
2071                 .subvendor = 0x1554,
2072                 .subdevice = 0x4811,
2073                 .card      = CX88_BOARD_PIXELVIEW,
2074         },{
2075                 .subvendor = 0x7063,
2076                 .subdevice = 0x3000, /* HD-3000 card */
2077                 .card      = CX88_BOARD_PCHDTV_HD3000,
2078         },{
2079                 .subvendor = 0x17de,
2080                 .subdevice = 0xa8a6,
2081                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T,
2082         },{
2083                 .subvendor = 0x0070,
2084                 .subdevice = 0x2801,
2085                 .card      = CX88_BOARD_HAUPPAUGE_ROSLYN,
2086         },{
2087                 .subvendor = 0x14f1,
2088                 .subdevice = 0x0342,
2089                 .card      = CX88_BOARD_DIGITALLOGIC_MEC,
2090         },{
2091                 .subvendor = 0x10fc,
2092                 .subdevice = 0xd035,
2093                 .card      = CX88_BOARD_IODATA_GVBCTV7E,
2094         },{
2095                 .subvendor = 0x1421,
2096                 .subdevice = 0x0334,
2097                 .card      = CX88_BOARD_ADSTECH_DVB_T_PCI,
2098         },{
2099                 .subvendor = 0x153b,
2100                 .subdevice = 0x1166,
2101                 .card      = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1,
2102         },{
2103                 .subvendor = 0x18ac,
2104                 .subdevice = 0xd500,
2105                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD,
2106         },{
2107                 .subvendor = 0x1461,
2108                 .subdevice = 0x8011,
2109                 .card      = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550,
2110         },{
2111                 .subvendor = PCI_VENDOR_ID_ATI,
2112                 .subdevice = 0xa101,
2113                 .card      = CX88_BOARD_ATI_HDTVWONDER,
2114         },{
2115                 .subvendor = 0x107d,
2116                 .subdevice = 0x665f,
2117                 .card      = CX88_BOARD_WINFAST_DTV1000,
2118         },{
2119                 .subvendor = 0x1461,
2120                 .subdevice = 0x000a,
2121                 .card      = CX88_BOARD_AVERTV_303,
2122         },{
2123                 .subvendor = 0x0070,
2124                 .subdevice = 0x9200,
2125                 .card      = CX88_BOARD_HAUPPAUGE_NOVASE2_S1,
2126         },{
2127                 .subvendor = 0x0070,
2128                 .subdevice = 0x9201,
2129                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
2130         },{
2131                 .subvendor = 0x0070,
2132                 .subdevice = 0x9202,
2133                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
2134         },{
2135                 .subvendor = 0x17de,
2136                 .subdevice = 0x08b2,
2137                 .card      = CX88_BOARD_KWORLD_DVBS_100,
2138         },{
2139                 .subvendor = 0x0070,
2140                 .subdevice = 0x9400,
2141                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
2142         },{
2143                 .subvendor = 0x0070,
2144                 .subdevice = 0x9402,
2145                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
2146         },{
2147                 .subvendor = 0x0070,
2148                 .subdevice = 0x9800,
2149                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
2150         },{
2151                 .subvendor = 0x0070,
2152                 .subdevice = 0x9802,
2153                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
2154         },{
2155                 .subvendor = 0x0070,
2156                 .subdevice = 0x9001,
2157                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2158         },{
2159                 .subvendor = 0x1822,
2160                 .subdevice = 0x0025,
2161                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
2162         },{
2163                 .subvendor = 0x17de,
2164                 .subdevice = 0x08a1,
2165                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
2166         },{
2167                 .subvendor = 0x18ac,
2168                 .subdevice = 0xdb50,
2169                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
2170         },{
2171                 .subvendor = 0x18ac,
2172                 .subdevice = 0xdb54,
2173                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
2174                 /* Re-branded DViCO: DigitalNow DVB-T Dual */
2175         },{
2176                 .subvendor = 0x18ac,
2177                 .subdevice = 0xdb11,
2178                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
2179                 /* Re-branded DViCO: UltraView DVB-T Plus */
2180         }, {
2181                 .subvendor = 0x18ac,
2182                 .subdevice = 0xdb30,
2183                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO,
2184         }, {
2185                 .subvendor = 0x17de,
2186                 .subdevice = 0x0840,
2187                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
2188         },{
2189                 .subvendor = 0x1421,
2190                 .subdevice = 0x0305,
2191                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
2192         },{
2193                 .subvendor = 0x18ac,
2194                 .subdevice = 0xdb40,
2195                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
2196         },{
2197                 .subvendor = 0x18ac,
2198                 .subdevice = 0xdb44,
2199                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
2200         },{
2201                 .subvendor = 0x7063,
2202                 .subdevice = 0x5500,
2203                 .card      = CX88_BOARD_PCHDTV_HD5500,
2204         },{
2205                 .subvendor = 0x17de,
2206                 .subdevice = 0x0841,
2207                 .card      = CX88_BOARD_KWORLD_MCE200_DELUXE,
2208         },{
2209                 .subvendor = 0x1822,
2210                 .subdevice = 0x0019,
2211                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
2212         },{
2213                 .subvendor = 0x1554,
2214                 .subdevice = 0x4813,
2215                 .card      = CX88_BOARD_PIXELVIEW_PLAYTV_P7000,
2216         },{
2217                 .subvendor = 0x14f1,
2218                 .subdevice = 0x0842,
2219                 .card      = CX88_BOARD_NPGTECH_REALTV_TOP10FM,
2220         },{
2221                 .subvendor = 0x107d,
2222                 .subdevice = 0x665e,
2223                 .card      = CX88_BOARD_WINFAST_DTV2000H,
2224         },{
2225                 .subvendor = 0x18ac,
2226                 .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */
2227                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
2228         },{
2229                 .subvendor = 0x14f1,
2230                 .subdevice = 0x0084,
2231                 .card      = CX88_BOARD_GENIATECH_DVBS,
2232         },{
2233                 .subvendor = 0x0070,
2234                 .subdevice = 0x1404,
2235                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2236         },{
2237                 .subvendor = 0x1461,
2238                 .subdevice = 0xc111, /* AverMedia M150-D */
2239                 /* This board is known to work with the ASUS PVR416 config */
2240                 .card      = CX88_BOARD_ASUS_PVR_416,
2241         },{
2242                 .subvendor = 0xc180,
2243                 .subdevice = 0xc980,
2244                 .card      = CX88_BOARD_TE_DTV_250_OEM_SWANN,
2245         },{
2246                 .subvendor = 0x0070,
2247                 .subdevice = 0x9600,
2248                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2249         },{
2250                 .subvendor = 0x0070,
2251                 .subdevice = 0x9601,
2252                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2253         },{
2254                 .subvendor = 0x0070,
2255                 .subdevice = 0x9602,
2256                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
2257         },{
2258                 .subvendor = 0x107d,
2259                 .subdevice = 0x6632,
2260                 .card      = CX88_BOARD_LEADTEK_PVR2000,
2261         },{
2262                 .subvendor = 0x12ab,
2263                 .subdevice = 0x2300, /* Club3D Zap TV2100 */
2264                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
2265         },{
2266                 .subvendor = 0x0070,
2267                 .subdevice = 0x9000,
2268                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
2269         },{
2270                 .subvendor = 0x0070,
2271                 .subdevice = 0x1400,
2272                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2273         },{
2274                 .subvendor = 0x0070,
2275                 .subdevice = 0x1401,
2276                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2277         },{
2278                 .subvendor = 0x0070,
2279                 .subdevice = 0x1402,
2280                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
2281         },{
2282                 .subvendor = 0x1421,
2283                 .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */
2284                 .card      = CX88_BOARD_KWORLD_DVBS_100,
2285         },{
2286                 .subvendor = 0x1421,
2287                 .subdevice = 0x0390,
2288                 .card      = CX88_BOARD_ADSTECH_PTV_390,
2289         },{
2290                 .subvendor = 0x11bd,
2291                 .subdevice = 0x0051,
2292                 .card      = CX88_BOARD_PINNACLE_PCTV_HD_800i,
2293         }, {
2294                 .subvendor = 0x18ac,
2295                 .subdevice = 0xd530,
2296                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO,
2297         }, {
2298                 .subvendor = 0x12ab,
2299                 .subdevice = 0x1788,
2300                 .card      = CX88_BOARD_PINNACLE_HYBRID_PCTV,
2301         }, {
2302                 .subvendor = 0x14f1,
2303                 .subdevice = 0xea3d,
2304                 .card      = CX88_BOARD_POWERCOLOR_REAL_ANGEL,
2305         }, {
2306                 .subvendor = 0x107d,
2307                 .subdevice = 0x6f18,
2308                 .card      = CX88_BOARD_WINFAST_TV2000_XP_GLOBAL,
2309         }, {
2310                 .subvendor = 0x14f1,
2311                 .subdevice = 0x8852,
2312                 .card      = CX88_BOARD_GENIATECH_X8000_MT,
2313         }, {
2314                 .subvendor = 0x18ac,
2315                 .subdevice = 0xd610,
2316                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD,
2317         }, {
2318                 .subvendor = 0x1554,
2319                 .subdevice = 0x4935,
2320                 .card      = CX88_BOARD_PROLINK_PV_8000GT,
2321         }, {
2322                 .subvendor = 0x1554,
2323                 .subdevice = 0x4976,
2324                 .card      = CX88_BOARD_PROLINK_PV_GLOBAL_XTREME,
2325         }, {
2326                 .subvendor = 0x17de,
2327                 .subdevice = 0x08c1,
2328                 .card      = CX88_BOARD_KWORLD_ATSC_120,
2329         }, {
2330                 .subvendor = 0x0070,
2331                 .subdevice = 0x6900,
2332                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2333         }, {
2334                 .subvendor = 0x0070,
2335                 .subdevice = 0x6904,
2336                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2337         }, {
2338                 .subvendor = 0x0070,
2339                 .subdevice = 0x6902,
2340                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000,
2341         }, {
2342                 .subvendor = 0x0070,
2343                 .subdevice = 0x6905,
2344                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000LITE,
2345         }, {
2346                 .subvendor = 0x0070,
2347                 .subdevice = 0x6906,
2348                 .card      = CX88_BOARD_HAUPPAUGE_HVR4000LITE,
2349         }, {
2350                 .subvendor = 0xd420,
2351                 .subdevice = 0x9022,
2352                 .card      = CX88_BOARD_TEVII_S420,
2353         }, {
2354                 .subvendor = 0xd460,
2355                 .subdevice = 0x9022,
2356                 .card      = CX88_BOARD_TEVII_S460,
2357         }, {
2358                 .subvendor = 0xA044,
2359                 .subdevice = 0x2011,
2360                 .card      = CX88_BOARD_OMICOM_SS4_PCI,
2361         }, {
2362                 .subvendor = 0x8910,
2363                 .subdevice = 0x8888,
2364                 .card      = CX88_BOARD_TBS_8910,
2365         }, {
2366                 .subvendor = 0x8920,
2367                 .subdevice = 0x8888,
2368                 .card      = CX88_BOARD_TBS_8920,
2369         }, {
2370                 .subvendor = 0xb022,
2371                 .subdevice = 0x3022,
2372                 .card      = CX88_BOARD_PROF_6200,
2373         }, {
2374                 .subvendor = 0xB033,
2375                 .subdevice = 0x3033,
2376                 .card      = CX88_BOARD_PROF_7300,
2377         }, {
2378                 .subvendor = 0xb200,
2379                 .subdevice = 0x4200,
2380                 .card      = CX88_BOARD_SATTRADE_ST4200,
2381         }, {
2382                 .subvendor = 0x153b,
2383                 .subdevice = 0x1177,
2384                 .card      = CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII,
2385         },
2386 };
2387
2388 /* ----------------------------------------------------------------------- */
2389 /* some leadtek specific stuff                                             */
2390
2391 static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
2392 {
2393         /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
2394          * any others.
2395          *
2396          * Byte 0 is 1 on the NTSC board.
2397          */
2398
2399         if (eeprom_data[4] != 0x7d ||
2400             eeprom_data[5] != 0x10 ||
2401             eeprom_data[7] != 0x66) {
2402                 warn_printk(core, "Leadtek eeprom invalid.\n");
2403                 return;
2404         }
2405
2406         core->board.tuner_type = (eeprom_data[6] == 0x13) ?
2407                 TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3;
2408
2409         info_printk(core, "Leadtek Winfast 2000XP Expert config: "
2410                     "tuner=%d, eeprom[0]=0x%02x\n",
2411                     core->board.tuner_type, eeprom_data[0]);
2412 }
2413
2414 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
2415 {
2416         struct tveeprom tv;
2417
2418         tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data);
2419         core->board.tuner_type = tv.tuner_type;
2420         core->tuner_formats = tv.tuner_formats;
2421         core->board.radio.type = tv.has_radio ? CX88_RADIO : 0;
2422
2423         /* Make sure we support the board model */
2424         switch (tv.model)
2425         {
2426         case 14009: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in) */
2427         case 14019: /* WinTV-HVR3000 (Retail, IR Blaster, b/panel video, 3.5mm audio in) */
2428         case 14029: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge) */
2429         case 14109: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - low profile) */
2430         case 14129: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge - LP) */
2431         case 14559: /* WinTV-HVR3000 (OEM, no IR, b/panel video, 3.5mm audio in) */
2432         case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */
2433         case 14659: /* WinTV-HVR3000 (OEM, no IR, b/panel video, RCA audio in - Low profile) */
2434         case 14669: /* WinTV-HVR3000 (OEM, no IR, no b/panel video - Low profile) */
2435         case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
2436         case 34519: /* WinTV-PCI-FM */
2437         case 69009:
2438                 /* WinTV-HVR4000 (DVBS/S2/T, Video and IR, back panel inputs) */
2439         case 69100: /* WinTV-HVR4000LITE (DVBS/S2, IR) */
2440         case 69500: /* WinTV-HVR4000LITE (DVBS/S2, No IR) */
2441         case 69559:
2442                 /* WinTV-HVR4000 (DVBS/S2/T, Video no IR, back panel inputs) */
2443         case 69569: /* WinTV-HVR4000 (DVBS/S2/T, Video no IR) */
2444         case 90002: /* Nova-T-PCI (9002) */
2445         case 92001: /* Nova-S-Plus (Video and IR) */
2446         case 92002: /* Nova-S-Plus (Video and IR) */
2447         case 90003: /* Nova-T-PCI (9002 No RF out) */
2448         case 90500: /* Nova-T-PCI (oem) */
2449         case 90501: /* Nova-T-PCI (oem/IR) */
2450         case 92000: /* Nova-SE2 (OEM, No Video or IR) */
2451         case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
2452         case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
2453         case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */
2454         case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */
2455         case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */
2456         case 96569: /* WinTV-HVR1300 () */
2457         case 96659: /* WinTV-HVR1300 () */
2458         case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
2459                 /* known */
2460                 break;
2461         default:
2462                 warn_printk(core, "warning: unknown hauppauge model #%d\n",
2463                             tv.model);
2464                 break;
2465         }
2466
2467         info_printk(core, "hauppauge eeprom: model=%d\n", tv.model);
2468 }
2469
2470 /* ----------------------------------------------------------------------- */
2471 /* some GDI (was: Modular Technology) specific stuff                       */
2472
2473 static struct {
2474         int  id;
2475         int  fm;
2476         char *name;
2477 } gdi_tuner[] = {
2478         [ 0x01 ] = { .id   = TUNER_ABSENT,
2479                      .name = "NTSC_M" },
2480         [ 0x02 ] = { .id   = TUNER_ABSENT,
2481                      .name = "PAL_B" },
2482         [ 0x03 ] = { .id   = TUNER_ABSENT,
2483                      .name = "PAL_I" },
2484         [ 0x04 ] = { .id   = TUNER_ABSENT,
2485                      .name = "PAL_D" },
2486         [ 0x05 ] = { .id   = TUNER_ABSENT,
2487                      .name = "SECAM" },
2488
2489         [ 0x10 ] = { .id   = TUNER_ABSENT,
2490                      .fm   = 1,
2491                      .name = "TEMIC_4049" },
2492         [ 0x11 ] = { .id   = TUNER_TEMIC_4136FY5,
2493                      .name = "TEMIC_4136" },
2494         [ 0x12 ] = { .id   = TUNER_ABSENT,
2495                      .name = "TEMIC_4146" },
2496
2497         [ 0x20 ] = { .id   = TUNER_PHILIPS_FQ1216ME,
2498                      .fm   = 1,
2499                      .name = "PHILIPS_FQ1216_MK3" },
2500         [ 0x21 ] = { .id   = TUNER_ABSENT, .fm = 1,
2501                      .name = "PHILIPS_FQ1236_MK3" },
2502         [ 0x22 ] = { .id   = TUNER_ABSENT,
2503                      .name = "PHILIPS_FI1236_MK3" },
2504         [ 0x23 ] = { .id   = TUNER_ABSENT,
2505                      .name = "PHILIPS_FI1216_MK3" },
2506 };
2507
2508 static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
2509 {
2510         char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
2511                 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
2512
2513         info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
2514         if (NULL == name)
2515                 return;
2516         core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
2517         core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
2518                 CX88_RADIO : 0;
2519 }
2520
2521 /* ------------------------------------------------------------------- */
2522 /* some Divco specific stuff                                           */
2523 static int cx88_dvico_xc2028_callback(struct cx88_core *core,
2524                                       int command, int arg)
2525 {
2526         switch (command) {
2527         case XC2028_TUNER_RESET:
2528                 switch (core->boardnr) {
2529                 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2530                         /* GPIO-4 xc3028 tuner */
2531
2532                         cx_set(MO_GP0_IO, 0x00001000);
2533                         cx_clear(MO_GP0_IO, 0x00000010);
2534                         msleep(100);
2535                         cx_set(MO_GP0_IO, 0x00000010);
2536                         msleep(100);
2537                         break;
2538                 default:
2539                         cx_write(MO_GP0_IO, 0x101000);
2540                         mdelay(5);
2541                         cx_set(MO_GP0_IO, 0x101010);
2542                 }
2543                 break;
2544         default:
2545                 return -EINVAL;
2546         }
2547
2548         return 0;
2549 }
2550
2551
2552 /* ----------------------------------------------------------------------- */
2553 /* some Geniatech specific stuff                                           */
2554
2555 static int cx88_xc3028_geniatech_tuner_callback(struct cx88_core *core,
2556                                                 int command, int mode)
2557 {
2558         switch (command) {
2559         case XC2028_TUNER_RESET:
2560                 switch (INPUT(core->input).type) {
2561                 case CX88_RADIO:
2562                         break;
2563                 case CX88_VMUX_DVB:
2564                         cx_write(MO_GP1_IO, 0x030302);
2565                         mdelay(50);
2566                         break;
2567                 default:
2568                         cx_write(MO_GP1_IO, 0x030301);
2569                         mdelay(50);
2570                 }
2571                 cx_write(MO_GP1_IO, 0x101010);
2572                 mdelay(50);
2573                 cx_write(MO_GP1_IO, 0x101000);
2574                 mdelay(50);
2575                 cx_write(MO_GP1_IO, 0x101010);
2576                 mdelay(50);
2577                 return 0;
2578         }
2579         return -EINVAL;
2580 }
2581
2582 /* ------------------------------------------------------------------- */
2583 /* some Divco specific stuff                                           */
2584 static int cx88_pv_8000gt_callback(struct cx88_core *core,
2585                                    int command, int arg)
2586 {
2587         switch (command) {
2588         case XC2028_TUNER_RESET:
2589                 cx_write(MO_GP2_IO, 0xcf7);
2590                 mdelay(50);
2591                 cx_write(MO_GP2_IO, 0xef5);
2592                 mdelay(50);
2593                 cx_write(MO_GP2_IO, 0xcf7);
2594                 break;
2595         default:
2596                 return -EINVAL;
2597         }
2598
2599         return 0;
2600 }
2601
2602 /* ----------------------------------------------------------------------- */
2603 /* some DViCO specific stuff                                               */
2604
2605 static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
2606 {
2607         struct i2c_msg msg = { .addr = 0x45, .flags = 0 };
2608         int i, err;
2609         static u8 init_bufs[13][5] = {
2610                 { 0x10, 0x00, 0x20, 0x01, 0x03 },
2611                 { 0x10, 0x10, 0x01, 0x00, 0x21 },
2612                 { 0x10, 0x10, 0x10, 0x00, 0xCA },
2613                 { 0x10, 0x10, 0x12, 0x00, 0x08 },
2614                 { 0x10, 0x10, 0x13, 0x00, 0x0A },
2615                 { 0x10, 0x10, 0x16, 0x01, 0xC0 },
2616                 { 0x10, 0x10, 0x22, 0x01, 0x3D },
2617                 { 0x10, 0x10, 0x73, 0x01, 0x2E },
2618                 { 0x10, 0x10, 0x72, 0x00, 0xC5 },
2619                 { 0x10, 0x10, 0x71, 0x01, 0x97 },
2620                 { 0x10, 0x10, 0x70, 0x00, 0x0F },
2621                 { 0x10, 0x10, 0xB0, 0x00, 0x01 },
2622                 { 0x03, 0x0C },
2623         };
2624
2625         for (i = 0; i < ARRAY_SIZE(init_bufs); i++) {
2626                 msg.buf = init_bufs[i];
2627                 msg.len = (i != 12 ? 5 : 2);
2628                 err = i2c_transfer(&core->i2c_adap, &msg, 1);
2629                 if (err != 1) {
2630                         warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d "
2631                                           "failed (err = %d)!\n", i, err);
2632                         return;
2633                 }
2634         }
2635 }
2636
2637 static int cx88_xc2028_tuner_callback(struct cx88_core *core,
2638                                       int command, int arg)
2639 {
2640         /* Board-specific callbacks */
2641         switch (core->boardnr) {
2642         case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
2643         case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2644         case CX88_BOARD_GENIATECH_X8000_MT:
2645         case CX88_BOARD_KWORLD_ATSC_120:
2646                 return cx88_xc3028_geniatech_tuner_callback(core,
2647                                                         command, arg);
2648         case CX88_BOARD_PROLINK_PV_8000GT:
2649         case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
2650                 return cx88_pv_8000gt_callback(core, command, arg);
2651         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2652         case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2653                 return cx88_dvico_xc2028_callback(core, command, arg);
2654         }
2655
2656         switch (command) {
2657         case XC2028_TUNER_RESET:
2658                 switch (INPUT(core->input).type) {
2659                 case CX88_RADIO:
2660                         info_printk(core, "setting GPIO to radio!\n");
2661                         cx_write(MO_GP0_IO, 0x4ff);
2662                         mdelay(250);
2663                         cx_write(MO_GP2_IO, 0xff);
2664                         mdelay(250);
2665                         break;
2666                 case CX88_VMUX_DVB:     /* Digital TV*/
2667                 default:                /* Analog TV */
2668                         info_printk(core, "setting GPIO to TV!\n");
2669                         break;
2670                 }
2671                 cx_write(MO_GP1_IO, 0x101010);
2672                 mdelay(250);
2673                 cx_write(MO_GP1_IO, 0x101000);
2674                 mdelay(250);
2675                 cx_write(MO_GP1_IO, 0x101010);
2676                 mdelay(250);
2677                 return 0;
2678         }
2679         return -EINVAL;
2680 }
2681
2682 /* ----------------------------------------------------------------------- */
2683 /* Tuner callback function. Currently only needed for the Pinnacle         *
2684  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both       *
2685  * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c)    */
2686
2687 static int cx88_xc5000_tuner_callback(struct cx88_core *core,
2688                                       int command, int arg)
2689 {
2690         switch (core->boardnr) {
2691         case CX88_BOARD_PINNACLE_PCTV_HD_800i:
2692                 if (command == 0) { /* This is the reset command from xc5000 */
2693                         /* Reset XC5000 tuner via SYS_RSTO_pin */
2694                         cx_write(MO_SRST_IO, 0);
2695                         msleep(10);
2696                         cx_write(MO_SRST_IO, 1);
2697                         return 0;
2698                 } else {
2699                         err_printk(core, "xc5000: unknown tuner "
2700                                    "callback command.\n");
2701                         return -EINVAL;
2702                 }
2703                 break;
2704         case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
2705                 if (command == 0) { /* This is the reset command from xc5000 */
2706                         cx_clear(MO_GP0_IO, 0x00000010);
2707                         msleep(10);
2708                         cx_set(MO_GP0_IO, 0x00000010);
2709                         return 0;
2710                 } else {
2711                         printk(KERN_ERR
2712                                 "xc5000: unknown tuner callback command.\n");
2713                         return -EINVAL;
2714                 }
2715                 break;
2716         }
2717         return 0; /* Should never be here */
2718 }
2719
2720 int cx88_tuner_callback(void *priv, int component, int command, int arg)
2721 {
2722         struct i2c_algo_bit_data *i2c_algo = priv;
2723         struct cx88_core *core;
2724
2725         if (!i2c_algo) {
2726                 printk(KERN_ERR "cx88: Error - i2c private data undefined.\n");
2727                 return -EINVAL;
2728         }
2729
2730         core = i2c_algo->data;
2731
2732         if (!core) {
2733                 printk(KERN_ERR "cx88: Error - device struct undefined.\n");
2734                 return -EINVAL;
2735         }
2736
2737         if (component != DVB_FRONTEND_COMPONENT_TUNER)
2738                 return -EINVAL;
2739
2740         switch (core->board.tuner_type) {
2741                 case TUNER_XC2028:
2742                         info_printk(core, "Calling XC2028/3028 callback\n");
2743                         return cx88_xc2028_tuner_callback(core, command, arg);
2744                 case TUNER_XC5000:
2745                         info_printk(core, "Calling XC5000 callback\n");
2746                         return cx88_xc5000_tuner_callback(core, command, arg);
2747         }
2748         err_printk(core, "Error: Calling callback for tuner %d\n",
2749                    core->board.tuner_type);
2750         return -EINVAL;
2751 }
2752 EXPORT_SYMBOL(cx88_tuner_callback);
2753
2754 /* ----------------------------------------------------------------------- */
2755
2756 static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
2757 {
2758         int i;
2759
2760         if (0 == pci->subsystem_vendor &&
2761             0 == pci->subsystem_device) {
2762                 printk(KERN_ERR
2763                        "%s: Your board has no valid PCI Subsystem ID and thus can't\n"
2764                        "%s: be autodetected.  Please pass card=<n> insmod option to\n"
2765                        "%s: workaround that.  Redirect complaints to the vendor of\n"
2766                        "%s: the TV card.  Best regards,\n"
2767                        "%s:         -- tux\n",
2768                        core->name,core->name,core->name,core->name,core->name);
2769         } else {
2770                 printk(KERN_ERR
2771                        "%s: Your board isn't known (yet) to the driver.  You can\n"
2772                        "%s: try to pick one of the existing card configs via\n"
2773                        "%s: card=<n> insmod option.  Updating to the latest\n"
2774                        "%s: version might help as well.\n",
2775                        core->name,core->name,core->name,core->name);
2776         }
2777         err_printk(core, "Here is a list of valid choices for the card=<n> "
2778                    "insmod option:\n");
2779         for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
2780                 printk(KERN_ERR "%s:    card=%d -> %s\n",
2781                        core->name, i, cx88_boards[i].name);
2782 }
2783
2784 static void cx88_card_setup_pre_i2c(struct cx88_core *core)
2785 {
2786         switch (core->boardnr) {
2787         case CX88_BOARD_HAUPPAUGE_HVR1300:
2788                 /*
2789                  * Bring the 702 demod up before i2c scanning/attach or devices are hidden
2790                  * We leave here with the 702 on the bus
2791                  *
2792                  * "reset the IR receiver on GPIO[3]"
2793                  * Reported by Mike Crash <mike AT mikecrash.com>
2794                  */
2795                 cx_write(MO_GP0_IO, 0x0000ef88);
2796                 udelay(1000);
2797                 cx_clear(MO_GP0_IO, 0x00000088);
2798                 udelay(50);
2799                 cx_set(MO_GP0_IO, 0x00000088); /* 702 out of reset */
2800                 udelay(1000);
2801                 break;
2802
2803         case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
2804         case CX88_BOARD_PROLINK_PV_8000GT:
2805                 cx_write(MO_GP2_IO, 0xcf7);
2806                 mdelay(50);
2807                 cx_write(MO_GP2_IO, 0xef5);
2808                 mdelay(50);
2809                 cx_write(MO_GP2_IO, 0xcf7);
2810                 msleep(10);
2811                 break;
2812
2813         case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
2814                 /* Enable the xc5000 tuner */
2815                 cx_set(MO_GP0_IO, 0x00001010);
2816                 break;
2817
2818         case CX88_BOARD_HAUPPAUGE_HVR3000:
2819         case CX88_BOARD_HAUPPAUGE_HVR4000:
2820                 /* Init GPIO */
2821                 cx_write(MO_GP0_IO, core->board.input[0].gpio0);
2822                 udelay(1000);
2823                 cx_clear(MO_GP0_IO, 0x00000080);
2824                 udelay(50);
2825                 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
2826                 udelay(1000);
2827                 break;
2828         }
2829 }
2830
2831 /*
2832  * Sets board-dependent xc3028 configuration
2833  */
2834 void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl)
2835 {
2836         memset(ctl, 0, sizeof(*ctl));
2837
2838         ctl->fname   = XC2028_DEFAULT_FIRMWARE;
2839         ctl->max_len = 64;
2840
2841         switch (core->boardnr) {
2842         case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2843                 /* Now works with firmware version 2.7 */
2844                 if (core->i2c_algo.udelay < 16)
2845                         core->i2c_algo.udelay = 16;
2846                 break;
2847         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2848                 ctl->demod = XC3028_FE_ZARLINK456;
2849                 break;
2850         case CX88_BOARD_KWORLD_ATSC_120:
2851         case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2852                 ctl->demod = XC3028_FE_OREN538;
2853                 break;
2854         case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
2855         case CX88_BOARD_PROLINK_PV_8000GT:
2856                 /*
2857                  * Those boards uses non-MTS firmware
2858                  */
2859                 break;
2860         case CX88_BOARD_PINNACLE_HYBRID_PCTV:
2861         case CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII:
2862                 ctl->demod = XC3028_FE_ZARLINK456;
2863                 ctl->mts = 1;
2864                 break;
2865         default:
2866                 ctl->demod = XC3028_FE_OREN538;
2867                 ctl->mts = 1;
2868         }
2869 }
2870 EXPORT_SYMBOL_GPL(cx88_setup_xc3028);
2871
2872 static void cx88_card_setup(struct cx88_core *core)
2873 {
2874         static u8 eeprom[256];
2875         struct tuner_setup tun_setup;
2876         unsigned int mode_mask = T_RADIO     |
2877                                  T_ANALOG_TV |
2878                                  T_DIGITAL_TV;
2879
2880         memset(&tun_setup, 0, sizeof(tun_setup));
2881
2882         if (0 == core->i2c_rc) {
2883                 core->i2c_client.addr = 0xa0 >> 1;
2884                 tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom));
2885         }
2886
2887         switch (core->boardnr) {
2888         case CX88_BOARD_HAUPPAUGE:
2889         case CX88_BOARD_HAUPPAUGE_ROSLYN:
2890                 if (0 == core->i2c_rc)
2891                         hauppauge_eeprom(core, eeprom+8);
2892                 break;
2893         case CX88_BOARD_GDI:
2894                 if (0 == core->i2c_rc)
2895                         gdi_eeprom(core, eeprom);
2896                 break;
2897         case CX88_BOARD_WINFAST2000XP_EXPERT:
2898                 if (0 == core->i2c_rc)
2899                         leadtek_eeprom(core, eeprom);
2900                 break;
2901         case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
2902         case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
2903         case CX88_BOARD_HAUPPAUGE_DVB_T1:
2904         case CX88_BOARD_HAUPPAUGE_HVR1100:
2905         case CX88_BOARD_HAUPPAUGE_HVR1100LP:
2906         case CX88_BOARD_HAUPPAUGE_HVR3000:
2907         case CX88_BOARD_HAUPPAUGE_HVR1300:
2908         case CX88_BOARD_HAUPPAUGE_HVR4000:
2909         case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
2910                 if (0 == core->i2c_rc)
2911                         hauppauge_eeprom(core, eeprom);
2912                 break;
2913         case CX88_BOARD_KWORLD_DVBS_100:
2914                 cx_write(MO_GP0_IO, 0x000007f8);
2915                 cx_write(MO_GP1_IO, 0x00000001);
2916                 break;
2917         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2918                 /* GPIO0:0 is hooked to demod reset */
2919                 /* GPIO0:4 is hooked to xc3028 reset */
2920                 cx_write(MO_GP0_IO, 0x00111100);
2921                 msleep(1);
2922                 cx_write(MO_GP0_IO, 0x00111111);
2923                 break;
2924         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
2925                 /* GPIO0:6 is hooked to FX2 reset pin */
2926                 cx_set(MO_GP0_IO, 0x00004040);
2927                 cx_clear(MO_GP0_IO, 0x00000040);
2928                 msleep(1000);
2929                 cx_set(MO_GP0_IO, 0x00004040);
2930                 /* FALLTHROUGH */
2931         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
2932         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
2933         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
2934                 /* GPIO0:0 is hooked to mt352 reset pin */
2935                 cx_set(MO_GP0_IO, 0x00000101);
2936                 cx_clear(MO_GP0_IO, 0x00000001);
2937                 msleep(1);
2938                 cx_set(MO_GP0_IO, 0x00000101);
2939                 if (0 == core->i2c_rc &&
2940                     core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
2941                         dvico_fusionhdtv_hybrid_init(core);
2942                 break;
2943         case CX88_BOARD_KWORLD_DVB_T:
2944         case CX88_BOARD_DNTV_LIVE_DVB_T:
2945                 cx_set(MO_GP0_IO, 0x00000707);
2946                 cx_set(MO_GP2_IO, 0x00000101);
2947                 cx_clear(MO_GP2_IO, 0x00000001);
2948                 msleep(1);
2949                 cx_clear(MO_GP0_IO, 0x00000007);
2950                 cx_set(MO_GP2_IO, 0x00000101);
2951                 break;
2952         case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
2953                 cx_write(MO_GP0_IO, 0x00080808);
2954                 break;
2955         case CX88_BOARD_ATI_HDTVWONDER:
2956                 if (0 == core->i2c_rc) {
2957                         /* enable tuner */
2958                         int i;
2959                         static const u8 buffer [][2] = {
2960                                 {0x10,0x12},
2961                                 {0x13,0x04},
2962                                 {0x16,0x00},
2963                                 {0x14,0x04},
2964                                 {0x17,0x00}
2965                         };
2966                         core->i2c_client.addr = 0x0a;
2967
2968                         for (i = 0; i < ARRAY_SIZE(buffer); i++)
2969                                 if (2 != i2c_master_send(&core->i2c_client,
2970                                                         buffer[i],2))
2971                                         warn_printk(core, "Unable to enable "
2972                                                     "tuner(%i).\n", i);
2973                 }
2974                 break;
2975         case CX88_BOARD_MSI_TVANYWHERE_MASTER:
2976         {
2977                 struct v4l2_priv_tun_config tea5767_cfg;
2978                 struct tea5767_ctrl ctl;
2979
2980                 memset(&ctl, 0, sizeof(ctl));
2981
2982                 ctl.high_cut  = 1;
2983                 ctl.st_noise  = 1;
2984                 ctl.deemph_75 = 1;
2985                 ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
2986
2987                 tea5767_cfg.tuner = TUNER_TEA5767;
2988                 tea5767_cfg.priv  = &ctl;
2989
2990                 call_all(core, tuner, s_config, &tea5767_cfg);
2991                 break;
2992         }
2993         case  CX88_BOARD_TEVII_S420:
2994         case  CX88_BOARD_TEVII_S460:
2995         case  CX88_BOARD_OMICOM_SS4_PCI:
2996         case  CX88_BOARD_TBS_8910:
2997         case  CX88_BOARD_TBS_8920:
2998         case  CX88_BOARD_PROF_6200:
2999         case  CX88_BOARD_PROF_7300:
3000         case  CX88_BOARD_SATTRADE_ST4200:
3001                 cx_write(MO_SRST_IO, 0);
3002                 msleep(100);
3003                 cx_write(MO_SRST_IO, 1);
3004                 msleep(100);
3005                 break;
3006         } /*end switch() */
3007
3008
3009         /* Setup tuners */
3010         if ((core->board.radio_type != UNSET)) {
3011                 tun_setup.mode_mask      = T_RADIO;
3012                 tun_setup.type           = core->board.radio_type;
3013                 tun_setup.addr           = core->board.radio_addr;
3014                 tun_setup.tuner_callback = cx88_tuner_callback;
3015                 call_all(core, tuner, s_type_addr, &tun_setup);
3016                 mode_mask &= ~T_RADIO;
3017         }
3018
3019         if (core->board.tuner_type != TUNER_ABSENT) {
3020                 tun_setup.mode_mask      = mode_mask;
3021                 tun_setup.type           = core->board.tuner_type;
3022                 tun_setup.addr           = core->board.tuner_addr;
3023                 tun_setup.tuner_callback = cx88_tuner_callback;
3024
3025                 call_all(core, tuner, s_type_addr, &tun_setup);
3026         }
3027
3028         if (core->board.tda9887_conf) {
3029                 struct v4l2_priv_tun_config tda9887_cfg;
3030
3031                 tda9887_cfg.tuner = TUNER_TDA9887;
3032                 tda9887_cfg.priv  = &core->board.tda9887_conf;
3033
3034                 call_all(core, tuner, s_config, &tda9887_cfg);
3035         }
3036
3037         if (core->board.tuner_type == TUNER_XC2028) {
3038                 struct v4l2_priv_tun_config  xc2028_cfg;
3039                 struct xc2028_ctrl           ctl;
3040
3041                 /* Fills device-dependent initialization parameters */
3042                 cx88_setup_xc3028(core, &ctl);
3043
3044                 /* Sends parameters to xc2028/3028 tuner */
3045                 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
3046                 xc2028_cfg.tuner = TUNER_XC2028;
3047                 xc2028_cfg.priv  = &ctl;
3048                 info_printk(core, "Asking xc2028/3028 to load firmware %s\n",
3049                             ctl.fname);
3050                 call_all(core, tuner, s_config, &xc2028_cfg);
3051         }
3052         call_all(core, tuner, s_standby);
3053 }
3054
3055 /* ------------------------------------------------------------------ */
3056
3057 static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
3058 {
3059         unsigned int lat = UNSET;
3060         u8 ctrl = 0;
3061         u8 value;
3062
3063         /* check pci quirks */
3064         if (pci_pci_problems & PCIPCI_TRITON) {
3065                 printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n",
3066                        name);
3067                 ctrl |= CX88X_EN_TBFX;
3068         }
3069         if (pci_pci_problems & PCIPCI_NATOMA) {
3070                 printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n",
3071                        name);
3072                 ctrl |= CX88X_EN_TBFX;
3073         }
3074         if (pci_pci_problems & PCIPCI_VIAETBF) {
3075                 printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n",
3076                        name);
3077                 ctrl |= CX88X_EN_TBFX;
3078         }
3079         if (pci_pci_problems & PCIPCI_VSFX) {
3080                 printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n",
3081                        name);
3082                 ctrl |= CX88X_EN_VSFX;
3083         }
3084 #ifdef PCIPCI_ALIMAGIK
3085         if (pci_pci_problems & PCIPCI_ALIMAGIK) {
3086                 printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
3087                        name);
3088                 lat = 0x0A;
3089         }
3090 #endif
3091
3092         /* check insmod options */
3093         if (UNSET != latency)
3094                 lat = latency;
3095
3096         /* apply stuff */
3097         if (ctrl) {
3098                 pci_read_config_byte(pci, CX88X_DEVCTRL, &value);
3099                 value |= ctrl;
3100                 pci_write_config_byte(pci, CX88X_DEVCTRL, value);
3101         }
3102         if (UNSET != lat) {
3103                 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
3104                        name, latency);
3105                 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
3106         }
3107         return 0;
3108 }
3109
3110 int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
3111 {
3112         if (request_mem_region(pci_resource_start(pci,0),
3113                                pci_resource_len(pci,0),
3114                                core->name))
3115                 return 0;
3116         printk(KERN_ERR
3117                "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
3118                core->name, PCI_FUNC(pci->devfn),
3119                (unsigned long long)pci_resource_start(pci, 0),
3120                pci->subsystem_vendor, pci->subsystem_device);
3121         return -EBUSY;
3122 }
3123
3124 /* Allocate and initialize the cx88 core struct.  One should hold the
3125  * devlist mutex before calling this.  */
3126 struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
3127 {
3128         struct cx88_core *core;
3129         int i;
3130
3131         core = kzalloc(sizeof(*core), GFP_KERNEL);
3132         if (core == NULL)
3133                 return NULL;
3134
3135         atomic_inc(&core->refcount);
3136         core->pci_bus  = pci->bus->number;
3137         core->pci_slot = PCI_SLOT(pci->devfn);
3138         core->pci_irqmask = PCI_INT_RISC_RD_BERRINT | PCI_INT_RISC_WR_BERRINT |
3139                             PCI_INT_BRDG_BERRINT | PCI_INT_SRC_DMA_BERRINT |
3140                             PCI_INT_DST_DMA_BERRINT | PCI_INT_IPB_DMA_BERRINT;
3141         mutex_init(&core->lock);
3142
3143         core->nr = nr;
3144         sprintf(core->name, "cx88[%d]", core->nr);
3145
3146         strcpy(core->v4l2_dev.name, core->name);
3147         if (v4l2_device_register(NULL, &core->v4l2_dev)) {
3148                 kfree(core);
3149                 return NULL;
3150         }
3151
3152         if (0 != cx88_get_resources(core, pci)) {
3153                 v4l2_device_unregister(&core->v4l2_dev);
3154                 kfree(core);
3155                 return NULL;
3156         }
3157
3158         /* PCI stuff */
3159         cx88_pci_quirks(core->name, pci);
3160         core->lmmio = ioremap(pci_resource_start(pci, 0),
3161                               pci_resource_len(pci, 0));
3162         core->bmmio = (u8 __iomem *)core->lmmio;
3163
3164         if (core->lmmio == NULL) {
3165                 kfree(core);
3166                 return NULL;
3167         }
3168
3169         /* board config */
3170         core->boardnr = UNSET;
3171         if (card[core->nr] < ARRAY_SIZE(cx88_boards))
3172                 core->boardnr = card[core->nr];
3173         for (i = 0; UNSET == core->boardnr && i < ARRAY_SIZE(cx88_subids); i++)
3174                 if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
3175                     pci->subsystem_device == cx88_subids[i].subdevice)
3176                         core->boardnr = cx88_subids[i].card;
3177         if (UNSET == core->boardnr) {
3178                 core->boardnr = CX88_BOARD_UNKNOWN;
3179                 cx88_card_list(core, pci);
3180         }
3181
3182         memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
3183
3184         if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB))
3185                 core->board.num_frontends = 1;
3186
3187         info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
3188                 pci->subsystem_vendor, pci->subsystem_device, core->board.name,
3189                 core->boardnr, card[core->nr] == core->boardnr ?
3190                 "insmod option" : "autodetected",
3191                 core->board.num_frontends);
3192
3193         if (tuner[core->nr] != UNSET)
3194                 core->board.tuner_type = tuner[core->nr];
3195         if (radio[core->nr] != UNSET)
3196                 core->board.radio_type = radio[core->nr];
3197
3198         info_printk(core, "TV tuner type %d, Radio tuner type %d\n",
3199                     core->board.tuner_type, core->board.radio_type);
3200
3201         /* init hardware */
3202         cx88_reset(core);
3203         cx88_card_setup_pre_i2c(core);
3204         cx88_i2c_init(core, pci);
3205
3206         /* load tuner module, if needed */
3207         if (TUNER_ABSENT != core->board.tuner_type) {
3208                 /* Ignore 0x6b and 0x6f on cx88 boards.
3209                  * FusionHDTV5 RT Gold has an ir receiver at 0x6b
3210                  * and an RTC at 0x6f which can get corrupted if probed. */
3211                 static const unsigned short tv_addrs[] = {
3212                         0x42, 0x43, 0x4a, 0x4b,         /* tda8290 */
3213                         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
3214                         0x68, 0x69, 0x6a, 0x6c, 0x6d, 0x6e,
3215                         I2C_CLIENT_END
3216                 };
3217                 int has_demod = (core->board.tda9887_conf & TDA9887_PRESENT);
3218
3219                 /* I don't trust the radio_type as is stored in the card
3220                    definitions, so we just probe for it.
3221                    The radio_type is sometimes missing, or set to UNSET but
3222                    later code configures a tea5767.
3223                  */
3224                 v4l2_i2c_new_probed_subdev(&core->v4l2_dev, &core->i2c_adap,
3225                                 "tuner", "tuner",
3226                                 v4l2_i2c_tuner_addrs(ADDRS_RADIO));
3227                 if (has_demod)
3228                         v4l2_i2c_new_probed_subdev(&core->v4l2_dev,
3229                                 &core->i2c_adap, "tuner", "tuner",
3230                                 v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
3231                 if (core->board.tuner_addr == ADDR_UNSET) {
3232                         v4l2_i2c_new_probed_subdev(&core->v4l2_dev,
3233                                 &core->i2c_adap, "tuner", "tuner",
3234                                 has_demod ? tv_addrs + 4 : tv_addrs);
3235                 } else {
3236                         v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
3237                                 "tuner", "tuner", core->board.tuner_addr);
3238                 }
3239         }
3240
3241         cx88_card_setup(core);
3242         cx88_ir_init(core, pci);
3243
3244         return core;
3245 }