Re: [PATCH] si2157: Add support for Logilink VG0022A.
From: Mauro Carvalho Chehab
Date: Thu Oct 03 2019 - 07:17:50 EST
Em Thu, 3 Oct 2019 12:57:50 +0200
Gonsolo <gonsolo@xxxxxxxxx> escreveu:
> Hi!
>
> Boot time:
>
> > [ 5.380991] si2168 1-0067: firmware version: B 4.0.2
>
> When starting VLC:
>
> > [ 457.677363] si2168 1-0067: downloading firmware from file
> > 'dvb-demod-si2168-b40-01.fw'
> > [ 458.631034] si2168 1-0067: firmware version: B 4.0.11
> > [ 458.650309] si2157 2-0063: unknown chip version Si21255-\xff\xff\xff
>
> There are two different firmware versions, 4.0.2 and 4.0.11. Is that expected?
It means that there's a firmware stored at the device's eeprom
(version 4.0.2). When the driver starts, it downloads a newer firmware
from the file dvb-demod-si2168-b40-01.fw.
Btw, could you please try the enclosed hack and post the results?
Thanks,
Mauro
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index e87040d6eca7..3ccfd602934b 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -76,6 +76,7 @@ static int si2157_init(struct dvb_frontend *fe)
const struct firmware *fw;
const char *fw_name;
unsigned int uitmp, chip_id;
+ int i;
dev_dbg(&client->dev, "\n");
@@ -118,16 +119,32 @@ static int si2157_init(struct dvb_frontend *fe)
goto err;
}
- /* query chip revision */
- memcpy(cmd.args, "\x02", 1);
- cmd.wlen = 1;
- cmd.rlen = 13;
- ret = si2157_cmd_execute(client, &cmd);
- if (ret)
- goto err;
+ for (i = 0; i < 10; i++) {
+ /* query chip revision */
+ memcpy(cmd.args, "\x02", 1);
+ cmd.wlen = 1;
+ cmd.rlen = 13;
+ ret = si2157_cmd_execute(client, &cmd);
+ if (ret)
+ goto err;
+
+ chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
+ cmd.args[4] << 0;
- chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
- cmd.args[4] << 0;
+ if (chip_id != 0xffffffff)
+ break;
+
+ msleep(10);
+ }
+
+ if (i)
+ dev_info(&client->dev, "Needed to wait %i ms to get chip version", i * 10);
+
+ if (chip_id == 0xffffffff) {
+ dev_err(&client->dev, "Unable to retrieve chip version\n");
+ ret = -EINVAL;
+ goto err;
+ }
#define SI2177_A30 ('A' << 24 | 77 << 16 | '3' << 8 | '0' << 0)
#define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0)