linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Fw: USB: core: WARN if pipe direction != setup packet direction
       [not found] <HE1PR0602MB32762856D2728450104CE1C6A1219@HE1PR0602MB3276.eurprd06.prod.outlook.com>
@ 2021-05-29 19:21 ` Alan Stern
       [not found]   ` <HE1PR0602MB3276072A2816DCBD1EB7DEB4A1219@HE1PR0602MB3276.eurprd06.prod.outlook.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2021-05-29 19:21 UTC (permalink / raw)
  To: Eero; +Cc: Mauro Carvalho Chehab, linux-media, USB mailing list

Once again, please always send these emails to the mailing list as well 
as to me.  If this means sending from your gmail address instead of the 
hotmail address, so be it.

On Sat, May 29, 2021 at 09:56:05PM +0300, Eero wrote:
> Hi,
> 
> The patch removed the warning, but the usb dvb-t stick does not work
> because of looping messages in dmesg:
> [  418.485387] mxl5005s I2C write failed
> [  418.658410] mxl5005s I2C write failed
> 
> Those messages come from:
> 
> linux-next-next-20210528/drivers/media/tuners/mxl5005s.c
> 
> static int mxl5005s_writereg(struct dvb_frontend *fe, u8 reg, u8 val,
> int latch) {
> 	struct mxl5005s_state *state = fe->tuner_priv;
> 	u8 buf[3] = { reg, val, MXL5005S_LATCH_BYTE };
> 	struct i2c_msg msg = { .addr = state->config->i2c_address,
> .flags = 0, .buf = buf, .len = 3 };
> 
> 	if (latch == 0)
> 		msg.len = 2;
> 
> 	dprintk(2, "%s(0x%x, 0x%x, 0x%x)\n", __func__, reg, val,
> 	msg.addr);
> 
> 	if (i2c_transfer(state->i2c, &msg, 1) != 1) {
> 		printk(KERN_WARNING "mxl5005s I2C write failed\n");
> 		return -EREMOTEIO;
> 	}
> 	return 0;
> }

