diff options
author | Michael Krufky <mkrufky@kernellabs.com> | 2012-02-06 17:40:32 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-02-14 14:19:59 -0500 |
commit | 76efb0ba2118c286231dd062bf02b2537cc8738f (patch) | |
tree | a5dc5eb7156386ee3a9e17a4a70be8a737c8b85c /drivers/media/common/tuners/xc5000.c | |
parent | 88495030dc53cd97d4c71937b959e8c67ed27ed7 (diff) |
[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/xc5000.c')
-rw-r--r-- | drivers/media/common/tuners/xc5000.c | 22 |
1 files changed, 16 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); | |||
49 | #define dprintk(level, fmt, arg...) if (debug >= level) \ | 49 | #define dprintk(level, fmt, arg...) if (debug >= level) \ |
50 | printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) | 50 | printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) |
51 | 51 | ||
52 | #define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.6.114.fw" | ||
53 | #define XC5000_DEFAULT_FIRMWARE_SIZE 12401 | ||
54 | |||
55 | struct xc5000_priv { | 52 | struct xc5000_priv { |
56 | struct tuner_i2c_props i2c_props; | 53 | struct tuner_i2c_props i2c_props; |
57 | struct list_head hybrid_tuner_instance_list; | 54 | struct list_head hybrid_tuner_instance_list; |
@@ -62,6 +59,8 @@ struct xc5000_priv { | |||
62 | u8 video_standard; | 59 | u8 video_standard; |
63 | u8 rf_mode; | 60 | u8 rf_mode; |
64 | u8 radio_input; | 61 | u8 radio_input; |
62 | |||
63 | struct xc5000_fw_cfg *fw; | ||
65 | }; | 64 | }; |
66 | 65 | ||
67 | /* Misc Defines */ | 66 | /* Misc Defines */ |
@@ -204,6 +203,11 @@ static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { | |||
204 | {"FM Radio-INPUT1_MONO", 0x0278, 0x9002} | 203 | {"FM Radio-INPUT1_MONO", 0x0278, 0x9002} |
205 | }; | 204 | }; |
206 | 205 | ||
206 | struct xc5000_fw_cfg xc5000a_1_6_114 = { | ||
207 | .name = "dvb-fe-xc5000-1.6.114.fw", | ||
208 | .size = 12401, | ||
209 | }; | ||
210 | |||
207 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); | 211 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); |
208 | static int xc5000_is_firmware_loaded(struct dvb_frontend *fe); | 212 | static int xc5000_is_firmware_loaded(struct dvb_frontend *fe); |
209 | static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val); | 213 | static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val); |
@@ -555,9 +559,9 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
555 | 559 | ||
556 | /* request the firmware, this will block and timeout */ | 560 | /* request the firmware, this will block and timeout */ |
557 | printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n", | 561 | printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n", |
558 | XC5000_DEFAULT_FIRMWARE); | 562 | priv->fw->name); |
559 | 563 | ||
560 | ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, | 564 | ret = request_firmware(&fw, priv->fw->name, |
561 | priv->i2c_props.adap->dev.parent); | 565 | priv->i2c_props.adap->dev.parent); |
562 | if (ret) { | 566 | if (ret) { |
563 | printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); | 567 | printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); |
@@ -569,7 +573,7 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
569 | ret = XC_RESULT_SUCCESS; | 573 | ret = XC_RESULT_SUCCESS; |
570 | } | 574 | } |
571 | 575 | ||
572 | if (fw->size != XC5000_DEFAULT_FIRMWARE_SIZE) { | 576 | if (fw->size != priv->fw->size) { |
573 | printk(KERN_ERR "xc5000: firmware incorrect size\n"); | 577 | printk(KERN_ERR "xc5000: firmware incorrect size\n"); |
574 | ret = XC_RESULT_RESET_FAILURE; | 578 | ret = XC_RESULT_RESET_FAILURE; |
575 | } else { | 579 | } else { |
@@ -1139,6 +1143,12 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
1139 | if (priv->radio_input == 0) | 1143 | if (priv->radio_input == 0) |
1140 | priv->radio_input = cfg->radio_input; | 1144 | priv->radio_input = cfg->radio_input; |
1141 | 1145 | ||
1146 | /* don't override firmware filename if it's already been set | ||
1147 | unless explicitly specified */ | ||
1148 | if ((priv->fw == NULL) || (cfg->fw)) | ||
1149 | /* use default firmware if none specified */ | ||
1150 | priv->fw = (cfg->fw) ? cfg->fw : XC5000_DEFAULT_FIRMWARE; | ||
1151 | |||
1142 | /* Check if firmware has been loaded. It is possible that another | 1152 | /* Check if firmware has been loaded. It is possible that another |
1143 | instance of the driver has loaded the firmware. | 1153 | instance of the driver has loaded the firmware. |
1144 | */ | 1154 | */ |