All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block i2c tuner reads for Avermedia Twinstar in the af9035 driver
@ 2013-02-10 19:43 Jose Alberto Reguero
  2013-02-10 20:11 ` Antti Palosaari
  0 siblings, 1 reply; 12+ messages in thread
From: Jose Alberto Reguero @ 2013-02-10 19:43 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: Gianluca Gennari, LMML

This patch block the i2c tuner reads for Avermedia Twinstar. If it's
needed other pids can be added.

Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>

diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.c linux.new/drivers/media/usb/dvb-usb-v2/af9035.c
--- linux/drivers/media/usb/dvb-usb-v2/af9035.c	2013-01-07 05:45:57.000000000 +0100
+++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.c	2013-02-08 22:55:08.304089054 +0100
@@ -232,7 +232,11 @@ static int af9035_i2c_master_xfer(struct
 			buf[3] = 0x00; /* reg addr MSB */
 			buf[4] = 0x00; /* reg addr LSB */
 			memcpy(&buf[5], msg[0].buf, msg[0].len);
-			ret = af9035_ctrl_msg(d, &req);
+			if (state->block_read) {
+				msg[1].buf[0] = 0x3f;
+				ret = 0;
+			} else
+				ret = af9035_ctrl_msg(d, &req);
 		}
 	} else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
 		if (msg[0].len > 40) {
@@ -638,6 +642,17 @@ static int af9035_read_config(struct dvb
 	for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++)
 		state->af9033_config[i].clock = clock_lut[tmp];
 
+	state->block_read = false;
+
+	if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA &&
+		le16_to_cpu(d->udev->descriptor.idProduct) ==
+			USB_PID_AVERMEDIA_TWINSTAR) {
+		dev_dbg(&d->udev->dev,
+				"%s: AverMedia Twinstar: block i2c read from tuner\n",
+				__func__);
+		state->block_read = true;
+	}
+
 	return 0;
 
 err:
diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.h linux.new/drivers/media/usb/dvb-usb-v2/af9035.h
--- linux/drivers/media/usb/dvb-usb-v2/af9035.h	2013-01-07 05:45:57.000000000 +0100
+++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.h	2013-02-08 22:52:42.293842710 +0100
@@ -54,6 +54,7 @@ struct usb_req {
 struct state {
 	u8 seq; /* packet sequence number */
 	bool dual_mode;
+	bool block_read;
 	struct af9033_config af9033_config[2];
 };
 



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-04-09 19:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-10 19:43 [PATCH] block i2c tuner reads for Avermedia Twinstar in the af9035 driver Jose Alberto Reguero
2013-02-10 20:11 ` Antti Palosaari
2013-02-11 13:48   ` Jose Alberto Reguero
2013-03-11 11:51     ` Jose Alberto Reguero
2013-03-11 12:57       ` Antti Palosaari
2013-03-11 20:02         ` Jose Alberto Reguero
2013-03-11 22:11           ` Antti Palosaari
2013-03-17 18:49             ` Jose Alberto Reguero
2013-03-17 21:46               ` Antti Palosaari
2013-03-24 19:39                 ` Jose Alberto Reguero
2013-03-26 12:53                   ` Jose Alberto Reguero
2013-04-09 19:44                     ` Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.