summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-07-01 00:35:26 -0400
committerMichael Krufky <mkrufky@linuxtv.org>2008-07-01 00:35:26 -0400
commitc5b49b860f6d546b5c4c2a7d38d4d982d20d9c17 (patch)
treee22a2a88a48ef37b783d0a661b00c9e11b56ed3c /linux
parente2049a567720df0a7865db90a946af608831faf4 (diff)
downloadmediapointer-dvb-s2-c5b49b860f6d546b5c4c2a7d38d4d982d20d9c17.tar.gz
mediapointer-dvb-s2-c5b49b860f6d546b5c4c2a7d38d4d982d20d9c17.tar.bz2
sms1xxx: support device-specific firmware filenames on stellar usb1 sticks
From: Michael Krufky <mkrufky@linuxtv.org> Add the capability to define device-specific firmware filenames for the SMS1010, with a mechanism to fall back to the generic firmware if the device-specific firmware is not present. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/siano/smsusb.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/linux/drivers/media/dvb/siano/smsusb.c b/linux/drivers/media/dvb/siano/smsusb.c
index e8c3a11e9..079deb2a1 100644
--- a/linux/drivers/media/dvb/siano/smsusb.c
+++ b/linux/drivers/media/dvb/siano/smsusb.c
@@ -188,22 +188,39 @@ static char *smsusb1_fw_lkup[] = {
"dvbt_bda_stellar_usb.inp",
};
-static int smsusb1_load_firmware(struct usb_device *udev, int id)
+static inline char *sms_get_fw_name(int mode, int board_id)
+{
+ char **fw = sms_get_board(board_id)->fw;
+ return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode];
+}
+
+static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id)
{
const struct firmware *fw;
u8 *fw_buffer;
int rc, dummy;
+ char *fw_filename;
if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) {
sms_err("invalid firmware id specified %d", id);
return -EINVAL;
}
- rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev);
+ fw_filename = sms_get_fw_name(id, board_id);
+
+ rc = request_firmware(&fw, fw_filename, &udev->dev);
if (rc < 0) {
- sms_err("failed to open \"%s\" mode %d",
- smsusb1_fw_lkup[id], id);
- return rc;
+ sms_warn("failed to open \"%s\" mode %d, "
+ "trying again with default firmware", fw_filename, id);
+
+ fw_filename = smsusb1_fw_lkup[id];
+ rc = request_firmware(&fw, fw_filename, &udev->dev);
+ if (rc < 0) {
+ sms_warn("failed to open \"%s\" mode %d",
+ fw_filename, id);
+
+ return rc;
+ }
}
fw_buffer = kmalloc(fw->size, GFP_KERNEL);
@@ -220,7 +237,7 @@ static int smsusb1_load_firmware(struct usb_device *udev, int id)
sms_err("failed to allocate firmware buffer");
rc = -ENOMEM;
}
- sms_info("read FW %s, size=%zd", smsusb1_fw_lkup[id], fw->size);
+ sms_info("read FW %s, size=%zd", fw_filename, fw->size);
release_firmware(fw);
@@ -405,7 +422,8 @@ static int smsusb_probe(struct usb_interface *intf,
udev->bus->busnum, udev->devpath);
sms_info("stellar device was found.");
return smsusb1_load_firmware(
- udev, smscore_registry_getmode(devpath));
+ udev, smscore_registry_getmode(devpath),
+ id->driver_info);
}
rc = smsusb_init_device(intf, id->driver_info);