Commit c9cb0820 authored by Olli Salonen's avatar Olli Salonen Committed by Mauro Carvalho Chehab

[media] si2168: Add support for chip revision Si2168 A30

Add handling for different chip revisions and firmwares.
Signed-off-by: default avatarOlli Salonen <olli.salonen@iki.fi>
Reviewed-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent b02db9e1
...@@ -333,7 +333,7 @@ static int si2168_init(struct dvb_frontend *fe) ...@@ -333,7 +333,7 @@ static int si2168_init(struct dvb_frontend *fe)
struct si2168 *s = fe->demodulator_priv; struct si2168 *s = fe->demodulator_priv;
int ret, len, remaining; int ret, len, remaining;
const struct firmware *fw = NULL; const struct firmware *fw = NULL;
u8 *fw_file = SI2168_FIRMWARE; u8 *fw_file;
const unsigned int i2c_wr_max = 8; const unsigned int i2c_wr_max = 8;
struct si2168_cmd cmd; struct si2168_cmd cmd;
...@@ -353,6 +353,7 @@ static int si2168_init(struct dvb_frontend *fe) ...@@ -353,6 +353,7 @@ static int si2168_init(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
/* query chip revision */
memcpy(cmd.args, "\x02", 1); memcpy(cmd.args, "\x02", 1);
cmd.wlen = 1; cmd.wlen = 1;
cmd.rlen = 13; cmd.rlen = 13;
...@@ -374,6 +375,20 @@ static int si2168_init(struct dvb_frontend *fe) ...@@ -374,6 +375,20 @@ static int si2168_init(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; 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'))
fw_file = SI2168_A30_FIRMWARE;
else {
dev_err(&s->client->dev,
"%s: no firmware file for Si2168-%c%c defined\n",
KBUILD_MODNAME, cmd.args[3], cmd.args[4]);
ret = -EINVAL;
goto err;
}
/* cold state - try to download firmware */ /* cold state - try to download firmware */
dev_info(&s->client->dev, "%s: found a '%s' in cold state\n", dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
KBUILD_MODNAME, si2168_ops.info.name); KBUILD_MODNAME, si2168_ops.info.name);
...@@ -381,9 +396,18 @@ static int si2168_init(struct dvb_frontend *fe) ...@@ -381,9 +396,18 @@ static int si2168_init(struct dvb_frontend *fe)
/* request the firmware, this will block and timeout */ /* request the firmware, this will block and timeout */
ret = request_firmware(&fw, fw_file, &s->client->dev); ret = request_firmware(&fw, fw_file, &s->client->dev);
if (ret) { if (ret) {
dev_err(&s->client->dev, "%s: firmare file '%s' not found\n", /* fallback mechanism to handle old name for
KBUILD_MODNAME, fw_file); SI2168_B40_FIRMWARE */
goto err; if (((cmd.args[1] & 0x0f) == 2) && (cmd.args[3] == '4') &&
(cmd.args[4] == '0')) {
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",
KBUILD_MODNAME, fw_file);
goto err;
}
} }
dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n", dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n",
...@@ -643,4 +667,4 @@ module_i2c_driver(si2168_driver); ...@@ -643,4 +667,4 @@ module_i2c_driver(si2168_driver);
MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver"); MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_FIRMWARE(SI2168_FIRMWARE); MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/i2c-mux.h> #include <linux/i2c-mux.h>
#define SI2168_FIRMWARE "dvb-demod-si2168-01.fw" #define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
#define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
#define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-01.fw"
/* state struct */ /* state struct */
struct si2168 { struct si2168 {
......
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