All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Eero Lehtinen <debiangamer2@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Antti Palosaari <crope@iki.fi>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] media: rtl28xxu: add type-detection instrumentation
Date: Mon, 31 May 2021 09:52:18 +0200	[thread overview]
Message-ID: <YLSVsrhMZ2oOL1vM@hovoldconsulting.com> (raw)
In-Reply-To: <CAHS3B0Ez+eKSgrCEnW2ccpBCHc_gJ_Cs3abS_DAYXRAAjNYeTA@mail.gmail.com>

[ Resending with linux-usb on CC...]

[ Adding back linux-usb and Alan on CC.

  Also adding Antti, Hans and Mauro.

  Eero, please make sure to keep everyone on CC. ]

Quick summary:

A recent attempt to suppress a new warning in USB core:

	https://lore.kernel.org/r/20210524110920.24599-4-johan@kernel.org
	
caused the chip type detection to fail in Eero's system, and we're
trying to determine how best to handle this.

Hans, could you hold off applying the above until this has been
resolved?

On Mon, May 31, 2021 at 09:58:09AM +0300, Eero Lehtinen wrote:
> Hi,
> 
> I found dev_info messages from /var/log/messages.
> 
> May 30 18:41:19 optipc kernel: [    3.143433] dvb_usb_rtl28xxu
> 1-1:1.0: rtl28xxu_identify_state - ret1 = 0
> May 30 18:41:19 optipc kernel: [    3.147688] dvb_usb_rtl28xxu
> 1-1:1.0: rtl28xxu_identify_state - ret2 = -32

