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