diff mbox series

[2/4] media: si2168: add support for not loading a firmware

Message ID 6901e775290445a93c39c11a4f544d6127452418.1570194906.git.mchehab+samsung@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/4] media: si2168: use bits instead of bool for flags | expand

Commit Message

Mauro Carvalho Chehab Oct. 4, 2019, 1:15 p.m. UTC
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@kernel.org>
---
 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 mbox series

Patch

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 */