diff options
author | Antti Palosaari <crope@iki.fi> | 2014-07-13 19:22:19 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-14 21:07:09 -0300 |
commit | b6b6fd6feb5f71267ef535f15061a397f86ebb26 (patch) | |
tree | c79e0ee89a2c7cb6c4c870e0f1aca3cdb504ea0c /drivers/media/dvb-frontends | |
parent | bac53a2c604779297ac8ee54ce7eda4cc07b65f5 (diff) | |
download | op-kernel-dev-b6b6fd6feb5f71267ef535f15061a397f86ebb26.zip op-kernel-dev-b6b6fd6feb5f71267ef535f15061a397f86ebb26.tar.gz |
[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: Antti Palosaari <crope@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r-- | drivers/media/dvb-frontends/si2168.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index db4b28a..1b56b8e 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c @@ -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; } |