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