diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-dvb.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-dvb.c | 96 |
1 files changed, 88 insertions, 8 deletions
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index aabbf4854f66..503a8d5b5382 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c | |||
@@ -61,9 +61,6 @@ if (debug >= level) \ | |||
61 | printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \ | 61 | printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \ |
62 | } while (0) | 62 | } while (0) |
63 | 63 | ||
64 | #define EM28XX_DVB_NUM_BUFS 5 | ||
65 | #define EM28XX_DVB_MAX_PACKETS 64 | ||
66 | |||
67 | struct em28xx_dvb { | 64 | struct em28xx_dvb { |
68 | struct dvb_frontend *fe[2]; | 65 | struct dvb_frontend *fe[2]; |
69 | 66 | ||
@@ -172,20 +169,21 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb) | |||
172 | max_dvb_packet_size = dev->dvb_max_pkt_size; | 169 | max_dvb_packet_size = dev->dvb_max_pkt_size; |
173 | if (max_dvb_packet_size < 0) | 170 | if (max_dvb_packet_size < 0) |
174 | return max_dvb_packet_size; | 171 | return max_dvb_packet_size; |
175 | dprintk(1, "Using %d buffers each with %d bytes\n", | 172 | dprintk(1, "Using %d buffers each with %d x %d bytes\n", |
176 | EM28XX_DVB_NUM_BUFS, | 173 | EM28XX_DVB_NUM_BUFS, |
174 | EM28XX_DVB_MAX_PACKETS, | ||
177 | max_dvb_packet_size); | 175 | max_dvb_packet_size); |
178 | 176 | ||
179 | return em28xx_init_isoc(dev, EM28XX_DVB_MAX_PACKETS, | 177 | return em28xx_init_isoc(dev, EM28XX_DIGITAL_MODE, |
180 | EM28XX_DVB_NUM_BUFS, max_dvb_packet_size, | 178 | EM28XX_DVB_MAX_PACKETS, EM28XX_DVB_NUM_BUFS, |
181 | em28xx_dvb_isoc_copy); | 179 | max_dvb_packet_size, em28xx_dvb_isoc_copy); |
182 | } | 180 | } |
183 | 181 | ||
184 | static int em28xx_stop_streaming(struct em28xx_dvb *dvb) | 182 | static int em28xx_stop_streaming(struct em28xx_dvb *dvb) |
185 | { | 183 | { |
186 | struct em28xx *dev = dvb->adapter.priv; | 184 | struct em28xx *dev = dvb->adapter.priv; |
187 | 185 | ||
188 | em28xx_uninit_isoc(dev); | 186 | em28xx_capture_start(dev, 0); |
189 | 187 | ||
190 | em28xx_set_mode(dev, EM28XX_SUSPEND); | 188 | em28xx_set_mode(dev, EM28XX_SUSPEND); |
191 | 189 | ||
@@ -327,6 +325,19 @@ struct drxk_config hauppauge_930c_drxk = { | |||
327 | .chunk_size = 56, | 325 | .chunk_size = 56, |
328 | }; | 326 | }; |
329 | 327 | ||
328 | struct drxk_config maxmedia_ub425_tc_drxk = { | ||
329 | .adr = 0x29, | ||
330 | .single_master = 1, | ||
331 | .no_i2c_bridge = 1, | ||
332 | }; | ||
333 | |||
334 | struct drxk_config pctv_520e_drxk = { | ||
335 | .adr = 0x29, | ||
336 | .single_master = 1, | ||
337 | .microcode_name = "dvb-demod-drxk-pctv.fw", | ||
338 | .chunk_size = 58, | ||
339 | }; | ||
340 | |||
330 | static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) | 341 | static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) |
331 | { | 342 | { |
332 | struct em28xx_dvb *dvb = fe->sec_priv; | 343 | struct em28xx_dvb *dvb = fe->sec_priv; |
@@ -460,6 +471,33 @@ static void terratec_h5_init(struct em28xx *dev) | |||
460 | em28xx_gpio_set(dev, terratec_h5_end); | 471 | em28xx_gpio_set(dev, terratec_h5_end); |
461 | }; | 472 | }; |
462 | 473 | ||
474 | static void pctv_520e_init(struct em28xx *dev) | ||
475 | { | ||
476 | /* | ||
477 | * Init TDA8295(?) analog demodulator. Looks like I2C traffic to | ||
478 | * digital demodulator and tuner are routed via TDA8295. | ||
479 | */ | ||
480 | int i; | ||
481 | struct { | ||
482 | unsigned char r[4]; | ||
483 | int len; | ||
484 | } regs[] = { | ||
485 | {{ 0x06, 0x02, 0x00, 0x31 }, 4}, | ||
486 | {{ 0x01, 0x02 }, 2}, | ||
487 | {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, | ||
488 | {{ 0x01, 0x00 }, 2}, | ||
489 | {{ 0x01, 0x00, 0xff, 0xaf }, 4}, | ||
490 | {{ 0x01, 0x00, 0x03, 0xa0 }, 4}, | ||
491 | {{ 0x01, 0x00 }, 2}, | ||
492 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, | ||
493 | }; | ||
494 | |||
495 | dev->i2c_client.addr = 0x82 >> 1; /* 0x41 */ | ||
496 | |||
497 | for (i = 0; i < ARRAY_SIZE(regs); i++) | ||
498 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | ||
499 | }; | ||
500 | |||
463 | static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) | 501 | static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) |
464 | { | 502 | { |
465 | /* Values extracted from a USB trace of the Terratec Windows driver */ | 503 | /* Values extracted from a USB trace of the Terratec Windows driver */ |
@@ -938,6 +976,48 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
938 | dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap, | 976 | dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap, |
939 | &em28xx_a8293_config); | 977 | &em28xx_a8293_config); |
940 | break; | 978 | break; |
979 | case EM2874_BOARD_MAXMEDIA_UB425_TC: | ||
980 | /* attach demodulator */ | ||
981 | dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk, | ||
982 | &dev->i2c_adap); | ||
983 | |||
984 | if (dvb->fe[0]) { | ||
985 | /* disable I2C-gate */ | ||
986 | dvb->fe[0]->ops.i2c_gate_ctrl = NULL; | ||
987 | |||
988 | /* attach tuner */ | ||
989 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], | ||
990 | &dev->i2c_adap, 0x60)) { | ||
991 | dvb_frontend_detach(dvb->fe[0]); | ||
992 | result = -EINVAL; | ||
993 | goto out_free; | ||
994 | } | ||
995 | } | ||
996 | |||
997 | /* TODO: we need drx-3913k firmware in order to support DVB-T */ | ||
998 | em28xx_info("MaxMedia UB425-TC: only DVB-C supported by that " \ | ||
999 | "driver version\n"); | ||
1000 | |||
1001 | break; | ||
1002 | case EM2884_BOARD_PCTV_510E: | ||
1003 | case EM2884_BOARD_PCTV_520E: | ||
1004 | pctv_520e_init(dev); | ||
1005 | |||
1006 | /* attach demodulator */ | ||
1007 | dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, | ||
1008 | &dev->i2c_adap); | ||
1009 | |||
1010 | if (dvb->fe[0]) { | ||
1011 | /* attach tuner */ | ||
1012 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, | ||
1013 | &dev->i2c_adap, | ||
1014 | &em28xx_cxd2820r_tda18271_config)) { | ||
1015 | dvb_frontend_detach(dvb->fe[0]); | ||
1016 | result = -EINVAL; | ||
1017 | goto out_free; | ||
1018 | } | ||
1019 | } | ||
1020 | break; | ||
941 | default: | 1021 | default: |
942 | em28xx_errdev("/2: The frontend of your DVB/ATSC card" | 1022 | em28xx_errdev("/2: The frontend of your DVB/ATSC card" |
943 | " isn't supported yet\n"); | 1023 | " isn't supported yet\n"); |