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>

authored by

Patrick Boettcher and committed by
Mauro Carvalho Chehab
f5373788 5af0c8f6

+34 -34
+31 -6
drivers/media/dvb/dvb-usb/cxusb.c
··· 11 * design, so it can be reused for the "analogue-only" device (if it will 12 * appear at all). 13 * 14 - * TODO: check if the cx25840-driver (from ivtv) can be used for the analogue 15 - * part 16 * 17 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) 18 * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net) ··· 342 return -EIO; 343 } 344 345 /* DVB USB Driver stuff */ 346 static struct dvb_usb_properties cxusb_medion_properties; 347 static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; ··· 432 static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { 433 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 434 435 - .usb_ctrl = CYPRESS_FX2, 436 - .firmware = "dvb-usb-bluebird-01.fw", 437 /* use usb alt setting 0 for EP4 transfer (dvb-t), 438 use usb alt setting 7 for EP2 transfer (atsc) */ 439 ··· 472 static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { 473 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 474 475 - .usb_ctrl = CYPRESS_FX2, 476 - .firmware = "dvb-usb-bluebird-01.fw", 477 /* use usb alt setting 0 for EP4 transfer (dvb-t), 478 use usb alt setting 7 for EP2 transfer (atsc) */ 479
··· 11 * design, so it can be reused for the "analogue-only" device (if it will 12 * appear at all). 13 * 14 + * Use the cx25840-driver for the analogue part 15 * 16 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) 17 * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net) ··· 343 return -EIO; 344 } 345 346 + /* 347 + * DViCO bluebird firmware needs the "warm" product ID to be patched into the 348 + * firmware file before download. 349 + */ 350 + 351 + #define BLUEBIRD_01_ID_OFFSET 6638 352 + static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw) 353 + { 354 + if (fw->size < BLUEBIRD_01_ID_OFFSET + 4) 355 + return -EINVAL; 356 + 357 + if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && 358 + fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { 359 + 360 + /* FIXME: are we allowed to change the fw-data ? */ 361 + fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; 362 + fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; 363 + 364 + return usb_cypress_load_firmware(udev,fw,CYPRESS_FX2); 365 + } 366 + 367 + return -EINVAL; 368 + } 369 + 370 /* DVB USB Driver stuff */ 371 static struct dvb_usb_properties cxusb_medion_properties; 372 static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; ··· 409 static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { 410 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 411 412 + .usb_ctrl = DEVICE_SPECIFIC, 413 + .firmware = "dvb-usb-bluebird-01.fw", 414 + .download_firmware = bluebird_patch_dvico_firmware_download, 415 /* use usb alt setting 0 for EP4 transfer (dvb-t), 416 use usb alt setting 7 for EP2 transfer (atsc) */ 417 ··· 448 static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { 449 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 450 451 + .usb_ctrl = DEVICE_SPECIFIC, 452 + .firmware = "dvb-usb-bluebird-01.fw", 453 + .download_firmware = bluebird_patch_dvico_firmware_download, 454 /* use usb alt setting 0 for EP4 transfer (dvb-t), 455 use usb alt setting 7 for EP2 transfer (atsc) */ 456
+2 -28
drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
··· 33 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); 34 } 35 36 - static int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) 37 { 38 struct hexline hx; 39 u8 reset; ··· 73 74 return ret; 75 } 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 82 - static 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 98 int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props) 99 { ··· 88 } 89 90 info("downloading firmware from file '%s'",props->firmware); 91 - 92 - if (le16_to_cpu(udev->descriptor.idVendor) == USB_VID_DVICO) { 93 - ret = dvb_usb_patch_dvico_firmware(udev, fw); 94 - if (ret != 0) 95 - warn("this firmware file not recognised"); 96 - } 97 98 switch (props->usb_ctrl) { 99 case CYPRESS_AN2135:
··· 33 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); 34 } 35 36 + int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) 37 { 38 struct hexline hx; 39 u8 reset; ··· 73 74 return ret; 75 } 76 + EXPORT_SYMBOL(usb_cypress_load_firmware); 77 78 int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props) 79 { ··· 108 } 109 110 info("downloading firmware from file '%s'",props->firmware); 111 112 switch (props->usb_ctrl) { 113 case CYPRESS_AN2135:
+1
drivers/media/dvb/dvb-usb/dvb-usb.h
··· 342 u8 chk; 343 }; 344 extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *); 345 346 #endif
··· 342 u8 chk; 343 }; 344 extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *); 345 + extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); 346 347 #endif