[PATCH 2/4] media: si2168: add support for not loading a firmware
From: Mauro Carvalho Chehab
Date: Fri Oct 04 2019 - 09:15:40 EST
Some devices (Logilink VG0022A) don't work properly with the
standard firmware. Upgrading the firmware makes I2C transfers
to fail when talking to the tuner.
While we don't have a better alternative, add support to
disable the firmware load on such devices.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@xxxxxxxxxx>
---
drivers/media/dvb-frontends/si2168.c | 5 +++++
drivers/media/dvb-frontends/si2168.h | 3 +++
drivers/media/dvb-frontends/si2168_priv.h | 1 +
3 files changed, 9 insertions(+)
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 14b93a7d3358..3a3cb7a7d45a 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -445,6 +445,9 @@ static int si2168_init(struct dvb_frontend *fe)
if (ret)
goto err;
+ if (dev->dont_load_firmware)
+ goto dont_load;
+
/* request the firmware, this will block and timeout */
ret = request_firmware(&fw, dev->firmware_name, &client->dev);
if (ret) {
@@ -504,6 +507,7 @@ static int si2168_init(struct dvb_frontend *fe)
release_firmware(fw);
+dont_load:
cmd_init(&cmd, "\x01\x01", 2, 1);
ret = si2168_cmd_execute(client, &cmd);
if (ret)
@@ -749,6 +753,7 @@ static int si2168_probe(struct i2c_client *client,
dev->ts_clock_inv = config->ts_clock_inv;
dev->ts_clock_gapped = config->ts_clock_gapped;
dev->spectral_inversion = config->spectral_inversion;
+ dev->dont_load_firmware = config->dont_load_firmware;
dev_info(&client->dev, "Silicon Labs Si2168-%c%d%d successfully identified\n",
dev->version >> 24 & 0xff, dev->version >> 16 & 0xff,
diff --git a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h
index ecd21adf8950..5e5de4619c3b 100644
--- a/drivers/media/dvb-frontends/si2168.h
+++ b/drivers/media/dvb-frontends/si2168.h
@@ -28,6 +28,8 @@
* TS clock gapped
* @spectral_inversion:
* Inverted spectrum
+ * @dont_load_firmware:
+ * Instead of uploading a new firmware, use the existing one
*
* Note:
* The I2C address of this demod is 0x64.
@@ -46,6 +48,7 @@ struct si2168_config {
unsigned int ts_clock_inv:1;
unsigned int ts_clock_gapped:1;
unsigned int spectral_inversion:1;
+ unsigned int dont_load_firmware:1;
};
#endif
diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h
index 18bea5222082..bdc1754da747 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -40,6 +40,7 @@ struct si2168_dev {
unsigned int ts_clock_inv:1;
unsigned int ts_clock_gapped:1;
unsigned int spectral_inversion:1;
+ unsigned int dont_load_firmware:1;
};
/* firmware command struct */
--
2.21.0