This is a completely different error.  It should be reported to the 
maintainers of the media drivers (CC'ed).

Does the same problem occur if you don't apply Johan's rtl28xxu patch 
and you revert commit 5cc59c418fde from 5.13.rc3-next?

Alan Stern

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

* Re: USB: core: WARN if pipe direction != setup packet direction
       [not found]   ` <HE1PR0602MB3276072A2816DCBD1EB7DEB4A1219@HE1PR0602MB3276.eurprd06.prod.outlook.com>
@ 2021-05-29 19:58     ` Alan Stern
  2021-05-30 10:18       ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2021-05-29 19:58 UTC (permalink / raw)
  To: Eero; +Cc: Johan Hovold, USB mailing list

Please don't top-post.  And for the third time, please CC your emails 
to the mailing list.  If you don't, I will stop replying.

On Sat, May 29, 2021 at 10:41:51PM +0300, Eero wrote:
> Hi,
> 
> The dvb-t stick works when I did that. Thank you.
> 
> BR, Eero
> 
> On Sat, 29 May 2021 15:21:36 -0400
> > 
> > Does the same problem occur if you don't apply Johan's rtl28xxu patch 
> > and you revert commit 5cc59c418fde from 5.13.rc3-next?
> > 
> > Alan Stern

Johan, it appears that your patch making an empty I2C read actually 
transfer one byte somehow causes a problem for this dvb-t stick.

Below is a copy of the original problem report.  Any ideas?

Alan Stern


The patch removed the warning, but the usb dvb-t stick does not work
because of looping messages in dmesg:
[  418.485387] mxl5005s I2C write failed
[  418.658410] mxl5005s I2C write failed

Those messages come from:

linux-next-next-20210528/drivers/media/tuners/mxl5005s.c

static int mxl5005s_writereg(struct dvb_frontend *fe, u8 reg, u8 val,
int latch) {
	struct mxl5005s_state *state = fe->tuner_priv;
	u8 buf[3] = { reg, val, MXL5005S_LATCH_BYTE };
	struct i2c_msg msg = { .addr = state->config->i2c_address,
.flags = 0, .buf = buf, .len = 3 };

	if (latch == 0)
		msg.len = 2;

	dprintk(2, "%s(0x%x, 0x%x, 0x%x)\n", __func__, reg, val,
	msg.addr);

	if (i2c_transfer(state->i2c, &msg, 1) != 1) {
		printk(KERN_WARNING "mxl5005s I2C write failed\n");
		return -EREMOTEIO;
	}
	return 0;
}

BR, Eero

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

* Re: USB: core: WARN if pipe direction != setup packet direction
  2021-05-29 19:58     ` Alan Stern
@ 2021-05-30 10:18       ` Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2021-05-30 10:18 UTC (permalink / raw)
  To: Alan Stern; +Cc: Eero, USB mailing list

On Sat, May 29, 2021 at 03:58:31PM -0400, Alan Stern wrote:
> Please don't top-post.  And for the third time, please CC your emails 
> to the mailing list.  If you don't, I will stop replying.
> 
> On Sat, May 29, 2021 at 10:41:51PM +0300, Eero wrote:
> > Hi,
> > 
> > The dvb-t stick works when I did that. Thank you.
> > 
> > BR, Eero
> > 
> > On Sat, 29 May 2021 15:21:36 -0400
> > > 
> > > Does the same problem occur if you don't apply Johan's rtl28xxu patch 
> > > and you revert commit 5cc59c418fde from 5.13.rc3-next?
> > > 
> > > Alan Stern
> 
> Johan, it appears that your patch making an empty I2C read actually 
> transfer one byte somehow causes a problem for this dvb-t stick.
> 
> Below is a copy of the original problem report.  Any ideas?

I'd start with verifying that the type is still detected correctly so
that the driver uses the right implementation (i.e. for rtl2831u instead
of rtl2832u or vice versa).

If that isn't the problem, it could be the 1-byte read request itself
that throws the firmware off and causes later accesses to fail even if
that seems a bit far-fetched.

> The patch removed the warning, but the usb dvb-t stick does not work
> because of looping messages in dmesg:
> [  418.485387] mxl5005s I2C write failed
> [  418.658410] mxl5005s I2C write failed
 
Eero, could you try the below patch on top of linux-next (i.e. without
the zero-length request patch) and send us the logs?

Johan


From eda5deca4cbdebe21718bb13f76b8eed0673f9be Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Mon, 24 May 2021 10:55:19 +0200
Subject: [PATCH] media: rtl28xxu: add type-detection instrumentation

---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 97ed17a141bb..21e565603108 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -612,8 +612,10 @@ static int rtl28xxu_read_config(struct dvb_usb_device *d)
 static int rtl28xxu_identify_state(struct dvb_usb_device *d, const char **name)
 {
 	struct rtl28xxu_dev *dev = d_to_priv(d);
+	u8 buf[1];
 	int ret;
 	struct rtl28xxu_req req_demod_i2c = {0x0020, CMD_I2C_DA_RD, 0, NULL};
+	struct rtl28xxu_req req_demod_i2c2 = {0x0020, CMD_I2C_DA_RD, 1, buf};
 
 	dev_dbg(&d->intf->dev, "\n");
 
@@ -622,6 +624,11 @@ static int rtl28xxu_identify_state(struct dvb_usb_device *d, const char **name)
 	 * by old RTL2831U.
 	 */
 	ret = rtl28xxu_ctrl_msg(d, &req_demod_i2c);
+	dev_info(&d->intf->dev, "%s - ret1 = %d\n", __func__, ret);
+
+	ret = rtl28xxu_ctrl_msg(d, &req_demod_i2c2);
+	dev_info(&d->intf->dev, "%s - ret2 = %d\n", __func__, ret);
+
 	if (ret == -EPIPE) {
 		dev->chip_id = CHIP_ID_RTL2831U;
 	} else if (ret == 0) {
-- 
2.31.1


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

end of thread, other threads:[~2021-05-30 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <HE1PR0602MB32762856D2728450104CE1C6A1219@HE1PR0602MB3276.eurprd06.prod.outlook.com>
2021-05-29 19:21 ` Fw: USB: core: WARN if pipe direction != setup packet direction Alan Stern
     [not found]   ` <HE1PR0602MB3276072A2816DCBD1EB7DEB4A1219@HE1PR0602MB3276.eurprd06.prod.outlook.com>
2021-05-29 19:58     ` Alan Stern
2021-05-30 10:18       ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).