Ok, thanks. So this explains how things go wrong.

	ret = rtl28xxu_ctrl_msg(d, &req_demod_i2c);
	if (ret == -EPIPE) {
		dev->chip_id = CHIP_ID_RTL2831U;
	} else if (ret == 0) {
		dev->chip_id = CHIP_ID_RTL2832U;

The chip used to be identified as RTL2832U but after my change it is
now detected as RTL2831U and the driver uses a separate implementation
with different hardcoded defaults.

Commit d0f232e823af ("[media] rtl28xxu: add heuristic to detect chip
type") added this code and claimed that the i2c register in question
would only be found on newer RTL2832U models. Yet, actually reading the
register returns an error in your setup.

So, something is fishy here. Has anyone verified that the chip-type
detection works as expected for older RTL2831U?

> Gmail allows only top posting.

Even with the web interface you can expand the quoted text and reply
inline.

> Hi,
> 
> Yes, a working kernel uses the CXD2837ER driver. It is recognized as
> follows at boot. You must switch to CXD2837ER at boot time so that
> applications pick it:
> #!/bin/bash
> if [ ! -e /dev/dvb/adapter0/frontend99 ] then
> mv /dev/dvb/adapter0/frontend0 /dev/dvb/adapter0/frontend99
> mv /dev/dvb/adapter0/frontend1 /dev/dvb/adapter0/frontend0
> fi
> 
> [    3.426235] dvbdev: DVB: registering new adapter (Astrometa DVB-T2)
> [    3.431121] i2c i2c-10: Added multiplexed i2c bus 11
> [    3.431125] rtl2832 10-0010: Realtek RTL2832 successfully attached
> [    3.432648] i2c i2c-10: cxd2841er_attach(): I2C adapter
> 000000000397a340 SLVX addr 6e SLVT addr 6c
> [    3.441178] i2c i2c-10: cxd2841er_attach(): attaching CXD2837ER
> DVB-C/T/T2 frontend
> [    3.441180] i2c i2c-10: cxd2841er_attach(): chip ID 0xb1 OK.
> [    3.441182] usb 1-1: DVB: registering adapter 0 frontend 0 (Realtek
> RTL2832 (DVB-T))...
> [    3.441218] usb 1-1: DVB: registering adapter 0 frontend 1 (Sony
> CXD2837ER DVB-T/T2/C demodulator)...
> [    3.443994] r820t 11-003a: creating new instance
> [    3.457197] r820t 11-003a: Rafael Micro r820t successfully identified
> [    3.457210] r820t 11-003a: attaching existing instance
> [    3.512185] r820t 11-003a: Rafael Micro r820t successfully identified
> [    3.526915] rtl2832_sdr rtl2832_sdr.1.auto: Registered as swradio0
> [    3.526917] rtl2832_sdr rtl2832_sdr.1.auto: Realtek RTL2832 SDR attached
> [    3.526918] rtl2832_sdr rtl2832_sdr.1.auto: SDR API is still
> slightly experimental and functionality changes may follow
> [    3.542192] Registered IR keymap rc-astrometa-t2hybrid
> [    3.542205] rc rc0: Astrometa DVB-T2 as
> /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-1/rc/rc0
> [    3.542226] input: Astrometa DVB-T2 as
> /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-1/rc/rc0/input21
> [    3.542271] usb 1-1: dvb_usb_v2: schedule remote query interval to 200 msecs
> [    3.562187] usb 1-1: dvb_usb_v2: 'Astrometa DVB-T2' successfully
> initialized and connected
> [    3.562230] usbcore: registered new interface driver dvb_usb_rtl28xxu


> On Mon, May 31, 2021 at 9:46 AM Johan Hovold <johan@kernel.org> wrote:
> >
> > [ Again, please don't top post. See
> > http://en.wikipedia.org/wiki/Top_post ]
> >
> > On Sun, May 30, 2021 at 09:58:26PM +0300, Eero Lehtinen wrote:
> > > Hi,
> > >
> > > I used dev_dbg instead of dev_info and got:
> > > drivers/media/usb/dvb-usb-v2/rtl28xxu.c:648
> > > [dvb_usb_rtl28xxu]rtl28xxu_identify_state =_ "failed=%d\012"
> > > drivers/media/usb/dvb-usb-v2/rtl28xxu.c:640
> > > [dvb_usb_rtl28xxu]rtl28xxu_identify_state =_ "chip_id=%u\012"
> > > drivers/media/usb/dvb-usb-v2/rtl28xxu.c:630
> > > [dvb_usb_rtl28xxu]rtl28xxu_identify_state =_ "%s - ret2 = %d\012"
> > > drivers/media/usb/dvb-usb-v2/rtl28xxu.c:627
> > > [dvb_usb_rtl28xxu]rtl28xxu_identify_state =_ "%s - ret1 = %d\012"
> > > drivers/media/usb/dvb-usb-v2/rtl28xxu.c:620
> > > [dvb_usb_rtl28xxu]rtl28xxu_identify_state =_ "\012"
> > >
> > > dev_info does not show up with dmesg or dynamic debug.
> >
> > Odd. Just use dev_err() since that shows up in your logs.
> >
> > > Should the kernel use the CXD2837ER driver and not the mxl5005s driver
> > > like it does with this patch.
> >
> > Yes, something like that could be the problem here. Did it use CXD2837ER
> > before the patch?
> >
> > I still need to see the return values for those transfer to determine
> > how best to address this so could you try again with dev_err()?

Johan

  parent reply	other threads:[~2021-05-31  7:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30 12:23 [PATCH] media: rtl28xxu: add type-detection instrumentation Eero Lehtinen
2021-05-30 13:54 ` Johan Hovold
2021-05-30 15:57   ` Eero Lehtinen
2021-05-30 18:02     ` Johan Hovold
2021-05-30 18:58       ` Eero Lehtinen
2021-05-31  6:46         ` Johan Hovold
     [not found]           ` <CAHS3B0Ez+eKSgrCEnW2ccpBCHc_gJ_Cs3abS_DAYXRAAjNYeTA@mail.gmail.com>
2021-05-31  7:52             ` Johan Hovold [this message]
2021-05-31  8:42               ` Johan Hovold
2021-05-31  9:08                 ` Eero Lehtinen
2021-05-31  9:13                   ` Johan Hovold
2021-06-02 11:01                     ` Antti Palosaari
2021-06-02 12:33                       ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLSVsrhMZ2oOL1vM@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=crope@iki.fi \
    --cc=debiangamer2@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.