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