linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Antti Palosaari <crope@iki.fi>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Devin Heitmueller <dheitmueller@kernellabs.com>
Subject: Re: [PATCH 2/5] em28xx: respect the message size constraints for i2c transfers
Date: Sat, 15 Dec 2012 13:57:14 +0100	[thread overview]
Message-ID: <50CC73AA.40106@googlemail.com> (raw)
In-Reply-To: <50CB5A0A.3030305@iki.fi>

Am 14.12.2012 17:55, schrieb Antti Palosaari:
> On 12/14/2012 06:28 PM, Frank Schäfer wrote:
>> The em2800 can transfer up to 4 bytes per i2c message.
>> All other em25xx/em27xx/28xx chips can transfer at least 64 bytes per
>> message.
>>
>> I2C adapters should never split messages transferred via the I2C
>> subsystem
>> into multiple message transfers, because the result will almost
>> always NOT be
>> the same as when the whole data is transferred to the I2C client in a
>> single
>> message.
>> If the message size exceeds the capabilities of the I2C adapter,
>> -EOPNOTSUPP
>> should be returned.
>>
>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>
>
>> +    if (len < 1 || len > 4)
>> +        return -EOPNOTSUPP;
>
> That patch seem to be good for my eyes, but that check for len < 1 is
> something I would like to double checked. Generally len = 0 is OK and
> is used some cases, probing and sometimes when all registers are read
> for example.
>
> Did you test it returns some error for zero len messages?
>

First of all: thank you for reviewing the patch !

Yeah, messages with zero length could be used for device detection.
But yes, I checked that and it doesn't work.

For the em2800 algorithm, it doesn't work because of the way the mesage
length is encoded in the first two bytes of register 0x05:

118                buf2[1] = 0x84 + len - 1;

Bit 2 is used for read/write, that's why it is

67                b2[5] = 0x80 + len - 1;

for writes.


The more interesting case is the em28xx i2c algorithm...
But zero length messages don't work there, too (at least not with the
em2765 and em2820).
To be more precise: they SEEM to work, but they don't. Even when there
is no i2c device, you get no error (neither from the USB subsystem, nor
from the bridge status register).

Regards,
Frank



  reply	other threads:[~2012-12-15 12:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 16:28 [PATCH 0/5] em28xx: i2c bug fixes and cleanups Frank Schäfer
2012-12-14 16:28 ` [PATCH 1/5] em28xx: clean up the data type mess of the i2c transfer function parameters Frank Schäfer
2012-12-14 16:28 ` [PATCH 2/5] em28xx: respect the message size constraints for i2c transfers Frank Schäfer
2012-12-14 16:55   ` Antti Palosaari
2012-12-15 12:57     ` Frank Schäfer [this message]
2012-12-14 16:28 ` [PATCH 3/5] em28xx: fix two severe bugs in function em2800_i2c_recv_bytes() Frank Schäfer
2012-12-14 16:28 ` [PATCH 4/5] em28xx: fix the i2c adapter functionality flags Frank Schäfer
2012-12-14 16:28 ` [PATCH 5/5] em28xx: fix+improve+unify i2c error handling, debug messages and code comments Frank Schäfer
2012-12-14 17:03   ` Antti Palosaari
2012-12-15 13:01     ` Frank Schäfer
2012-12-15 13:46       ` Antti Palosaari
2012-12-15 16:25         ` Frank Schäfer
2012-12-15 17:16           ` Antti Palosaari
2012-12-16 18:20             ` Frank Schäfer
2012-12-15 17:18           ` Mauro Carvalho Chehab

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=50CC73AA.40106@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=crope@iki.fi \
    --cc=dheitmueller@kernellabs.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).