public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Hans Verkuil <hverkuil@xs4all.nl>, CityK <cityk@rogers.com>,
	hermann pitton <hermann-pitton@arcor.de>,
	V4L <video4linux-list@redhat.com>,
	Josh Borke <joshborke@gmail.com>,
	David Lonie <loniedavid@gmail.com>,
	linux-media@vger.kernel.org
Subject: Re: KWorld ATSC 115 all static
Date: Sun, 18 Jan 2009 11:08:05 +0100	[thread overview]
Message-ID: <20090118110805.691c7273@hyperion.delvare> (raw)
In-Reply-To: <Pine.LNX.4.58.0901171058480.11165@shell2.speakeasy.net>

Hi Trent,

On Sat, 17 Jan 2009 11:45:57 -0800 (PST), Trent Piepho wrote:
> On Fri, 16 Jan 2009, Jean Delvare wrote:
> > On Fri, 16 Jan 2009 05:34:59 -0800 (PST), Trent Piepho wrote:
> > > How will this work for drivers like bttv, where the i2c address of the
> > > tuner chips isn't know for every supported card?
> >
> > Is this a problem in practice? My understanding was that I2C gates were
> > relatively recent in the history of V4L devices, so I assumed that for
> > devices with an I2C gate we would know where the devices are.
> 
> Changing hardware without notice is something manufactures still do, which
> makes probing even for modern hardware still useful in some cases.

But I would expect limited probing then (using
i2c_new_probed_device()), not wide probing using the .detect() method.

> But the old hardware that was always probed uses the same i2c clients as
> the new hardware that has gates and muxes.

This isn't necessarily an issue: your I2C chip driver can implement
a .detect() method for old hardware, where class is set to
I2C_CLASS_TV_ANALOG, while more recent hardware set no class and
instantiate the I2C devices explicitly. The new i2c model allows both
approaches to cohabit nicely.

> > This is indeed a possible implementation. One could argue though that
> > it's a bit overkill to instantiate a separate i2c_adapter just for a
> > gate. There are also caveats you must pay attention to. Two things in
> > particular that come to my mind:
> 
> The I2C layer doesn't have a concept for an i2c bus segment, so an
> i2c_adapter is the next closest thing.  One could create an entirely new
> struct i2c_bus for that, but how would it be different than the currenct
> i2c_adapter?  It seems like just another layer of complexity.

I agree with you, using i2c_adapter for bus segments is the plan, as
far as multiplexers are concerned. My point was whether it was worth
considering a chip behind a gate as a bus segment or not.

> > * Your proposal above, in its simple form, is incompatible with I2C
> > device detection, because devices which are before the gate would be
> > double-detected (once on each segment.)
> >
> > The first point is very easy to handle, the second is a little more
> > complicated. Basically you should add an address check at the beginning
> > of cx88_gate_i2c_xfer() to reject all transfers except to the device
> > you know is behind the gate.
> 
> I can think of a few more ways to do.  The main adapter could get
> registered with no I2C_CLASS_* (or with something like I2C_CLASS_MUX) so
> clients that scan won't scan it.  Then create virtual adapters for gate
> closed and gate open.  Scan gate closed first and then excluded any
> addresses found from the gate open adapter.

Yeah, that could work in some cases... At the cost of 3 i2c_adapter
instances. And it seems specifically tailored for hardware that need
scanning. I mean, if you do _not_ scan when gate is closed, then you
don't know what addresses must be removed from the gate-opened adapter,
so you can't allow for probing on that adapter.

But this doesn't seem to work in the general case: you may not be able
to actually scan for chips when gate is closed.  Some chips may not
respond to probing (either because they never do, or because they are
themselves behind another gate or multiplexer.) For complex topologies,
I am skeptical that your approach will be practical. It might even be
pretty confusing due to the fact that the apparent topology will be
quite different from the physical one.

(If we go that route then it does make sense to start speaking of
virtual adapters.)

Anyway, there's nothing missing from i2c-core right now to implement
this, is there?

