提交 f5373788 编写于 作者: P Patrick Boettcher 提交者: Mauro Carvalho Chehab

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: NPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: NMichael Krufky <mkrufky@m1k.net>
Signed-off-by: NChris Pascoe <c.pascoe@itee.uq.edu.au>
Signed-off-by: NMauro Carvalho Chehab <mchehab@brturbo.com.br>
上级 5af0c8f6
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
* design, so it can be reused for the "analogue-only" device (if it will * design, so it can be reused for the "analogue-only" device (if it will
* appear at all). * appear at all).
* *
* TODO: check if the cx25840-driver (from ivtv) can be used for the analogue * Use the cx25840-driver for the analogue part
* part
* *
* Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
* Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net) * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net)
...@@ -343,6 +342,30 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d) ...@@ -343,6 +342,30 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
return -EIO; return -EIO;
} }
/*
* DViCO bluebird firmware needs the "warm" product ID to be patched into the
* firmware file before download.
*/
#define BLUEBIRD_01_ID_OFFSET 6638
static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw)
{
if (fw->size < BLUEBIRD_01_ID_OFFSET + 4)
return -EINVAL;
if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) &&
fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
/* FIXME: are we allowed to change the fw-data ? */
fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1;
fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8;
return usb_cypress_load_firmware(udev,fw,CYPRESS_FX2);
}
return -EINVAL;
}
/* DVB USB Driver stuff */ /* DVB USB Driver stuff */
static struct dvb_usb_properties cxusb_medion_properties; static struct dvb_usb_properties cxusb_medion_properties;
static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties;
...@@ -409,8 +432,9 @@ static struct dvb_usb_properties cxusb_medion_properties = { ...@@ -409,8 +432,9 @@ static struct dvb_usb_properties cxusb_medion_properties = {
static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
.caps = DVB_USB_IS_AN_I2C_ADAPTER, .caps = DVB_USB_IS_AN_I2C_ADAPTER,
.usb_ctrl = CYPRESS_FX2, .usb_ctrl = DEVICE_SPECIFIC,
.firmware = "dvb-usb-bluebird-01.fw", .firmware = "dvb-usb-bluebird-01.fw",
.download_firmware = bluebird_patch_dvico_firmware_download,
/* use usb alt setting 0 for EP4 transfer (dvb-t), /* use usb alt setting 0 for EP4 transfer (dvb-t),
use usb alt setting 7 for EP2 transfer (atsc) */ use usb alt setting 7 for EP2 transfer (atsc) */
...@@ -448,8 +472,9 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { ...@@ -448,8 +472,9 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
.caps = DVB_USB_IS_AN_I2C_ADAPTER, .caps = DVB_USB_IS_AN_I2C_ADAPTER,
.usb_ctrl = CYPRESS_FX2, .usb_ctrl = DEVICE_SPECIFIC,
.firmware = "dvb-usb-bluebird-01.fw", .firmware = "dvb-usb-bluebird-01.fw",
.download_firmware = bluebird_patch_dvico_firmware_download,
/* use usb alt setting 0 for EP4 transfer (dvb-t), /* use usb alt setting 0 for EP4 transfer (dvb-t),
use usb alt setting 7 for EP2 transfer (atsc) */ use usb alt setting 7 for EP2 transfer (atsc) */
......
...@@ -33,7 +33,7 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le ...@@ -33,7 +33,7 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le
0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000);
} }
static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
{ {
struct hexline hx; struct hexline hx;
u8 reset; u8 reset;
...@@ -73,27 +73,7 @@ static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmw ...@@ -73,27 +73,7 @@ static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmw
return ret; return ret;
} }
EXPORT_SYMBOL(usb_cypress_load_firmware);
/*
* DViCO bluebird firmware needs the "warm" product ID to be patched into the
* firmware file before download.
*/
#define BLUEBIRD_01_ID_OFFSET 6638
static int dvb_usb_patch_dvico_firmware(struct usb_device *udev, const struct firmware *fw)
{
if (fw->size < BLUEBIRD_01_ID_OFFSET + 4)
return -EINVAL;
if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) &&
fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1;
fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8;
return 0;
}
return -EINVAL;
}
int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props) int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props)
{ {
...@@ -109,12 +89,6 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties ...@@ -109,12 +89,6 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties
info("downloading firmware from file '%s'",props->firmware); info("downloading firmware from file '%s'",props->firmware);
if (le16_to_cpu(udev->descriptor.idVendor) == USB_VID_DVICO) {
ret = dvb_usb_patch_dvico_firmware(udev, fw);
if (ret != 0)
warn("this firmware file not recognised");
}
switch (props->usb_ctrl) { switch (props->usb_ctrl) {
case CYPRESS_AN2135: case CYPRESS_AN2135:
case CYPRESS_AN2235: case CYPRESS_AN2235:
......
...@@ -342,5 +342,6 @@ struct hexline { ...@@ -342,5 +342,6 @@ struct hexline {
u8 chk; u8 chk;
}; };
extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *); extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *);
extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册