[media] af9035: select firmware loader according to firmware
authorAntti Palosaari <crope@iki.fi>
Thu, 7 Mar 2013 20:59:55 +0000 (17:59 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Mar 2013 22:00:38 +0000 (19:00 -0300)
AF9035 and IT9135 supports two different firmware format. Select
correct loader according to first byte of firmware file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/dvb-usb-v2/af9035.c

index ce8cccb8946aad8ad298e4fbbd599e98d7bdb969..75d99aec10b67be56eb76679722bef377156309e 100644 (file)
@@ -344,7 +344,7 @@ err:
        return ret;
 }
 
-static int af9035_download_firmware_af9035(struct dvb_usb_device *d,
+static int af9035_download_firmware_old(struct dvb_usb_device *d,
                const struct firmware *fw)
 {
        int ret, i, j, len;
@@ -430,7 +430,7 @@ err:
        return ret;
 }
 
-static int af9035_download_firmware_it9135(struct dvb_usb_device *d,
+static int af9035_download_firmware_new(struct dvb_usb_device *d,
                const struct firmware *fw)
 {
        int ret, i, i_prev;
@@ -540,10 +540,10 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
                }
        }
 
-       if (state->chip_type == 0x9135)
-               ret = af9035_download_firmware_it9135(d, fw);
+       if (fw->data[0] == 0x01)
+               ret = af9035_download_firmware_old(d, fw);
        else
-               ret = af9035_download_firmware_af9035(d, fw);
+               ret = af9035_download_firmware_new(d, fw);
        if (ret < 0)
                goto err;