aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-06-26 03:58:30 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:23:20 -0400
commit02aea4fb640cdc4018e0a6d34e235eb63e4482d7 (patch)
treee357cba33f9c33374b2fd8ceed7bde1e13f6f680 /drivers/media/dvb
parent2708e888c57904f78649dcd91dcda9768d580ecf (diff)
V4L/DVB (8301): 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 <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/siano/sms-cards.h2
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c31
-rw-r--r--drivers/media/dvb/siano/smsusb.c1
3 files changed, 28 insertions, 6 deletions
diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h
index 7ba3df63dffe..9e93f0b5b231 100644
--- a/drivers/media/dvb/siano/sms-cards.h
+++ b/drivers/media/dvb/siano/sms-cards.h
@@ -31,8 +31,8 @@
31#define SMS1XXX_BOARD_SIANO_VEGA 5 31#define SMS1XXX_BOARD_SIANO_VEGA 5
32 32
33struct sms_board { 33struct sms_board {
34 char *name;
35 enum sms_device_type_st type; 34 enum sms_device_type_st type;
35 char *name, *fw[DEVICE_MODE_MAX];
36}; 36};
37 37
38struct sms_board *sms_get_board(int id); 38struct sms_board *sms_get_board(int id);
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index bbb3ad9c804a..eaa7cf22715b 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -32,6 +32,7 @@
32#include <linux/firmware.h> 32#include <linux/firmware.h>
33 33
34#include "smscoreapi.h" 34#include "smscoreapi.h"
35#include "sms-cards.h"
35 36
36int sms_debug; 37int sms_debug;
37module_param_named(debug, sms_debug, int, 0644); 38module_param_named(debug, sms_debug, int, 0644);
@@ -600,7 +601,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
600 sms_info("failed to open \"%s\"", filename); 601 sms_info("failed to open \"%s\"", filename);
601 return rc; 602 return rc;
602 } 603 }
603 sms_info("read FW %s, size=%d\"", filename, fw->size); 604 sms_info("read FW %s, size=%d", filename, fw->size);
604 fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), 605 fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT),
605 GFP_KERNEL | GFP_DMA); 606 GFP_KERNEL | GFP_DMA);
606 if (fw_buffer) { 607 if (fw_buffer) {
@@ -736,6 +737,12 @@ static char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = {
736 {"none", "none", "none", "cmmb_vega_12mhz.inp"} 737 {"none", "none", "none", "cmmb_vega_12mhz.inp"}
737}; 738};
738 739
740static inline char *sms_get_fw_name(struct smscore_device_t *coredev,
741 int mode, enum sms_device_type_st type)
742{
743 char **fw = sms_get_board(smscore_get_board_id(coredev))->fw;
744 return (fw && fw[mode]) ? fw[mode] : smscore_fw_lkup[mode][type];
745}
739 746
740/** 747/**
741 * calls device handler to change mode of operation 748 * calls device handler to change mode of operation
@@ -776,12 +783,26 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
776 } 783 }
777 784
778 if (!(coredev->modes_supported & (1 << mode))) { 785 if (!(coredev->modes_supported & (1 << mode))) {
786 char *fw_filename;
787
779 type = smscore_registry_gettype(coredev->devpath); 788 type = smscore_registry_gettype(coredev->devpath);
780 rc = smscore_load_firmware_from_file( 789 fw_filename = sms_get_fw_name(coredev, mode, type);
781 coredev, smscore_fw_lkup[mode][type], NULL); 790
791 rc = smscore_load_firmware_from_file(coredev,
792 fw_filename, NULL);
782 if (rc < 0) { 793 if (rc < 0) {
783 sms_err("load firmware failed %d", rc); 794 sms_err("error %d loading firmware: %s, "
784 return rc; 795 "trying again with default firmware",
796 rc, fw_filename);
797
798 /* try again with the default firmware */
799 rc = smscore_load_firmware_from_file(coredev,
800 smscore_fw_lkup[mode][type], NULL);
801
802 if (rc < 0) {
803 sms_err("load firmware failed %d", rc);
804 return rc;
805 }
785 } 806 }
786 } else 807 } else
787 sms_info("mode %d supported by running " 808 sms_info("mode %d supported by running "
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index e7e0fe735427..f85210f2bd0d 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -216,6 +216,7 @@ static int smsusb1_load_firmware(struct usb_device *udev, int id)
216 sms_err("failed to allocate firmware buffer"); 216 sms_err("failed to allocate firmware buffer");
217 rc = -ENOMEM; 217 rc = -ENOMEM;
218 } 218 }
219 sms_info("read FW %s, size=%d", smsusb1_fw_lkup[id], fw->size);
219 220
220 release_firmware(fw); 221 release_firmware(fw);
221 222