From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Steven Toth <stoth@kernellabs.com>,
Linux-Media <linux-media@vger.kernel.org>,
Jean Delvare <khali@linux-fr.org>, Antti Palosaari <crope@iki.fi>
Subject: Re: CX24116 i2c patch
Date: Thu, 05 May 2011 13:38:03 -0300 [thread overview]
Message-ID: <4DC2D26B.5050108@redhat.com> (raw)
In-Reply-To: <BANLkTimDy7Z3Y6ZWR_GjCNZmxAzRaKveoA@mail.gmail.com>
Em 05-05-2011 12:34, Devin Heitmueller escreveu:
> On Thu, May 5, 2011 at 9:15 AM, Mauro Carvalho Chehab
> <mchehab@redhat.com> wrote:
>> So, the I2C adapter xfer code will end by being something like:
>>
>> switch(i2c_device) {
>> case FOO:
>> use_split_code_foo();
>> break;
>> case BAR:
>> use_splic_code_bar();
>> break;
>> ...
>> }
>>
>>
>> (if you want to see one example of the above, take a look at drivers/media/video/cx231xx/cx231xx-i2c.c).
>
> The cx231xx is actually an example of a poor implementation
Yes.
> rather
> than a deficiency in the chip. The device does support sending
> arbitrarily long sequences, but because of a lack of support for i2c
> clock stretching they hacked in their own GPIO based bitbang
> implementation which only gets used in certain cases.
No. There are two different situations here: they use GPIO bitbang for
one device type, due to clock stretching, but also the hardware doesn't accept
long I2C messages. I've double-checked this with the vendor developers, and
double-checked the sniffed messages from the original driver.
The case I detected troubles were with tda18271 device (that doesn't use
clock stretching), and using the direct hardware support for I2C, at the
I2C bus 2. The Hauppauge devices that you've worked have the tuner connected
to the I2C bus 1. Perhaps bus 2 has a smaller hardware buffer, or perhaps
the chip revision present on the device I tested is more limited.
In any case, every time more than 4 data bytes were sent to tda18271, the
hardware returned an error.
If you take a look at cx231xx-core, you'll see that other types of non-GPIO
messages with more than 4 bytes are broken into smaller messages there.
> If somebody
> wanted to clean it up I believe it could be done much more cleanly.
> That said, it hasn't happened because the code as-is "works" and in
> reality I don't think there are any shipping products which use
> cx231xx and xc5000 (they are all Conexant reference designs).
>
> If somebody really wants to clean this up, they should have a board
> profile field which indicates whether to create an i2c adapter which
> uses the onboard i2c controller, or alternatively to setup an i2c
> adapter which uses the real Linux i2c-bitbang implementation. That
> would make the implementation much easier to understand as well as
> eliminating all the crap code which makes decisions based on the
> destination i2c address.
Yes, the code can be cleaned, but this won't solve the issue: messages still
need to be broken to be used by (some) I2C buses on it.
Also, cx231xx is not an exception: there are very few hardware that would
accept a 32 KB message to be sent directly via I2C. The hardware were this
is done via bit-bang will support. Also a few other devices like saa7134,
where data is sent byte by byte and kernel waits for the I2C device to indicate
that one byte were sent, and it can then forward the next byte. Yet, on
both cases, I don't think it is a good idea to send a 32 KB data into just
one I2C transaction.
However, on the devices where you pass a buffer to the hardware/firmware
(like all USB devices), the size of the I2C message is limited. The upper
limit is 80 bytes for an I2C control message, but several devices have
a lower limit for it.
Mauro.
next prev parent reply other threads:[~2011-05-05 16:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 12:28 CX24116 i2c patch Steven Toth
2011-05-05 13:15 ` Mauro Carvalho Chehab
2011-05-05 15:09 ` Jean Delvare
2011-05-05 16:18 ` Mauro Carvalho Chehab
2011-05-16 15:33 ` Jean Delvare
2011-05-05 15:34 ` Devin Heitmueller
2011-05-05 16:38 ` Mauro Carvalho Chehab [this message]
2011-05-05 15:25 ` Devin Heitmueller
2011-05-05 16:55 ` Mauro Carvalho Chehab
2011-05-05 22:03 ` Antti Palosaari
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=4DC2D26B.5050108@redhat.com \
--to=mchehab@redhat.com \
--cc=crope@iki.fi \
--cc=dheitmueller@kernellabs.com \
--cc=khali@linux-fr.org \
--cc=linux-media@vger.kernel.org \
--cc=stoth@kernellabs.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