aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Pascoe <c.pascoe@itee.uq.edu.au>2006-01-09 15:21:28 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:21:28 -0500
commit0029ee143d66ca89d0e8b074abb452cf4ca2c53c (patch)
tree6d87e987682ba3b5f4d3d135d5aeb15c22a622a7
parent0602fbb2c84ffea1b06ae8e677662074620f01d7 (diff)
V4L/DVB (3310): DViCO Dual Digital DVB-T / USB bluebird updates
- Add support for the USB portion of the DViCO Dual Digital board. Patch correct "warm" USB IDs into bluebird firmware before download. Signed-off-by: Chris Pascoe <c.pascoe@itee.uq.edu.au> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c95
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c27
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h12
3 files changed, 128 insertions, 6 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 2c1b1e5992a3..9622a79d6e68 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -26,6 +26,8 @@
26 26
27#include "cx22702.h" 27#include "cx22702.h"
28#include "lgdt330x.h" 28#include "lgdt330x.h"
29#include "mt352.h"
30#include "mt352_priv.h"
29 31
30/* debug */ 32/* debug */
31int dvb_usb_cxusb_debug; 33int dvb_usb_cxusb_debug;
@@ -157,6 +159,27 @@ static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
157 return 0; 159 return 0;
158} 160}
159 161
162static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
163{
164 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 };
165 static u8 reset [] = { RESET, 0x80 };
166 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
167 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
168 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
169 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
170
171 mt352_write(fe, clock_config, sizeof(clock_config));
172 udelay(200);
173 mt352_write(fe, reset, sizeof(reset));
174 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
175
176 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
177 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
178 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
179
180 return 0;
181}
182
160struct cx22702_config cxusb_cx22702_config = { 183struct cx22702_config cxusb_cx22702_config = {
161 .demod_address = 0x63, 184 .demod_address = 0x63,
162 185
@@ -172,6 +195,12 @@ struct lgdt330x_config cxusb_lgdt330x_config = {
172 .pll_set = dvb_usb_pll_set_i2c, 195 .pll_set = dvb_usb_pll_set_i2c,
173}; 196};
174 197
198struct mt352_config cxusb_dee1601_config = {
199 .demod_address = 0x0f,
200 .demod_init = cxusb_dee1601_demod_init,
201 .pll_set = dvb_usb_pll_set,
202};
203
175/* Callbacks for DVB USB */ 204/* Callbacks for DVB USB */
176static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d) 205static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d)
177{ 206{
@@ -193,6 +222,13 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_device *d)
193 return 0; 222 return 0;
194} 223}
195 224
225static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d)
226{
227 d->pll_addr = 0x61;
228 d->pll_desc = &dvb_pll_thomson_dtt7579;
229 return 0;
230}
231
196static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d) 232static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d)
197{ 233{
198 u8 b; 234 u8 b;
@@ -220,15 +256,31 @@ static int cxusb_lgdt330x_frontend_attach(struct dvb_usb_device *d)
220 return -EIO; 256 return -EIO;
221} 257}
222 258
259static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
260{
261 if (usb_set_interface(d->udev,0,0) < 0)
262 err("set interface failed");
263
264 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
265
266 if ((d->fe = mt352_attach(&cxusb_dee1601_config, &d->i2c_adap)) != NULL)
267 return 0;
268
269 return -EIO;
270}
271
223/* DVB USB Driver stuff */ 272/* DVB USB Driver stuff */
224static struct dvb_usb_properties cxusb_medion_properties; 273static struct dvb_usb_properties cxusb_medion_properties;
225static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; 274static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties;
275static struct dvb_usb_properties cxusb_bluebird_dee1601_properties;
226 276
227static int cxusb_probe(struct usb_interface *intf, 277static int cxusb_probe(struct usb_interface *intf,
228 const struct usb_device_id *id) 278 const struct usb_device_id *id)
229{ 279{
230 if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || 280 if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
231 dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0) { 281 dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
282 dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0
283 ){
232 return 0; 284 return 0;
233 } 285 }
234 286
@@ -239,6 +291,8 @@ static struct usb_device_id cxusb_table [] = {
239 { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, 291 { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
240 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, 292 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
241 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, 293 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
294 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) },
295 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) },
242 {} /* Terminating entry */ 296 {} /* Terminating entry */
243}; 297};
244MODULE_DEVICE_TABLE (usb, cxusb_table); 298MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -318,6 +372,45 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
318 } 372 }
319}; 373};
320 374
375static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
376 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
377
378 .usb_ctrl = CYPRESS_FX2,
379 .firmware = "dvb-usb-bluebird-01.fw",
380 /* use usb alt setting 0 for EP4 transfer (dvb-t),
381 use usb alt setting 7 for EP2 transfer (atsc) */
382
383 .size_of_priv = sizeof(struct cxusb_state),
384
385 .streaming_ctrl = cxusb_streaming_ctrl,
386 .power_ctrl = cxusb_power_ctrl,
387 .frontend_attach = cxusb_dee1601_frontend_attach,
388 .tuner_attach = cxusb_dee1601_tuner_attach,
389
390 .i2c_algo = &cxusb_i2c_algo,
391
392 .generic_bulk_ctrl_endpoint = 0x01,
393 /* parameter for the MPEG2-data transfer */
394 .urb = {
395 .type = DVB_USB_BULK,
396 .count = 5,
397 .endpoint = 0x04,
398 .u = {
399 .bulk = {
400 .buffersize = 8192,
401 }
402 }
403 },
404
405 .num_device_descs = 1,
406 .devices = {
407 { "DViCO FusionHDTV DVB-T Dual USB",
408 { &cxusb_table[3], NULL },
409 { &cxusb_table[4], NULL },
410 },
411 }
412};
413
321static struct usb_driver cxusb_driver = { 414static struct usb_driver cxusb_driver = {
322 .name = "dvb_usb_cxusb", 415 .name = "dvb_usb_cxusb",
323 .probe = cxusb_probe, 416 .probe = cxusb_probe,
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
index 51ce7403999b..b2670476c3f2 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
@@ -74,6 +74,27 @@ static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmw
74 return ret; 74 return ret;
75} 75}
76 76
77/*
78 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
79 * firmware file before download.
80 */
81#define BLUEBIRD_01_ID_OFFSET 6638
82static int dvb_usb_patch_dvico_firmware(struct usb_device *udev, const struct firmware *fw)
83{
84 if (fw->size < BLUEBIRD_01_ID_OFFSET + 4)
85 return -EINVAL;
86
87 if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) &&
88 fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
89 fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1;
90 fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8;
91
92 return 0;
93 }
94
95 return -EINVAL;
96}
97
77int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props) 98int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props)
78{ 99{
79 int ret; 100 int ret;
@@ -88,6 +109,12 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties
88 109
89 info("downloading firmware from file '%s'",props->firmware); 110 info("downloading firmware from file '%s'",props->firmware);
90 111
112 if (le16_to_cpu(udev->descriptor.idVendor) == USB_VID_DVICO) {
113 ret = dvb_usb_patch_dvico_firmware(udev, fw);
114 if (ret != 0)
115 warn("this firmware file not recognised");
116 }
117
91 switch (props->usb_ctrl) { 118 switch (props->usb_ctrl) {
92 case CYPRESS_AN2135: 119 case CYPRESS_AN2135:
93 case CYPRESS_AN2235: 120 case CYPRESS_AN2235:
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 784adfe1c070..d22934383226 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -86,13 +86,15 @@
86#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 86#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300
87#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 87#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301
88#define USB_PID_NEBULA_DIGITV 0x0201 88#define USB_PID_NEBULA_DIGITV 0x0201
89#define USB_PID_DVICO_BLUEBIRD_LGZ201 0xdb00
90#define USB_PID_DVICO_BLUEBIRD_TH7579 0xdb10
91#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 89#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820
92#define USB_PID_DVICO_BLUEBIRD_LGZ201_1 0xdb01
93#define USB_PID_DVICO_BLUEBIRD_TH7579_2 0xdb11
94#define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 90#define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500
95#define USB_PID_DVICO_BLUEBIRD_LG064F_WARM 0xd700 91#define USB_PID_DVICO_BLUEBIRD_LG064F_WARM 0xd501
92#define USB_PID_DVICO_BLUEBIRD_LGZ201_COLD 0xdb00
93#define USB_PID_DVICO_BLUEBIRD_LGZ201_WARM 0xdb01
94#define USB_PID_DVICO_BLUEBIRD_TH7579_COLD 0xdb10
95#define USB_PID_DVICO_BLUEBIRD_TH7579_WARM 0xdb11
96#define USB_PID_DVICO_BLUEBIRD_DEE1601_COLD 0xdb50
97#define USB_PID_DVICO_BLUEBIRD_DEE1601_WARM 0xdb51
96#define USB_PID_MEDION_MD95700 0x0932 98#define USB_PID_MEDION_MD95700 0x0932
97#define USB_PID_KYE_DVB_T_COLD 0x701e 99#define USB_PID_KYE_DVB_T_COLD 0x701e
98#define USB_PID_KYE_DVB_T_WARM 0x701f 100#define USB_PID_KYE_DVB_T_WARM 0x701f