Merge branches 'omap1-upstream' and 'omap2-upstream' into devel
[linux-2.6] / drivers / media / video / cx88 / cx88-cards.c
1 /*
2  *
3  * device driver for Conexant 2388x based TV cards
4  * card-specific stuff.
5  *
6  * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 #include <linux/init.h>
24 #include <linux/module.h>
25 #include <linux/pci.h>
26 #include <linux/delay.h>
27
28 #include "cx88.h"
29
30 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
31 static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
32 static unsigned int card[]  = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
33
34 module_param_array(tuner, int, NULL, 0444);
35 module_param_array(radio, int, NULL, 0444);
36 module_param_array(card,  int, NULL, 0444);
37
38 MODULE_PARM_DESC(tuner,"tuner type");
39 MODULE_PARM_DESC(radio,"radio tuner type");
40 MODULE_PARM_DESC(card,"card type");
41
42 static unsigned int latency = UNSET;
43 module_param(latency,int,0444);
44 MODULE_PARM_DESC(latency,"pci latency timer");
45
46 /* ------------------------------------------------------------------ */
47 /* board config info                                                  */
48
49 static const struct cx88_board cx88_boards[] = {
50         [CX88_BOARD_UNKNOWN] = {
51                 .name           = "UNKNOWN/GENERIC",
52                 .tuner_type     = UNSET,
53                 .radio_type     = UNSET,
54                 .tuner_addr     = ADDR_UNSET,
55                 .radio_addr     = ADDR_UNSET,
56                 .input          = {{
57                         .type   = CX88_VMUX_COMPOSITE1,
58                         .vmux   = 0,
59                 },{
60                         .type   = CX88_VMUX_COMPOSITE2,
61                         .vmux   = 1,
62                 },{
63                         .type   = CX88_VMUX_COMPOSITE3,
64                         .vmux   = 2,
65                 },{
66                         .type   = CX88_VMUX_COMPOSITE4,
67                         .vmux   = 3,
68                 }},
69         },
70         [CX88_BOARD_HAUPPAUGE] = {
71                 .name           = "Hauppauge WinTV 34xxx models",
72                 .tuner_type     = UNSET,
73                 .radio_type     = UNSET,
74                 .tuner_addr     = ADDR_UNSET,
75                 .radio_addr     = ADDR_UNSET,
76                 .tda9887_conf   = TDA9887_PRESENT,
77                 .input          = {{
78                         .type   = CX88_VMUX_TELEVISION,
79                         .vmux   = 0,
80                         .gpio0  = 0xff00,  // internal decoder
81                 },{
82                         .type   = CX88_VMUX_DEBUG,
83                         .vmux   = 0,
84                         .gpio0  = 0xff01,  // mono from tuner chip
85                 },{
86                         .type   = CX88_VMUX_COMPOSITE1,
87                         .vmux   = 1,
88                         .gpio0  = 0xff02,
89                 },{
90                         .type   = CX88_VMUX_SVIDEO,
91                         .vmux   = 2,
92                         .gpio0  = 0xff02,
93                 }},
94                 .radio = {
95                         .type   = CX88_RADIO,
96                         .gpio0  = 0xff01,
97                 },
98         },
99         [CX88_BOARD_GDI] = {
100                 .name           = "GDI Black Gold",
101                 .tuner_type     = UNSET,
102                 .radio_type     = UNSET,
103                 .tuner_addr     = ADDR_UNSET,
104                 .radio_addr     = ADDR_UNSET,
105                 .input          = {{
106                         .type   = CX88_VMUX_TELEVISION,
107                         .vmux   = 0,
108                 },{
109                         .type   = CX88_VMUX_SVIDEO,
110                         .vmux   = 2,
111                 }},
112         },
113         [CX88_BOARD_PIXELVIEW] = {
114                 .name           = "PixelView",
115                 .tuner_type     = TUNER_PHILIPS_PAL,
116                 .radio_type     = UNSET,
117                 .tuner_addr     = ADDR_UNSET,
118                 .radio_addr     = ADDR_UNSET,
119                 .input          = {{
120                         .type   = CX88_VMUX_TELEVISION,
121                         .vmux   = 0,
122                         .gpio0  = 0xff00,  // internal decoder
123                 },{
124                         .type   = CX88_VMUX_COMPOSITE1,
125                         .vmux   = 1,
126                 },{
127                         .type   = CX88_VMUX_SVIDEO,
128                         .vmux   = 2,
129                 }},
130                 .radio = {
131                          .type  = CX88_RADIO,
132                          .gpio0 = 0xff10,
133                 },
134         },
135         [CX88_BOARD_ATI_WONDER_PRO] = {
136                 .name           = "ATI TV Wonder Pro",
137                 .tuner_type     = TUNER_PHILIPS_4IN1,
138                 .radio_type     = UNSET,
139                 .tuner_addr     = ADDR_UNSET,
140                 .radio_addr     = ADDR_UNSET,
141                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
142                 .input          = {{
143                         .type   = CX88_VMUX_TELEVISION,
144                         .vmux   = 0,
145                         .gpio0  = 0x03ff,
146                 },{
147                         .type   = CX88_VMUX_COMPOSITE1,
148                         .vmux   = 1,
149                         .gpio0  = 0x03fe,
150                 },{
151                         .type   = CX88_VMUX_SVIDEO,
152                         .vmux   = 2,
153                         .gpio0  = 0x03fe,
154                 }},
155         },
156         [CX88_BOARD_WINFAST2000XP_EXPERT] = {
157                 .name           = "Leadtek Winfast 2000XP Expert",
158                 .tuner_type     = TUNER_PHILIPS_4IN1,
159                 .radio_type     = UNSET,
160                 .tuner_addr     = ADDR_UNSET,
161                 .radio_addr     = ADDR_UNSET,
162                 .tda9887_conf   = TDA9887_PRESENT,
163                 .input          = {{
164                         .type   = CX88_VMUX_TELEVISION,
165                         .vmux   = 0,
166                         .gpio0  = 0x00F5e700,
167                         .gpio1  = 0x00003004,
168                         .gpio2  = 0x00F5e700,
169                         .gpio3  = 0x02000000,
170                 },{
171                         .type   = CX88_VMUX_COMPOSITE1,
172                         .vmux   = 1,
173                         .gpio0  = 0x00F5c700,
174                         .gpio1  = 0x00003004,
175                         .gpio2  = 0x00F5c700,
176                         .gpio3  = 0x02000000,
177                 },{
178                         .type   = CX88_VMUX_SVIDEO,
179                         .vmux   = 2,
180                         .gpio0  = 0x00F5c700,
181                         .gpio1  = 0x00003004,
182                         .gpio2  = 0x00F5c700,
183                         .gpio3  = 0x02000000,
184                 }},
185                 .radio = {
186                         .type   = CX88_RADIO,
187                         .gpio0  = 0x00F5d700,
188                         .gpio1  = 0x00003004,
189                         .gpio2  = 0x00F5d700,
190                         .gpio3  = 0x02000000,
191                 },
192         },
193         [CX88_BOARD_AVERTV_STUDIO_303] = {
194                 .name           = "AverTV Studio 303 (M126)",
195                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
196                 .radio_type     = UNSET,
197                 .tuner_addr     = ADDR_UNSET,
198                 .radio_addr     = ADDR_UNSET,
199                 .tda9887_conf   = TDA9887_PRESENT,
200                 .input          = {{
201                         .type   = CX88_VMUX_TELEVISION,
202                         .vmux   = 0,
203                         .gpio1  = 0xe09f,
204                 },{
205                         .type   = CX88_VMUX_COMPOSITE1,
206                         .vmux   = 1,
207                         .gpio1  = 0xe05f,
208                 },{
209                         .type   = CX88_VMUX_SVIDEO,
210                         .vmux   = 2,
211                         .gpio1  = 0xe05f,
212                 }},
213                 .radio = {
214                         .gpio1  = 0xe0df,
215                         .type   = CX88_RADIO,
216                 },
217         },
218         [CX88_BOARD_MSI_TVANYWHERE_MASTER] = {
219                 // added gpio values thanks to Michal
220                 // values for PAL from DScaler
221                 .name           = "MSI TV-@nywhere Master",
222                 .tuner_type     = TUNER_MT2032,
223                 .radio_type     = UNSET,
224                 .tuner_addr     = ADDR_UNSET,
225                 .radio_addr     = ADDR_UNSET,
226                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER_NTSC,
227                 .input          = {{
228                         .type   = CX88_VMUX_TELEVISION,
229                         .vmux   = 0,
230                         .gpio0  = 0x000040bf,
231                         .gpio1  = 0x000080c0,
232                         .gpio2  = 0x0000ff40,
233                 },{
234                         .type   = CX88_VMUX_COMPOSITE1,
235                         .vmux   = 1,
236                         .gpio0  = 0x000040bf,
237                         .gpio1  = 0x000080c0,
238                         .gpio2  = 0x0000ff40,
239                 },{
240                         .type   = CX88_VMUX_SVIDEO,
241                         .vmux   = 2,
242                         .gpio0  = 0x000040bf,
243                         .gpio1  = 0x000080c0,
244                         .gpio2  = 0x0000ff40,
245                 }},
246                 .radio = {
247                          .type   = CX88_RADIO,
248                 },
249         },
250         [CX88_BOARD_WINFAST_DV2000] = {
251                 .name           = "Leadtek Winfast DV2000",
252                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
253                 .radio_type     = UNSET,
254                 .tuner_addr     = ADDR_UNSET,
255                 .radio_addr     = ADDR_UNSET,
256                 .tda9887_conf   = TDA9887_PRESENT,
257                 .input          = {{
258                         .type   = CX88_VMUX_TELEVISION,
259                         .vmux   = 0,
260                         .gpio0  = 0x0035e700,
261                         .gpio1  = 0x00003004,
262                         .gpio2  = 0x0035e700,
263                         .gpio3  = 0x02000000,
264                 },{
265
266                         .type   = CX88_VMUX_COMPOSITE1,
267                         .vmux   = 1,
268                         .gpio0  = 0x0035c700,
269                         .gpio1  = 0x00003004,
270                         .gpio2  = 0x0035c700,
271                         .gpio3  = 0x02000000,
272                 },{
273                         .type   = CX88_VMUX_SVIDEO,
274                         .vmux   = 2,
275                         .gpio0  = 0x0035c700,
276                         .gpio1  = 0x0035c700,
277                         .gpio2  = 0x02000000,
278                         .gpio3  = 0x02000000,
279                 }},
280                 .radio = {
281                         .type   = CX88_RADIO,
282                         .gpio0  = 0x0035d700,
283                         .gpio1  = 0x00007004,
284                         .gpio2  = 0x0035d700,
285                         .gpio3  = 0x02000000,
286                 },
287         },
288         [CX88_BOARD_LEADTEK_PVR2000] = {
289                 // gpio values for PAL version from regspy by DScaler
290                 .name           = "Leadtek PVR 2000",
291                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
292                 .radio_type     = UNSET,
293                 .tuner_addr     = ADDR_UNSET,
294                 .radio_addr     = ADDR_UNSET,
295                 .tda9887_conf   = TDA9887_PRESENT,
296                 .input          = {{
297                         .type   = CX88_VMUX_TELEVISION,
298                         .vmux   = 0,
299                         .gpio0  = 0x0000bde2,
300                         .extadc = 1,
301                 },{
302                         .type   = CX88_VMUX_COMPOSITE1,
303                         .vmux   = 1,
304                         .gpio0  = 0x0000bde6,
305                         .extadc = 1,
306                 },{
307                         .type   = CX88_VMUX_SVIDEO,
308                         .vmux   = 2,
309                         .gpio0  = 0x0000bde6,
310                         .extadc = 1,
311                 }},
312                 .radio = {
313                         .type   = CX88_RADIO,
314                         .gpio0  = 0x0000bd62,
315                         .extadc = 1,
316                 },
317                 .mpeg           = CX88_MPEG_BLACKBIRD,
318         },
319         [CX88_BOARD_IODATA_GVVCP3PCI] = {
320                 .name           = "IODATA GV-VCP3/PCI",
321                 .tuner_type     = TUNER_ABSENT,
322                 .radio_type     = UNSET,
323                 .tuner_addr     = ADDR_UNSET,
324                 .radio_addr     = ADDR_UNSET,
325                 .input          = {{
326                         .type   = CX88_VMUX_COMPOSITE1,
327                         .vmux   = 0,
328                 },{
329                         .type   = CX88_VMUX_COMPOSITE2,
330                         .vmux   = 1,
331                 },{
332                         .type   = CX88_VMUX_SVIDEO,
333                         .vmux   = 2,
334                 }},
335         },
336         [CX88_BOARD_PROLINK_PLAYTVPVR] = {
337                 .name           = "Prolink PlayTV PVR",
338                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
339                 .radio_type     = UNSET,
340                 .tuner_addr     = ADDR_UNSET,
341                 .radio_addr     = ADDR_UNSET,
342                 .tda9887_conf   = TDA9887_PRESENT,
343                 .input          = {{
344                         .type   = CX88_VMUX_TELEVISION,
345                         .vmux   = 0,
346                         .gpio0  = 0xbff0,
347                 },{
348                         .type   = CX88_VMUX_COMPOSITE1,
349                         .vmux   = 1,
350                         .gpio0  = 0xbff3,
351                 },{
352                         .type   = CX88_VMUX_SVIDEO,
353                         .vmux   = 2,
354                         .gpio0  = 0xbff3,
355                 }},
356                 .radio = {
357                         .type   = CX88_RADIO,
358                         .gpio0  = 0xbff0,
359                 },
360         },
361         [CX88_BOARD_ASUS_PVR_416] = {
362                 .name           = "ASUS PVR-416",
363                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
364                 .radio_type     = UNSET,
365                 .tuner_addr     = ADDR_UNSET,
366                 .radio_addr     = ADDR_UNSET,
367                 .tda9887_conf   = TDA9887_PRESENT,
368                 .input          = {{
369                         .type   = CX88_VMUX_TELEVISION,
370                         .vmux   = 0,
371                         .gpio0  = 0x0000fde6,
372                 },{
373                         .type   = CX88_VMUX_SVIDEO,
374                         .vmux   = 2,
375                         .gpio0  = 0x0000fde6, // 0x0000fda6 L,R RCA audio in?
376                         .extadc = 1,
377                 }},
378                 .radio = {
379                         .type   = CX88_RADIO,
380                         .gpio0  = 0x0000fde2,
381                 },
382                 .mpeg           = CX88_MPEG_BLACKBIRD,
383         },
384         [CX88_BOARD_MSI_TVANYWHERE] = {
385                 .name           = "MSI TV-@nywhere",
386                 .tuner_type     = TUNER_MT2032,
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  = 0x00000fbf,
395                         .gpio2  = 0x0000fc08,
396                 },{
397                         .type   = CX88_VMUX_COMPOSITE1,
398                         .vmux   = 1,
399                         .gpio0  = 0x00000fbf,
400                         .gpio2  = 0x0000fc68,
401                 },{
402                         .type   = CX88_VMUX_SVIDEO,
403                         .vmux   = 2,
404                         .gpio0  = 0x00000fbf,
405                         .gpio2  = 0x0000fc68,
406                 }},
407         },
408         [CX88_BOARD_KWORLD_DVB_T] = {
409                 .name           = "KWorld/VStream XPert DVB-T",
410                 .tuner_type     = TUNER_ABSENT,
411                 .radio_type     = UNSET,
412                 .tuner_addr     = ADDR_UNSET,
413                 .radio_addr     = ADDR_UNSET,
414                 .input          = {{
415                         .type   = CX88_VMUX_COMPOSITE1,
416                         .vmux   = 1,
417                         .gpio0  = 0x0700,
418                         .gpio2  = 0x0101,
419                 },{
420                         .type   = CX88_VMUX_SVIDEO,
421                         .vmux   = 2,
422                         .gpio0  = 0x0700,
423                         .gpio2  = 0x0101,
424                 }},
425                 .mpeg           = CX88_MPEG_DVB,
426         },
427         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = {
428                 .name           = "DViCO FusionHDTV DVB-T1",
429                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
430                 .radio_type     = UNSET,
431                 .tuner_addr     = ADDR_UNSET,
432                 .radio_addr     = ADDR_UNSET,
433                 .input          = {{
434                         .type   = CX88_VMUX_COMPOSITE1,
435                         .vmux   = 1,
436                         .gpio0  = 0x000027df,
437                 },{
438                         .type   = CX88_VMUX_SVIDEO,
439                         .vmux   = 2,
440                         .gpio0  = 0x000027df,
441                 }},
442                 .mpeg           = CX88_MPEG_DVB,
443         },
444         [CX88_BOARD_KWORLD_LTV883] = {
445                 .name           = "KWorld LTV883RF",
446                 .tuner_type     = TUNER_TNF_8831BGFF,
447                 .radio_type     = UNSET,
448                 .tuner_addr     = ADDR_UNSET,
449                 .radio_addr     = ADDR_UNSET,
450                 .input          = {{
451                         .type   = CX88_VMUX_TELEVISION,
452                         .vmux   = 0,
453                         .gpio0  = 0x07f8,
454                 },{
455                         .type   = CX88_VMUX_DEBUG,
456                         .vmux   = 0,
457                         .gpio0  = 0x07f9,  // mono from tuner chip
458                 },{
459                         .type   = CX88_VMUX_COMPOSITE1,
460                         .vmux   = 1,
461                         .gpio0  = 0x000007fa,
462                 },{
463                         .type   = CX88_VMUX_SVIDEO,
464                         .vmux   = 2,
465                         .gpio0  = 0x000007fa,
466                 }},
467                 .radio = {
468                         .type   = CX88_RADIO,
469                         .gpio0  = 0x000007f8,
470                 },
471         },
472         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q] = {
473                 .name           = "DViCO FusionHDTV 3 Gold-Q",
474                 .tuner_type     = TUNER_MICROTUNE_4042FI5,
475                 .radio_type     = UNSET,
476                 .tuner_addr     = ADDR_UNSET,
477                 .radio_addr     = ADDR_UNSET,
478                 /*
479                    GPIO[0] resets DT3302 DTV receiver
480                     0 - reset asserted
481                     1 - normal operation
482                    GPIO[1] mutes analog audio output connector
483                     0 - enable selected source
484                     1 - mute
485                    GPIO[2] selects source for analog audio output connector
486                     0 - analog audio input connector on tab
487                     1 - analog DAC output from CX23881 chip
488                    GPIO[3] selects RF input connector on tuner module
489                     0 - RF connector labeled CABLE
490                     1 - RF connector labeled ANT
491                    GPIO[4] selects high RF for QAM256 mode
492                     0 - normal RF
493                     1 - high RF
494                 */
495                 .input          = {{
496                         .type   = CX88_VMUX_TELEVISION,
497                         .vmux   = 0,
498                         .gpio0  = 0x0f0d,
499                 },{
500                         .type   = CX88_VMUX_CABLE,
501                         .vmux   = 0,
502                         .gpio0  = 0x0f05,
503                 },{
504                         .type   = CX88_VMUX_COMPOSITE1,
505                         .vmux   = 1,
506                         .gpio0  = 0x0f00,
507                 },{
508                         .type   = CX88_VMUX_SVIDEO,
509                         .vmux   = 2,
510                         .gpio0  = 0x0f00,
511                 }},
512                 .mpeg           = CX88_MPEG_DVB,
513         },
514         [CX88_BOARD_HAUPPAUGE_DVB_T1] = {
515                 .name           = "Hauppauge Nova-T DVB-T",
516                 .tuner_type     = TUNER_ABSENT,
517                 .radio_type     = UNSET,
518                 .tuner_addr     = ADDR_UNSET,
519                 .radio_addr     = ADDR_UNSET,
520                 .input          = {{
521                         .type   = CX88_VMUX_DVB,
522                         .vmux   = 0,
523                 }},
524                 .mpeg           = CX88_MPEG_DVB,
525         },
526         [CX88_BOARD_CONEXANT_DVB_T1] = {
527                 .name           = "Conexant DVB-T reference design",
528                 .tuner_type     = TUNER_ABSENT,
529                 .radio_type     = UNSET,
530                 .tuner_addr     = ADDR_UNSET,
531                 .radio_addr     = ADDR_UNSET,
532                 .input          = {{
533                         .type   = CX88_VMUX_DVB,
534                         .vmux   = 0,
535                 }},
536                 .mpeg           = CX88_MPEG_DVB,
537         },
538         [CX88_BOARD_PROVIDEO_PV259] = {
539                 .name           = "Provideo PV259",
540                 .tuner_type     = TUNER_PHILIPS_FQ1216ME,
541                 .radio_type     = UNSET,
542                 .tuner_addr     = ADDR_UNSET,
543                 .radio_addr     = ADDR_UNSET,
544                 .input          = {{
545                         .type   = CX88_VMUX_TELEVISION,
546                         .vmux   = 0,
547                         .extadc = 1,
548                 }},
549                 .mpeg           = CX88_MPEG_BLACKBIRD,
550         },
551         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
552                 .name           = "DViCO FusionHDTV DVB-T Plus",
553                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
554                 .radio_type     = UNSET,
555                 .tuner_addr     = ADDR_UNSET,
556                 .radio_addr     = ADDR_UNSET,
557                 .input          = {{
558                         .type   = CX88_VMUX_COMPOSITE1,
559                         .vmux   = 1,
560                         .gpio0  = 0x000027df,
561                 },{
562                         .type   = CX88_VMUX_SVIDEO,
563                         .vmux   = 2,
564                         .gpio0  = 0x000027df,
565                 }},
566                 .mpeg           = CX88_MPEG_DVB,
567         },
568         [CX88_BOARD_DNTV_LIVE_DVB_T] = {
569                 .name           = "digitalnow DNTV Live! DVB-T",
570                 .tuner_type     = TUNER_ABSENT,
571                 .radio_type     = UNSET,
572                 .tuner_addr     = ADDR_UNSET,
573                 .radio_addr     = ADDR_UNSET,
574                 .input          = {{
575                         .type   = CX88_VMUX_COMPOSITE1,
576                         .vmux   = 1,
577                         .gpio0  = 0x00000700,
578                         .gpio2  = 0x00000101,
579                 },{
580                         .type   = CX88_VMUX_SVIDEO,
581                         .vmux   = 2,
582                         .gpio0  = 0x00000700,
583                         .gpio2  = 0x00000101,
584                 }},
585                 .mpeg           = CX88_MPEG_DVB,
586         },
587         [CX88_BOARD_PCHDTV_HD3000] = {
588                 .name           = "pcHDTV HD3000 HDTV",
589                 .tuner_type     = TUNER_THOMSON_DTT761X,
590                 .radio_type     = UNSET,
591                 .tuner_addr     = ADDR_UNSET,
592                 .radio_addr     = ADDR_UNSET,
593                 .tda9887_conf   = TDA9887_PRESENT,
594                 /* GPIO[2] = audio source for analog audio out connector
595                  *  0 = analog audio input connector
596                  *  1 = CX88 audio DACs
597                  *
598                  * GPIO[7] = input to CX88's audio/chroma ADC
599                  *  0 = FM 10.7 MHz IF
600                  *  1 = Sound 4.5 MHz IF
601                  *
602                  * GPIO[1,5,6] = Oren 51132 pins 27,35,28 respectively
603                  *
604                  * GPIO[16] = Remote control input
605                  */
606                 .input          = {{
607                         .type   = CX88_VMUX_TELEVISION,
608                         .vmux   = 0,
609                         .gpio0  = 0x00008484,
610                 },{
611                         .type   = CX88_VMUX_COMPOSITE1,
612                         .vmux   = 1,
613                         .gpio0  = 0x00008400,
614                 },{
615                         .type   = CX88_VMUX_SVIDEO,
616                         .vmux   = 2,
617                         .gpio0  = 0x00008400,
618                 }},
619                 .radio = {
620                         .type   = CX88_RADIO,
621                         .gpio0  = 0x00008404,
622                 },
623                 .mpeg           = CX88_MPEG_DVB,
624         },
625         [CX88_BOARD_HAUPPAUGE_ROSLYN] = {
626                 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu>
627                 // GPIO values obtained from regspy, courtesy Sean Covel
628                 .name           = "Hauppauge WinTV 28xxx (Roslyn) models",
629                 .tuner_type     = UNSET,
630                 .radio_type     = UNSET,
631                 .tuner_addr     = ADDR_UNSET,
632                 .radio_addr     = ADDR_UNSET,
633                 .input          = {{
634                         .type   = CX88_VMUX_TELEVISION,
635                         .vmux   = 0,
636                         .gpio0  = 0xed1a,
637                         .gpio2  = 0x00ff,
638                 },{
639                         .type   = CX88_VMUX_DEBUG,
640                         .vmux   = 0,
641                         .gpio0  = 0xff01,
642                 },{
643                         .type   = CX88_VMUX_COMPOSITE1,
644                         .vmux   = 1,
645                         .gpio0  = 0xff02,
646                 },{
647                         .type   = CX88_VMUX_SVIDEO,
648                         .vmux   = 2,
649                         .gpio0  = 0xed92,
650                         .gpio2  = 0x00ff,
651                 }},
652                 .radio = {
653                          .type   = CX88_RADIO,
654                          .gpio0  = 0xed96,
655                          .gpio2  = 0x00ff,
656                  },
657                 .mpeg           = CX88_MPEG_BLACKBIRD,
658         },
659         [CX88_BOARD_DIGITALLOGIC_MEC] = {
660                 .name           = "Digital-Logic MICROSPACE Entertainment Center (MEC)",
661                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
662                 .radio_type     = UNSET,
663                 .tuner_addr     = ADDR_UNSET,
664                 .radio_addr     = ADDR_UNSET,
665                 .tda9887_conf   = TDA9887_PRESENT,
666                 .input          = {{
667                         .type   = CX88_VMUX_TELEVISION,
668                         .vmux   = 0,
669                         .gpio0  = 0x00009d80,
670                         .extadc = 1,
671                 },{
672                         .type   = CX88_VMUX_COMPOSITE1,
673                         .vmux   = 1,
674                         .gpio0  = 0x00009d76,
675                         .extadc = 1,
676                 },{
677                         .type   = CX88_VMUX_SVIDEO,
678                         .vmux   = 2,
679                         .gpio0  = 0x00009d76,
680                         .extadc = 1,
681                 }},
682                 .radio = {
683                         .type   = CX88_RADIO,
684                         .gpio0  = 0x00009d00,
685                         .extadc = 1,
686                 },
687                 .mpeg           = CX88_MPEG_BLACKBIRD,
688         },
689         [CX88_BOARD_IODATA_GVBCTV7E] = {
690                 .name           = "IODATA GV/BCTV7E",
691                 .tuner_type     = TUNER_PHILIPS_FQ1286,
692                 .radio_type     = UNSET,
693                 .tuner_addr     = ADDR_UNSET,
694                 .radio_addr     = ADDR_UNSET,
695                 .tda9887_conf   = TDA9887_PRESENT,
696                 .input          = {{
697                         .type   = CX88_VMUX_TELEVISION,
698                         .vmux   = 1,
699                         .gpio1  = 0x0000e03f,
700                 },{
701                         .type   = CX88_VMUX_COMPOSITE1,
702                         .vmux   = 2,
703                         .gpio1  = 0x0000e07f,
704                 },{
705                         .type   = CX88_VMUX_SVIDEO,
706                         .vmux   = 3,
707                         .gpio1  = 0x0000e07f,
708                 }}
709         },
710         [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = {
711                 .name           = "PixelView PlayTV Ultra Pro (Stereo)",
712                 /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */
713                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
714                 .radio_type     = UNSET,
715                 .tuner_addr     = ADDR_UNSET,
716                 .radio_addr     = ADDR_UNSET,
717                 .input          = {{
718                         .type   = CX88_VMUX_TELEVISION,
719                         .vmux   = 0,
720                         .gpio0  = 0xbf61,  /* internal decoder */
721                 },{
722                         .type   = CX88_VMUX_COMPOSITE1,
723                         .vmux   = 1,
724                         .gpio0  = 0xbf63,
725                 },{
726                         .type   = CX88_VMUX_SVIDEO,
727                         .vmux   = 2,
728                         .gpio0  = 0xbf63,
729                 }},
730                 .radio = {
731                          .type  = CX88_RADIO,
732                          .gpio0 = 0xbf60,
733                  },
734         },
735         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = {
736                 .name           = "DViCO FusionHDTV 3 Gold-T",
737                 .tuner_type     = TUNER_THOMSON_DTT761X,
738                 .radio_type     = UNSET,
739                 .tuner_addr     = ADDR_UNSET,
740                 .radio_addr     = ADDR_UNSET,
741                 .tda9887_conf   = TDA9887_PRESENT,
742                 .input          = {{
743                         .type   = CX88_VMUX_TELEVISION,
744                         .vmux   = 0,
745                         .gpio0  = 0x97ed,
746                 },{
747                         .type   = CX88_VMUX_COMPOSITE1,
748                         .vmux   = 1,
749                         .gpio0  = 0x97e9,
750                 },{
751                         .type   = CX88_VMUX_SVIDEO,
752                         .vmux   = 2,
753                         .gpio0  = 0x97e9,
754                 }},
755                 .mpeg           = CX88_MPEG_DVB,
756         },
757         [CX88_BOARD_ADSTECH_DVB_T_PCI] = {
758                 .name           = "ADS Tech Instant TV DVB-T PCI",
759                 .tuner_type     = TUNER_ABSENT,
760                 .radio_type     = UNSET,
761                 .tuner_addr     = ADDR_UNSET,
762                 .radio_addr     = ADDR_UNSET,
763                 .input          = {{
764                         .type   = CX88_VMUX_COMPOSITE1,
765                         .vmux   = 1,
766                         .gpio0  = 0x0700,
767                         .gpio2  = 0x0101,
768                 },{
769                         .type   = CX88_VMUX_SVIDEO,
770                         .vmux   = 2,
771                         .gpio0  = 0x0700,
772                         .gpio2  = 0x0101,
773                 }},
774                 .mpeg           = CX88_MPEG_DVB,
775         },
776         [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = {
777                 .name           = "TerraTec Cinergy 1400 DVB-T",
778                 .tuner_type     = TUNER_ABSENT,
779                 .input          = {{
780                         .type   = CX88_VMUX_DVB,
781                         .vmux   = 0,
782                 },{
783                         .type   = CX88_VMUX_COMPOSITE1,
784                         .vmux   = 2,
785                 },{
786                         .type   = CX88_VMUX_SVIDEO,
787                         .vmux   = 2,
788                 }},
789                 .mpeg           = CX88_MPEG_DVB,
790         },
791         [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = {
792                 .name           = "DViCO FusionHDTV 5 Gold",
793                 .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H062F */
794                 .radio_type     = UNSET,
795                 .tuner_addr     = ADDR_UNSET,
796                 .radio_addr     = ADDR_UNSET,
797                 .tda9887_conf   = TDA9887_PRESENT,
798                 .input          = {{
799                         .type   = CX88_VMUX_TELEVISION,
800                         .vmux   = 0,
801                         .gpio0  = 0x87fd,
802                 },{
803                         .type   = CX88_VMUX_COMPOSITE1,
804                         .vmux   = 1,
805                         .gpio0  = 0x87f9,
806                 },{
807                         .type   = CX88_VMUX_SVIDEO,
808                         .vmux   = 2,
809                         .gpio0  = 0x87f9,
810                 }},
811                 .mpeg           = CX88_MPEG_DVB,
812         },
813         [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = {
814                 .name           = "AverMedia UltraTV Media Center PCI 550",
815                 .tuner_type     = TUNER_PHILIPS_FM1236_MK3,
816                 .radio_type     = UNSET,
817                 .tuner_addr     = ADDR_UNSET,
818                 .radio_addr     = ADDR_UNSET,
819                 .tda9887_conf   = TDA9887_PRESENT,
820                 .input          = {{
821                         .type   = CX88_VMUX_COMPOSITE1,
822                         .vmux   = 0,
823                         .gpio0  = 0x0000cd73,
824                         .extadc = 1,
825                 },{
826                         .type   = CX88_VMUX_SVIDEO,
827                         .vmux   = 1,
828                         .gpio0  = 0x0000cd73,
829                         .extadc = 1,
830                 },{
831                         .type   = CX88_VMUX_TELEVISION,
832                         .vmux   = 3,
833                         .gpio0  = 0x0000cdb3,
834                         .extadc = 1,
835                 }},
836                 .radio = {
837                         .type   = CX88_RADIO,
838                         .vmux   = 2,
839                         .gpio0  = 0x0000cdf3,
840                         .extadc = 1,
841                 },
842                 .mpeg           = CX88_MPEG_BLACKBIRD,
843         },
844         [CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD] = {
845                  /* Alexander Wold <awold@bigfoot.com> */
846                  .name           = "Kworld V-Stream Xpert DVD",
847                  .tuner_type     = UNSET,
848                  .input          = {{
849                          .type   = CX88_VMUX_COMPOSITE1,
850                          .vmux   = 1,
851                          .gpio0  = 0x03000000,
852                          .gpio1  = 0x01000000,
853                          .gpio2  = 0x02000000,
854                          .gpio3  = 0x00100000,
855                  },{
856                          .type   = CX88_VMUX_SVIDEO,
857                          .vmux   = 2,
858                          .gpio0  = 0x03000000,
859                          .gpio1  = 0x01000000,
860                          .gpio2  = 0x02000000,
861                          .gpio3  = 0x00100000,
862                  }},
863         },
864         [CX88_BOARD_ATI_HDTVWONDER] = {
865                 .name           = "ATI HDTV Wonder",
866                 .tuner_type     = TUNER_PHILIPS_TUV1236D,
867                 .radio_type     = UNSET,
868                 .tuner_addr     = ADDR_UNSET,
869                 .radio_addr     = ADDR_UNSET,
870                 .input          = {{
871                         .type   = CX88_VMUX_TELEVISION,
872                         .vmux   = 0,
873                         .gpio0  = 0x00000ff7,
874                         .gpio1  = 0x000000ff,
875                         .gpio2  = 0x00000001,
876                         .gpio3  = 0x00000000,
877                 },{
878                         .type   = CX88_VMUX_COMPOSITE1,
879                         .vmux   = 1,
880                         .gpio0  = 0x00000ffe,
881                         .gpio1  = 0x000000ff,
882                         .gpio2  = 0x00000001,
883                         .gpio3  = 0x00000000,
884                 },{
885                         .type   = CX88_VMUX_SVIDEO,
886                         .vmux   = 2,
887                         .gpio0  = 0x00000ffe,
888                         .gpio1  = 0x000000ff,
889                         .gpio2  = 0x00000001,
890                         .gpio3  = 0x00000000,
891                 }},
892                 .mpeg           = CX88_MPEG_DVB,
893         },
894         [CX88_BOARD_WINFAST_DTV1000] = {
895                 .name           = "WinFast DTV1000-T",
896                 .tuner_type     = TUNER_ABSENT,
897                 .radio_type     = UNSET,
898                 .tuner_addr     = ADDR_UNSET,
899                 .radio_addr     = ADDR_UNSET,
900                 .input          = {{
901                         .type   = CX88_VMUX_DVB,
902                         .vmux   = 0,
903                 },{
904                         .type   = CX88_VMUX_COMPOSITE1,
905                         .vmux   = 1,
906                 },{
907                         .type   = CX88_VMUX_SVIDEO,
908                         .vmux   = 2,
909                 }},
910                 .mpeg           = CX88_MPEG_DVB,
911         },
912         [CX88_BOARD_AVERTV_303] = {
913                 .name           = "AVerTV 303 (M126)",
914                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
915                 .radio_type     = UNSET,
916                 .tuner_addr     = ADDR_UNSET,
917                 .radio_addr     = ADDR_UNSET,
918                 .tda9887_conf   = TDA9887_PRESENT,
919                 .input          = {{
920                         .type   = CX88_VMUX_TELEVISION,
921                         .vmux   = 0,
922                         .gpio0  = 0x00ff,
923                         .gpio1  = 0xe09f,
924                         .gpio2  = 0x0010,
925                         .gpio3  = 0x0000,
926                 },{
927                         .type   = CX88_VMUX_COMPOSITE1,
928                         .vmux   = 1,
929                         .gpio0  = 0x00ff,
930                         .gpio1  = 0xe05f,
931                         .gpio2  = 0x0010,
932                         .gpio3  = 0x0000,
933                 },{
934                         .type   = CX88_VMUX_SVIDEO,
935                         .vmux   = 2,
936                         .gpio0  = 0x00ff,
937                         .gpio1  = 0xe05f,
938                         .gpio2  = 0x0010,
939                         .gpio3  = 0x0000,
940                 }},
941         },
942         [CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1] = {
943                 .name           = "Hauppauge Nova-S-Plus DVB-S",
944                 .tuner_type     = TUNER_ABSENT,
945                 .radio_type     = UNSET,
946                 .tuner_addr     = ADDR_UNSET,
947                 .radio_addr     = ADDR_UNSET,
948                 .input          = {{
949                         .type   = CX88_VMUX_DVB,
950                         .vmux   = 0,
951                 },{
952                         .type   = CX88_VMUX_COMPOSITE1,
953                         .vmux   = 1,
954                 },{
955                         .type   = CX88_VMUX_SVIDEO,
956                         .vmux   = 2,
957                 }},
958                 .mpeg           = CX88_MPEG_DVB,
959         },
960         [CX88_BOARD_HAUPPAUGE_NOVASE2_S1] = {
961                 .name           = "Hauppauge Nova-SE2 DVB-S",
962                 .tuner_type     = TUNER_ABSENT,
963                 .radio_type     = UNSET,
964                 .tuner_addr     = ADDR_UNSET,
965                 .radio_addr     = ADDR_UNSET,
966                 .input          = {{
967                         .type   = CX88_VMUX_DVB,
968                         .vmux   = 0,
969                 }},
970                 .mpeg           = CX88_MPEG_DVB,
971         },
972         [CX88_BOARD_KWORLD_DVBS_100] = {
973                 .name           = "KWorld DVB-S 100",
974                 .tuner_type     = TUNER_ABSENT,
975                 .radio_type     = UNSET,
976                 .tuner_addr     = ADDR_UNSET,
977                 .radio_addr     = ADDR_UNSET,
978                 .input          = {{
979                         .type   = CX88_VMUX_DVB,
980                         .vmux   = 0,
981                 },{
982                         .type   = CX88_VMUX_COMPOSITE1,
983                         .vmux   = 1,
984                 },{
985                         .type   = CX88_VMUX_SVIDEO,
986                         .vmux   = 2,
987                 }},
988                 .mpeg           = CX88_MPEG_DVB,
989         },
990         [CX88_BOARD_HAUPPAUGE_HVR1100] = {
991                 .name           = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid",
992                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
993                 .radio_type     = UNSET,
994                 .tuner_addr     = ADDR_UNSET,
995                 .radio_addr     = ADDR_UNSET,
996                 .tda9887_conf   = TDA9887_PRESENT,
997                 .input          = {{
998                         .type   = CX88_VMUX_TELEVISION,
999                         .vmux   = 0,
1000                 },{
1001                         .type   = CX88_VMUX_COMPOSITE1,
1002                         .vmux   = 1,
1003                 },{
1004                         .type   = CX88_VMUX_SVIDEO,
1005                         .vmux   = 2,
1006                 }},
1007                 /* fixme: Add radio support */
1008                 .mpeg           = CX88_MPEG_DVB,
1009         },
1010         [CX88_BOARD_HAUPPAUGE_HVR1100LP] = {
1011                 .name           = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)",
1012                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1013                 .radio_type     = UNSET,
1014                 .tuner_addr     = ADDR_UNSET,
1015                 .radio_addr     = ADDR_UNSET,
1016                 .tda9887_conf   = TDA9887_PRESENT,
1017                 .input          = {{
1018                         .type   = CX88_VMUX_TELEVISION,
1019                         .vmux   = 0,
1020                 },{
1021                         .type   = CX88_VMUX_COMPOSITE1,
1022                         .vmux   = 1,
1023                 }},
1024                 /* fixme: Add radio support */
1025                 .mpeg           = CX88_MPEG_DVB,
1026         },
1027         [CX88_BOARD_DNTV_LIVE_DVB_T_PRO] = {
1028                 .name           = "digitalnow DNTV Live! DVB-T Pro",
1029                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1030                 .radio_type     = UNSET,
1031                 .tuner_addr     = ADDR_UNSET,
1032                 .radio_addr     = ADDR_UNSET,
1033                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE |
1034                                   TDA9887_PORT2_ACTIVE,
1035                 .input          = {{
1036                         .type   = CX88_VMUX_TELEVISION,
1037                         .vmux   = 0,
1038                         .gpio0  = 0xf80808,
1039                 },{
1040                         .type   = CX88_VMUX_COMPOSITE1,
1041                         .vmux   = 1,
1042                         .gpio0  = 0xf80808,
1043                 },{
1044                         .type   = CX88_VMUX_SVIDEO,
1045                         .vmux   = 2,
1046                         .gpio0  = 0xf80808,
1047                 }},
1048                 .radio = {
1049                          .type  = CX88_RADIO,
1050                          .gpio0 = 0xf80808,
1051                 },
1052                 .mpeg           = CX88_MPEG_DVB,
1053         },
1054         [CX88_BOARD_KWORLD_DVB_T_CX22702] = {
1055                 /* Kworld V-stream Xpert DVB-T with Thomson tuner */
1056                 /* DTT 7579 Conexant CX22702-19 Conexant CX2388x  */
1057                 /* Manenti Marco <marco_manenti@colman.it> */
1058                 .name           = "KWorld/VStream XPert DVB-T with cx22702",
1059                 .tuner_type     = TUNER_ABSENT,
1060                 .radio_type     = UNSET,
1061                 .tuner_addr     = ADDR_UNSET,
1062                 .radio_addr     = ADDR_UNSET,
1063                 .input          = {{
1064                         .type   = CX88_VMUX_COMPOSITE1,
1065                         .vmux   = 1,
1066                         .gpio0  = 0x0700,
1067                         .gpio2  = 0x0101,
1068                 },{
1069                         .type   = CX88_VMUX_SVIDEO,
1070                         .vmux   = 2,
1071                         .gpio0  = 0x0700,
1072                         .gpio2  = 0x0101,
1073                 }},
1074                 .mpeg           = CX88_MPEG_DVB,
1075         },
1076         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL] = {
1077                 .name           = "DViCO FusionHDTV DVB-T Dual Digital",
1078                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
1079                 .radio_type     = UNSET,
1080                 .tuner_addr     = ADDR_UNSET,
1081                 .radio_addr     = ADDR_UNSET,
1082                 .input          = {{
1083                         .type   = CX88_VMUX_COMPOSITE1,
1084                         .vmux   = 1,
1085                         .gpio0  = 0x000067df,
1086                  },{
1087                         .type   = CX88_VMUX_SVIDEO,
1088                         .vmux   = 2,
1089                         .gpio0  = 0x000067df,
1090                 }},
1091                 .mpeg           = CX88_MPEG_DVB,
1092         },
1093         [CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT] = {
1094                 .name           = "KWorld HardwareMpegTV XPert",
1095                 .tuner_type     = TUNER_PHILIPS_TDA8290,
1096                 .radio_type     = UNSET,
1097                 .tuner_addr     = ADDR_UNSET,
1098                 .radio_addr     = ADDR_UNSET,
1099                 .input          = {{
1100                         .type   = CX88_VMUX_TELEVISION,
1101                         .vmux   = 0,
1102                         .gpio0  = 0x3de2,
1103                         .gpio2  = 0x00ff,
1104                 },{
1105                         .type   = CX88_VMUX_COMPOSITE1,
1106                         .vmux   = 1,
1107                         .gpio0  = 0x3de6,
1108                         .extadc = 1,
1109                 },{
1110                         .type   = CX88_VMUX_SVIDEO,
1111                         .vmux   = 2,
1112                         .gpio0  = 0x3de6,
1113                         .extadc = 1,
1114                 }},
1115                 .radio = {
1116                         .type   = CX88_RADIO,
1117                         .gpio0  = 0x3de6,
1118                         .gpio2  = 0x00ff,
1119                 },
1120                 .mpeg           = CX88_MPEG_BLACKBIRD,
1121         },
1122         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID] = {
1123                 .name           = "DViCO FusionHDTV DVB-T Hybrid",
1124                 .tuner_type     = TUNER_THOMSON_FE6600,
1125                 .radio_type     = UNSET,
1126                 .tuner_addr     = ADDR_UNSET,
1127                 .radio_addr     = ADDR_UNSET,
1128                 .input          = {{
1129                         .type   = CX88_VMUX_TELEVISION,
1130                         .vmux   = 0,
1131                         .gpio0  = 0x0000a75f,
1132                 },{
1133                         .type   = CX88_VMUX_COMPOSITE1,
1134                         .vmux   = 1,
1135                         .gpio0  = 0x0000a75b,
1136                 },{
1137                         .type   = CX88_VMUX_SVIDEO,
1138                         .vmux   = 2,
1139                         .gpio0  = 0x0000a75b,
1140                 }},
1141                 .mpeg           = CX88_MPEG_DVB,
1142         },
1143         [CX88_BOARD_PCHDTV_HD5500] = {
1144                 .name           = "pcHDTV HD5500 HDTV",
1145                 .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H064F */
1146                 .radio_type     = UNSET,
1147                 .tuner_addr     = ADDR_UNSET,
1148                 .radio_addr     = ADDR_UNSET,
1149                 .tda9887_conf   = TDA9887_PRESENT,
1150                 .input          = {{
1151                         .type   = CX88_VMUX_TELEVISION,
1152                         .vmux   = 0,
1153                         .gpio0  = 0x87fd,
1154                 },{
1155                         .type   = CX88_VMUX_COMPOSITE1,
1156                         .vmux   = 1,
1157                         .gpio0  = 0x87f9,
1158                 },{
1159                         .type   = CX88_VMUX_SVIDEO,
1160                         .vmux   = 2,
1161                         .gpio0  = 0x87f9,
1162                 }},
1163                 .mpeg           = CX88_MPEG_DVB,
1164         },
1165         [CX88_BOARD_KWORLD_MCE200_DELUXE] = {
1166                 /* FIXME: tested TV input only, disabled composite,
1167                    svideo and radio until they can be tested also. */
1168                 .name           = "Kworld MCE 200 Deluxe",
1169                 .tuner_type     = TUNER_TENA_9533_DI,
1170                 .radio_type     = UNSET,
1171                 .tda9887_conf   = TDA9887_PRESENT,
1172                 .tuner_addr     = ADDR_UNSET,
1173                 .radio_addr     = ADDR_UNSET,
1174                 .input          = {{
1175                         .type   = CX88_VMUX_TELEVISION,
1176                         .vmux   = 0,
1177                         .gpio0  = 0x0000BDE6
1178                 }},
1179                 .mpeg           = CX88_MPEG_BLACKBIRD,
1180         },
1181         [CX88_BOARD_PIXELVIEW_PLAYTV_P7000] = {
1182                 /* FIXME: SVideo, Composite and FM inputs are untested */
1183                 .name           = "PixelView PlayTV P7000",
1184                 .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
1185                 .radio_type     = UNSET,
1186                 .tuner_addr     = ADDR_UNSET,
1187                 .radio_addr     = ADDR_UNSET,
1188                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE |
1189                                   TDA9887_PORT2_ACTIVE,
1190                 .input          = {{
1191                         .type   = CX88_VMUX_TELEVISION,
1192                         .vmux   = 0,
1193                         .gpio0  = 0x5da6,
1194                 }},
1195                 .mpeg           = CX88_MPEG_BLACKBIRD,
1196         },
1197         [CX88_BOARD_NPGTECH_REALTV_TOP10FM] = {
1198                 .name           = "NPG Tech Real TV FM Top 10",
1199                 .tuner_type     = TUNER_TNF_5335MF, /* Actually a TNF9535 */
1200                 .radio_type     = UNSET,
1201                 .tuner_addr     = ADDR_UNSET,
1202                 .radio_addr     = ADDR_UNSET,
1203                 .input          = {{
1204                         .type   = CX88_VMUX_TELEVISION,
1205                         .vmux   = 0,
1206                         .gpio0  = 0x0788,
1207                 },{
1208                         .type   = CX88_VMUX_COMPOSITE1,
1209                         .vmux   = 1,
1210                         .gpio0  = 0x078b,
1211                 },{
1212                         .type   = CX88_VMUX_SVIDEO,
1213                         .vmux   = 2,
1214                         .gpio0  = 0x078b,
1215                 }},
1216                 .radio = {
1217                          .type  = CX88_RADIO,
1218                          .gpio0 = 0x074a,
1219                 },
1220         },
1221         [CX88_BOARD_WINFAST_DTV2000H] = {
1222                 /* video inputs and radio still in testing */
1223                 .name           = "WinFast DTV2000 H",
1224                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1225                 .radio_type     = UNSET,
1226                 .tuner_addr     = ADDR_UNSET,
1227                 .radio_addr     = ADDR_UNSET,
1228                 .tda9887_conf   = TDA9887_PRESENT,
1229                 .input          = {{
1230                         .type   = CX88_VMUX_TELEVISION,
1231                         .vmux   = 0,
1232                         .gpio0  = 0x00017304,
1233                         .gpio1  = 0x00008203,
1234                         .gpio2  = 0x00017304,
1235                         .gpio3  = 0x02000000,
1236                 }},
1237                 .mpeg           = CX88_MPEG_DVB,
1238         },
1239         [CX88_BOARD_GENIATECH_DVBS] = {
1240                 .name          = "Geniatech DVB-S",
1241                 .tuner_type    = TUNER_ABSENT,
1242                 .radio_type    = UNSET,
1243                 .tuner_addr    = ADDR_UNSET,
1244                 .radio_addr    = ADDR_UNSET,
1245                 .input  = {{
1246                         .type  = CX88_VMUX_DVB,
1247                         .vmux  = 0,
1248                 },{
1249                         .type  = CX88_VMUX_COMPOSITE1,
1250                         .vmux  = 1,
1251                 }},
1252                 .mpeg           = CX88_MPEG_DVB,
1253         },
1254         [CX88_BOARD_HAUPPAUGE_HVR3000] = {
1255                 /* FIXME: Add dvb & radio support */
1256                 .name           = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T",
1257                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1258                 .radio_type     = UNSET,
1259                 .tuner_addr     = ADDR_UNSET,
1260                 .radio_addr     = ADDR_UNSET,
1261                 .tda9887_conf   = TDA9887_PRESENT,
1262                 .input          = {{
1263                         .type   = CX88_VMUX_TELEVISION,
1264                         .vmux   = 0,
1265                         .gpio0  = 0x84bf,
1266                 },{
1267                         .type   = CX88_VMUX_COMPOSITE1,
1268                         .vmux   = 1,
1269                         .gpio0  = 0x84bf,
1270                 },{
1271                         .type   = CX88_VMUX_SVIDEO,
1272                         .vmux   = 2,
1273                         .gpio0  = 0x84bf,
1274                 }},
1275                 .mpeg           = CX88_MPEG_DVB,
1276         },
1277         [CX88_BOARD_NORWOOD_MICRO] = {
1278                 .name           = "Norwood Micro TV Tuner",
1279                 .tuner_type     = TUNER_TNF_5335MF,
1280                 .radio_type     = UNSET,
1281                 .tuner_addr     = ADDR_UNSET,
1282                 .radio_addr     = ADDR_UNSET,
1283                 .input          = {{
1284                         .type   = CX88_VMUX_TELEVISION,
1285                         .vmux   = 0,
1286                         .gpio0  = 0x0709,
1287                 },{
1288                         .type   = CX88_VMUX_COMPOSITE1,
1289                         .vmux   = 1,
1290                         .gpio0  = 0x070b,
1291                 },{
1292                         .type   = CX88_VMUX_SVIDEO,
1293                         .vmux   = 2,
1294                         .gpio0  = 0x070b,
1295                 }},
1296         },
1297         [CX88_BOARD_TE_DTV_250_OEM_SWANN] = {
1298                 .name           = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM",
1299                 .tuner_type     = TUNER_LG_PAL_NEW_TAPC,
1300                 .radio_type     = UNSET,
1301                 .tuner_addr     = ADDR_UNSET,
1302                 .radio_addr     = ADDR_UNSET,
1303                 .input          = {{
1304                         .type   = CX88_VMUX_TELEVISION,
1305                         .vmux   = 0,
1306                         .gpio0  = 0x003fffff,
1307                         .gpio1  = 0x00e00000,
1308                         .gpio2  = 0x003fffff,
1309                         .gpio3  = 0x02000000,
1310                 },{
1311                         .type   = CX88_VMUX_COMPOSITE1,
1312                         .vmux   = 1,
1313                         .gpio0  = 0x003fffff,
1314                         .gpio1  = 0x00e00000,
1315                         .gpio2  = 0x003fffff,
1316                         .gpio3  = 0x02000000,
1317                 },{
1318                         .type   = CX88_VMUX_SVIDEO,
1319                         .vmux   = 2,
1320                         .gpio0  = 0x003fffff,
1321                         .gpio1  = 0x00e00000,
1322                         .gpio2  = 0x003fffff,
1323                         .gpio3  = 0x02000000,
1324                 }},
1325         },
1326         [CX88_BOARD_HAUPPAUGE_HVR1300] = {
1327                 .name           = "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder",
1328                 .tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
1329                 .radio_type     = UNSET,
1330                 .tuner_addr     = ADDR_UNSET,
1331                 .radio_addr     = ADDR_UNSET,
1332                 .tda9887_conf   = TDA9887_PRESENT,
1333                 .audio_chip     = AUDIO_CHIP_WM8775,
1334                 .input          = {{
1335                         .type   = CX88_VMUX_TELEVISION,
1336                         .vmux   = 0,
1337                         .gpio0  = 0xe780,
1338                         .extadc = 1,
1339                 },{
1340                         .type   = CX88_VMUX_COMPOSITE1,
1341                         .vmux   = 1,
1342                         .gpio0  = 0xe780,
1343                         .extadc = 1,
1344                 },{
1345                         .type   = CX88_VMUX_SVIDEO,
1346                         .vmux   = 2,
1347                         .gpio0  = 0xe780,
1348                         .extadc = 1,
1349                 }},
1350                 /* fixme: Add radio support */
1351                 .mpeg           = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
1352         },
1353         [CX88_BOARD_ADSTECH_PTV_390] = {
1354                 .name           = "ADS Tech Instant Video PCI",
1355                 .tuner_type     = TUNER_ABSENT,
1356                 .radio_type     = UNSET,
1357                 .tuner_addr     = ADDR_UNSET,
1358                 .radio_addr     = ADDR_UNSET,
1359                 .input          = {{
1360                         .type   = CX88_VMUX_DEBUG,
1361                         .vmux   = 3,
1362                         .gpio0  = 0x04ff,
1363                 },{
1364                         .type   = CX88_VMUX_COMPOSITE1,
1365                         .vmux   = 1,
1366                         .gpio0  = 0x07fa,
1367                 },{
1368                         .type   = CX88_VMUX_SVIDEO,
1369                         .vmux   = 2,
1370                         .gpio0  = 0x07fa,
1371                 }},
1372         },
1373 };
1374
1375 /* ------------------------------------------------------------------ */
1376 /* PCI subsystem IDs                                                  */
1377
1378 static const struct cx88_subid cx88_subids[] = {
1379         {
1380                 .subvendor = 0x0070,
1381                 .subdevice = 0x3400,
1382                 .card      = CX88_BOARD_HAUPPAUGE,
1383         },{
1384                 .subvendor = 0x0070,
1385                 .subdevice = 0x3401,
1386                 .card      = CX88_BOARD_HAUPPAUGE,
1387         },{
1388                 .subvendor = 0x14c7,
1389                 .subdevice = 0x0106,
1390                 .card      = CX88_BOARD_GDI,
1391         },{
1392                 .subvendor = 0x14c7,
1393                 .subdevice = 0x0107, /* with mpeg encoder */
1394                 .card      = CX88_BOARD_GDI,
1395         },{
1396                 .subvendor = PCI_VENDOR_ID_ATI,
1397                 .subdevice = 0x00f8,
1398                 .card      = CX88_BOARD_ATI_WONDER_PRO,
1399         },{
1400                 .subvendor = 0x107d,
1401                 .subdevice = 0x6611,
1402                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
1403         },{
1404                 .subvendor = 0x107d,
1405                 .subdevice = 0x6613,    /* NTSC */
1406                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
1407         },{
1408                 .subvendor = 0x107d,
1409                 .subdevice = 0x6620,
1410                 .card      = CX88_BOARD_WINFAST_DV2000,
1411         },{
1412                 .subvendor = 0x107d,
1413                 .subdevice = 0x663b,
1414                 .card      = CX88_BOARD_LEADTEK_PVR2000,
1415         },{
1416                 .subvendor = 0x107d,
1417                 .subdevice = 0x663c,
1418                 .card      = CX88_BOARD_LEADTEK_PVR2000,
1419         },{
1420                 .subvendor = 0x1461,
1421                 .subdevice = 0x000b,
1422                 .card      = CX88_BOARD_AVERTV_STUDIO_303,
1423         },{
1424                 .subvendor = 0x1462,
1425                 .subdevice = 0x8606,
1426                 .card      = CX88_BOARD_MSI_TVANYWHERE_MASTER,
1427         },{
1428                 .subvendor = 0x10fc,
1429                 .subdevice = 0xd003,
1430                 .card      = CX88_BOARD_IODATA_GVVCP3PCI,
1431         },{
1432                 .subvendor = 0x1043,
1433                 .subdevice = 0x4823,  /* with mpeg encoder */
1434                 .card      = CX88_BOARD_ASUS_PVR_416,
1435         },{
1436                 .subvendor = 0x17de,
1437                 .subdevice = 0x08a6,
1438                 .card      = CX88_BOARD_KWORLD_DVB_T,
1439         },{
1440                 .subvendor = 0x18ac,
1441                 .subdevice = 0xd810,
1442                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
1443         },{
1444                 .subvendor = 0x18ac,
1445                 .subdevice = 0xd820,
1446                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T,
1447         },{
1448                 .subvendor = 0x18ac,
1449                 .subdevice = 0xdb00,
1450                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1,
1451         },{
1452                 .subvendor = 0x0070,
1453                 .subdevice = 0x9002,
1454                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
1455         },{
1456                 .subvendor = 0x14f1,
1457                 .subdevice = 0x0187,
1458                 .card      = CX88_BOARD_CONEXANT_DVB_T1,
1459         },{
1460                 .subvendor = 0x1540,
1461                 .subdevice = 0x2580,
1462                 .card      = CX88_BOARD_PROVIDEO_PV259,
1463         },{
1464                 .subvendor = 0x18ac,
1465                 .subdevice = 0xdb10,
1466                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
1467         },{
1468                 .subvendor = 0x1554,
1469                 .subdevice = 0x4811,
1470                 .card      = CX88_BOARD_PIXELVIEW,
1471         },{
1472                 .subvendor = 0x7063,
1473                 .subdevice = 0x3000, /* HD-3000 card */
1474                 .card      = CX88_BOARD_PCHDTV_HD3000,
1475         },{
1476                 .subvendor = 0x17de,
1477                 .subdevice = 0xa8a6,
1478                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T,
1479         },{
1480                 .subvendor = 0x0070,
1481                 .subdevice = 0x2801,
1482                 .card      = CX88_BOARD_HAUPPAUGE_ROSLYN,
1483         },{
1484                 .subvendor = 0x14f1,
1485                 .subdevice = 0x0342,
1486                 .card      = CX88_BOARD_DIGITALLOGIC_MEC,
1487         },{
1488                 .subvendor = 0x10fc,
1489                 .subdevice = 0xd035,
1490                 .card      = CX88_BOARD_IODATA_GVBCTV7E,
1491         },{
1492                 .subvendor = 0x1421,
1493                 .subdevice = 0x0334,
1494                 .card      = CX88_BOARD_ADSTECH_DVB_T_PCI,
1495         },{
1496                 .subvendor = 0x153b,
1497                 .subdevice = 0x1166,
1498                 .card      = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1,
1499         },{
1500                 .subvendor = 0x18ac,
1501                 .subdevice = 0xd500,
1502                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD,
1503         },{
1504                 .subvendor = 0x1461,
1505                 .subdevice = 0x8011,
1506                 .card      = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550,
1507         },{
1508                 .subvendor = PCI_VENDOR_ID_ATI,
1509                 .subdevice = 0xa101,
1510                 .card      = CX88_BOARD_ATI_HDTVWONDER,
1511         },{
1512                 .subvendor = 0x107d,
1513                 .subdevice = 0x665f,
1514                 .card      = CX88_BOARD_WINFAST_DTV1000,
1515         },{
1516                 .subvendor = 0x1461,
1517                 .subdevice = 0x000a,
1518                 .card      = CX88_BOARD_AVERTV_303,
1519         },{
1520                 .subvendor = 0x0070,
1521                 .subdevice = 0x9200,
1522                 .card      = CX88_BOARD_HAUPPAUGE_NOVASE2_S1,
1523         },{
1524                 .subvendor = 0x0070,
1525                 .subdevice = 0x9201,
1526                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
1527         },{
1528                 .subvendor = 0x0070,
1529                 .subdevice = 0x9202,
1530                 .card      = CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1,
1531         },{
1532                 .subvendor = 0x17de,
1533                 .subdevice = 0x08b2,
1534                 .card      = CX88_BOARD_KWORLD_DVBS_100,
1535         },{
1536                 .subvendor = 0x0070,
1537                 .subdevice = 0x9400,
1538                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
1539         },{
1540                 .subvendor = 0x0070,
1541                 .subdevice = 0x9402,
1542                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100,
1543         },{
1544                 .subvendor = 0x0070,
1545                 .subdevice = 0x9800,
1546                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
1547         },{
1548                 .subvendor = 0x0070,
1549                 .subdevice = 0x9802,
1550                 .card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
1551         },{
1552                 .subvendor = 0x0070,
1553                 .subdevice = 0x9001,
1554                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
1555         },{
1556                 .subvendor = 0x1822,
1557                 .subdevice = 0x0025,
1558                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
1559         },{
1560                 .subvendor = 0x17de,
1561                 .subdevice = 0x08a1,
1562                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
1563         },{
1564                 .subvendor = 0x18ac,
1565                 .subdevice = 0xdb50,
1566                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
1567         },{
1568                 .subvendor = 0x18ac,
1569                 .subdevice = 0xdb54,
1570                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
1571                 /* Re-branded DViCO: DigitalNow DVB-T Dual */
1572         },{
1573                 .subvendor = 0x18ac,
1574                 .subdevice = 0xdb11,
1575                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
1576                 /* Re-branded DViCO: UltraView DVB-T Plus */
1577         },{
1578                 .subvendor = 0x17de,
1579                 .subdevice = 0x0840,
1580                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
1581         },{
1582                 .subvendor = 0x1421,
1583                 .subdevice = 0x0305,
1584                 .card      = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
1585         },{
1586                 .subvendor = 0x18ac,
1587                 .subdevice = 0xdb40,
1588                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
1589         },{
1590                 .subvendor = 0x18ac,
1591                 .subdevice = 0xdb44,
1592                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID,
1593         },{
1594                 .subvendor = 0x7063,
1595                 .subdevice = 0x5500,
1596                 .card      = CX88_BOARD_PCHDTV_HD5500,
1597         },{
1598                 .subvendor = 0x17de,
1599                 .subdevice = 0x0841,
1600                 .card      = CX88_BOARD_KWORLD_MCE200_DELUXE,
1601         },{
1602                 .subvendor = 0x1822,
1603                 .subdevice = 0x0019,
1604                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T_PRO,
1605         },{
1606                 .subvendor = 0x1554,
1607                 .subdevice = 0x4813,
1608                 .card      = CX88_BOARD_PIXELVIEW_PLAYTV_P7000,
1609         },{
1610                 .subvendor = 0x14f1,
1611                 .subdevice = 0x0842,
1612                 .card      = CX88_BOARD_NPGTECH_REALTV_TOP10FM,
1613         },{
1614                 .subvendor = 0x107d,
1615                 .subdevice = 0x665e,
1616                 .card      = CX88_BOARD_WINFAST_DTV2000H,
1617         },{
1618                 .subvendor = 0x18ac,
1619                 .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */
1620                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
1621         },{
1622                 .subvendor = 0x14f1,
1623                 .subdevice = 0x0084,
1624                 .card      = CX88_BOARD_GENIATECH_DVBS,
1625         },{
1626                 .subvendor = 0x0070,
1627                 .subdevice = 0x1404,
1628                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
1629         },{
1630                 .subvendor = 0x1461,
1631                 .subdevice = 0xc111, /* AverMedia M150-D */
1632                 /* This board is known to work with the ASUS PVR416 config */
1633                 .card      = CX88_BOARD_ASUS_PVR_416,
1634         },{
1635                 .subvendor = 0xc180,
1636                 .subdevice = 0xc980,
1637                 .card      = CX88_BOARD_TE_DTV_250_OEM_SWANN,
1638         },{
1639                 .subvendor = 0x0070,
1640                 .subdevice = 0x9600,
1641                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
1642         },{
1643                 .subvendor = 0x0070,
1644                 .subdevice = 0x9601,
1645                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
1646         },{
1647                 .subvendor = 0x0070,
1648                 .subdevice = 0x9602,
1649                 .card      = CX88_BOARD_HAUPPAUGE_HVR1300,
1650         },{
1651                 .subvendor = 0x107d,
1652                 .subdevice = 0x6632,
1653                 .card      = CX88_BOARD_LEADTEK_PVR2000,
1654         },{
1655                 .subvendor = 0x12ab,
1656                 .subdevice = 0x2300, /* Club3D Zap TV2100 */
1657                 .card      = CX88_BOARD_KWORLD_DVB_T_CX22702,
1658         },{
1659                 .subvendor = 0x0070,
1660                 .subdevice = 0x9000,
1661                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
1662         },{
1663                 .subvendor = 0x0070,
1664                 .subdevice = 0x1400,
1665                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
1666         },{
1667                 .subvendor = 0x0070,
1668                 .subdevice = 0x1401,
1669                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
1670         },{
1671                 .subvendor = 0x0070,
1672                 .subdevice = 0x1402,
1673                 .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
1674         },{
1675                 .subvendor = 0x1421,
1676                 .subdevice = 0x0341, /* ADS Tech InstantTV DVB-S */
1677                 .card      = CX88_BOARD_KWORLD_DVBS_100,
1678         },{
1679                 .subvendor = 0x1421,
1680                 .subdevice = 0x0390,
1681                 .card      = CX88_BOARD_ADSTECH_PTV_390,
1682         },
1683 };
1684
1685 /* ----------------------------------------------------------------------- */
1686 /* some leadtek specific stuff                                             */
1687
1688 static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
1689 {
1690         /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
1691          * any others.
1692          *
1693          * Byte 0 is 1 on the NTSC board.
1694          */
1695
1696         if (eeprom_data[4] != 0x7d ||
1697             eeprom_data[5] != 0x10 ||
1698             eeprom_data[7] != 0x66) {
1699                 printk(KERN_WARNING "%s: Leadtek eeprom invalid.\n",
1700                        core->name);
1701                 return;
1702         }
1703
1704         core->board.tuner_type = (eeprom_data[6] == 0x13) ?
1705                 TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3;
1706
1707         printk(KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: "
1708                "tuner=%d, eeprom[0]=0x%02x\n",
1709                core->name, core->board.tuner_type, eeprom_data[0]);
1710 }
1711
1712 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
1713 {
1714         struct tveeprom tv;
1715
1716         tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data);
1717         core->board.tuner_type = tv.tuner_type;
1718         core->tuner_formats = tv.tuner_formats;
1719         core->board.radio.type = tv.has_radio ? CX88_RADIO : 0;
1720
1721         /* Make sure we support the board model */
1722         switch (tv.model)
1723         {
1724         case 14009: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in) */
1725         case 14019: /* WinTV-HVR3000 (Retail, IR Blaster, b/panel video, 3.5mm audio in) */
1726         case 14029: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge) */
1727         case 14109: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - low profile) */
1728         case 14129: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge - LP) */
1729         case 14559: /* WinTV-HVR3000 (OEM, no IR, b/panel video, 3.5mm audio in) */
1730         case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */
1731         case 14659: /* WinTV-HVR3000 (OEM, no IR, b/panel video, RCA audio in - Low profile) */
1732         case 14669: /* WinTV-HVR3000 (OEM, no IR, no b/panel video - Low profile) */
1733         case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
1734         case 34519: /* WinTV-PCI-FM */
1735         case 90002: /* Nova-T-PCI (9002) */
1736         case 92001: /* Nova-S-Plus (Video and IR) */
1737         case 92002: /* Nova-S-Plus (Video and IR) */
1738         case 90003: /* Nova-T-PCI (9002 No RF out) */
1739         case 90500: /* Nova-T-PCI (oem) */
1740         case 90501: /* Nova-T-PCI (oem/IR) */
1741         case 92000: /* Nova-SE2 (OEM, No Video or IR) */
1742         case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
1743         case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
1744         case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */
1745         case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */
1746         case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */
1747         case 96569: /* WinTV-HVR1300 () */
1748         case 96659: /* WinTV-HVR1300 () */
1749         case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
1750                 /* known */
1751                 break;
1752         default:
1753                 printk("%s: warning: unknown hauppauge model #%d\n",
1754                        core->name, tv.model);
1755                 break;
1756         }
1757
1758         printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
1759                         core->name, tv.model);
1760 }
1761
1762 /* ----------------------------------------------------------------------- */
1763 /* some GDI (was: Modular Technology) specific stuff                       */
1764
1765 static struct {
1766         int  id;
1767         int  fm;
1768         char *name;
1769 } gdi_tuner[] = {
1770         [ 0x01 ] = { .id   = TUNER_ABSENT,
1771                      .name = "NTSC_M" },
1772         [ 0x02 ] = { .id   = TUNER_ABSENT,
1773                      .name = "PAL_B" },
1774         [ 0x03 ] = { .id   = TUNER_ABSENT,
1775                      .name = "PAL_I" },
1776         [ 0x04 ] = { .id   = TUNER_ABSENT,
1777                      .name = "PAL_D" },
1778         [ 0x05 ] = { .id   = TUNER_ABSENT,
1779                      .name = "SECAM" },
1780
1781         [ 0x10 ] = { .id   = TUNER_ABSENT,
1782                      .fm   = 1,
1783                      .name = "TEMIC_4049" },
1784         [ 0x11 ] = { .id   = TUNER_TEMIC_4136FY5,
1785                      .name = "TEMIC_4136" },
1786         [ 0x12 ] = { .id   = TUNER_ABSENT,
1787                      .name = "TEMIC_4146" },
1788
1789         [ 0x20 ] = { .id   = TUNER_PHILIPS_FQ1216ME,
1790                      .fm   = 1,
1791                      .name = "PHILIPS_FQ1216_MK3" },
1792         [ 0x21 ] = { .id   = TUNER_ABSENT, .fm = 1,
1793                      .name = "PHILIPS_FQ1236_MK3" },
1794         [ 0x22 ] = { .id   = TUNER_ABSENT,
1795                      .name = "PHILIPS_FI1236_MK3" },
1796         [ 0x23 ] = { .id   = TUNER_ABSENT,
1797                      .name = "PHILIPS_FI1216_MK3" },
1798 };
1799
1800 static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
1801 {
1802         char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
1803                 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
1804
1805         printk(KERN_INFO "%s: GDI: tuner=%s\n", core->name,
1806                name ? name : "unknown");
1807         if (NULL == name)
1808                 return;
1809         core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
1810         core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
1811                 CX88_RADIO : 0;
1812 }
1813
1814 /* ----------------------------------------------------------------------- */
1815 /* some DViCO specific stuff                                               */
1816
1817 static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
1818 {
1819         struct i2c_msg msg = { .addr = 0x45, .flags = 0 };
1820         int i, err;
1821         static u8 init_bufs[13][5] = {
1822                 { 0x10, 0x00, 0x20, 0x01, 0x03 },
1823                 { 0x10, 0x10, 0x01, 0x00, 0x21 },
1824                 { 0x10, 0x10, 0x10, 0x00, 0xCA },
1825                 { 0x10, 0x10, 0x12, 0x00, 0x08 },
1826                 { 0x10, 0x10, 0x13, 0x00, 0x0A },
1827                 { 0x10, 0x10, 0x16, 0x01, 0xC0 },
1828                 { 0x10, 0x10, 0x22, 0x01, 0x3D },
1829                 { 0x10, 0x10, 0x73, 0x01, 0x2E },
1830                 { 0x10, 0x10, 0x72, 0x00, 0xC5 },
1831                 { 0x10, 0x10, 0x71, 0x01, 0x97 },
1832                 { 0x10, 0x10, 0x70, 0x00, 0x0F },
1833                 { 0x10, 0x10, 0xB0, 0x00, 0x01 },
1834                 { 0x03, 0x0C },
1835         };
1836
1837         for (i = 0; i < ARRAY_SIZE(init_bufs); i++) {
1838                 msg.buf = init_bufs[i];
1839                 msg.len = (i != 12 ? 5 : 2);
1840                 err = i2c_transfer(&core->i2c_adap, &msg, 1);
1841                 if (err != 1) {
1842                         printk("dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n", i, err);
1843                         return;
1844                 }
1845         }
1846 }
1847
1848 /* ----------------------------------------------------------------------- */
1849
1850 static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
1851 {
1852         int i;
1853
1854         if (0 == pci->subsystem_vendor &&
1855             0 == pci->subsystem_device) {
1856                 printk("%s: Your board has no valid PCI Subsystem ID and thus can't\n"
1857                        "%s: be autodetected.  Please pass card=<n> insmod option to\n"
1858                        "%s: workaround that.  Redirect complaints to the vendor of\n"
1859                        "%s: the TV card.  Best regards,\n"
1860                        "%s:         -- tux\n",
1861                        core->name,core->name,core->name,core->name,core->name);
1862         } else {
1863                 printk("%s: Your board isn't known (yet) to the driver.  You can\n"
1864                        "%s: try to pick one of the existing card configs via\n"
1865                        "%s: card=<n> insmod option.  Updating to the latest\n"
1866                        "%s: version might help as well.\n",
1867                        core->name,core->name,core->name,core->name);
1868         }
1869         printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n",
1870                core->name);
1871         for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
1872                 printk("%s:    card=%d -> %s\n",
1873                        core->name, i, cx88_boards[i].name);
1874 }
1875
1876 static void cx88_card_setup_pre_i2c(struct cx88_core *core)
1877 {
1878         switch (core->boardnr) {
1879         case CX88_BOARD_HAUPPAUGE_HVR1300:
1880                 /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */
1881                 /* We leave here with the 702 on the bus */
1882                 cx_write(MO_GP0_IO, 0x0000e780);
1883                 udelay(1000);
1884                 cx_clear(MO_GP0_IO, 0x00000080);
1885                 udelay(50);
1886                 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
1887                 udelay(1000);
1888                 break;
1889         }
1890 }
1891
1892 static void cx88_card_setup(struct cx88_core *core)
1893 {
1894         static u8 eeprom[256];
1895
1896         if (0 == core->i2c_rc) {
1897                 core->i2c_client.addr = 0xa0 >> 1;
1898                 tveeprom_read(&core->i2c_client,eeprom,sizeof(eeprom));
1899         }
1900
1901         switch (core->boardnr) {
1902         case CX88_BOARD_HAUPPAUGE:
1903         case CX88_BOARD_HAUPPAUGE_ROSLYN:
1904                 if (0 == core->i2c_rc)
1905                         hauppauge_eeprom(core,eeprom+8);
1906                 break;
1907         case CX88_BOARD_GDI:
1908                 if (0 == core->i2c_rc)
1909                         gdi_eeprom(core,eeprom);
1910                 break;
1911         case CX88_BOARD_WINFAST2000XP_EXPERT:
1912                 if (0 == core->i2c_rc)
1913                         leadtek_eeprom(core,eeprom);
1914                 break;
1915         case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
1916         case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
1917         case CX88_BOARD_HAUPPAUGE_DVB_T1:
1918         case CX88_BOARD_HAUPPAUGE_HVR1100:
1919         case CX88_BOARD_HAUPPAUGE_HVR1100LP:
1920         case CX88_BOARD_HAUPPAUGE_HVR3000:
1921         case CX88_BOARD_HAUPPAUGE_HVR1300:
1922                 if (0 == core->i2c_rc)
1923                         hauppauge_eeprom(core,eeprom);
1924                 break;
1925         case CX88_BOARD_KWORLD_DVBS_100:
1926                 cx_write(MO_GP0_IO, 0x000007f8);
1927                 cx_write(MO_GP1_IO, 0x00000001);
1928                 break;
1929         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
1930                 /* GPIO0:6 is hooked to FX2 reset pin */
1931                 cx_set(MO_GP0_IO, 0x00004040);
1932                 cx_clear(MO_GP0_IO, 0x00000040);
1933                 msleep(1000);
1934                 cx_set(MO_GP0_IO, 0x00004040);
1935                 /* FALLTHROUGH */
1936         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
1937         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
1938         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
1939                 /* GPIO0:0 is hooked to mt352 reset pin */
1940                 cx_set(MO_GP0_IO, 0x00000101);
1941                 cx_clear(MO_GP0_IO, 0x00000001);
1942                 msleep(1);
1943                 cx_set(MO_GP0_IO, 0x00000101);
1944                 if (0 == core->i2c_rc &&
1945                     core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
1946                         dvico_fusionhdtv_hybrid_init(core);
1947                 break;
1948         case CX88_BOARD_KWORLD_DVB_T:
1949         case CX88_BOARD_DNTV_LIVE_DVB_T:
1950                 cx_set(MO_GP0_IO, 0x00000707);
1951                 cx_set(MO_GP2_IO, 0x00000101);
1952                 cx_clear(MO_GP2_IO, 0x00000001);
1953                 msleep(1);
1954                 cx_clear(MO_GP0_IO, 0x00000007);
1955                 cx_set(MO_GP2_IO, 0x00000101);
1956                 break;
1957         case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
1958                 cx_write(MO_GP0_IO, 0x00080808);
1959                 break;
1960         case CX88_BOARD_ATI_HDTVWONDER:
1961                 if (0 == core->i2c_rc) {
1962                         /* enable tuner */
1963                         int i;
1964                         static const u8 buffer [][2] = {
1965                                 {0x10,0x12},
1966                                 {0x13,0x04},
1967                                 {0x16,0x00},
1968                                 {0x14,0x04},
1969                                 {0x17,0x00}
1970                         };
1971                         core->i2c_client.addr = 0x0a;
1972
1973                         for (i = 0; i < ARRAY_SIZE(buffer); i++)
1974                                 if (2 != i2c_master_send(&core->i2c_client,
1975                                                         buffer[i],2))
1976                                         printk(KERN_WARNING
1977                                                 "%s: Unable to enable "
1978                                                 "tuner(%i).\n",
1979                                                 core->name, i);
1980                 }
1981                 break;
1982         }
1983 }
1984
1985 /* ------------------------------------------------------------------ */
1986
1987 static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
1988 {
1989         unsigned int lat = UNSET;
1990         u8 ctrl = 0;
1991         u8 value;
1992
1993         /* check pci quirks */
1994         if (pci_pci_problems & PCIPCI_TRITON) {
1995                 printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n",
1996                        name);
1997                 ctrl |= CX88X_EN_TBFX;
1998         }
1999         if (pci_pci_problems & PCIPCI_NATOMA) {
2000                 printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n",
2001                        name);
2002                 ctrl |= CX88X_EN_TBFX;
2003         }
2004         if (pci_pci_problems & PCIPCI_VIAETBF) {
2005                 printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n",
2006                        name);
2007                 ctrl |= CX88X_EN_TBFX;
2008         }
2009         if (pci_pci_problems & PCIPCI_VSFX) {
2010                 printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n",
2011                        name);
2012                 ctrl |= CX88X_EN_VSFX;
2013         }
2014 #ifdef PCIPCI_ALIMAGIK
2015         if (pci_pci_problems & PCIPCI_ALIMAGIK) {
2016                 printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
2017                        name);
2018                 lat = 0x0A;
2019         }
2020 #endif
2021
2022         /* check insmod options */
2023         if (UNSET != latency)
2024                 lat = latency;
2025
2026         /* apply stuff */
2027         if (ctrl) {
2028                 pci_read_config_byte(pci, CX88X_DEVCTRL, &value);
2029                 value |= ctrl;
2030                 pci_write_config_byte(pci, CX88X_DEVCTRL, value);
2031         }
2032         if (UNSET != lat) {
2033                 printk(KERN_INFO "%s: setting pci latency timer to %d\n",
2034                        name, latency);
2035                 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
2036         }
2037         return 0;
2038 }
2039
2040 int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
2041 {
2042         if (request_mem_region(pci_resource_start(pci,0),
2043                                pci_resource_len(pci,0),
2044                                core->name))
2045                 return 0;
2046         printk(KERN_ERR
2047                "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
2048                core->name, PCI_FUNC(pci->devfn),
2049                (unsigned long long)pci_resource_start(pci, 0),
2050                pci->subsystem_vendor, pci->subsystem_device);
2051         return -EBUSY;
2052 }
2053
2054 /* Allocate and initialize the cx88 core struct.  One should hold the
2055  * devlist mutex before calling this.  */
2056 struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
2057 {
2058         struct cx88_core *core;
2059         int i;
2060
2061         core = kzalloc(sizeof(*core), GFP_KERNEL);
2062
2063         atomic_inc(&core->refcount);
2064         core->pci_bus  = pci->bus->number;
2065         core->pci_slot = PCI_SLOT(pci->devfn);
2066         core->pci_irqmask = PCI_INT_RISC_RD_BERRINT | PCI_INT_RISC_WR_BERRINT |
2067                             PCI_INT_BRDG_BERRINT | PCI_INT_SRC_DMA_BERRINT |
2068                             PCI_INT_DST_DMA_BERRINT | PCI_INT_IPB_DMA_BERRINT;
2069         mutex_init(&core->lock);
2070
2071         core->nr = nr;
2072         sprintf(core->name, "cx88[%d]", core->nr);
2073         if (0 != cx88_get_resources(core, pci)) {
2074                 kfree(core);
2075                 return NULL;
2076         }
2077
2078         /* PCI stuff */
2079         cx88_pci_quirks(core->name, pci);
2080         core->lmmio = ioremap(pci_resource_start(pci, 0),
2081                               pci_resource_len(pci, 0));
2082         core->bmmio = (u8 __iomem *)core->lmmio;
2083
2084         /* board config */
2085         core->boardnr = UNSET;
2086         if (card[core->nr] < ARRAY_SIZE(cx88_boards))
2087                 core->boardnr = card[core->nr];
2088         for (i = 0; UNSET == core->boardnr && i < ARRAY_SIZE(cx88_subids); i++)
2089                 if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
2090                     pci->subsystem_device == cx88_subids[i].subdevice)
2091                         core->boardnr = cx88_subids[i].card;
2092         if (UNSET == core->boardnr) {
2093                 core->boardnr = CX88_BOARD_UNKNOWN;
2094                 cx88_card_list(core, pci);
2095         }
2096
2097         memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
2098
2099         printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
2100                 core->name,pci->subsystem_vendor,
2101                 pci->subsystem_device, core->board.name,
2102                 core->boardnr, card[core->nr] == core->boardnr ?
2103                 "insmod option" : "autodetected");
2104
2105         if (tuner[core->nr] != UNSET)
2106                 core->board.tuner_type = tuner[core->nr];
2107         if (radio[core->nr] != UNSET)
2108                 core->board.radio_type = radio[core->nr];
2109
2110         printk(KERN_INFO "%s: TV tuner type %d, Radio tuner type %d\n",
2111                core->name, core->board.tuner_type, core->board.radio_type);
2112
2113         /* init hardware */
2114         cx88_reset(core);
2115         cx88_card_setup_pre_i2c(core);
2116         cx88_i2c_init(core, pci);
2117         cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL);
2118         cx88_card_setup(core);
2119         cx88_ir_init(core, pci);
2120
2121         return core;
2122 }
2123
2124 /* ------------------------------------------------------------------ */
2125
2126 /*
2127  * Local variables:
2128  * c-basic-offset: 8
2129  * End:
2130  * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
2131  */