public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Alessandro Radicati <alessandro@radicati.net>,
	linux-media@vger.kernel.org
Subject: Re: AVerMedia HD Volar (A867) AF9035 + MXL5007T driver issues
Date: Tue, 5 Apr 2016 21:15:58 +0300	[thread overview]
Message-ID: <570400DE.9040306@iki.fi> (raw)
In-Reply-To: <CAO8Cc0qvJxO2Z63HJd1_df+mY8HHB-UrUUZLPqBHQuoyD=TAkQ@mail.gmail.com>

On 04/02/2016 01:44 PM, Alessandro Radicati wrote:
> Hi,
> In trying to understand why my DVB USB tuner doesn't work with stock
> kernel drivers (4.2.0), I decided to pull out my logic analyser and
> sniff the I2C bus between the AF9035 and MXL5007T.  I seem to have
> uncovered a couple of issues:
>
> 1) Attach fails because MXL5007T driver I2C soft reset fails.  This is
> due to the preceding chip id read request that seems to hang the I2C
> bus and cause subsequent I2C commands to fail.

In my understanding MXL5007T register read is done in a two 
transactions. First you should write wanted register to register 0xfb. 
After that single byte read from the chip returns value for register 
configured to 0xfb. Write+read with repeated start is not supported and 
driver is buggy as it request that which usually leads to bogus value.


> 2) AF9035 driver I2C master xfer incorrectly implements "Write read"
> case.  The FW expects register address fields to be used to send the
> I2C writes for register selection.  The current implementation ignores
> these fields and the result is that only an I2C read is issued.
> Therefore the "0x3f" returned by the MXL5007T chip id query is not
> from the expected register.  This is what is seen on the I2C bus:
>
> S | Read 0x60 + ACK | 0x3F + NAK | ...
>
> After which SDA is held low for ~6sec; reason for subsequent commands failing.

You should use "S | W | P | S | R | P", no "S | W | S | R | P" == write 
read with repeated start condition.

> 3) After modifying the AF9035 driver to fix point 2 and use the
> register address field, the following is seen on the I2C bus:
>
> S | Write 0x60 + ACK | 0xFB + ACK | 0xD9 + ACK | P
> S | Read 0x60 + ACK | 0x14 + NAK | ...

That is correct sequence. You are trying to read more than 1 byte and it 
fails?

> This time we get an expected response, but the I2C bus still hangs
> with SDA held low and no Stop sequence.  It seems that the MXL5007T is
> holding SDA low since the AF9035 happily cycles SCL trying to execute
> the subsequent writes.  Without a solution to this, it seems that
> avoiding the I2C read is the best way to have the driver work
> correctly.  There are no other tuner reads so point 2 above becomes
> moot for at least this device.
>
> Does anyone have any insight on the MXL5007T chip ID command and
> whether it should be issued in certain conditions?  Any suggestions on
> how to resolve this given the above?

I tried to fix it earlier:
http://www.spinics.net/lists/linux-media/msg62264.html

Feel free to fix! It should not be very hard as you could even sniff 
data from the I2C bus directly. I don't have any AF9035+MXL5007T device, 
but I have tested it with older AF9015+MXL5007T.

regards
Antti

-- 
http://palosaari.fi/

  reply	other threads:[~2016-04-05 18:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-02 10:44 AVerMedia HD Volar (A867) AF9035 + MXL5007T driver issues Alessandro Radicati
2016-04-05 18:15 ` Antti Palosaari [this message]
2016-04-05 19:34   ` Alessandro Radicati
2016-04-05 22:33     ` Antti Palosaari
2016-04-05 23:00       ` Alessandro Radicati
  -- strict thread matches above, loose matches on Subject: below --
2016-04-08 23:13 Jose Alberto Reguero
     [not found] <57083b12.ec3ec20a.eed91.1ea1SMTPIN_ADDED_BROKEN@mx.google.com>
2016-04-08 23:59 ` Alessandro Radicati
2016-04-09  0:50   ` Antti Palosaari
2016-04-09  1:22     ` Antti Palosaari
2016-04-09  1:52       ` Alessandro Radicati
2016-04-09  2:17         ` Antti Palosaari
2016-04-09  8:13           ` Alessandro Radicati
2016-04-09 14:25             ` Antti Palosaari
2016-04-09 16:11               ` Alessandro Radicati
2016-04-09 17:07                 ` Antti Palosaari
2016-04-09 17:38                   ` Alessandro Radicati
2016-04-09  1:29     ` Alessandro Radicati
2016-04-10 21:30 Jose Alberto Reguero

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=570400DE.9040306@iki.fi \
    --to=crope@iki.fi \
    --cc=alessandro@radicati.net \
    --cc=linux-media@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox