diff options
author | David Wong <davidtlwong@gmail.com> | 2009-10-26 08:41:22 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:35 -0500 |
commit | b18bd1d8806c0982c7835dcb58a27c4e9005e4fb (patch) | |
tree | 54e79beaae9a22420f564f98a62eb4d08b8f69a7 | |
parent | ea5697fe9ed6a1d534de436eff3138041e3c8aa9 (diff) |
V4L/DVB (13376): cx-usb: add Mygica D689 DMB-TH USB support
X-Patchwork-Id: 55873
Add support for cxusb card Mygica D689 DBM-TH USB
Signed-off-by: David T. L. Wong <davidtlwong@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 118 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 |
2 files changed, 119 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 2a53dd096eef..542de171874a 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -36,9 +36,11 @@ | |||
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 "max2165.h" | ||
39 | #include "dib7000p.h" | 40 | #include "dib7000p.h" |
40 | #include "dib0070.h" | 41 | #include "dib0070.h" |
41 | #include "lgs8gxx.h" | 42 | #include "lgs8gxx.h" |
43 | #include "atbm8830.h" | ||
42 | 44 | ||
43 | /* debug */ | 45 | /* debug */ |
44 | static int dvb_usb_cxusb_debug; | 46 | static int dvb_usb_cxusb_debug; |
@@ -714,6 +716,11 @@ static struct mxl5005s_config d680_dmb_tuner = { | |||
714 | .AgcMasterByte = 0x00, | 716 | .AgcMasterByte = 0x00, |
715 | }; | 717 | }; |
716 | 718 | ||
719 | static struct max2165_config mygica_d689_max2165_cfg = { | ||
720 | .i2c_address = 0x60, | ||
721 | .osc_clk = 20 | ||
722 | }; | ||
723 | |||
717 | /* Callbacks for DVB USB */ | 724 | /* Callbacks for DVB USB */ |
718 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) | 725 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
719 | { | 726 | { |
@@ -813,6 +820,14 @@ static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap) | |||
813 | return (fe == NULL) ? -EIO : 0; | 820 | return (fe == NULL) ? -EIO : 0; |
814 | } | 821 | } |
815 | 822 | ||
823 | static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap) | ||
824 | { | ||
825 | struct dvb_frontend *fe; | ||
826 | fe = dvb_attach(max2165_attach, adap->fe, | ||
827 | &adap->dev->i2c_adap, &mygica_d689_max2165_cfg); | ||
828 | return (fe == NULL) ? -EIO : 0; | ||
829 | } | ||
830 | |||
816 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) | 831 | static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) |
817 | { | 832 | { |
818 | u8 b; | 833 | u8 b; |
@@ -1160,6 +1175,56 @@ static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap) | |||
1160 | return 0; | 1175 | return 0; |
1161 | } | 1176 | } |
1162 | 1177 | ||
1178 | static struct atbm8830_config mygica_d689_atbm8830_cfg = { | ||
1179 | .prod = ATBM8830_PROD_8830, | ||
1180 | .demod_address = 0x40, | ||
1181 | .serial_ts = 0, | ||
1182 | .ts_sampling_edge = 1, | ||
1183 | .ts_clk_gated = 0, | ||
1184 | .osc_clk_freq = 30400, /* in kHz */ | ||
1185 | .if_freq = 0, /* zero IF */ | ||
1186 | .zif_swap_iq = 1, | ||
1187 | }; | ||
1188 | |||
1189 | static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) | ||
1190 | { | ||
1191 | struct dvb_usb_device *d = adap->dev; | ||
1192 | int n; | ||
1193 | |||
1194 | /* Select required USB configuration */ | ||
1195 | if (usb_set_interface(d->udev, 0, 0) < 0) | ||
1196 | err("set interface failed"); | ||
1197 | |||
1198 | /* Unblock all USB pipes */ | ||
1199 | usb_clear_halt(d->udev, | ||
1200 | usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); | ||
1201 | usb_clear_halt(d->udev, | ||
1202 | usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); | ||
1203 | usb_clear_halt(d->udev, | ||
1204 | usb_rcvbulkpipe(d->udev, d->props.adapter[0].stream.endpoint)); | ||
1205 | |||
1206 | |||
1207 | /* Reset the tuner */ | ||
1208 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { | ||
1209 | err("clear tuner gpio failed"); | ||
1210 | return -EIO; | ||
1211 | } | ||
1212 | msleep(100); | ||
1213 | if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { | ||
1214 | err("set tuner gpio failed"); | ||
1215 | return -EIO; | ||
1216 | } | ||
1217 | msleep(100); | ||
1218 | |||
1219 | /* Attach frontend */ | ||
1220 | adap->fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg, | ||
1221 | &d->i2c_adap); | ||
1222 | if (adap->fe == NULL) | ||
1223 | return -EIO; | ||
1224 | |||
1225 | return 0; | ||
1226 | } | ||
1227 | |||
1163 | /* | 1228 | /* |
1164 | * DViCO has shipped two devices with the same USB ID, but only one of them | 1229 | * DViCO has shipped two devices with the same USB ID, but only one of them |
1165 | * needs a firmware download. Check the device class details to see if they | 1230 | * needs a firmware download. Check the device class details to see if they |
@@ -1240,6 +1305,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; | |||
1240 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; | 1305 | static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; |
1241 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; | 1306 | static struct dvb_usb_device_properties cxusb_aver_a868r_properties; |
1242 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties; | 1307 | static struct dvb_usb_device_properties cxusb_d680_dmb_properties; |
1308 | static struct dvb_usb_device_properties cxusb_mygica_d689_properties; | ||
1243 | 1309 | ||
1244 | static int cxusb_probe(struct usb_interface *intf, | 1310 | static int cxusb_probe(struct usb_interface *intf, |
1245 | const struct usb_device_id *id) | 1311 | const struct usb_device_id *id) |
@@ -1268,6 +1334,8 @@ static int cxusb_probe(struct usb_interface *intf, | |||
1268 | THIS_MODULE, NULL, adapter_nr) || | 1334 | THIS_MODULE, NULL, adapter_nr) || |
1269 | 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, | 1335 | 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, |
1270 | THIS_MODULE, NULL, adapter_nr) || | 1336 | THIS_MODULE, NULL, adapter_nr) || |
1337 | 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, | ||
1338 | THIS_MODULE, NULL, adapter_nr) || | ||
1271 | 0) | 1339 | 0) |
1272 | return 0; | 1340 | return 0; |
1273 | 1341 | ||
@@ -1294,6 +1362,7 @@ static struct usb_device_id cxusb_table [] = { | |||
1294 | { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, | 1362 | { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, |
1295 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, | 1363 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, |
1296 | { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, | 1364 | { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, |
1365 | { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) }, | ||
1297 | {} /* Terminating entry */ | 1366 | {} /* Terminating entry */ |
1298 | }; | 1367 | }; |
1299 | MODULE_DEVICE_TABLE (usb, cxusb_table); | 1368 | MODULE_DEVICE_TABLE (usb, cxusb_table); |
@@ -1837,6 +1906,55 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { | |||
1837 | } | 1906 | } |
1838 | }; | 1907 | }; |
1839 | 1908 | ||
1909 | static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { | ||
1910 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
1911 | |||
1912 | .usb_ctrl = CYPRESS_FX2, | ||
1913 | |||
1914 | .size_of_priv = sizeof(struct cxusb_state), | ||
1915 | |||
1916 | .num_adapters = 1, | ||
1917 | .adapter = { | ||
1918 | { | ||
1919 | .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, | ||
1920 | .frontend_attach = cxusb_mygica_d689_frontend_attach, | ||
1921 | .tuner_attach = cxusb_mygica_d689_tuner_attach, | ||
1922 | |||
1923 | /* parameter for the MPEG2-data transfer */ | ||
1924 | .stream = { | ||
1925 | .type = USB_BULK, | ||
1926 | .count = 5, | ||
1927 | .endpoint = 0x02, | ||
1928 | .u = { | ||
1929 | .bulk = { | ||
1930 | .buffersize = 8192, | ||
1931 | } | ||
1932 | } | ||
1933 | }, | ||
1934 | }, | ||
1935 | }, | ||
1936 | |||
1937 | .power_ctrl = cxusb_d680_dmb_power_ctrl, | ||
1938 | |||
1939 | .i2c_algo = &cxusb_i2c_algo, | ||
1940 | |||
1941 | .generic_bulk_ctrl_endpoint = 0x01, | ||
1942 | |||
1943 | .rc_interval = 100, | ||
1944 | .rc_key_map = d680_dmb_rc_keys, | ||
1945 | .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys), | ||
1946 | .rc_query = cxusb_d680_dmb_rc_query, | ||
1947 | |||
1948 | .num_device_descs = 1, | ||
1949 | .devices = { | ||
1950 | { | ||
1951 | "Mygica D689 DMB-TH", | ||
1952 | { NULL }, | ||
1953 | { &cxusb_table[19], NULL }, | ||
1954 | }, | ||
1955 | } | ||
1956 | }; | ||
1957 | |||
1840 | static struct usb_driver cxusb_driver = { | 1958 | static struct usb_driver cxusb_driver = { |
1841 | .name = "dvb_usb_cxusb", | 1959 | .name = "dvb_usb_cxusb", |
1842 | .probe = cxusb_probe, | 1960 | .probe = cxusb_probe, |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index dc57fe1b6f0f..f1602d4ace6d 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -279,6 +279,7 @@ | |||
279 | #define USB_PID_TELESTAR_STARSTICK_2 0x8000 | 279 | #define USB_PID_TELESTAR_STARSTICK_2 0x8000 |
280 | #define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807 | 280 | #define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807 |
281 | #define USB_PID_SONY_PLAYTV 0x0003 | 281 | #define USB_PID_SONY_PLAYTV 0x0003 |
282 | #define USB_PID_MYGICA_D689 0xd811 | ||
282 | #define USB_PID_ELGATO_EYETV_DTT 0x0021 | 283 | #define USB_PID_ELGATO_EYETV_DTT 0x0021 |
283 | #define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020 | 284 | #define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020 |
284 | #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000 | 285 | #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000 |