diff mbox series

[4/4] Add support for Logilink VG0022A.

Message ID 20191010095103.3803-5-gonsolo@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/4] si2168: Use bits and convert to kernel-doc format. | expand

Commit Message

Gon Solo Oct. 10, 2019, 9:51 a.m. UTC
This includes a hack for the device as it returns only 0xff after a new
firmware is loaded. To quote Mauro:

"When the [...] firmware that came with the device is replaced
by a new one, any I2C data received from the tuner will be
replaced by 0xff.

Probably, the vendor firmware has some patch specifically
designed for this device. So, we can't replace by the generic
firmware.

The right solution would be to extract the [...] firmware from
the original driver and ask the driver to load the specifically
designed firmware, but, while we don't have that, the next best
solution is to just keep the original firmware at the device."

Signed-off-by: Gon Solo <gonsolo@gmail.com>
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Gon Solo Oct. 10, 2019, 11:44 a.m. UTC | #1
Hi!

> "When the [...] firmware that came with the device is replaced
> by a new one, any I2C data received from the tuner will be
> replaced by 0xff.
> 
> Probably, the vendor firmware has some patch specifically
> designed for this device. So, we can't replace by the generic
> firmware.
> 
> The right solution would be to extract the [...] firmware from
> the original driver and ask the driver to load the specifically
> designed firmware, but, while we don't have that, the next best
> solution is to just keep the original firmware at the device."
 
The information in the patch is not totally correct. It is the
si2168(!) firmware download that confuses things, not the one for the
si2157. The si2157 seems to have no firmware and the problem is
that we used to bail out because we didn't recognize the bogus
chip id. The following patch corrects this.

Signed-off-by: <andreas.wendleder@gmail.com>

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 792667ee5ebc..5a2943e2932b 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1621,17 +1621,20 @@ static int it930x_tuner_attach(struct dvb_usb_adapter *adap)
 	si2157_config.fe = adap->fe[0];
 
 	/*
-	 * HACK: The Logilink VG0022A has a bug: when the si2157
+	 * HACK: The Logilink VG0022A has a bug: When the si2168
 	 * firmware that came with the device is replaced by a new
 	 * one, the I2C transfers to the tuner will return just 0xff.
 	 *
 	 * Probably, the vendor firmware has some patch specifically
 	 * designed for this device. So, we can't replace by the
 	 * generic firmware. The right solution would be to extract
-	 * the si2157 firmware from the original driver and ask the
+	 * the si2157/68 firmware from the original driver and ask the
 	 * driver to load the specifically designed firmware, but,
 	 * while we don't have that, the next best solution is to just
 	 * keep the original firmware at the device.
+	 *
+	 * Or, the Windows driver includes the same hack and doesn't
+	 * bail out on bogus chip ids.
 	 */
 	if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_DEXATEK &&
 	    le16_to_cpu(d->udev->descriptor.idProduct) == 0x0100)
Gon Solo Nov. 15, 2019, 6:06 p.m. UTC | #2
Hi!

Context: In the upcoming 5.5 kernel there will be (hopefully) support
for the Logilink VG0022A DVB-T2 usb stick. Since this device has a bug a
kernel quirk has been added. An additional quirk is needed for suspend
to work. This is documented here. Hopefully it will be picked up in
distributions or if not, owners of this device can find this
information on the internet.

Standby for this Logilink VG0022A device does not work. I had to
manually unload the module dvb_usb_af9035:

cat /lib/systemd/system-sleep/suspend-modules:

=====

case $1 in
    pre)
        for mod in $(</etc/suspend-modules.conf); do
            rmmod $mod
        done
    ;;
    post)
        for mod in $(</etc/suspend-modules.conf); do
            modprobe $mod
        done
    ;;
esac

=====

cat /etc/suspend-modules.conf:

=====

dvb_usb_af9035

=====

Cheers,
g
diff mbox series

Patch

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 51e607ea3add..792667ee5ebc 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1619,6 +1619,24 @@  static int it930x_tuner_attach(struct dvb_usb_adapter *adap)
 
 	memset(&si2157_config, 0, sizeof(si2157_config));
 	si2157_config.fe = adap->fe[0];
+
+	/*
+	 * HACK: The Logilink VG0022A has a bug: when the si2157
+	 * firmware that came with the device is replaced by a new
+	 * one, the I2C transfers to the tuner will return just 0xff.
+	 *
+	 * Probably, the vendor firmware has some patch specifically
+	 * designed for this device. So, we can't replace by the
+	 * generic firmware. The right solution would be to extract
+	 * the si2157 firmware from the original driver and ask the
+	 * driver to load the specifically designed firmware, but,
+	 * while we don't have that, the next best solution is to just
+	 * keep the original firmware at the device.
+	 */
+	if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_DEXATEK &&
+	    le16_to_cpu(d->udev->descriptor.idProduct) == 0x0100)
+		si2157_config.dont_load_firmware = true;
+
 	si2157_config.if_port = it930x_addresses_table[state->it930x_addresses].tuner_if_port;
 	ret = af9035_add_i2c_dev(d, "si2157",
 				 it930x_addresses_table[state->it930x_addresses].tuner_i2c_addr,
@@ -2130,6 +2148,8 @@  static const struct usb_device_id af9035_id_table[] = {
 		&it930x_props, "ITE 9303 Generic", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310,
 		&it930x_props, "AVerMedia TD310 DVB-T2", NULL) },
+	{ DVB_USB_DEVICE(USB_VID_DEXATEK, 0x0100,
+		&it930x_props, "Logilink VG0022A", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, af9035_id_table);