> > At which point it is no longer clear why you want to have 2
> > i2c_adapters. You can have just one which opens (and closes) the gate
> > automatically for the right I2C address and not for the other addresses.
> 
> The scanning order problem.  The adapter is scanned before the gate can be
> controlled.  Works better with i2c-dev too.  Suppose I have a new card or a
> new revision and want to scan for devices behind the gate and see if I can
> figure out what they are?

Well, if you have a new card, you presumably don't know that it has a
gate to start with. If you have enough information about the gate, then
I expect you to also have enough information about what is behind it.

One possible requirement this discussion is bringing up, is the ability
to instantiate an i2c_adapter without any probing class set, then do
some initialization (e.g. accessing the gate chip, and close the gate)
and only then add probing classes (or have a separate function to ask
for re-probing of a given adapter.) This would fulfill your needs,
wouldn't it? Then we can stick to the physical topology.

> > Sorry for not being clear, I was only trying to address the gate issue
> > here, not the (more complex) multiplexing issue. I am not aware of V4L
> > devices having real I2C muxes?
> 
> I think some multi-tuner cards have real muxes.  But if the system created
> for muxes can be applied to gates as well, why not use it instead of
> creating something else for gates?

If we had support for muxes already, they I'd say yes, let's handle
gates the same. But the problem is that full muxes support is a
non-trivial thing, and we don't have it now, and I have no idea when we
will have it. I _hope_ before the end of the year, but I didn't even
start working on it, and I don't have any hardware to test either.

My main reason for suggesting a simple handling of gates is so that you
can have it quickly. But if you prefer to help me (and others)
implement full support for muxes instead, you're very welcome :)

> (..)
> First adapter created with the class set to 0 or I2C_CLASS_MUX, so nothing
> scans it (except a mux driver that scans).  Mux is added with
> i2c_new_device() and creats new busses/adapters for each segment.  These
> have the "real" class for the device and so get scanned.

Mux drivers should not scan. I mean, I've never see a mux chip that can
be detected. You should _know_ what mux you have on your bus.

> > But this has the disadvantage to leave the gate opened for longer than
> > it really has to, which could have adverse consequences on video
> > quality. Anyway, I'm leaving this up to you video/media people, as I
> > don't know enough myself about this to make a sane decision.
> 
> I think the gates are primarily meant to shield the device from noise
> relating to i2c bus traffic for other devices.  So it shouldn't be a
> problem to leave the gate open as long as it's closed when a message that
> doesn't need to go behind the gate is sent.

Ah, OK, I get the idea now.

