The patch number 8301 was added via Michael Krufky <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel
If anyone has any objections, please let us know by sending a message to:
[EMAIL PROTECTED]
------
From: Michael Krufky <[EMAIL PROTECTED]>
sms1xxx: add capability to define device-specific firmware filenames
Add the capability to define device-specific firmware filenames for the SMS1150,
with a mechanism to fall back to the generic firmware if the device-specific
firmware is not present.
Signed-off-by: Michael Krufky <[EMAIL PROTECTED]>
---
linux/drivers/media/dvb/siano/sms-cards.h | 2 -
linux/drivers/media/dvb/siano/smscoreapi.c | 31 +++++++++++++++++----
linux/drivers/media/dvb/siano/smsusb.c | 1
3 files changed, 28 insertions(+), 6 deletions(-)
diff -r efbe379fe439 -r ae5fa4467009 linux/drivers/media/dvb/siano/sms-cards.h
--- a/linux/drivers/media/dvb/siano/sms-cards.h Sat Jun 21 01:24:38 2008 -0400
+++ b/linux/drivers/media/dvb/siano/sms-cards.h Thu Jun 26 00:58:30 2008 -0400
@@ -31,8 +31,8 @@
#define SMS1XXX_BOARD_SIANO_VEGA 5
struct sms_board {
- char *name;
enum sms_device_type_st type;
+ char *name, *fw[DEVICE_MODE_MAX];
};
struct sms_board *sms_get_board(int id);
diff -r efbe379fe439 -r ae5fa4467009 linux/drivers/media/dvb/siano/smscoreapi.c
--- a/linux/drivers/media/dvb/siano/smscoreapi.c Sat Jun 21 01:24:38
2008 -0400
+++ b/linux/drivers/media/dvb/siano/smscoreapi.c Thu Jun 26 00:58:30
2008 -0400
@@ -32,6 +32,7 @@
#include <linux/firmware.h>
#include "smscoreapi.h"
+#include "sms-cards.h"
int sms_debug;
module_param_named(debug, sms_debug, int, 0644);
@@ -600,7 +601,7 @@ static int smscore_load_firmware_from_fi
sms_info("failed to open \"%s\"", filename);
return rc;
}
- sms_info("read FW %s, size=%d\"", filename, fw->size);
+ sms_info("read FW %s, size=%d", filename, fw->size);
fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT),
GFP_KERNEL | GFP_DMA);
if (fw_buffer) {
@@ -736,6 +737,12 @@ static char *smscore_fw_lkup[][SMS_NUM_O
{"none", "none", "none", "cmmb_vega_12mhz.inp"}
};
+static inline char *sms_get_fw_name(struct smscore_device_t *coredev,
+ int mode, enum sms_device_type_st type)
+{
+ char **fw = sms_get_board(smscore_get_board_id(coredev))->fw;
+ return (fw && fw[mode]) ? fw[mode] : smscore_fw_lkup[mode][type];
+}
/**
* calls device handler to change mode of operation
@@ -776,12 +783,26 @@ int smscore_set_device_mode(struct smsco
}
if (!(coredev->modes_supported & (1 << mode))) {
+ char *fw_filename;
+
type = smscore_registry_gettype(coredev->devpath);
- rc = smscore_load_firmware_from_file(
- coredev, smscore_fw_lkup[mode][type], NULL);
+ fw_filename = sms_get_fw_name(coredev, mode, type);
+
+ rc = smscore_load_firmware_from_file(coredev,
+ fw_filename, NULL);
if (rc < 0) {
- sms_err("load firmware failed %d", rc);
- return rc;
+ sms_err("error %d loading firmware: %s, "
+ "trying again with default firmware",
+ rc, fw_filename);
+
+ /* try again with the default firmware */
+ rc = smscore_load_firmware_from_file(coredev,
+ smscore_fw_lkup[mode][type], NULL);
+
+ if (rc < 0) {
+ sms_err("load firmware failed %d", rc);
+ return rc;
+ }
}
} else
sms_info("mode %d supported by running "
diff -r efbe379fe439 -r ae5fa4467009 linux/drivers/media/dvb/siano/smsusb.c
--- a/linux/drivers/media/dvb/siano/smsusb.c Sat Jun 21 01:24:38 2008 -0400
+++ b/linux/drivers/media/dvb/siano/smsusb.c Thu Jun 26 00:58:30 2008 -0400
@@ -220,6 +220,7 @@ static int smsusb1_load_firmware(struct
sms_err("failed to allocate firmware buffer");
rc = -ENOMEM;
}
+ sms_info("read FW %s, size=%d", smsusb1_fw_lkup[id], fw->size);
release_firmware(fw);
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/ae5fa4467009b938e6bd33089dfb622af70c43ce
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits