diff options
Diffstat (limited to 'drivers/media/dvb/dvb-usb/cxusb.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 504 |
1 files changed, 501 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 563400277a42..406d7fba369d 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -36,6 +36,9 @@ | |||
36 | #include "tuner-xc2028.h" | 36 | #include "tuner-xc2028.h" |
37 | #include "tuner-simple.h" | 37 | #include "tuner-simple.h" |
38 | #include "mxl5005s.h" | 38 | #include "mxl5005s.h" |
39 | #include "dib7000p.h" | ||
40 | #include "dib0070.h" | ||
41 | #include "lgs8gl5.h" | ||
39 | 42 | ||
40 | /* debug */ | 43 | /* debug */ |
41 | static int dvb_usb_cxusb_debug; | 44 | static int dvb_usb_cxusb_debug; |
@@ -109,6 +112,25 @@ static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff) | |||
109 | cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40); | 112 | cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40); |
110 | } | 113 | } |
111 | 114 | ||
115 | static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d, | ||
116 | u8 addr, int onoff) | ||
117 | { | ||
118 | u8 o[2] = {addr, onoff}; | ||
119 | u8 i; | ||
120 | int rc; | ||
121 | |||
122 | rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); | ||
123 | |||
124 | if (rc < 0) | ||
125 | return rc; | ||
126 | if (i == 0x01) | ||
127 | return 0; | ||
128 | else { | ||
129 | deb_info("gpio_write failed.\n"); | ||
130 | return -EIO; | ||
131 | } | ||
132 | } | ||
133 | |||
112 | /* I2C */ | 134 | /* I2C */ |
113 | static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | 135 | static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
114 | int num) | 136 | int num) |
@@ -262,6 +284,20 @@ static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
262 | return rc; | 284 | return rc; |
263 | } | 285 | } |
264 | 286 | ||
287 | static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
288 | { | ||
289 | int ret; | ||
290 | u8 b; | ||
291 | ret = cxusb_power_ctrl(d, onoff); | ||
292 | if (!onoff) | ||
293 | return ret; | ||
294 | |||
295 | msleep(128); | ||
296 | cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1); | ||
297 | msleep(100); | ||
298 | return ret; | ||
299 | } | ||
300 | |||
265 | static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 301 | static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
266 | { | 302 | { |
267 | u8 buf[2] = { 0x03, 0x00 }; | 303 | u8 buf[2] = { 0x03, 0x00 }; |
@@ -283,6 +319,67 @@ static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
283 | return 0; | 319 | return 0; |
284 | } | 320 | } |
285 | 321 | ||
322 | static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d) | ||
323 | { | ||
324 | int ep = d->props.generic_bulk_ctrl_endpoint; | ||
325 | const int timeout = 100; | ||
326 | const int junk_len = 32; | ||
327 | u8 *junk; | ||
328 | int rd_count; | ||
329 | |||
330 | /* Discard remaining data in video pipe */ | ||
331 | junk = kmalloc(junk_len, GFP_KERNEL); | ||
332 | if (!junk) | ||
333 | return; | ||
334 | while (1) { | ||
335 | if (usb_bulk_msg(d->udev, | ||
336 | usb_rcvbulkpipe(d->udev, ep), | ||
337 | junk, junk_len, &rd_count, timeout) < 0) | ||
338 | break; | ||
339 | if (!rd_count) | ||
340 | break; | ||
341 | } | ||
342 | kfree(junk); | ||
343 | } | ||
344 | |||
345 | static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d) | ||
346 | { | ||
347 | struct usb_data_stream_properties *p = &d->props.adapter[0].stream; | ||
348 | const int timeout = 100; | ||
349 | const int junk_len = p->u.bulk.buffersize; | ||
350 | u8 *junk; | ||
351 | int rd_count; | ||
352 | |||
353 | /* Discard remaining data in video pipe */ | ||
354 | junk = kmalloc(junk_len, GFP_KERNEL); | ||
355 | if (!junk) | ||
356 | return; | ||
357 | while (1) { | ||
358 | if (usb_bulk_msg(d->udev, | ||
359 | usb_rcvbulkpipe(d->udev, p->endpoint), | ||
360 | junk, junk_len, &rd_count, timeout) < 0) | ||
361 | break; | ||
362 | if (!rd_count) | ||
363 | break; | ||
364 | } | ||
365 | kfree(junk); | ||
366 | } | ||
367 | |||
368 | static int cxusb_d680_dmb_streaming_ctrl( | ||
369 | struct dvb_usb_adapter *adap, int onoff) | ||
370 | { | ||
371 | if (onoff) { | ||
372 | u8 buf[2] = { 0x03, 0x00 }; | ||
373 | cxusb_d680_dmb_drain_video(adap->dev); | ||
374 | return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, | ||
375 | buf, sizeof(buf), NULL, 0); | ||
376 | } else { | ||
377 | int ret = cxusb_ctrl_msg(adap->dev, | ||
378 | CMD_STREAMING_OFF, NULL, 0, NULL, 0); | ||
379 | return ret; | ||
380 | } | ||
381 | } | ||
382 | |||
286 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 383 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
287 | { | 384 | { |
288 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 385 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; |
@@ -335,6 +432,32 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
335 | return 0; | 432 | return 0; |
336 | } | 433 | } |
337 | 434 | ||
435 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | ||
436 | int *state) | ||
437 | { | ||
438 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | ||
439 | u8 ircode[2]; | ||
440 | int i; | ||
441 | |||
442 | *event = 0; | ||
443 | *state = REMOTE_NO_KEY_PRESSED; | ||
444 | |||
445 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) | ||
446 | return 0; | ||
447 | |||
448 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
449 | if (keymap[i].custom == ircode[0] && | ||
450 | keymap[i].data == ircode[1]) { | ||
451 | *event = keymap[i].event; | ||
452 | *state = REMOTE_KEY_PRESSED; | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | } | ||
457 | |||
458 | return 0; | ||
459 | } | ||
460 | |||
338 | static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { | 461 | static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { |
339 | { 0xfe, 0x02, KEY_TV }, | 462 | { 0xfe, 0x02, KEY_TV }, |
340 | { 0xfe, 0x0e, KEY_MP3 }, | 463 | { 0xfe, 0x0e, KEY_MP3 }, |
@@ -422,6 +545,44 @@ static struct dvb_usb_rc_key dvico_portable_rc_keys[] = { | |||
422 | { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */ | 545 | { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */ |
423 | }; | 546 | }; |
424 | 547 | ||
548 | static struct dvb_usb_rc_key d680_dmb_rc_keys[] = { | ||
549 | { 0x00, 0x38, KEY_UNKNOWN }, /* TV/AV */ | ||
550 | { 0x08, 0x0c, KEY_ZOOM }, | ||
551 | { 0x08, 0x00, KEY_0 }, | ||
552 | { 0x00, 0x01, KEY_1 }, | ||
553 | { 0x08, 0x02, KEY_2 }, | ||
554 | { 0x00, 0x03, KEY_3 }, | ||
555 | { 0x08, 0x04, KEY_4 }, | ||
556 | { 0x00, 0x05, KEY_5 }, | ||
557 | { 0x08, 0x06, KEY_6 }, | ||
558 | { 0x00, 0x07, KEY_7 }, | ||
559 | { 0x08, 0x08, KEY_8 }, | ||
560 | { 0x00, 0x09, KEY_9 }, | ||
561 | { 0x00, 0x0a, KEY_MUTE }, | ||
562 | { 0x08, 0x29, KEY_BACK }, | ||
563 | { 0x00, 0x12, KEY_CHANNELUP }, | ||
564 | { 0x08, 0x13, KEY_CHANNELDOWN }, | ||
565 | { 0x00, 0x2b, KEY_VOLUMEUP }, | ||
566 | { 0x08, 0x2c, KEY_VOLUMEDOWN }, | ||
567 | { 0x00, 0x20, KEY_UP }, | ||
568 | { 0x08, 0x21, KEY_DOWN }, | ||
569 | { 0x00, 0x11, KEY_LEFT }, | ||
570 | { 0x08, 0x10, KEY_RIGHT }, | ||
571 | { 0x00, 0x0d, KEY_OK }, | ||
572 | { 0x08, 0x1f, KEY_RECORD }, | ||
573 | { 0x00, 0x17, KEY_PLAYPAUSE }, | ||
574 | { 0x08, 0x16, KEY_PLAYPAUSE }, | ||
575 | { 0x00, 0x0b, KEY_STOP }, | ||
576 | { 0x08, 0x27, KEY_FASTFORWARD }, | ||
577 | { 0x00, 0x26, KEY_REWIND }, | ||
578 | { 0x08, 0x1e, KEY_UNKNOWN }, /* Time Shift */ | ||
579 | { 0x00, 0x0e, KEY_UNKNOWN }, /* Snapshot */ | ||
580 | { 0x08, 0x2d, KEY_UNKNOWN }, /* Mouse Cursor */ | ||
581 | { 0x00, 0x0f, KEY_UNKNOWN }, /* Minimize/Maximize */ | ||
582 | { 0x08, 0x14, KEY_UNKNOWN }, /* Shuffle */ | ||
583 | { 0x00, 0x25, KEY_POWER }, | ||
584 | }; | ||
585 | |||
425 | static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) | 586 | static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) |
426 | { | 587 | { |
427 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; | 588 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; |
@@ -527,6 +688,24 @@ static struct mxl5005s_config aver_a868r_tuner = { | |||
527 | .AgcMasterByte = 0x00, | 688 | .AgcMasterByte = 0x00, |
528 | }; | 689 | }; |
529 | 690 | ||
691 | /* FIXME: needs tweaking */ | ||
692 | static struct mxl5005s_config d680_dmb_tuner = { | ||
693 | .i2c_address = 0x63, | ||
694 | .if_freq = 36125000UL, | ||
695 | .xtal_freq = CRYSTAL_FREQ_16000000HZ, | ||
696 | .agc_mode = MXL_SINGLE_AGC, | ||
697 | .tracking_filter = MXL_TF_C, | ||
698 | .rssi_enable = MXL_RSSI_ENABLE, | ||
699 | .cap_select = MXL_CAP_SEL_ENABLE, | ||
700 | .div_out = MXL_DIV_OUT_4, | ||
701 | .clock_out = MXL_CLOCK_OUT_DISABLE, | ||
702 | .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM, | ||
703 | .top = MXL5005S_TOP_25P2, | ||
704 | .mod_mode = MXL_DIGITAL_MODE, | ||
705 | .if_mode = MXL_ZERO_IF, | ||
706 | .AgcMasterByte = 0x00, | ||
707 | }; | ||
708 | |||
530 | /* Callbacks for DVB USB */ | 709 | /* Callbacks for DVB USB */ |
531 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) | 710 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
532 | { | 711 | { |
@@ -563,7 +742,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) | |||
563 | return 0; | 742 | return 0; |
564 | } | 743 | } |
565 | 744 | ||
566 | static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg) | 745 | static int dvico_bluebird_xc2028_callback(void *ptr, int component, |
746 | int command, int arg) | ||
567 | { | 747 | { |
568 | struct dvb_usb_adapter *adap = ptr; | 748 | struct dvb_usb_adapter *adap = ptr; |
569 | struct dvb_usb_device *d = adap->dev; | 749 | struct dvb_usb_device *d = adap->dev; |
@@ -591,14 +771,16 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) | |||
591 | struct xc2028_config cfg = { | 771 | struct xc2028_config cfg = { |
592 | .i2c_adap = &adap->dev->i2c_adap, | 772 | .i2c_adap = &adap->dev->i2c_adap, |
593 | .i2c_addr = 0x61, | 773 | .i2c_addr = 0x61, |
594 | .callback = dvico_bluebird_xc2028_callback, | ||
595 | }; | 774 | }; |
596 | static struct xc2028_ctrl ctl = { | 775 | static struct xc2028_ctrl ctl = { |
597 | .fname = "xc3028-v27.fw", | 776 | .fname = XC2028_DEFAULT_FIRMWARE, |
598 | .max_len = 64, | 777 | .max_len = 64, |
599 | .demod = XC3028_FE_ZARLINK456, | 778 | .demod = XC3028_FE_ZARLINK456, |
600 | }; | 779 | }; |
601 | 780 | ||
781 | /* FIXME: generalize & move to common area */ | ||
782 | adap->fe->callback = dvico_bluebird_xc2028_callback; | ||
783 | |||
602 | fe = dvb_attach(xc2028_attach, adap->fe, &cfg); | 784 | fe = dvb_attach(xc2028_attach, adap->fe, &cfg); |
603 | if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) | 785 | if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) |
604 | return -EIO; | 786 | return -EIO; |
@@ -615,6 +797,14 @@ static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) | |||
615 | return 0; | 797 | return 0; |
616 | } | 798 | } |
617 | 799 | ||
800 | static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap) | ||
801 | { | ||
802 | struct dvb_frontend *fe; | ||
803 | fe = dvb_attach(mxl5005s_attach, adap->fe, | ||
804 | &adap->dev->i2c_adap, &d680_dmb_tuner); | ||
805 | return (fe == NULL) ? -EIO : 0; | ||
806 | } | ||
807 | |||
618 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) | 808 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) |
619 | { | 809 | { |
620 | u8 b; | 810 | u8 b; |
@@ -726,6 +916,159 @@ no_IR: | |||
726 | return 0; | 916 | return 0; |
727 | } | 917 | } |
728 | 918 | ||
919 | static struct dibx000_agc_config dib7070_agc_config = { | ||
920 | .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, | ||
921 | |||
922 | /* | ||
923 | * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, | ||
924 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | ||
925 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 | ||
926 | */ | ||
927 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | | ||
928 | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | ||
929 | .inv_gain = 600, | ||
930 | .time_stabiliz = 10, | ||
931 | .alpha_level = 0, | ||
932 | .thlock = 118, | ||
933 | .wbd_inv = 0, | ||
934 | .wbd_ref = 3530, | ||
935 | .wbd_sel = 1, | ||
936 | .wbd_alpha = 5, | ||
937 | .agc1_max = 65535, | ||
938 | .agc1_min = 0, | ||
939 | .agc2_max = 65535, | ||
940 | .agc2_min = 0, | ||
941 | .agc1_pt1 = 0, | ||
942 | .agc1_pt2 = 40, | ||
943 | .agc1_pt3 = 183, | ||
944 | .agc1_slope1 = 206, | ||
945 | .agc1_slope2 = 255, | ||
946 | .agc2_pt1 = 72, | ||
947 | .agc2_pt2 = 152, | ||
948 | .agc2_slope1 = 88, | ||
949 | .agc2_slope2 = 90, | ||
950 | .alpha_mant = 17, | ||
951 | .alpha_exp = 27, | ||
952 | .beta_mant = 23, | ||
953 | .beta_exp = 51, | ||
954 | .perform_agc_softsplit = 0, | ||
955 | }; | ||
956 | |||
957 | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { | ||
958 | .internal = 60000, | ||
959 | .sampling = 15000, | ||
960 | .pll_prediv = 1, | ||
961 | .pll_ratio = 20, | ||
962 | .pll_range = 3, | ||
963 | .pll_reset = 1, | ||
964 | .pll_bypass = 0, | ||
965 | .enable_refdiv = 0, | ||
966 | .bypclk_div = 0, | ||
967 | .IO_CLK_en_core = 1, | ||
968 | .ADClkSrc = 1, | ||
969 | .modulo = 2, | ||
970 | /* refsel, sel, freq_15k */ | ||
971 | .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), | ||
972 | .ifreq = (0 << 25) | 0, | ||
973 | .timf = 20452225, | ||
974 | .xtal_hz = 12000000, | ||
975 | }; | ||
976 | |||
977 | static struct dib7000p_config cxusb_dualdig4_rev2_config = { | ||
978 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, | ||
979 | .output_mpeg2_in_188_bytes = 1, | ||
980 | |||
981 | .agc_config_count = 1, | ||
982 | .agc = &dib7070_agc_config, | ||
983 | .bw = &dib7070_bw_config_12_mhz, | ||
984 | .tuner_is_baseband = 1, | ||
985 | .spur_protect = 1, | ||
986 | |||
987 | .gpio_dir = 0xfcef, | ||
988 | .gpio_val = 0x0110, | ||
989 | |||
990 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
991 | |||
992 | .hostbus_diversity = 1, | ||
993 | }; | ||
994 | |||
995 | static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap) | ||
996 | { | ||
997 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) | ||
998 | err("set interface failed"); | ||
999 | |||
1000 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); | ||
1001 | |||
1002 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); | ||
1003 | |||
1004 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | ||
1005 | &cxusb_dualdig4_rev2_config); | ||
1006 | |||
1007 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | ||
1008 | &cxusb_dualdig4_rev2_config); | ||
1009 | if (adap->fe == NULL) | ||
1010 | return -EIO; | ||
1011 | |||
1012 | return 0; | ||
1013 | } | ||
1014 | |||
1015 | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) | ||
1016 | { | ||
1017 | return dib7000p_set_gpio(fe, 8, 0, !onoff); | ||
1018 | } | ||
1019 | |||
1020 | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) | ||
1021 | { | ||
1022 | return 0; | ||
1023 | } | ||
1024 | |||
1025 | static struct dib0070_config dib7070p_dib0070_config = { | ||
1026 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | ||
1027 | .reset = dib7070_tuner_reset, | ||
1028 | .sleep = dib7070_tuner_sleep, | ||
1029 | .clock_khz = 12000, | ||
1030 | }; | ||
1031 | |||
1032 | struct dib0700_adapter_state { | ||
1033 | int (*set_param_save) (struct dvb_frontend *, | ||
1034 | struct dvb_frontend_parameters *); | ||
1035 | }; | ||
1036 | |||
1037 | static int dib7070_set_param_override(struct dvb_frontend *fe, | ||
1038 | struct dvb_frontend_parameters *fep) | ||
1039 | { | ||
1040 | struct dvb_usb_adapter *adap = fe->dvb->priv; | ||
1041 | struct dib0700_adapter_state *state = adap->priv; | ||
1042 | |||
1043 | u16 offset; | ||
1044 | u8 band = BAND_OF_FREQUENCY(fep->frequency/1000); | ||
1045 | switch (band) { | ||
1046 | case BAND_VHF: offset = 950; break; | ||
1047 | default: | ||
1048 | case BAND_UHF: offset = 550; break; | ||
1049 | } | ||
1050 | |||
1051 | dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); | ||
1052 | |||
1053 | return state->set_param_save(fe, fep); | ||
1054 | } | ||
1055 | |||
1056 | static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap) | ||
1057 | { | ||
1058 | struct dib0700_adapter_state *st = adap->priv; | ||
1059 | struct i2c_adapter *tun_i2c = | ||
1060 | dib7000p_get_i2c_master(adap->fe, | ||
1061 | DIBX000_I2C_INTERFACE_TUNER, 1); | ||
1062 | |||
1063 | if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, | ||
1064 | &dib7070p_dib0070_config) == NULL) | ||
1065 | return -ENODEV; | ||
1066 | |||
1067 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | ||
1068 | adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override; | ||
1069 | return 0; | ||
1070 | } | ||
1071 | |||
729 | static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) | 1072 | static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) |
730 | { | 1073 | { |
731 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) | 1074 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
@@ -751,6 +1094,54 @@ static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) | |||
751 | return -EIO; | 1094 | return -EIO; |
752 | } | 1095 | } |
753 | 1096 | ||
1097 | static struct lgs8gl5_config lgs8gl5_cfg = { | ||
1098 | .demod_address = 0x19, | ||
1099 | }; | ||
1100 | |||
1101 | static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap) | ||
1102 | { | ||
1103 | struct dvb_usb_device *d = adap->dev; | ||
1104 | int n; | ||
1105 | |||
1106 | /* Select required USB configuration */ | ||
1107 | if (usb_set_interface(d->udev, 0, 0) < 0) | ||
1108 | err("set interface failed"); | ||
1109 | |||
1110 | /* Unblock all USB pipes */ | ||
1111 | usb_clear_halt(d->udev, | ||
1112 | usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); | ||
1113 | usb_clear_halt(d->udev, | ||
1114 | usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); | ||
1115 | usb_clear_halt(d->udev, | ||
1116 | usb_rcvbulkpipe(d->udev, d->props.adapter[0].stream.endpoint)); | ||
1117 | |||
1118 | /* Drain USB pipes to avoid hang after reboot */ | ||
1119 | for (n = 0; n < 5; n++) { | ||
1120 | cxusb_d680_dmb_drain_message(d); | ||
1121 | cxusb_d680_dmb_drain_video(d); | ||
1122 | msleep(200); | ||
1123 | } | ||
1124 | |||
1125 | /* Reset the tuner */ | ||
1126 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { | ||
1127 | err("clear tuner gpio failed"); | ||
1128 | return -EIO; | ||
1129 | } | ||
1130 | msleep(100); | ||
1131 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { | ||
1132 | err("set tuner gpio failed"); | ||
1133 | return -EIO; | ||
1134 | } | ||
1135 | msleep(100); | ||
1136 | |||
1137 | /* Attach frontend */ | ||
1138 | adap->fe = dvb_attach(lgs8gl5_attach, &lgs8gl5_cfg, &d->i2c_adap); | ||
1139 | if (adap->fe == NULL) | ||
1140 | return -EIO; | ||
1141 | |||
1142 | return 0; | ||
1143 | } | ||
1144 | |||
754 | /* | 1145 | /* |
755 | * DViCO has shipped two devices with the same USB ID, but only one of them | 1146 | * DViCO has shipped two devices with the same USB ID, but only one of them |
756 | * needs a firmware download. Check the device class details to see if they | 1147 | * needs a firmware download. Check the device class details to see if they |
@@ -826,9 +1217,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties; | |||
826 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; | 1217 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; |
827 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; | 1218 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; |
828 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; | 1219 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; |
1220 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties; | ||
829 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; | 1221 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; |
830 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; | 1222 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; |
831 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; | 1223 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; |
1224 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties; | ||
832 | 1225 | ||
833 | static int cxusb_probe(struct usb_interface *intf, | 1226 | static int cxusb_probe(struct usb_interface *intf, |
834 | const struct usb_device_id *id) | 1227 | const struct usb_device_id *id) |
@@ -852,6 +1245,11 @@ static int cxusb_probe(struct usb_interface *intf, | |||
852 | THIS_MODULE, NULL, adapter_nr) || | 1245 | THIS_MODULE, NULL, adapter_nr) || |
853 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, | 1246 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, |
854 | THIS_MODULE, NULL, adapter_nr) || | 1247 | THIS_MODULE, NULL, adapter_nr) || |
1248 | 0 == dvb_usb_device_init(intf, | ||
1249 | &cxusb_bluebird_dualdig4_rev2_properties, | ||
1250 | THIS_MODULE, NULL, adapter_nr) || | ||
1251 | 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, | ||
1252 | THIS_MODULE, NULL, adapter_nr) || | ||
855 | 0) | 1253 | 0) |
856 | return 0; | 1254 | return 0; |
857 | 1255 | ||
@@ -876,6 +1274,8 @@ static struct usb_device_id cxusb_table [] = { | |||
876 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, | 1274 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, |
877 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, | 1275 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, |
878 | { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, | 1276 | { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, |
1277 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, | ||
1278 | { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, | ||
879 | {} /* Terminating entry */ | 1279 | {} /* Terminating entry */ |
880 | }; | 1280 | }; |
881 | MODULE_DEVICE_TABLE (usb, cxusb_table); | 1281 | MODULE_DEVICE_TABLE (usb, cxusb_table); |
@@ -1321,6 +1721,104 @@ static struct dvb_usb_device_properties cxusb_aver_a868r_properties = { | |||
1321 | } | 1721 | } |
1322 | }; | 1722 | }; |
1323 | 1723 | ||
1724 | static | ||
1725 | struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { | ||
1726 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1727 | |||
1728 | .usb_ctrl = CYPRESS_FX2, | ||
1729 | |||
1730 | .size_of_priv = sizeof(struct cxusb_state), | ||
1731 | |||
1732 | .num_adapters = 1, | ||
1733 | .adapter = { | ||
1734 | { | ||
1735 | .streaming_ctrl = cxusb_streaming_ctrl, | ||
1736 | .frontend_attach = cxusb_dualdig4_rev2_frontend_attach, | ||
1737 | .tuner_attach = cxusb_dualdig4_rev2_tuner_attach, | ||
1738 | .size_of_priv = sizeof(struct dib0700_adapter_state), | ||
1739 | /* parameter for the MPEG2-data transfer */ | ||
1740 | .stream = { | ||
1741 | .type = USB_BULK, | ||
1742 | .count = 7, | ||
1743 | .endpoint = 0x02, | ||
1744 | .u = { | ||
1745 | .bulk = { | ||
1746 | .buffersize = 4096, | ||
1747 | } | ||
1748 | } | ||
1749 | }, | ||
1750 | }, | ||
1751 | }, | ||
1752 | |||
1753 | .power_ctrl = cxusb_bluebird_power_ctrl, | ||
1754 | |||
1755 | .i2c_algo = &cxusb_i2c_algo, | ||
1756 | |||
1757 | .generic_bulk_ctrl_endpoint = 0x01, | ||
1758 | |||
1759 | .rc_interval = 100, | ||
1760 | .rc_key_map = dvico_mce_rc_keys, | ||
1761 | .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), | ||
1762 | .rc_query = cxusb_rc_query, | ||
1763 | |||
1764 | .num_device_descs = 1, | ||
1765 | .devices = { | ||
1766 | { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)", | ||
1767 | { NULL }, | ||
1768 | { &cxusb_table[17], NULL }, | ||
1769 | }, | ||
1770 | } | ||
1771 | }; | ||
1772 | |||
1773 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { | ||
1774 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1775 | |||
1776 | .usb_ctrl = CYPRESS_FX2, | ||
1777 | |||
1778 | .size_of_priv = sizeof(struct cxusb_state), | ||
1779 | |||
1780 | .num_adapters = 1, | ||
1781 | .adapter = { | ||
1782 | { | ||
1783 | .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, | ||
1784 | .frontend_attach = cxusb_d680_dmb_frontend_attach, | ||
1785 | .tuner_attach = cxusb_d680_dmb_tuner_attach, | ||
1786 | |||
1787 | /* parameter for the MPEG2-data transfer */ | ||
1788 | .stream = { | ||
1789 | .type = USB_BULK, | ||
1790 | .count = 5, | ||
1791 | .endpoint = 0x02, | ||
1792 | .u = { | ||
1793 | .bulk = { | ||
1794 | .buffersize = 8192, | ||
1795 | } | ||
1796 | } | ||
1797 | }, | ||
1798 | }, | ||
1799 | }, | ||
1800 | |||
1801 | .power_ctrl = cxusb_d680_dmb_power_ctrl, | ||
1802 | |||
1803 | .i2c_algo = &cxusb_i2c_algo, | ||
1804 | |||
1805 | .generic_bulk_ctrl_endpoint = 0x01, | ||
1806 | |||
1807 | .rc_interval = 100, | ||
1808 | .rc_key_map = d680_dmb_rc_keys, | ||
1809 | .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys), | ||
1810 | .rc_query = cxusb_d680_dmb_rc_query, | ||
1811 | |||
1812 | .num_device_descs = 1, | ||
1813 | .devices = { | ||
1814 | { | ||
1815 | "Conexant DMB-TH Stick", | ||
1816 | { NULL }, | ||
1817 | { &cxusb_table[18], NULL }, | ||
1818 | }, | ||
1819 | } | ||
1820 | }; | ||
1821 | |||
1324 | static struct usb_driver cxusb_driver = { | 1822 | static struct usb_driver cxusb_driver = { |
1325 | .name = "dvb_usb_cxusb", | 1823 | .name = "dvb_usb_cxusb", |
1326 | .probe = cxusb_probe, | 1824 | .probe = cxusb_probe, |