-- 
Jean Delvare

  reply	other threads:[~2009-01-18 10:08 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15 14:01 KWorld ATSC 115 all static Hans Verkuil
2009-01-15 14:30 ` Michael Krufky
2009-01-15 17:29   ` Mauro Carvalho Chehab
2009-01-15 18:33     ` Trent Piepho
2009-01-16  2:02       ` Mauro Carvalho Chehab
     [not found]         ` <20090116110700.584ec052@hyperion.delvare>
     [not found]           ` <Pine.LNX.4.58.0901160424350.11165@shell2.speakeasy.net>
     [not found]             ` <20090116153257.0bd1c90f@hyperion.delvare>
2009-01-17 19:45               ` Trent Piepho
2009-01-18 10:08                 ` Jean Delvare [this message]
2009-01-15 23:11     ` hermann pitton
2009-01-16  1:39 ` CityK
2009-01-16  3:20   ` CityK
2009-01-16  3:38     ` Mauro Carvalho Chehab
2009-01-17 16:20     ` Hans Verkuil
2009-01-17 17:42       ` hermann pitton
2009-01-17 18:44         ` Michael Krufky
2009-01-17 19:16           ` hermann pitton
2009-01-18 18:10       ` CityK
     [not found]         ` <200901182011.11960.hverkuil@xs4all.nl>
2009-01-18 21:20           ` CityK
     [not found]             ` <200901182241.10047.hverkuil@xs4all.nl>
2009-01-18 23:36               ` CityK
2009-01-19 11:01                 ` Mauro Carvalho Chehab
     [not found]                 ` <200901190853.19327.hverkuil@xs4all.nl>
2009-01-19 11:08                   ` Mauro Carvalho Chehab
2009-01-19 17:16                     ` hermann pitton
2009-01-25 18:10                   ` CityK
2009-01-25 18:32                     ` CityK
2009-01-25 21:49                     ` Trent Piepho
2009-01-25 23:08                       ` hermann pitton
2009-01-25 23:35                       ` CityK
2009-01-26  0:45                         ` hermann pitton
2009-01-28  2:23                         ` Mauro Carvalho Chehab
2009-01-28  3:29                           ` hermann pitton
2009-01-29 23:44             ` CityK
2009-01-30  3:00               ` Mauro Carvalho Chehab
2009-01-19  0:38           ` Trent Piepho
2009-02-02 23:58         ` David Engel
2009-02-03  6:03           ` CityK
2009-02-03 14:02             ` Michael Krufky
2009-02-04  3:56               ` KWorld ATSC 115 all static ... Mike's clarification CityK
2009-02-03 17:22             ` KWorld ATSC 115 all static David Engel
2009-02-04  4:07               ` CityK
2009-02-05  2:55                 ` David Engel
2009-02-04  2:31             ` hermann pitton
2009-02-04  5:26               ` CityK
2009-02-05  1:22                 ` hermann pitton
2009-02-08 10:07                 ` Mauro Carvalho Chehab
2009-02-08 12:39                   ` Mauro Carvalho Chehab
2009-02-09  2:43             ` Mauro Carvalho Chehab
2009-02-09  2:43             ` Mauro Carvalho Chehab
2009-02-10  0:37               ` hermann pitton
2009-02-10  0:54                 ` hermann pitton
2009-02-10  1:31                   ` hermann pitton
2009-02-10  2:35                     ` Mauro Carvalho Chehab
2009-02-10  3:14                       ` hermann pitton
2009-02-10  3:43                         ` hermann pitton
2009-02-10  6:15                           ` Mauro Carvalho Chehab
2009-02-10 12:07                             ` Jonathan Isom
2009-02-10 12:27                               ` Mauro Carvalho Chehab
2009-02-10 12:48                                 ` Jonathan Isom
2009-02-10 19:02                                   ` Mauro Carvalho Chehab
2009-02-11  3:50                                 ` David Engel
2009-02-11  4:34                                   ` hermann pitton
2009-02-11  7:43                                   ` Mauro Carvalho Chehab
2009-02-11 23:21                                     ` David Engel
2009-02-13  3:07                                       ` David Engel
2009-02-13 11:04                                         ` Mauro Carvalho Chehab
2009-02-13 11:28                                           ` Mauro Carvalho Chehab
2009-02-13 20:28                                             ` David Engel
2009-02-13 20:35                                               ` Mauro Carvalho Chehab
2009-02-17 15:53                                               ` David Engel
2009-02-18  7:45                                                 ` Hans Verkuil
2009-02-18 15:26                                                   ` David Engel
2009-02-10  6:19                         ` Mauro Carvalho Chehab
2009-02-11  1:30                           ` hermann pitton
  -- strict thread matches above, loose matches on Subject: below --
2009-01-12  0:53 Josh Borke
2009-01-12  3:08 ` CityK
2009-01-12  5:19   ` Mauro Carvalho Chehab
2009-01-12  7:40     ` Hans Verkuil
2009-01-13  2:10       ` CityK
2009-01-13  3:17         ` hermann pitton
2009-01-14  4:41           ` CityK
2009-01-14  7:37             ` Hans Verkuil
2009-01-14 18:24               ` Hans Verkuil
2009-01-15  1:43                 ` hermann pitton
2009-01-15  5:01                 ` CityK
2009-01-15  7:27                   ` Hans Verkuil
2009-01-15 13:45                     ` Michael Krufky
2009-01-15  2:32             ` hermann pitton
2009-01-15  2:54               ` Mauro Carvalho Chehab
2009-01-15  3:15                 ` hermann pitton
2009-01-12  3:13 ` CityK

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=20090118110805.691c7273@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=cityk@rogers.com \
    --cc=hermann-pitton@arcor.de \
    --cc=hverkuil@xs4all.nl \
    --cc=joshborke@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=loniedavid@gmail.com \
    --cc=mchehab@infradead.org \
    --cc=mkrufky@linuxtv.org \
    --cc=video4linux-list@redhat.com \
    --cc=xyzzy@speakeasy.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