2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
5 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6 Markus Rechberger <mrechberger@gmail.com>
7 Mauro Carvalho Chehab <mchehab@infradead.org>
8 Sascha Sommer <saschasommer@freenet.de>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <linux/init.h>
26 #include <linux/module.h>
27 #include <linux/delay.h>
28 #include <linux/i2c.h>
29 #include <linux/usb.h>
30 #include <media/tuner.h>
31 #include <media/msp3400.h>
32 #include <media/saa7115.h>
33 #include <media/tvp5150.h>
34 #include <media/tveeprom.h>
35 #include <media/audiochip.h>
36 #include <media/v4l2-common.h>
40 static int tuner = -1;
41 module_param(tuner, int, 0444);
42 MODULE_PARM_DESC(tuner, "tuner type");
44 static unsigned int disable_ir;
45 module_param(disable_ir, int, 0444);
46 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
48 struct em28xx_hash_table {
54 struct em28xx_board em28xx_boards[] = {
55 [EM2800_BOARD_UNKNOWN] = {
56 .name = "Unknown EM2800 video grabber",
59 .tda9887_conf = TDA9887_PRESENT,
60 .decoder = EM28XX_SAA7113,
62 .type = EM28XX_VMUX_COMPOSITE1,
63 .vmux = SAA7115_COMPOSITE0,
66 .type = EM28XX_VMUX_SVIDEO,
67 .vmux = SAA7115_SVIDEO3,
71 [EM2820_BOARD_UNKNOWN] = {
72 .name = "Unknown EM2750/28xx video grabber",
74 .tuner_type = TUNER_ABSENT,
76 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
77 .name = "Kworld PVR TV 2800 RF",
80 .tuner_type = TUNER_TEMIC_PAL,
81 .tda9887_conf = TDA9887_PRESENT,
82 .decoder = EM28XX_SAA7113,
84 .type = EM28XX_VMUX_COMPOSITE1,
85 .vmux = SAA7115_COMPOSITE0,
88 .type = EM28XX_VMUX_SVIDEO,
89 .vmux = SAA7115_SVIDEO3,
93 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
94 .name = "Terratec Cinergy 250 USB",
96 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
97 .tda9887_conf = TDA9887_PRESENT,
98 .decoder = EM28XX_SAA7113,
100 .type = EM28XX_VMUX_TELEVISION,
101 .vmux = SAA7115_COMPOSITE2,
104 .type = EM28XX_VMUX_COMPOSITE1,
105 .vmux = SAA7115_COMPOSITE0,
108 .type = EM28XX_VMUX_SVIDEO,
109 .vmux = SAA7115_SVIDEO3,
113 [EM2820_BOARD_PINNACLE_USB_2] = {
114 .name = "Pinnacle PCTV USB 2",
116 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
117 .tda9887_conf = TDA9887_PRESENT,
118 .decoder = EM28XX_SAA7113,
120 .type = EM28XX_VMUX_TELEVISION,
121 .vmux = SAA7115_COMPOSITE2,
124 .type = EM28XX_VMUX_COMPOSITE1,
125 .vmux = SAA7115_COMPOSITE0,
128 .type = EM28XX_VMUX_SVIDEO,
129 .vmux = SAA7115_SVIDEO3,
133 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
134 .name = "Hauppauge WinTV USB 2",
136 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
137 .tda9887_conf = TDA9887_PRESENT |
138 TDA9887_PORT1_ACTIVE|
139 TDA9887_PORT2_ACTIVE,
140 .decoder = EM28XX_TVP5150,
142 /*FIXME: S-Video not tested */
144 .type = EM28XX_VMUX_TELEVISION,
145 .vmux = TVP5150_COMPOSITE0,
146 .amux = MSP_INPUT_DEFAULT,
148 .type = EM28XX_VMUX_SVIDEO,
149 .vmux = TVP5150_SVIDEO,
150 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
151 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
154 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
155 .name = "Hauppauge WinTV HVR 900",
157 .tda9887_conf = TDA9887_PRESENT,
158 .tuner_type = TUNER_XC2028,
160 .decoder = EM28XX_TVP5150,
162 .type = EM28XX_VMUX_TELEVISION,
163 .vmux = TVP5150_COMPOSITE0,
166 .type = EM28XX_VMUX_COMPOSITE1,
167 .vmux = TVP5150_COMPOSITE1,
170 .type = EM28XX_VMUX_SVIDEO,
171 .vmux = TVP5150_SVIDEO,
175 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
176 .name = "Hauppauge WinTV HVR 950",
178 .tda9887_conf = TDA9887_PRESENT,
179 .tuner_type = TUNER_XC2028,
183 .decoder = EM28XX_TVP5150,
185 .type = EM28XX_VMUX_TELEVISION,
186 .vmux = TVP5150_COMPOSITE0,
189 .type = EM28XX_VMUX_COMPOSITE1,
190 .vmux = TVP5150_COMPOSITE1,
193 .type = EM28XX_VMUX_SVIDEO,
194 .vmux = TVP5150_SVIDEO,
198 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
199 .name = "Terratec Hybrid XS",
201 .tda9887_conf = TDA9887_PRESENT,
202 .tuner_type = TUNER_XC2028,
203 .decoder = EM28XX_TVP5150,
205 .type = EM28XX_VMUX_TELEVISION,
206 .vmux = TVP5150_COMPOSITE0,
209 .type = EM28XX_VMUX_COMPOSITE1,
210 .vmux = TVP5150_COMPOSITE1,
213 .type = EM28XX_VMUX_SVIDEO,
214 .vmux = TVP5150_SVIDEO,
218 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
219 as Prodigy XS with a different PID, let's keep it separated for now
220 maybe we'll need it lateron */
221 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
222 .name = "Terratec Prodigy XS",
224 .tda9887_conf = TDA9887_PRESENT,
225 .tuner_type = TUNER_XC2028,
226 .decoder = EM28XX_TVP5150,
228 .type = EM28XX_VMUX_TELEVISION,
229 .vmux = TVP5150_COMPOSITE0,
232 .type = EM28XX_VMUX_COMPOSITE1,
233 .vmux = TVP5150_COMPOSITE1,
236 .type = EM28XX_VMUX_SVIDEO,
237 .vmux = TVP5150_SVIDEO,
241 [EM2820_BOARD_MSI_VOX_USB_2] = {
242 .name = "MSI VOX USB 2.0",
244 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
245 .tda9887_conf = TDA9887_PRESENT |
246 TDA9887_PORT1_ACTIVE |
247 TDA9887_PORT2_ACTIVE,
248 .max_range_640_480 = 1,
250 .decoder = EM28XX_SAA7114,
252 .type = EM28XX_VMUX_TELEVISION,
253 .vmux = SAA7115_COMPOSITE4,
256 .type = EM28XX_VMUX_COMPOSITE1,
257 .vmux = SAA7115_COMPOSITE0,
260 .type = EM28XX_VMUX_SVIDEO,
261 .vmux = SAA7115_SVIDEO3,
265 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
266 .name = "Terratec Cinergy 200 USB",
269 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
270 .tda9887_conf = TDA9887_PRESENT,
271 .decoder = EM28XX_SAA7113,
273 .type = EM28XX_VMUX_TELEVISION,
274 .vmux = SAA7115_COMPOSITE2,
277 .type = EM28XX_VMUX_COMPOSITE1,
278 .vmux = SAA7115_COMPOSITE0,
281 .type = EM28XX_VMUX_SVIDEO,
282 .vmux = SAA7115_SVIDEO3,
286 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
287 .name = "Leadtek Winfast USB II",
290 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
291 .tda9887_conf = TDA9887_PRESENT,
292 .decoder = EM28XX_SAA7113,
294 .type = EM28XX_VMUX_TELEVISION,
295 .vmux = SAA7115_COMPOSITE2,
298 .type = EM28XX_VMUX_COMPOSITE1,
299 .vmux = SAA7115_COMPOSITE0,
302 .type = EM28XX_VMUX_SVIDEO,
303 .vmux = SAA7115_SVIDEO3,
307 [EM2800_BOARD_KWORLD_USB2800] = {
308 .name = "Kworld USB2800",
311 .tuner_type = TUNER_PHILIPS_FCV1236D,
312 .tda9887_conf = TDA9887_PRESENT,
313 .decoder = EM28XX_SAA7113,
315 .type = EM28XX_VMUX_TELEVISION,
316 .vmux = SAA7115_COMPOSITE2,
319 .type = EM28XX_VMUX_COMPOSITE1,
320 .vmux = SAA7115_COMPOSITE0,
323 .type = EM28XX_VMUX_SVIDEO,
324 .vmux = SAA7115_SVIDEO3,
328 [EM2820_BOARD_PINNACLE_DVC_90] = {
329 .name = "Pinnacle Dazzle DVC 90/DVC 100",
331 .tuner_type = TUNER_ABSENT,
332 .decoder = EM28XX_SAA7113,
334 .type = EM28XX_VMUX_COMPOSITE1,
335 .vmux = SAA7115_COMPOSITE0,
338 .type = EM28XX_VMUX_SVIDEO,
339 .vmux = SAA7115_SVIDEO3,
343 [EM2800_BOARD_VGEAR_POCKETTV] = {
344 .name = "V-Gear PocketTV",
347 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
348 .tda9887_conf = TDA9887_PRESENT,
349 .decoder = EM28XX_SAA7113,
351 .type = EM28XX_VMUX_TELEVISION,
352 .vmux = SAA7115_COMPOSITE2,
355 .type = EM28XX_VMUX_COMPOSITE1,
356 .vmux = SAA7115_COMPOSITE0,
359 .type = EM28XX_VMUX_SVIDEO,
360 .vmux = SAA7115_SVIDEO3,
364 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
365 .name = "Pixelview Prolink PlayTV USB 2.0",
367 .tda9887_conf = TDA9887_PRESENT,
368 .tuner_type = TUNER_YMEC_TVF_5533MF,
369 .decoder = EM28XX_SAA7113,
371 .type = EM28XX_VMUX_TELEVISION,
372 .vmux = SAA7115_COMPOSITE2,
373 .amux = EM28XX_AMUX_LINE_IN,
375 .type = EM28XX_VMUX_COMPOSITE1,
376 .vmux = SAA7115_COMPOSITE0,
377 .amux = EM28XX_AMUX_LINE_IN,
379 .type = EM28XX_VMUX_SVIDEO,
380 .vmux = SAA7115_SVIDEO3,
381 .amux = EM28XX_AMUX_LINE_IN,
385 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
387 /* table of devices that work with this driver */
388 struct usb_device_id em28xx_id_table [] = {
389 { USB_DEVICE(0xeb1a, 0x2750),
390 .driver_info = EM2820_BOARD_UNKNOWN },
391 { USB_DEVICE(0xeb1a, 0x2800),
392 .driver_info = EM2800_BOARD_UNKNOWN },
393 { USB_DEVICE(0xeb1a, 0x2820),
394 .driver_info = EM2820_BOARD_UNKNOWN },
395 { USB_DEVICE(0xeb1a, 0x2821),
396 .driver_info = EM2820_BOARD_UNKNOWN },
397 { USB_DEVICE(0xeb1a, 0x2860),
398 .driver_info = EM2820_BOARD_UNKNOWN },
399 { USB_DEVICE(0xeb1a, 0x2861),
400 .driver_info = EM2820_BOARD_UNKNOWN },
401 { USB_DEVICE(0xeb1a, 0x2870),
402 .driver_info = EM2820_BOARD_UNKNOWN },
403 { USB_DEVICE(0xeb1a, 0x2881),
404 .driver_info = EM2820_BOARD_UNKNOWN },
405 { USB_DEVICE(0xeb1a, 0x2883),
406 .driver_info = EM2820_BOARD_UNKNOWN },
407 { USB_DEVICE(0x0ccd, 0x0036),
408 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
409 { USB_DEVICE(0x2304, 0x0208),
410 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
411 { USB_DEVICE(0x2040, 0x4200),
412 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
413 { USB_DEVICE(0x2040, 0x4201),
414 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
415 { USB_DEVICE(0x2304, 0x0207),
416 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
417 { USB_DEVICE(0x2304, 0x021a),
418 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
419 { USB_DEVICE(0x2040, 0x6500),
420 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
421 { USB_DEVICE(0x2040, 0x6502),
422 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
423 { USB_DEVICE(0x2040, 0x6513),
424 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 },
425 { USB_DEVICE(0x0ccd, 0x0042),
426 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
427 { USB_DEVICE(0x0ccd, 0x0047),
428 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
431 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
434 * Reset sequences for analog/digital modes
437 /* Board Hauppauge WinTV HVR 900 analog */
438 struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
444 /* Board Hauppauge WinTV HVR 900 digital */
445 struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
455 * EEPROM hash table for devices with generic USB IDs
457 static struct em28xx_hash_table em28xx_eeprom_hash [] = {
458 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
459 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
462 /* I2C devicelist hash table for devices with generic USB IDs */
463 static struct em28xx_hash_table em28xx_i2c_hash[] = {
464 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
465 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
468 int em28xx_tuner_callback(void *ptr, int command, int arg)
471 struct em28xx *dev = ptr;
472 struct em28xx_reg_seq *gpio;
474 if (dev->tuner_type != TUNER_XC2028)
477 if (command != XC2028_TUNER_RESET)
480 if (dev->mode == EM28XX_ANALOG_MODE)
481 gpio = dev->analog_gpio;
483 gpio = dev->digital_gpio;
485 /* djh - Not sure if these are still required */
486 dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
487 if (dev->mode == EM28XX_ANALOG_MODE)
488 dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1);
490 dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x37", 1);
496 /* Send GPIO reset sequences specified at board entry */
497 while (gpio->sleep >= 0) {
499 rc = dev->em28xx_write_regs(dev,
509 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
511 static void em28xx_set_model(struct em28xx *dev)
513 dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
514 dev->has_msp34xx = em28xx_boards[dev->model].has_msp34xx;
515 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
516 dev->decoder = em28xx_boards[dev->model].decoder;
517 dev->video_inputs = em28xx_boards[dev->model].vchannels;
518 dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
519 dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
520 dev->has_dvb = em28xx_boards[dev->model].has_dvb;
523 /* Since em28xx_pre_card_setup() requires a proper dev->model,
524 * this won't work for boards with generic PCI IDs
526 void em28xx_pre_card_setup(struct em28xx *dev)
528 em28xx_set_model(dev);
530 /* request some modules */
531 switch (dev->model) {
532 case EM2880_BOARD_TERRATEC_PRODIGY_XS:
533 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
534 case EM2880_BOARD_TERRATEC_HYBRID_XS:
535 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
536 em28xx_write_regs(dev, XCLK_REG, "\x27", 1);
537 em28xx_write_regs(dev, I2C_CLK_REG, "\x40", 1);
538 em28xx_write_regs(dev, 0x08, "\xff", 1);
539 em28xx_write_regs(dev, 0x04, "\x00", 1);
541 em28xx_write_regs(dev, 0x04, "\x08", 1);
543 em28xx_write_regs(dev, 0x08, "\xff", 1);
545 em28xx_write_regs(dev, 0x08, "\x2d", 1);
547 em28xx_write_regs(dev, 0x08, "\x3d", 1);
549 dev->analog_gpio = hauppauge_wintv_hvr_900_analog;
550 dev->digital_gpio = hauppauge_wintv_hvr_900_digital;
556 void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
558 memset(ctl, 0, sizeof(*ctl));
560 ctl->fname = XC2028_DEFAULT_FIRMWARE;
562 ctl->mts = em28xx_boards[dev->model].mts_firmware;
564 switch (dev->model) {
565 /* Add card-specific parameters for xc3028 here */
566 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
567 ctl->demod = XC3028_FE_DEFAULT;
570 ctl->demod = XC3028_FE_OREN538;
573 EXPORT_SYMBOL_GPL(em28xx_setup_xc3028);
575 static void em28xx_config_tuner(struct em28xx *dev)
577 struct v4l2_priv_tun_config xc2028_cfg;
578 struct tuner_setup tun_setup;
579 struct v4l2_frequency f;
581 if (dev->tuner_type == TUNER_ABSENT)
584 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
585 tun_setup.type = dev->tuner_type;
586 tun_setup.addr = dev->tuner_addr;
587 tun_setup.tuner_callback = em28xx_tuner_callback;
589 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
591 if (dev->tuner_type == TUNER_XC2028) {
592 struct xc2028_ctrl ctl;
594 em28xx_setup_xc3028(dev, &ctl);
596 xc2028_cfg.tuner = TUNER_XC2028;
597 xc2028_cfg.priv = &ctl;
599 em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
602 /* configure tuner */
604 f.type = V4L2_TUNER_ANALOG_TV;
605 f.frequency = 9076; /* just a magic number */
606 dev->ctl_freq = f.frequency;
607 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
610 static int em28xx_hint_board(struct em28xx *dev)
614 /* HINT method: EEPROM
616 * This method works only for boards with eeprom.
617 * Uses a hash of all eeprom bytes. The hash should be
618 * unique for a vendor/tuner pair.
619 * There are a high chance that tuners for different
620 * video standards produce different hashes.
622 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
623 if (dev->hash == em28xx_eeprom_hash[i].hash) {
624 dev->model = em28xx_eeprom_hash[i].model;
625 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
627 em28xx_errdev("Your board has no unique USB ID.\n");
628 em28xx_errdev("A hint were successfully done, "
629 "based on eeprom hash.\n");
630 em28xx_errdev("This method is not 100%% failproof.\n");
631 em28xx_errdev("If the board were missdetected, "
632 "please email this log to:\n");
633 em28xx_errdev("\tV4L Mailing List "
634 " <video4linux-list@redhat.com>\n");
635 em28xx_errdev("Board detected as %s\n",
636 em28xx_boards[dev->model].name);
642 /* HINT method: I2C attached devices
644 * This method works for all boards.
645 * Uses a hash of i2c scanned devices.
646 * Devices with the same i2c attached chips will
647 * be considered equal.
648 * This method is less precise than the eeprom one.
651 /* user did not request i2c scanning => do it now */
653 em28xx_do_i2c_scan(dev);
655 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
656 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
657 dev->model = em28xx_i2c_hash[i].model;
658 dev->tuner_type = em28xx_i2c_hash[i].tuner;
659 em28xx_errdev("Your board has no unique USB ID.\n");
660 em28xx_errdev("A hint were successfully done, "
661 "based on i2c devicelist hash.\n");
662 em28xx_errdev("This method is not 100%% failproof.\n");
663 em28xx_errdev("If the board were missdetected, "
664 "please email this log to:\n");
665 em28xx_errdev("\tV4L Mailing List "
666 " <video4linux-list@redhat.com>\n");
667 em28xx_errdev("Board detected as %s\n",
668 em28xx_boards[dev->model].name);
674 em28xx_errdev("Your board has no unique USB ID and thus need a "
675 "hint to be detected.\n");
676 em28xx_errdev("You may try to use card=<n> insmod option to "
677 "workaround that.\n");
678 em28xx_errdev("Please send an email with this log to:\n");
679 em28xx_errdev("\tV4L Mailing List <video4linux-list@redhat.com>\n");
680 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
681 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
683 em28xx_errdev("Here is a list of valid choices for the card=<n>"
684 " insmod option:\n");
685 for (i = 0; i < em28xx_bcount; i++) {
686 em28xx_errdev(" card=%d -> %s\n",
687 i, em28xx_boards[i].name);
692 /* ----------------------------------------------------------------------- */
693 void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
700 /* detect & configure */
701 switch (dev->model) {
702 case (EM2800_BOARD_UNKNOWN):
704 case (EM2820_BOARD_UNKNOWN):
706 case (EM2800_BOARD_TERRATEC_CINERGY_200):
707 case (EM2820_BOARD_TERRATEC_CINERGY_250):
708 ir->ir_codes = ir_codes_em_terratec;
709 ir->get_key = em28xx_get_key_terratec;
710 snprintf(ir->c.name, sizeof(ir->c.name),
711 "i2c IR (EM28XX Terratec)");
713 case (EM2820_BOARD_PINNACLE_USB_2):
714 ir->ir_codes = ir_codes_pinnacle_grey;
715 ir->get_key = em28xx_get_key_pinnacle_usb_grey;
716 snprintf(ir->c.name, sizeof(ir->c.name),
717 "i2c IR (EM28XX Pinnacle PCTV)");
719 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
720 ir->ir_codes = ir_codes_hauppauge_new;
721 ir->get_key = em28xx_get_key_em_haup;
722 snprintf(ir->c.name, sizeof(ir->c.name),
723 "i2c IR (EM2840 Hauppauge)");
725 case (EM2820_BOARD_MSI_VOX_USB_2):
727 case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
729 case (EM2800_BOARD_KWORLD_USB2800):
734 void em28xx_card_setup(struct em28xx *dev)
736 em28xx_set_model(dev);
738 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
740 /* request some modules */
741 switch (dev->model) {
742 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
743 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
744 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
747 #ifdef CONFIG_MODULES
748 request_module("tveeprom");
750 /* Call first TVeeprom */
752 dev->i2c_client.addr = 0xa0 >> 1;
753 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
755 dev->tuner_type = tv.tuner_type;
757 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
758 dev->i2s_speed = 2048000;
759 dev->has_msp34xx = 1;
761 #ifdef CONFIG_MODULES
763 request_module("ir-kbd-i2c");
767 case EM2820_BOARD_KWORLD_PVRTV2800RF:
768 /* GPIO enables sound on KWORLD PVR TV 2800RF */
769 em28xx_write_regs_req(dev, 0x00, 0x08, "\xf9", 1);
771 case EM2820_BOARD_UNKNOWN:
772 case EM2800_BOARD_UNKNOWN:
773 if (!em28xx_hint_board(dev))
774 em28xx_set_model(dev);
777 /* Allow override tuner type by a module parameter */
779 dev->tuner_type = tuner;
781 #ifdef CONFIG_MODULES
782 /* request some modules */
783 if (dev->has_msp34xx)
784 request_module("msp3400");
785 if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
786 request_module("saa7115");
787 if (dev->decoder == EM28XX_TVP5150)
788 request_module("tvp5150");
789 if (dev->tuner_type != TUNER_ABSENT)
790 request_module("tuner");
793 em28xx_config_tuner(dev);