Re: [PATCH] si2157: Add support for Logilink VG0022A.

Mauro Carvalho Chehab
2019-10-03T12:52:45Z

Em Thu, 3 Oct 2019 09:49:04 -0300
Mauro Carvalho Chehab <mchehab+samsung@kernel.org> escreveu:

> Em Thu, 3 Oct 2019 13:41:23 +0200
> Gonsolo <gonsolo@gmail.com> escreveu:
>
> > Hi!
> >
> > > 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.
> >
> > Thanks for the explanation.
> >
> > > Btw, could you please try the enclosed hack and post the results?
> >
> > Will do in a second.
> >
> > FWIW, this hack worked:
> >
> > diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> > index e87040d6eca7..28a3a4f1640e 100644
> > --- a/drivers/media/tuners/si2157.c
> > +++ b/drivers/media/tuners/si2157.c
> > @@ -136,6 +136,7 @@ static int si2157_init(struct dvb_frontend *fe)
> > #define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
> > #define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
> > #define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
> > + #define GONZO (255 << 24 | 255 << 16 | 255 << 8 | 255 << 0)
> >
> > switch (chip_id) {
> > case SI2158_A20:
> > @@ -148,6 +149,10 @@ static int si2157_init(struct dvb_frontend *fe)
> > case SI2177_A30:
> > fw_name = SI2157_A30_FIRMWARE;
> > break;
> > + case GONZO:
> > + dev_info(&client->dev, "trying null\n");
> > + fw_name = NULL;
> > + break;
> > case SI2157_A30:
> > case SI2147_A30:
> > case SI2146_A10:
>
> What does it print with this hack?
>
> Also, could you get the SI version after the reset code at
> skip_fw_download, just after retrieving si2157 firmware version?

Maybe something like this would make it work?

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index e87040d6eca7..86d945fd50b9 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -129,6 +129,28 @@ static int si2157_init(struct dvb_frontend *fe)
chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
cmd.args[4] << 0;

+ if (chip_id == 0xffffffff) {
+ /* reboot the tuner */
+ memcpy(cmd.args, "\x01\x01", 2);
+ cmd.wlen = 2;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(client, &cmd);
+ if (ret)
+ 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;
+
+ chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
+ cmd.args[4] << 0;
+
+ }
+
#define SI2177_A30 ('A' << 24 | 77 << 16 | '3' << 8 | '0' << 0)
#define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0)
#define SI2148_A20 ('A' << 24 | 48 << 16 | '2' << 8 | '0' << 0)

Thanks,
Mauro