summaryrefslogtreecommitdiff
path: root/drivers/media/common/tuners
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@kernellabs.com>2012-02-07 02:40:32 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-02-14 23:19:59 +0400
commit76efb0ba2118c286231dd062bf02b2537cc8738f (patch)
treea5dc5eb7156386ee3a9e17a4a70be8a737c8b85c /drivers/media/common/tuners
parent88495030dc53cd97d4c71937b959e8c67ed27ed7 (diff)
downloadlinux-76efb0ba2118c286231dd062bf02b2537cc8738f.tar.xz
[media] xc5000: allow drivers to set desired firmware in xc5000_attach
newer versions of the xc5000 silicon require newer firmware while remaining 100% driver compatible. original versions of the xc5000a continue to use the same firmware. Signed-off-by: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners')
-rw-r--r--drivers/media/common/tuners/xc5000.c22
-rw-r--r--drivers/media/common/tuners/xc5000.h13
2 files changed, 29 insertions, 6 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 296df05b8cda..16c3f75816c4 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -49,9 +49,6 @@ static LIST_HEAD(hybrid_tuner_instance_list);
#define dprintk(level, fmt, arg...) if (debug >= level) \
printk(KERN_INFO "%s: " fmt, "xc5000", ## arg)
-#define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.6.114.fw"
-#define XC5000_DEFAULT_FIRMWARE_SIZE 12401
-
struct xc5000_priv {
struct tuner_i2c_props i2c_props;
struct list_head hybrid_tuner_instance_list;
@@ -62,6 +59,8 @@ struct xc5000_priv {
u8 video_standard;
u8 rf_mode;
u8 radio_input;
+
+ struct xc5000_fw_cfg *fw;
};
/* Misc Defines */
@@ -204,6 +203,11 @@ static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
{"FM Radio-INPUT1_MONO", 0x0278, 0x9002}
};
+struct xc5000_fw_cfg xc5000a_1_6_114 = {
+ .name = "dvb-fe-xc5000-1.6.114.fw",
+ .size = 12401,
+};
+
static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
static int xc5000_is_firmware_loaded(struct dvb_frontend *fe);
static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val);
@@ -555,9 +559,9 @@ static int xc5000_fwupload(struct dvb_frontend *fe)
/* request the firmware, this will block and timeout */
printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n",
- XC5000_DEFAULT_FIRMWARE);
+ priv->fw->name);
- ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE,
+ ret = request_firmware(&fw, priv->fw->name,
priv->i2c_props.adap->dev.parent);
if (ret) {
printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n");
@@ -569,7 +573,7 @@ static int xc5000_fwupload(struct dvb_frontend *fe)
ret = XC_RESULT_SUCCESS;
}
- if (fw->size != XC5000_DEFAULT_FIRMWARE_SIZE) {
+ if (fw->size != priv->fw->size) {
printk(KERN_ERR "xc5000: firmware incorrect size\n");
ret = XC_RESULT_RESET_FAILURE;
} else {
@@ -1139,6 +1143,12 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
if (priv->radio_input == 0)
priv->radio_input = cfg->radio_input;
+ /* don't override firmware filename if it's already been set
+ unless explicitly specified */
+ if ((priv->fw == NULL) || (cfg->fw))
+ /* use default firmware if none specified */
+ priv->fw = (cfg->fw) ? cfg->fw : XC5000_DEFAULT_FIRMWARE;
+
/* Check if firmware has been loaded. It is possible that another
instance of the driver has loaded the firmware.
*/
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index e2957451b532..06d116266d81 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -27,10 +27,23 @@
struct dvb_frontend;
struct i2c_adapter;
+struct xc5000_fw_cfg {
+ char *name;
+ u16 size;
+};
+
+extern struct xc5000_fw_cfg xc5000a_1_6_114;
+
+#define XC5000_FW_A_1_6_114 &xc5000a_1_6_114
+
+#define XC5000_DEFAULT_FIRMWARE XC5000_FW_A_1_6_114
+
struct xc5000_config {
u8 i2c_address;
u32 if_khz;
u8 radio_input;
+
+ struct xc5000_fw_cfg *fw;
};
/* xc5000 callback command */