Commit 5c913c05 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (7439): tuner-xc2028: Adds an option to allow forcing to load an specific firmware name

There are a number of different firmware versions and variants, shipped
together with boards.

This patch adds an extra parameter to the tuner-xc2028 to allow specifying for
an specific firmware name to be loaded. This helps to test for a firmware that
better fits some board.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 5ec96b0c
...@@ -41,6 +41,11 @@ MODULE_PARM_DESC(audio_std, ...@@ -41,6 +41,11 @@ MODULE_PARM_DESC(audio_std,
"NICAM/A\n" "NICAM/A\n"
"NICAM/B\n"); "NICAM/B\n");
static char firmware_name[FIRMWARE_NAME_MAX];
module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0);
MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the "
"default firmware name\n");
static LIST_HEAD(xc2028_list); static LIST_HEAD(xc2028_list);
static DEFINE_MUTEX(xc2028_list_mutex); static DEFINE_MUTEX(xc2028_list_mutex);
...@@ -253,19 +258,24 @@ static int load_all_firmwares(struct dvb_frontend *fe) ...@@ -253,19 +258,24 @@ static int load_all_firmwares(struct dvb_frontend *fe)
int rc = 0; int rc = 0;
int n, n_array; int n, n_array;
char name[33]; char name[33];
char *fname;
tuner_dbg("%s called\n", __FUNCTION__); tuner_dbg("%s called\n", __FUNCTION__);
tuner_dbg("Reading firmware %s\n", priv->ctrl.fname); if (!firmware_name[0])
rc = request_firmware(&fw, priv->ctrl.fname, fname = priv->ctrl.fname;
&priv->i2c_props.adap->dev); else
fname = firmware_name;
tuner_dbg("Reading firmware %s\n", fname);
rc = request_firmware(&fw, fname, &priv->i2c_props.adap->dev);
if (rc < 0) { if (rc < 0) {
if (rc == -ENOENT) if (rc == -ENOENT)
tuner_err("Error: firmware %s not found.\n", tuner_err("Error: firmware %s not found.\n",
priv->ctrl.fname); fname);
else else
tuner_err("Error %d while requesting firmware %s \n", tuner_err("Error %d while requesting firmware %s \n",
rc, priv->ctrl.fname); rc, fname);
return rc; return rc;
} }
...@@ -274,7 +284,7 @@ static int load_all_firmwares(struct dvb_frontend *fe) ...@@ -274,7 +284,7 @@ static int load_all_firmwares(struct dvb_frontend *fe)
if (fw->size < sizeof(name) - 1 + 2 + 2) { if (fw->size < sizeof(name) - 1 + 2 + 2) {
tuner_err("Error: firmware file %s has invalid size!\n", tuner_err("Error: firmware file %s has invalid size!\n",
priv->ctrl.fname); fname);
goto corrupt; goto corrupt;
} }
...@@ -289,7 +299,7 @@ static int load_all_firmwares(struct dvb_frontend *fe) ...@@ -289,7 +299,7 @@ static int load_all_firmwares(struct dvb_frontend *fe)
p += 2; p += 2;
tuner_info("Loading %d firmware images from %s, type: %s, ver %d.%d\n", tuner_info("Loading %d firmware images from %s, type: %s, ver %d.%d\n",
n_array, priv->ctrl.fname, name, n_array, fname, name,
priv->firm_version >> 8, priv->firm_version & 0xff); priv->firm_version >> 8, priv->firm_version & 0xff);
priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL); priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment