aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-01-09 15:21:38 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:21:38 -0500
commitf53737882e26ff08022fec6ad79f061c49dadda2 (patch)
treed07379f003fbb144790b24e845045edfb4f517be /drivers/media/dvb/dvb-usb
parent5af0c8f6a09534ebc6c56b4e5d79d0d521364750 (diff)
V4L/DVB (3327): Remove DViCO specific firmware hacks from the generic code.
- Move the code that patches bluebird firmware before upload from the generic code into the cxusb driver itself. Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@m1k.net> Signed-off-by: Chris Pascoe <c.pascoe@itee.uq.edu.au> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c37
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c30
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h1
3 files changed, 34 insertions, 34 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 3100ce91ccdb..9d69f8225375 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -11,8 +11,7 @@
11 * design, so it can be reused for the "analogue-only" device (if it will 11 * design, so it can be reused for the "analogue-only" device (if it will
12 * appear at all). 12 * appear at all).
13 * 13 *
14 * TODO: check if the cx25840-driver (from ivtv) can be used for the analogue 14 * Use the cx25840-driver for the analogue part
15 * part
16 * 15 *
17 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) 16 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
18 * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net) 17 * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net)
@@ -343,6 +342,30 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
343 return -EIO; 342 return -EIO;
344} 343}
345 344
345/*
346 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
347 * firmware file before download.
348 */
349
350#define BLUEBIRD_01_ID_OFFSET 6638
351static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw)
352{
353 if (fw->size < BLUEBIRD_01_ID_OFFSET + 4)
354 return -EINVAL;
355
356 if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) &&
357 fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
358
359 /* FIXME: are we allowed to change the fw-data ? */
360 fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1;
361 fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8;
362
363 return usb_cypress_load_firmware(udev,fw,CYPRESS_FX2);
364 }
365
366 return -EINVAL;
367}
368
346/* DVB USB Driver stuff */ 369/* DVB USB Driver stuff */
347static struct dvb_usb_properties cxusb_medion_properties; 370static struct dvb_usb_properties cxusb_medion_properties;
348static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; 371static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties;
@@ -409,8 +432,9 @@ static struct dvb_usb_properties cxusb_medion_properties = {
409static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { 432static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
410 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 433 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
411 434
412 .usb_ctrl = CYPRESS_FX2, 435 .usb_ctrl = DEVICE_SPECIFIC,
413 .firmware = "dvb-usb-bluebird-01.fw", 436 .firmware = "dvb-usb-bluebird-01.fw",
437 .download_firmware = bluebird_patch_dvico_firmware_download,
414 /* use usb alt setting 0 for EP4 transfer (dvb-t), 438 /* use usb alt setting 0 for EP4 transfer (dvb-t),
415 use usb alt setting 7 for EP2 transfer (atsc) */ 439 use usb alt setting 7 for EP2 transfer (atsc) */
416 440
@@ -448,8 +472,9 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
448static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { 472static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
449 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 473 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
450 474
451 .usb_ctrl = CYPRESS_FX2, 475 .usb_ctrl = DEVICE_SPECIFIC,
452 .firmware = "dvb-usb-bluebird-01.fw", 476 .firmware = "dvb-usb-bluebird-01.fw",
477 .download_firmware = bluebird_patch_dvico_firmware_download,
453 /* use usb alt setting 0 for EP4 transfer (dvb-t), 478 /* use usb alt setting 0 for EP4 transfer (dvb-t),
454 use usb alt setting 7 for EP2 transfer (atsc) */ 479 use usb alt setting 7 for EP2 transfer (atsc) */
455 480
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
index b2670476c3f2..8535895819fb 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
@@ -33,7 +33,7 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le
33 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); 33 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000);
34} 34}
35 35
36static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) 36int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
37{ 37{
38 struct hexline hx; 38 struct hexline hx;
39 u8 reset; 39 u8 reset;
@@ -73,27 +73,7 @@ static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmw
73 73
74 return ret; 74 return ret;
75} 75}
76 76EXPORT_SYMBOL(usb_cypress_load_firmware);
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 77
98int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props) 78int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props)
99{ 79{
@@ -109,12 +89,6 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties
109 89
110 info("downloading firmware from file '%s'",props->firmware); 90 info("downloading firmware from file '%s'",props->firmware);
111 91
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
118 switch (props->usb_ctrl) { 92 switch (props->usb_ctrl) {
119 case CYPRESS_AN2135: 93 case CYPRESS_AN2135:
120 case CYPRESS_AN2235: 94 case CYPRESS_AN2235:
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 4060fe1ca082..dd568396e594 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -342,5 +342,6 @@ struct hexline {
342 u8 chk; 342 u8 chk;
343}; 343};
344extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *); 344extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *);
345extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
345 346
346#endif 347#endif