struct si2168 *s = fe->demodulator_priv;
int ret, len, remaining;
const struct firmware *fw = NULL;
- u8 *fw_file = SI2168_FIRMWARE;
+ u8 *fw_file;
const unsigned int i2c_wr_max = 8;
struct si2168_cmd cmd;
if (ret)
goto err;
+ /* query chip revision */
memcpy(cmd.args, "\x02", 1);
cmd.wlen = 1;
cmd.rlen = 13;
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'))
+ 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 */
dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
KBUILD_MODNAME, si2168_ops.info.name);
/* request the firmware, this will block and timeout */
ret = request_firmware(&fw, fw_file, &s->client->dev);
if (ret) {
- dev_err(&s->client->dev, "%s: firmare file '%s' not found\n",
- KBUILD_MODNAME, fw_file);
- goto err;
+ /* fallback mechanism to handle old name for
+ SI2168_B40_FIRMWARE */
+ 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",
MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver");
MODULE_LICENSE("GPL");
-MODULE_FIRMWARE(SI2168_FIRMWARE);
+MODULE_FIRMWARE(SI2168_B40_FIRMWARE);