[PATCH] DViCO FusionHDTV3 Gold-T documentation fix
[linux-2.6.git] / drivers / media / video / cx88 / cx88-cards.c
1 /*
2  * $Id: cx88-cards.c,v 1.66 2005/03/04 09:12:23 kraxel Exp $
3  *
4  * device driver for Conexant 2388x based TV cards
5  * card-specific stuff.
6  *
7  * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23
24 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/pci.h>
27 #include <linux/delay.h>
28
29 #include "cx88.h"
30
31 /* ------------------------------------------------------------------ */
32 /* board config info                                                  */
33
34 struct cx88_board cx88_boards[] = {
35         [CX88_BOARD_UNKNOWN] = {
36                 .name           = "UNKNOWN/GENERIC",
37                 .tuner_type     = UNSET,
38                 .input          = {{
39                         .type   = CX88_VMUX_COMPOSITE1,
40                         .vmux   = 0,
41                 },{
42                         .type   = CX88_VMUX_COMPOSITE2,
43                         .vmux   = 1,
44                 },{
45                         .type   = CX88_VMUX_COMPOSITE3,
46                         .vmux   = 2,
47                 },{
48                         .type   = CX88_VMUX_COMPOSITE4,
49                         .vmux   = 3,
50                 }},
51         },
52         [CX88_BOARD_HAUPPAUGE] = {
53                 .name           = "Hauppauge WinTV 34xxx models",
54                 .tuner_type     = UNSET,
55                 .tda9887_conf   = TDA9887_PRESENT,
56                 .input          = {{
57                         .type   = CX88_VMUX_TELEVISION,
58                         .vmux   = 0,
59                         .gpio0  = 0xff00,  // internal decoder
60                 },{
61                         .type   = CX88_VMUX_DEBUG,
62                         .vmux   = 0,
63                         .gpio0  = 0xff01,  // mono from tuner chip
64                 },{
65                         .type   = CX88_VMUX_COMPOSITE1,
66                         .vmux   = 1,
67                         .gpio0  = 0xff02,
68                 },{
69                         .type   = CX88_VMUX_SVIDEO,
70                         .vmux   = 2,
71                         .gpio0  = 0xff02,
72                 }},
73                 .radio = {
74                         .type   = CX88_RADIO,
75                         .gpio0  = 0xff01,
76                 },
77         },
78         [CX88_BOARD_GDI] = {
79                 .name           = "GDI Black Gold",
80                 .tuner_type     = UNSET,
81                 .input          = {{
82                         .type   = CX88_VMUX_TELEVISION,
83                         .vmux   = 0,
84                 }},
85         },
86         [CX88_BOARD_PIXELVIEW] = {
87                 .name           = "PixelView",
88                 .tuner_type     = 5,
89                 .input          = {{
90                         .type   = CX88_VMUX_TELEVISION,
91                         .vmux   = 0,
92                         .gpio0  = 0xff00,  // internal decoder
93                 },{
94                         .type   = CX88_VMUX_COMPOSITE1,
95                         .vmux   = 1,
96                 },{
97                         .type   = CX88_VMUX_SVIDEO,
98                         .vmux   = 2,
99                 }},
100                 .radio = {
101                          .type  = CX88_RADIO,
102                          .gpio0 = 0xff10,
103                  },
104         },
105         [CX88_BOARD_ATI_WONDER_PRO] = {
106                 .name           = "ATI TV Wonder Pro",
107                 .tuner_type     = 44,
108                 .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
109                 .input          = {{
110                         .type   = CX88_VMUX_TELEVISION,
111                         .vmux   = 0,
112                         .gpio0  = 0x03ff,
113                 },{
114                         .type   = CX88_VMUX_COMPOSITE1,
115                         .vmux   = 1,
116                         .gpio0  = 0x03fe,
117                 },{
118                         .type   = CX88_VMUX_SVIDEO,
119                         .vmux   = 2,
120                         .gpio0  = 0x03fe,
121                 }},
122         },
123         [CX88_BOARD_WINFAST2000XP_EXPERT] = {
124                 .name           = "Leadtek Winfast 2000XP Expert",
125                 .tuner_type     = 44,
126                 .tda9887_conf   = TDA9887_PRESENT,
127                 .input          = {{
128                         .type   = CX88_VMUX_TELEVISION,
129                         .vmux   = 0,
130                         .gpio0  = 0x00F5e700,
131                         .gpio1  = 0x00003004,
132                         .gpio2  = 0x00F5e700,
133                         .gpio3  = 0x02000000,
134                 },{
135                         .type   = CX88_VMUX_COMPOSITE1,
136                         .vmux   = 1,
137                         .gpio0  = 0x00F5c700,
138                         .gpio1  = 0x00003004,
139                         .gpio2  = 0x00F5c700,
140                         .gpio3  = 0x02000000,
141                 },{
142                         .type   = CX88_VMUX_SVIDEO,
143                         .vmux   = 2,
144                         .gpio0  = 0x00F5c700,
145                         .gpio1  = 0x00003004,
146                         .gpio2  = 0x00F5c700,
147                         .gpio3  = 0x02000000,
148                 }},
149                 .radio = {
150                         .type   = CX88_RADIO,
151                         .gpio0  = 0x00F5d700,
152                         .gpio1  = 0x00003004,
153                         .gpio2  = 0x00F5d700,
154                         .gpio3  = 0x02000000,
155                 },
156         },
157         [CX88_BOARD_AVERTV_303] = {
158                 .name           = "AverTV Studio 303 (M126)",
159                 .tuner_type     = 38,
160                 .tda9887_conf   = TDA9887_PRESENT,
161                 .input          = {{
162                         .type   = CX88_VMUX_TELEVISION,
163                         .vmux   = 0,
164                         .gpio1  = 0x309f,
165                 },{
166                         .type   = CX88_VMUX_COMPOSITE1,
167                         .vmux   = 1,
168                         .gpio1  = 0x305f,
169                 },{
170                         .type   = CX88_VMUX_SVIDEO,
171                         .vmux   = 2,
172                         .gpio1  = 0x305f,
173                 }},
174                 .radio = {
175                         .type   = CX88_RADIO,
176                 },
177         },
178         [CX88_BOARD_MSI_TVANYWHERE_MASTER] = {
179                 // added gpio values thanks to Michal
180                 // values for PAL from DScaler
181                 .name           = "MSI TV-@nywhere Master",
182                 .tuner_type     = 33,
183                 .tda9887_conf   = TDA9887_PRESENT,
184                 .input          = {{
185                         .type   = CX88_VMUX_TELEVISION,
186                         .vmux   = 0,
187                         .gpio0  = 0x000040bf,
188                         .gpio1  = 0x000080c0,
189                         .gpio2  = 0x0000ff40,
190                 },{
191                         .type   = CX88_VMUX_COMPOSITE1,
192                         .vmux   = 1,
193                         .gpio0  = 0x000040bf,
194                         .gpio1  = 0x000080c0,
195                         .gpio2  = 0x0000ff40,
196                 },{
197                         .type   = CX88_VMUX_SVIDEO,
198                         .vmux   = 2,
199                         .gpio0  = 0x000040bf,
200                         .gpio1  = 0x000080c0,
201                         .gpio2  = 0x0000ff40,
202                 }},
203                 .radio = {
204                          .type   = CX88_RADIO,
205                 },
206         },
207         [CX88_BOARD_WINFAST_DV2000] = {
208                 .name           = "Leadtek Winfast DV2000",
209                 .tuner_type     = 38,
210                 .tda9887_conf   = TDA9887_PRESENT,
211                 .input          = {{
212                         .type   = CX88_VMUX_TELEVISION,
213                         .vmux   = 0,
214                         .gpio0  = 0x0035e700,
215                         .gpio1  = 0x00003004,
216                         .gpio2  = 0x0035e700,
217                         .gpio3  = 0x02000000,
218                 },{
219
220                         .type   = CX88_VMUX_COMPOSITE1,
221                         .vmux   = 1,
222                         .gpio0  = 0x0035c700,
223                         .gpio1  = 0x00003004,
224                         .gpio2  = 0x0035c700,
225                         .gpio3  = 0x02000000,
226                 },{
227                         .type   = CX88_VMUX_SVIDEO,
228                         .vmux   = 2,
229                         .gpio0  = 0x0035c700,
230                         .gpio1  = 0x0035c700,
231                         .gpio2  = 0x02000000,
232                         .gpio3  = 0x02000000,
233                 }},
234                 .radio = {
235                         .type   = CX88_RADIO,
236                         .gpio0  = 0x0035d700,
237                         .gpio1  = 0x00007004,
238                         .gpio2  = 0x0035d700,
239                         .gpio3  = 0x02000000,
240                  },
241         },
242         [CX88_BOARD_LEADTEK_PVR2000] = {
243                 // gpio values for PAL version from regspy by DScaler
244                 .name           = "Leadtek PVR 2000",
245                 .tuner_type     = 38,
246                 .tda9887_conf   = TDA9887_PRESENT,
247                 .input          = {{
248                         .type   = CX88_VMUX_TELEVISION,
249                         .vmux   = 0,
250                         .gpio0  = 0x0000bde6,
251                 },{
252                         .type   = CX88_VMUX_COMPOSITE1,
253                         .vmux   = 1,
254                         .gpio0  = 0x0000bde6,
255                 },{
256                         .type   = CX88_VMUX_SVIDEO,
257                         .vmux   = 2,
258                         .gpio0  = 0x0000bde6,
259                 }},
260                 .radio = {
261                         .type   = CX88_RADIO,
262                         .gpio0  = 0x0000bd62,
263                 },
264                 .blackbird = 1,
265         },
266         [CX88_BOARD_IODATA_GVVCP3PCI] = {
267                 .name           = "IODATA GV-VCP3/PCI",
268                 .tuner_type     = TUNER_ABSENT,
269                 .input          = {{
270                         .type   = CX88_VMUX_COMPOSITE1,
271                         .vmux   = 0,
272                 },{
273                         .type   = CX88_VMUX_COMPOSITE2,
274                         .vmux   = 1,
275                 },{
276                         .type   = CX88_VMUX_SVIDEO,
277                         .vmux   = 2,
278                 }},
279         },
280         [CX88_BOARD_PROLINK_PLAYTVPVR] = {
281                 .name           = "Prolink PlayTV PVR",
282                 .tuner_type     = 43,
283                 .tda9887_conf   = TDA9887_PRESENT,
284                 .input          = {{
285                         .type   = CX88_VMUX_TELEVISION,
286                         .vmux   = 0,
287                         .gpio0  = 0xff00,
288                 },{
289                         .type   = CX88_VMUX_COMPOSITE1,
290                         .vmux   = 1,
291                         .gpio0  = 0xff03,
292                 },{
293                         .type   = CX88_VMUX_SVIDEO,
294                         .vmux   = 2,
295                         .gpio0  = 0xff03,
296                 }},
297                 .radio = {
298                         .type   = CX88_RADIO,
299                         .gpio0  = 0xff00,
300                 },
301         },
302         [CX88_BOARD_ASUS_PVR_416] = {
303                 .name           = "ASUS PVR-416",
304                 .tuner_type     = 43,
305                 .tda9887_conf   = TDA9887_PRESENT,
306                 .input          = {{
307                         .type   = CX88_VMUX_TELEVISION,
308                         .vmux   = 0,
309                         .gpio0  = 0x0000fde6,
310                 },{
311                         .type   = CX88_VMUX_SVIDEO,
312                         .vmux   = 2,
313                         .gpio0  = 0x0000fde6, // 0x0000fda6 L,R RCA audio in?
314                 }},
315                 .radio = {
316                         .type   = CX88_RADIO,
317                         .gpio0  = 0x0000fde2,
318                 },
319                 .blackbird = 1,
320         },
321         [CX88_BOARD_MSI_TVANYWHERE] = {
322                 .name           = "MSI TV-@nywhere",
323                 .tuner_type     = 33,
324                 .tda9887_conf   = TDA9887_PRESENT,
325                 .input          = {{
326                         .type   = CX88_VMUX_TELEVISION,
327                         .vmux   = 0,
328                         .gpio0  = 0x00000fbf,
329                         .gpio2  = 0x0000fc08,
330                 },{
331                         .type   = CX88_VMUX_COMPOSITE1,
332                         .vmux   = 1,
333                         .gpio0  = 0x00000fbf,
334                         .gpio2  = 0x0000fc68,
335                 },{
336                         .type   = CX88_VMUX_SVIDEO,
337                         .vmux   = 2,
338                         .gpio0  = 0x00000fbf,
339                         .gpio2  = 0x0000fc68,
340                 }},
341         },
342         [CX88_BOARD_KWORLD_DVB_T] = {
343                 .name           = "KWorld/VStream XPert DVB-T",
344                 .tuner_type     = TUNER_ABSENT,
345                 .input          = {{
346                         .type   = CX88_VMUX_COMPOSITE1,
347                         .vmux   = 1,
348                         .gpio0  = 0x0700,
349                         .gpio2  = 0x0101,
350                 },{
351                         .type   = CX88_VMUX_SVIDEO,
352                         .vmux   = 2,
353                         .gpio0  = 0x0700,
354                         .gpio2  = 0x0101,
355                 }},
356                 .dvb            = 1,
357         },
358         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = {
359                 .name           = "DVICO FusionHDTV DVB-T1",
360                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
361                 .input          = {{
362                         .type   = CX88_VMUX_COMPOSITE1,
363                         .vmux   = 1,
364                         .gpio0  = 0x000027df,
365                  },{
366                         .type   = CX88_VMUX_SVIDEO,
367                         .vmux   = 2,
368                         .gpio0  = 0x000027df,
369                 }},
370                 .dvb            = 1,
371         },
372         [CX88_BOARD_KWORLD_LTV883] = {
373                 .name           = "KWorld LTV883RF",
374                 .tuner_type     = 48,
375                 .input          = {{
376                         .type   = CX88_VMUX_TELEVISION,
377                         .vmux   = 0,
378                         .gpio0  = 0x07f8,
379                 },{
380                         .type   = CX88_VMUX_DEBUG,
381                         .vmux   = 0,
382                         .gpio0  = 0x07f9,  // mono from tuner chip
383                 },{
384                         .type   = CX88_VMUX_COMPOSITE1,
385                         .vmux   = 1,
386                         .gpio0  = 0x000007fa,
387                 },{
388                         .type   = CX88_VMUX_SVIDEO,
389                         .vmux   = 2,
390                         .gpio0  = 0x000007fa,
391                 }},
392                 .radio = {
393                         .type   = CX88_RADIO,
394                         .gpio0  = 0x000007f8,
395                 },
396         },
397         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD] = {
398                 .name           = "DViCO - FusionHDTV 3 Gold",
399                 .tuner_type     = TUNER_MICROTUNE_4042FI5,
400                 /*
401                    GPIO[0] resets DT3302 DTV receiver
402                     0 - reset asserted
403                     1 - normal operation
404                    GPIO[1] mutes analog audio output connector
405                     0 - enable selected source
406                     1 - mute
407                    GPIO[2] selects source for analog audio output connector
408                     0 - analog audio input connector on tab
409                     1 - analog DAC output from CX23881 chip
410                    GPIO[3] selects RF input connector on tuner module
411                     0 - RF connector labeled CABLE
412                     1 - RF connector labeled ANT
413                 */
414                 .input          = {{
415                         .type   = CX88_VMUX_TELEVISION,
416                         .vmux   = 0,
417                         .gpio0  = 0x0f0d,
418                 },{
419                         .type   = CX88_VMUX_CABLE,
420                         .vmux   = 0,
421                         .gpio0  = 0x0f05,
422                 },{
423                         .type   = CX88_VMUX_COMPOSITE1,
424                         .vmux   = 1,
425                         .gpio0  = 0x0f00,
426                 },{
427                         .type   = CX88_VMUX_SVIDEO,
428                         .vmux   = 2,
429                         .gpio0  = 0x0f00,
430                 }},
431         },
432         [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = {
433                 .name           = "DViCO - FusionHDTV 3 Gold-T",
434                 .tuner_type     = 52, /* Thomson DDT 7611 ATSC/NTSC */
435                /*  See DViCO FusionHDTV 3 Gold for GPIO documentation.  */
436                 .input          = {{
437                         .type   = CX88_VMUX_TELEVISION,
438                         .vmux   = 0,
439                         .gpio0  = 0x0f0d,
440                 },{
441                         .type   = CX88_VMUX_CABLE,
442                         .vmux   = 0,
443                         .gpio0  = 0x0f05,
444                 },{
445                         .type   = CX88_VMUX_COMPOSITE1,
446                         .vmux   = 1,
447                         .gpio0  = 0x0f00,
448                 },{
449                         .type   = CX88_VMUX_SVIDEO,
450                         .vmux   = 2,
451                         .gpio0  = 0x0f00,
452                 }},
453         },
454         [CX88_BOARD_HAUPPAUGE_DVB_T1] = {
455                 .name           = "Hauppauge Nova-T DVB-T",
456                 .tuner_type     = TUNER_ABSENT,
457                 .input          = {{
458                         .type   = CX88_VMUX_DVB,
459                         .vmux   = 0,
460                 }},
461                 .dvb            = 1,
462         },
463         [CX88_BOARD_CONEXANT_DVB_T1] = {
464                 .name           = "Conexant DVB-T reference design",
465                 .tuner_type     = TUNER_ABSENT,
466                 .input          = {{
467                         .type   = CX88_VMUX_DVB,
468                         .vmux   = 0,
469                 }},
470                 .dvb            = 1,
471         },
472         [CX88_BOARD_PROVIDEO_PV259] = {
473                 .name           = "Provideo PV259",
474                 .tuner_type     = TUNER_PHILIPS_FQ1216ME,
475                 .input          = {{
476                         .type   = CX88_VMUX_TELEVISION,
477                         .vmux   = 0,
478                 }},
479                 .blackbird = 1,
480         },
481         [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
482                 .name           = "DVICO FusionHDTV DVB-T Plus",
483                 .tuner_type     = TUNER_ABSENT, /* No analog tuner */
484                 .input          = {{
485                         .type   = CX88_VMUX_COMPOSITE1,
486                         .vmux   = 1,
487                         .gpio0  = 0x000027df,
488                  },{
489                         .type   = CX88_VMUX_SVIDEO,
490                         .vmux   = 2,
491                         .gpio0  = 0x000027df,
492                 }},
493                 .dvb            = 1,
494         },
495         [CX88_BOARD_DNTV_LIVE_DVB_T] = {
496                 .name           = "digitalnow DNTV Live! DVB-T",
497                 .tuner_type     = TUNER_ABSENT,
498                 .input          = {{
499                         .type   = CX88_VMUX_COMPOSITE1,
500                         .vmux   = 1,
501                         .gpio0  = 0x00000700,
502                         .gpio2  = 0x00000101,
503                 },{
504                         .type   = CX88_VMUX_SVIDEO,
505                         .vmux   = 2,
506                         .gpio0  = 0x00000700,
507                         .gpio2  = 0x00000101,
508                 }},
509                 .dvb            = 1,
510         },
511         [CX88_BOARD_PCHDTV_HD3000] = {
512                 .name           = "pcHDTV HD3000 HDTV",
513                 .tuner_type     = TUNER_THOMSON_DTT7610,
514                 .input          = {{
515                         .type   = CX88_VMUX_TELEVISION,
516                         .vmux   = 0,
517                         .gpio0  = 0x00008484,
518                         .gpio1  = 0x00000000,
519                         .gpio2  = 0x00000000,
520                         .gpio3  = 0x00000000,
521                 },{
522                         .type   = CX88_VMUX_COMPOSITE1,
523                         .vmux   = 1,
524                         .gpio0  = 0x00008400,
525                         .gpio1  = 0x00000000,
526                         .gpio2  = 0x00000000,
527                         .gpio3  = 0x00000000,
528                 },{
529                         .type   = CX88_VMUX_SVIDEO,
530                         .vmux   = 2,
531                         .gpio0  = 0x00008400,
532                         .gpio1  = 0x00000000,
533                         .gpio2  = 0x00000000,
534                         .gpio3  = 0x00000000,
535                 }},
536                 .radio = {
537                         .type   = CX88_RADIO,
538                         .vmux   = 2,
539                         .gpio0  = 0x00008400,
540                         .gpio1  = 0x00000000,
541                         .gpio2  = 0x00000000,
542                         .gpio3  = 0x00000000,
543                 },
544                 .dvb            = 1,
545         },
546         [CX88_BOARD_HAUPPAUGE_ROSLYN] = {
547                 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu>
548                 // GPIO values obtained from regspy, courtesy Sean Covel
549                 .name        = "Hauppauge WinTV 28xxx (Roslyn) models",
550                 .tuner_type  = UNSET,
551                 .input          = {{
552                         .type   = CX88_VMUX_TELEVISION,
553                         .vmux   = 0,
554                         .gpio0  = 0xed12,  // internal decoder
555                         .gpio2  = 0x00ff,
556                 },{
557                         .type   = CX88_VMUX_DEBUG,
558                         .vmux   = 0,
559                         .gpio0  = 0xff01,  // mono from tuner chip
560                 },{
561                         .type   = CX88_VMUX_COMPOSITE1,
562                         .vmux   = 1,
563                         .gpio0  = 0xff02,
564                 },{
565                         .type   = CX88_VMUX_SVIDEO,
566                         .vmux   = 2,
567                         .gpio0  = 0xed92,
568                         .gpio2  = 0x00ff,
569                 }},
570                 .radio = {
571                          .type   = CX88_RADIO,
572                          .gpio0  = 0xed96,
573                          .gpio2  = 0x00ff,
574                  },
575                 .blackbird = 1,
576         },
577         [CX88_BOARD_DIGITALLOGIC_MEC] = {
578                 /* params copied over from Leadtek PVR 2000 */
579                 .name           = "Digital-Logic MICROSPACE Entertainment Center (MEC)",
580                 /* not sure yet about the tuner type */
581                 .tuner_type     = 38,
582                 .tda9887_conf   = TDA9887_PRESENT,
583                 .input          = {{
584                         .type   = CX88_VMUX_TELEVISION,
585                         .vmux   = 0,
586                         .gpio0  = 0x0000bde6,
587                 },{
588                         .type   = CX88_VMUX_COMPOSITE1,
589                         .vmux   = 1,
590                         .gpio0  = 0x0000bde6,
591                 },{
592                         .type   = CX88_VMUX_SVIDEO,
593                         .vmux   = 2,
594                         .gpio0  = 0x0000bde6,
595                 }},
596                 .radio = {
597                         .type   = CX88_RADIO,
598                         .gpio0  = 0x0000bd62,
599                 },
600                 .blackbird = 1,
601         },
602         [CX88_BOARD_IODATA_GVBCTV7E] = {
603                 .name           = "IODATA GV/BCTV7E",
604                 .tuner_type     = TUNER_PHILIPS_FQ1286,
605                 .tda9887_conf   = TDA9887_PRESENT,
606                 .input          = {{
607                         .type   = CX88_VMUX_TELEVISION,
608                         .vmux   = 1,
609                         .gpio1  = 0x0000e03f,
610                 },{
611                         .type   = CX88_VMUX_COMPOSITE1,
612                         .vmux   = 2,
613                         .gpio1  = 0x0000e07f,
614                 },{
615                         .type   = CX88_VMUX_SVIDEO,
616                         .vmux   = 3,
617                         .gpio1  = 0x0000e07f,
618                 }}
619         },
620         [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = {
621                 .name           = "PixelView PlayTV Ultra Pro (Stereo)",
622                 .tuner_type     = 38,
623                 .input          = {{
624                         .type   = CX88_VMUX_TELEVISION,
625                         .vmux   = 0,
626                         .gpio0  = 0xbf61,  // internal decoder
627                 },{
628                         .type   = CX88_VMUX_COMPOSITE1,
629                         .vmux   = 1,
630                         .gpio0  = 0xbf63,
631                 },{
632                         .type   = CX88_VMUX_SVIDEO,
633                         .vmux   = 2,
634                         .gpio0  = 0xbf63,
635                 }},
636                 .radio = {
637                         .type  = CX88_RADIO,
638                         .gpio0 = 0xbf60,
639                 },
640         },
641 };
642 const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
643
644 /* ------------------------------------------------------------------ */
645 /* PCI subsystem IDs                                                  */
646
647 struct cx88_subid cx88_subids[] = {
648         {
649                 .subvendor = 0x0070,
650                 .subdevice = 0x3400,
651                 .card      = CX88_BOARD_HAUPPAUGE,
652         },{
653                 .subvendor = 0x0070,
654                 .subdevice = 0x3401,
655                 .card      = CX88_BOARD_HAUPPAUGE,
656         },{
657                 .subvendor = 0x14c7,
658                 .subdevice = 0x0106,
659                 .card      = CX88_BOARD_GDI,
660         },{
661                 .subvendor = 0x14c7,
662                 .subdevice = 0x0107, /* with mpeg encoder */
663                 .card      = CX88_BOARD_GDI,
664         },{
665                 .subvendor = PCI_VENDOR_ID_ATI,
666                 .subdevice = 0x00f8,
667                 .card      = CX88_BOARD_ATI_WONDER_PRO,
668         },{
669                 .subvendor = 0x107d,
670                 .subdevice = 0x6611,
671                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
672         },{
673                 .subvendor = 0x107d,
674                 .subdevice = 0x6613,    /* NTSC */
675                 .card      = CX88_BOARD_WINFAST2000XP_EXPERT,
676         },{
677                 .subvendor = 0x107d,
678                 .subdevice = 0x6620,
679                 .card      = CX88_BOARD_WINFAST_DV2000,
680         },{
681                 .subvendor = 0x107d,
682                 .subdevice = 0x663b,
683                 .card      = CX88_BOARD_LEADTEK_PVR2000,
684         },{
685                 .subvendor = 0x107d,
686                 .subdevice = 0x663C,
687                 .card      = CX88_BOARD_LEADTEK_PVR2000,
688         },{
689                 .subvendor = 0x1461,
690                 .subdevice = 0x000b,
691                 .card      = CX88_BOARD_AVERTV_303,
692         },{
693                 .subvendor = 0x1462,
694                 .subdevice = 0x8606,
695                 .card      = CX88_BOARD_MSI_TVANYWHERE_MASTER,
696         },{
697                 .subvendor = 0x10fc,
698                 .subdevice = 0xd003,
699                 .card      = CX88_BOARD_IODATA_GVVCP3PCI,
700         },{
701                 .subvendor = 0x1043,
702                 .subdevice = 0x4823,  /* with mpeg encoder */
703                 .card      = CX88_BOARD_ASUS_PVR_416,
704         },{
705                 .subvendor = 0x17de,
706                 .subdevice = 0x08a6,
707                 .card      = CX88_BOARD_KWORLD_DVB_T,
708         },{
709                 .subvendor = 0x18ac,
710                 .subdevice = 0xd810,
711                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD,
712         },{
713                 .subvendor = 0x18ac,
714                 .subdevice = 0xd820,
715                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T,
716         },{
717                 .subvendor = 0x18AC,
718                 .subdevice = 0xDB00,
719                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1,
720         },{
721                 .subvendor = 0x0070,
722                 .subdevice = 0x9002,
723                 .card      = CX88_BOARD_HAUPPAUGE_DVB_T1,
724         },{
725                 .subvendor = 0x14f1,
726                 .subdevice = 0x0187,
727                 .card      = CX88_BOARD_CONEXANT_DVB_T1,
728         },{
729                 .subvendor = 0x1540,
730                 .subdevice = 0x2580,
731                 .card      = CX88_BOARD_PROVIDEO_PV259,
732         },{
733                 .subvendor = 0x18AC,
734                 .subdevice = 0xDB10,
735                 .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
736         },{
737                 .subvendor = 0x1554,
738                 .subdevice = 0x4811,
739                 .card      = CX88_BOARD_PIXELVIEW,
740         },{
741                 .subvendor = 0x7063,
742                 .subdevice = 0x3000, /* HD-3000 card */
743                 .card      = CX88_BOARD_PCHDTV_HD3000,
744         },{
745                 .subvendor = 0x17DE,
746                 .subdevice = 0xA8A6,
747                 .card      = CX88_BOARD_DNTV_LIVE_DVB_T,
748         },{
749                 .subvendor = 0x0070,
750                 .subdevice = 0x2801,
751                 .card      = CX88_BOARD_HAUPPAUGE_ROSLYN,
752         },{
753                 .subvendor = 0x14F1,
754                 .subdevice = 0x0342,
755                 .card      = CX88_BOARD_DIGITALLOGIC_MEC,
756         },{
757                 .subvendor = 0x10fc,
758                 .subdevice = 0xd035,
759                 .card      = CX88_BOARD_IODATA_GVBCTV7E,
760         }
761 };
762 const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
763
764 /* ----------------------------------------------------------------------- */
765 /* some leadtek specific stuff                                             */
766
767 static void __devinit leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
768 {
769         /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
770          * any others.
771          *
772          * Byte 0 is 1 on the NTSC board.
773          */
774
775         if (eeprom_data[4] != 0x7d ||
776             eeprom_data[5] != 0x10 ||
777             eeprom_data[7] != 0x66) {
778                 printk(KERN_WARNING "%s: Leadtek eeprom invalid.\n",
779                        core->name);
780                 return;
781         }
782
783         core->has_radio  = 1;
784         core->tuner_type = (eeprom_data[6] == 0x13) ? 43 : 38;
785
786         printk(KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: "
787                "tuner=%d, eeprom[0]=0x%02x\n",
788                core->name, core->tuner_type, eeprom_data[0]);
789 }
790
791
792 /* ----------------------------------------------------------------------- */
793
794 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
795 {
796         struct tveeprom tv;
797
798         tveeprom_hauppauge_analog(&tv, eeprom_data);
799         core->tuner_type = tv.tuner_type;
800         core->has_radio  = tv.has_radio;
801 }
802
803 static int hauppauge_eeprom_dvb(struct cx88_core *core, u8 *ee)
804 {
805         int model;
806         int tuner;
807
808         /* Make sure we support the board model */
809         model = ee[0x1f] << 24 | ee[0x1e] << 16 | ee[0x1d] << 8 | ee[0x1c];
810         switch(model) {
811         case 90002:
812         case 90500:
813         case 90501:
814                 /* known */
815                 break;
816         default:
817                 printk("%s: warning: unknown hauppauge model #%d\n",
818                        core->name, model);
819                 break;
820         }
821
822         /* Make sure we support the tuner */
823         tuner = ee[0x2d];
824         switch(tuner) {
825         case 0x4B: /* dtt 7595 */
826         case 0x4C: /* dtt 7592 */
827                 break;
828         default:
829                 printk("%s: error: unknown hauppauge tuner 0x%02x\n",
830                        core->name, tuner);
831                 return -ENODEV;
832         }
833         printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%d\n",
834                core->name, model, tuner);
835         return 0;
836 }
837
838 /* ----------------------------------------------------------------------- */
839 /* some GDI (was: Modular Technology) specific stuff                       */
840
841 static struct {
842         int  id;
843         int  fm;
844         char *name;
845 } gdi_tuner[] = {
846         [ 0x01 ] = { .id   = TUNER_ABSENT,
847                      .name = "NTSC_M" },
848         [ 0x02 ] = { .id   = TUNER_ABSENT,
849                      .name = "PAL_B" },
850         [ 0x03 ] = { .id   = TUNER_ABSENT,
851                      .name = "PAL_I" },
852         [ 0x04 ] = { .id   = TUNER_ABSENT,
853                      .name = "PAL_D" },
854         [ 0x05 ] = { .id   = TUNER_ABSENT,
855                      .name = "SECAM" },
856
857         [ 0x10 ] = { .id   = TUNER_ABSENT,
858                      .fm   = 1,
859                      .name = "TEMIC_4049" },
860         [ 0x11 ] = { .id   = TUNER_TEMIC_4136FY5,
861                      .name = "TEMIC_4136" },
862         [ 0x12 ] = { .id   = TUNER_ABSENT,
863                      .name = "TEMIC_4146" },
864
865         [ 0x20 ] = { .id   = TUNER_PHILIPS_FQ1216ME,
866                      .fm   = 1,
867                      .name = "PHILIPS_FQ1216_MK3" },
868         [ 0x21 ] = { .id   = TUNER_ABSENT, .fm = 1,
869                      .name = "PHILIPS_FQ1236_MK3" },
870         [ 0x22 ] = { .id   = TUNER_ABSENT,
871                      .name = "PHILIPS_FI1236_MK3" },
872         [ 0x23 ] = { .id   = TUNER_ABSENT,
873                      .name = "PHILIPS_FI1216_MK3" },
874 };
875
876 static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
877 {
878         char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
879                 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
880
881         printk(KERN_INFO "%s: GDI: tuner=%s\n", core->name,
882                name ? name : "unknown");
883         if (NULL == name)
884                 return;
885         core->tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
886         core->has_radio  = gdi_tuner[eeprom_data[0x0d]].fm;
887 }
888
889 /* ----------------------------------------------------------------------- */
890
891 void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
892 {
893         int i;
894
895         if (0 == pci->subsystem_vendor &&
896             0 == pci->subsystem_device) {
897                 printk("%s: Your board has no valid PCI Subsystem ID and thus can't\n"
898                        "%s: be autodetected.  Please pass card=<n> insmod option to\n"
899                        "%s: workaround that.  Redirect complaints to the vendor of\n"
900                        "%s: the TV card.  Best regards,\n"
901                        "%s:         -- tux\n",
902                        core->name,core->name,core->name,core->name,core->name);
903         } else {
904                 printk("%s: Your board isn't known (yet) to the driver.  You can\n"
905                        "%s: try to pick one of the existing card configs via\n"
906                        "%s: card=<n> insmod option.  Updating to the latest\n"
907                        "%s: version might help as well.\n",
908                        core->name,core->name,core->name,core->name);
909         }
910         printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n",
911                core->name);
912         for (i = 0; i < cx88_bcount; i++)
913                 printk("%s:    card=%d -> %s\n",
914                        core->name, i, cx88_boards[i].name);
915 }
916
917 void cx88_card_setup(struct cx88_core *core)
918 {
919         static u8 eeprom[128];
920
921         if (0 == core->i2c_rc) {
922                 core->i2c_client.addr = 0xa0 >> 1;
923                 tveeprom_read(&core->i2c_client,eeprom,sizeof(eeprom));
924         }
925
926         switch (core->board) {
927         case CX88_BOARD_HAUPPAUGE:
928         case CX88_BOARD_HAUPPAUGE_ROSLYN:
929                 if (0 == core->i2c_rc)
930                         hauppauge_eeprom(core,eeprom+8);
931                 break;
932         case CX88_BOARD_GDI:
933                 if (0 == core->i2c_rc)
934                         gdi_eeprom(core,eeprom);
935                 break;
936         case CX88_BOARD_WINFAST2000XP_EXPERT:
937                 if (0 == core->i2c_rc)
938                         leadtek_eeprom(core,eeprom);
939                 break;
940         case CX88_BOARD_HAUPPAUGE_DVB_T1:
941                 if (0 == core->i2c_rc)
942                         hauppauge_eeprom_dvb(core,eeprom);
943                 break;
944         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
945         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
946                 /* GPIO0:0 is hooked to mt352 reset pin */
947                 cx_set(MO_GP0_IO, 0x00000101);
948                 cx_clear(MO_GP0_IO, 0x00000001);
949                 msleep(1);
950                 cx_set(MO_GP0_IO, 0x00000101);
951                 break;
952         case CX88_BOARD_KWORLD_DVB_T:
953         case CX88_BOARD_DNTV_LIVE_DVB_T:
954                 cx_set(MO_GP0_IO, 0x00000707);
955                 cx_set(MO_GP2_IO, 0x00000101);
956                 cx_clear(MO_GP2_IO, 0x00000001);
957                 msleep(1);
958                 cx_clear(MO_GP0_IO, 0x00000007);
959                 cx_set(MO_GP2_IO, 0x00000101);
960                 break;
961         }
962         if (cx88_boards[core->board].radio.type == CX88_RADIO)
963                 core->has_radio = 1;
964 }
965
966 /* ------------------------------------------------------------------ */
967
968 EXPORT_SYMBOL(cx88_boards);
969 EXPORT_SYMBOL(cx88_bcount);
970 EXPORT_SYMBOL(cx88_subids);
971 EXPORT_SYMBOL(cx88_idcount);
972 EXPORT_SYMBOL(cx88_card_list);
973 EXPORT_SYMBOL(cx88_card_setup);
974
975 /*
976  * Local variables:
977  * c-basic-offset: 8
978  * End:
979  */