Commit b6b6fd6f authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] si2168: few firmware download changes

Rework firmware selection logic a little bit.
Print notice asking user update firmware when old Si2168 B40
firmware is used.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Tested-by: default avatarOlli Salonen <olli.salonen@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent bac53a2c
......@@ -336,6 +336,7 @@ static int si2168_init(struct dvb_frontend *fe)
u8 *fw_file;
const unsigned int i2c_wr_max = 8;
struct si2168_cmd cmd;
unsigned int chip_id;
dev_dbg(&s->client->dev, "%s:\n", __func__);
......@@ -375,16 +376,24 @@ static int si2168_init(struct dvb_frontend *fe)
if (ret)
goto err;
if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
(cmd.args[4] == '0'))
fw_file = SI2168_B40_FIRMWARE;
else if (((cmd.args[1] & 0x0f) == 1) && (cmd.args[3] == '3') &&
(cmd.args[4] == '0'))
chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
cmd.args[4] << 0;
#define SI2168_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
#define SI2168_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
switch (chip_id) {
case SI2168_A30:
fw_file = SI2168_A30_FIRMWARE;
else {
break;
case SI2168_B40:
fw_file = SI2168_B40_FIRMWARE;
break;
default:
dev_err(&s->client->dev,
"%s: no firmware file for Si2168-%c%c defined\n",
KBUILD_MODNAME, cmd.args[3], cmd.args[4]);
"%s: unkown chip version Si21%d-%c%c%c\n",
KBUILD_MODNAME, cmd.args[2], cmd.args[1],
cmd.args[3], cmd.args[4]);
ret = -EINVAL;
goto err;
}
......@@ -396,15 +405,19 @@ static int si2168_init(struct dvb_frontend *fe)
/* request the firmware, this will block and timeout */
ret = request_firmware(&fw, fw_file, &s->client->dev);
if (ret) {
/* fallback mechanism to handle old name for
SI2168_B40_FIRMWARE */
if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
(cmd.args[4] == '0')) {
/* fallback mechanism to handle old name for Si2168 B40 fw */
if (chip_id == SI2168_B40) {
fw_file = SI2168_B40_FIRMWARE_FALLBACK;
ret = request_firmware(&fw, fw_file, &s->client->dev);
}
if (ret) {
dev_err(&s->client->dev, "%s: firmware file '%s' not found\n",
if (ret == 0) {
dev_notice(&s->client->dev,
"%s: please install firmware file '%s'\n",
KBUILD_MODNAME, SI2168_B40_FIRMWARE);
} else {
dev_err(&s->client->dev,
"%s: firmware file '%s' not found\n",
KBUILD_MODNAME, fw_file);
goto err;
}
......
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