diff options
author | Anton Blanchard <anton@samba.org> | 2008-08-09 11:23:15 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:49 -0400 |
commit | 8d79898897f8afee182febef18b96f559d32ebc4 (patch) | |
tree | 57d4780e3def9c20e72d7f29691e7bc6195f1d5b /drivers/media/dvb/dvb-usb/cxusb.c | |
parent | f723af16da8359cda47320001960609b0086082b (diff) |
V4L/DVB (8654): cxusb: add support for DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)
Add support for revision 2 of the DViCO FusionHDTV DVB-T Dual Digital 4
which has new tuners and demodulators (2 x DIB7070p). With this patch
both DVB reception and IR works.
The dib7000p driver currently hardwires the output mode to
OUTMODE_MPEG2_SERIAL regardless of what we ask for. Modify it to allow
OUTMODE_MPEG2_PAR_GATED_CLK to be set. Longer term we should remove the
check completely and set the output mode correctly in all the callers.
Add Kconfig bits to ensure the dib7000p and dib0070 modules are enabled.
It would be nice to only do this for the !DVB_FE_CUSTOMISE case, but
this is what the other DIB7070 module does (there are a number of
module dependencies in the attach code).
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/cxusb.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 563400277a42..1de3678a294b 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -36,6 +36,8 @@ | |||
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" | ||
39 | 41 | ||
40 | /* debug */ | 42 | /* debug */ |
41 | static int dvb_usb_cxusb_debug; | 43 | static int dvb_usb_cxusb_debug; |
@@ -726,6 +728,157 @@ no_IR: | |||
726 | return 0; | 728 | return 0; |
727 | } | 729 | } |
728 | 730 | ||
731 | static struct dibx000_agc_config dib7070_agc_config = { | ||
732 | .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, | ||
733 | |||
734 | /* | ||
735 | * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, | ||
736 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | ||
737 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 | ||
738 | */ | ||
739 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | | ||
740 | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | ||
741 | .inv_gain = 600, | ||
742 | .time_stabiliz = 10, | ||
743 | .alpha_level = 0, | ||
744 | .thlock = 118, | ||
745 | .wbd_inv = 0, | ||
746 | .wbd_ref = 3530, | ||
747 | .wbd_sel = 1, | ||
748 | .wbd_alpha = 5, | ||
749 | .agc1_max = 65535, | ||
750 | .agc1_min = 0, | ||
751 | .agc2_max = 65535, | ||
752 | .agc2_min = 0, | ||
753 | .agc1_pt1 = 0, | ||
754 | .agc1_pt2 = 40, | ||
755 | .agc1_pt3 = 183, | ||
756 | .agc1_slope1 = 206, | ||
757 | .agc1_slope2 = 255, | ||
758 | .agc2_pt1 = 72, | ||
759 | .agc2_pt2 = 152, | ||
760 | .agc2_slope1 = 88, | ||
761 | .agc2_slope2 = 90, | ||
762 | .alpha_mant = 17, | ||
763 | .alpha_exp = 27, | ||
764 | .beta_mant = 23, | ||
765 | .beta_exp = 51, | ||
766 | .perform_agc_softsplit = 0, | ||
767 | }; | ||
768 | |||
769 | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { | ||
770 | .internal = 60000, | ||
771 | .sampling = 15000, | ||
772 | .pll_prediv = 1, | ||
773 | .pll_ratio = 20, | ||
774 | .pll_range = 3, | ||
775 | .pll_reset = 1, | ||
776 | .pll_bypass = 0, | ||
777 | .enable_refdiv = 0, | ||
778 | .bypclk_div = 0, | ||
779 | .IO_CLK_en_core = 1, | ||
780 | .ADClkSrc = 1, | ||
781 | .modulo = 2, | ||
782 | /* refsel, sel, freq_15k */ | ||
783 | .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), | ||
784 | .ifreq = (0 << 25) | 0, | ||
785 | .timf = 20452225, | ||
786 | .xtal_hz = 12000000, | ||
787 | }; | ||
788 | |||
789 | static struct dib7000p_config cxusb_dualdig4_rev2_config = { | ||
790 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, | ||
791 | .output_mpeg2_in_188_bytes = 1, | ||
792 | |||
793 | .agc_config_count = 1, | ||
794 | .agc = &dib7070_agc_config, | ||
795 | .bw = &dib7070_bw_config_12_mhz, | ||
796 | .tuner_is_baseband = 1, | ||
797 | .spur_protect = 1, | ||
798 | |||
799 | .gpio_dir = 0xfcef, | ||
800 | .gpio_val = 0x0110, | ||
801 | |||
802 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
803 | |||
804 | .hostbus_diversity = 1, | ||
805 | }; | ||
806 | |||
807 | static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap) | ||
808 | { | ||
809 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) | ||
810 | err("set interface failed"); | ||
811 | |||
812 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); | ||
813 | |||
814 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); | ||
815 | |||
816 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | ||
817 | &cxusb_dualdig4_rev2_config); | ||
818 | |||
819 | if ((adap->fe = dvb_attach(dib7000p_attach, | ||
820 | &adap->dev->i2c_adap, 0x80, | ||
821 | &cxusb_dualdig4_rev2_config)) == NULL) | ||
822 | return -EIO; | ||
823 | |||
824 | return 0; | ||
825 | } | ||
826 | |||
827 | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) | ||
828 | { | ||
829 | return dib7000p_set_gpio(fe, 8, 0, !onoff); | ||
830 | } | ||
831 | |||
832 | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) | ||
833 | { | ||
834 | return 0; | ||
835 | } | ||
836 | |||
837 | static struct dib0070_config dib7070p_dib0070_config = { | ||
838 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | ||
839 | .reset = dib7070_tuner_reset, | ||
840 | .sleep = dib7070_tuner_sleep, | ||
841 | .clock_khz = 12000, | ||
842 | }; | ||
843 | |||
844 | struct dib0700_adapter_state { | ||
845 | int (*set_param_save) (struct dvb_frontend *, | ||
846 | struct dvb_frontend_parameters *); | ||
847 | }; | ||
848 | |||
849 | static int dib7070_set_param_override(struct dvb_frontend *fe, | ||
850 | struct dvb_frontend_parameters *fep) | ||
851 | { | ||
852 | struct dvb_usb_adapter *adap = fe->dvb->priv; | ||
853 | struct dib0700_adapter_state *state = adap->priv; | ||
854 | |||
855 | u16 offset; | ||
856 | u8 band = BAND_OF_FREQUENCY(fep->frequency/1000); | ||
857 | switch (band) { | ||
858 | case BAND_VHF: offset = 950; break; | ||
859 | case BAND_UHF: | ||
860 | default: offset = 550; break; | ||
861 | } | ||
862 | |||
863 | dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); | ||
864 | |||
865 | return state->set_param_save(fe, fep); | ||
866 | } | ||
867 | |||
868 | static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap) | ||
869 | { | ||
870 | struct dib0700_adapter_state *st = adap->priv; | ||
871 | struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); | ||
872 | |||
873 | if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, | ||
874 | &dib7070p_dib0070_config) == NULL) | ||
875 | return -ENODEV; | ||
876 | |||
877 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; | ||
878 | adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override; | ||
879 | return 0; | ||
880 | } | ||
881 | |||
729 | static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) | 882 | static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) |
730 | { | 883 | { |
731 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) | 884 | if (usb_set_interface(adap->dev->udev, 0, 1) < 0) |
@@ -826,6 +979,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties; | |||
826 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; | 979 | static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; |
827 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; | 980 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; |
828 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; | 981 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; |
982 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties; | ||
829 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; | 983 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; |
830 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; | 984 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; |
831 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; | 985 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; |
@@ -852,6 +1006,9 @@ static int cxusb_probe(struct usb_interface *intf, | |||
852 | THIS_MODULE, NULL, adapter_nr) || | 1006 | THIS_MODULE, NULL, adapter_nr) || |
853 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, | 1007 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, |
854 | THIS_MODULE, NULL, adapter_nr) || | 1008 | THIS_MODULE, NULL, adapter_nr) || |
1009 | 0 == dvb_usb_device_init(intf, | ||
1010 | &cxusb_bluebird_dualdig4_rev2_properties, | ||
1011 | THIS_MODULE, NULL, adapter_nr) || | ||
855 | 0) | 1012 | 0) |
856 | return 0; | 1013 | return 0; |
857 | 1014 | ||
@@ -876,6 +1033,7 @@ static struct usb_device_id cxusb_table [] = { | |||
876 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, | 1033 | { 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) }, | 1034 | { 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) }, | 1035 | { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, |
1036 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, | ||
879 | {} /* Terminating entry */ | 1037 | {} /* Terminating entry */ |
880 | }; | 1038 | }; |
881 | MODULE_DEVICE_TABLE (usb, cxusb_table); | 1039 | MODULE_DEVICE_TABLE (usb, cxusb_table); |
@@ -1321,6 +1479,54 @@ static struct dvb_usb_device_properties cxusb_aver_a868r_properties = { | |||
1321 | } | 1479 | } |
1322 | }; | 1480 | }; |
1323 | 1481 | ||
1482 | static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { | ||
1483 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1484 | |||
1485 | .usb_ctrl = CYPRESS_FX2, | ||
1486 | |||
1487 | .size_of_priv = sizeof(struct cxusb_state), | ||
1488 | |||
1489 | .num_adapters = 1, | ||
1490 | .adapter = { | ||
1491 | { | ||
1492 | .streaming_ctrl = cxusb_streaming_ctrl, | ||
1493 | .frontend_attach = cxusb_dualdig4_rev2_frontend_attach, | ||
1494 | .tuner_attach = cxusb_dualdig4_rev2_tuner_attach, | ||
1495 | .size_of_priv = sizeof(struct dib0700_adapter_state), | ||
1496 | /* parameter for the MPEG2-data transfer */ | ||
1497 | .stream = { | ||
1498 | .type = USB_BULK, | ||
1499 | .count = 7, | ||
1500 | .endpoint = 0x02, | ||
1501 | .u = { | ||
1502 | .bulk = { | ||
1503 | .buffersize = 4096, | ||
1504 | } | ||
1505 | } | ||
1506 | }, | ||
1507 | }, | ||
1508 | }, | ||
1509 | |||
1510 | .power_ctrl = cxusb_bluebird_power_ctrl, | ||
1511 | |||
1512 | .i2c_algo = &cxusb_i2c_algo, | ||
1513 | |||
1514 | .generic_bulk_ctrl_endpoint = 0x01, | ||
1515 | |||
1516 | .rc_interval = 100, | ||
1517 | .rc_key_map = dvico_mce_rc_keys, | ||
1518 | .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), | ||
1519 | .rc_query = cxusb_rc_query, | ||
1520 | |||
1521 | .num_device_descs = 1, | ||
1522 | .devices = { | ||
1523 | { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)", | ||
1524 | { NULL }, | ||
1525 | { &cxusb_table[17], NULL }, | ||
1526 | }, | ||
1527 | } | ||
1528 | }; | ||
1529 | |||
1324 | static struct usb_driver cxusb_driver = { | 1530 | static struct usb_driver cxusb_driver = { |
1325 | .name = "dvb_usb_cxusb", | 1531 | .name = "dvb_usb_cxusb", |
1326 | .probe = cxusb_probe, | 1532 | .probe = cxusb_probe, |