All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Michael Krufky <mkrufky@kernellabs.com>
Cc: Srinivasa.Deevi@conexant.com, Palash.Bandyopadhyay@conexant.com,
	dheitmueller@kernellabs.com,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH 08/10] V4L/DVB: tda18271: allow restricting max out to 4 bytes
Date: Thu, 30 Sep 2010 16:12:21 -0300	[thread overview]
Message-ID: <4CA4E115.2080607@redhat.com> (raw)
In-Reply-To: <AANLkTik_3MSjyqokvam28g5ohhCP=bb=_uzyzK0iM8Et@mail.gmail.com>

Hi Michael,

Em 30-09-2010 15:52, Michael Krufky escreveu:
> On Tue, Sep 28, 2010 at 2:46 PM, Mauro Carvalho Chehab
> <mchehab@redhat.com> wrote:
>> By default, tda18271 tries to optimize I2C bus by updating all registers
>> at the same time. Unfortunately, some devices doesn't support it.
>>
>> The current logic has a problem when small_i2c is equal to 8, since there
>> are some transfers using 11 + 1 bytes.
>>
>> Fix the problem by enforcing the max size at the right place, and allows
>> reducing it to max = 3 + 1.
>>
>> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> 
> This looks to me as if it is working around a problem on the i2c
> master.  I believe that a fix like this really belongs in the i2c
> master driver, it should be able to break the i2c transactions down
> into transactions that the i2c master can handle.
> 
> I wouldn't want to merge this without a better explanation of why it
> is necessary in the tda18271 driver.  It seems to be a band-aid to
> cover up a problem in the i2c master device driver code.

In the specific case of cx231xx the hardware don't support any I2C transactions 
with more than 4 bytes. It is common to find this kind of limit on other types
of hardware as well.

In the specific case of tda18271, the workaround for tda18271 is already there:

enum tda18271_small_i2c {
	TDA18271_39_BYTE_CHUNK_INIT = 0,
	TDA18271_16_BYTE_CHUNK_INIT = 1,
	TDA18271_08_BYTE_CHUNK_INIT = 2,
};
(from upstream tda18271.h header)

Yet, it is currently broken. In thesis, if you use small_i2c, it should limit the 
transactions size to a certain value, but, if you try to limit to 8, you'll still 
see some transactions with size=11, since the code that honors small_i2c only works
for the initial dump of the 39 registers, as there are some cases where writes to
EP3 registers are done with:
	tda18271_write_regs(fe, R_EP3, 11);

and the current code for tda18271_write_regs don't check it.

So, if there's a code there that allows limiting small_i2c:
	1) this code should work for all transactions, not only to the initial init;
	2) if there is such code, why not allow specifying a max size of 4 bytes?

Another aspect is that doing such kind or restriction at the i2c adapter would require
a very ugly logic, as some devices like tda18271 have only 8 bits registers per i2c address,
and a write (or read) with length > 1 byte update/read the next consecutive registers,
while other devices like xc3028 have one single I2C address for multi-byte operations like
updating the firmware.

If this logic would be moved into the bridge drivers, they would need to have some ugly
tests, checking for each specific i2c sub-driver at their core drivers.

Cheers,
Mauro.

  reply	other threads:[~2010-09-30 19:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1285699057.git.mchehab@redhat.com>
2010-09-28 18:46 ` [PATCH 01/10] V4L/DVB: cx231xx: remove a printk warning at -avcore and at -417 Mauro Carvalho Chehab
2010-10-07 21:48   ` Mauro Carvalho Chehab
2010-10-07 22:04     ` Devin Heitmueller
2010-10-07 23:09       ` Mauro Carvalho Chehab
2010-10-08  0:31       ` Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 02/10] V4L/DVB: cx231xx: fix Kconfig dependencies Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 03/10] V4L/DVB: tda18271: Add some hint about what tda18217 reg ID returned Mauro Carvalho Chehab
2010-09-29 12:29   ` Devin Heitmueller
2010-09-30 18:57   ` Michael Krufky
2010-09-30 19:16     ` Mauro Carvalho Chehab
2010-09-30 19:27       ` Michael Krufky
2010-09-30 19:58         ` Mauro Carvalho Chehab
2010-09-30 20:26         ` Mauro Carvalho Chehab
2010-09-30 21:03           ` Michael Krufky
2010-10-01  5:47             ` Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 04/10] V4L/DVB: cx231xx: properly implement URB control messages log Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 05/10] V4L/DVB: cx231xx: properly use the right tuner i2c address Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 06/10] V4L/DVB: cx231xx: better handle the master port enable command Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 07/10] V4L/DVB: cx231xx: Only change gpio direction when needed Mauro Carvalho Chehab
2010-09-28 18:46 ` [PATCH 08/10] V4L/DVB: tda18271: allow restricting max out to 4 bytes Mauro Carvalho Chehab
2010-09-29 12:29   ` Devin Heitmueller
2010-09-30 18:52   ` Michael Krufky
2010-09-30 19:12     ` Mauro Carvalho Chehab [this message]
2010-09-30 19:18       ` Michael Krufky
2010-09-30 19:48         ` Mauro Carvalho Chehab
2010-09-30 22:00     ` Antti Palosaari
2010-09-30 22:07       ` Michael Krufky
2010-10-01  5:46         ` Mauro Carvalho Chehab
2010-09-28 18:47 ` [PATCH 09/10] V4L/DVB: tda18271: Add debug message with frequency divisor Mauro Carvalho Chehab
2010-09-29 12:30   ` Devin Heitmueller
2010-09-30 19:03   ` Michael Krufky
2010-09-30 19:16     ` Mauro Carvalho Chehab
2010-09-28 18:47 ` [PATCH 10/10] V4L/DVB: cx231xx-audio: fix some locking issues 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=4CA4E115.2080607@redhat.com \
    --to=mchehab@redhat.com \
    --cc=Palash.Bandyopadhyay@conexant.com \
    --cc=Srinivasa.Deevi@conexant.com \
    --cc=dheitmueller@kernellabs.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mkrufky@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 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.