From: Jon Smirl <jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: RFC: proposal for new i2c.h macro to initialize i2c address lists on the fly
Date: Sun, 7 Jun 2009 09:25:11 -0400 [thread overview]
Message-ID: <9e4733910906070625i74477c9ma422b061eb61449d@mail.gmail.com> (raw)
In-Reply-To: <200906070835.46989.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
On Sun, Jun 7, 2009 at 2:35 AM, Hans Verkuil<hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org> wrote:
> On Sunday 07 June 2009 00:20:26 Jon Smirl wrote:
>> On Sat, Jun 6, 2009 at 9:00 AM, Hans Verkuil<hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org> wrote:
>> > Hi all,
>> >
>> > For video4linux we sometimes need to probe for a single i2c address.
>> > Normally you would do it like this:
>>
>> Why does video4linux need to probe to find i2c devices? Can't the
>> address be determined by knowing the PCI ID of the board?
>
> There are two reasons we need to probe: it is either because when the board
> was added no one bothered to record which chip was on what address (this
> happened in particular with old drivers like bttv) or because there is
> simply no other way to determine the presence or absence of an i2c device.
Unrecorded boards could be handled by adding a printk at driver init
time asking people to email you the needed information. Then remove
the printks as soon as you get the answer.
>
> E.g. there are three versions of one card: without upd64083 (Y/C separation
> device) and upd64031a (ghost reduction device), with only the upd64031a and
> one with both. Since they all have the same PCI ID the only way to
> determine the model is to probe.
Did they happen to change the subsystem device_id? There are two pairs
of PCI IDs on each card. Most of the time the subsystem vendor/device
isn't set.
Getting rid of the probes altogether is the most reliable solution.
There is probably a way to identify these boards more specifically
that you haven't discovered yet. PCI subsystem device ID is worth
checking.
>
> Regards,
>
> Hans
>
>>
>> > static const unsigned short addrs[] = {
>> > addr, I2C_CLIENT_END
>> > };
>> >
>> > client = i2c_new_probed_device(adapter, &info, addrs);
>> >
>> > This is a bit awkward and I came up with this macro:
>> >
>> > #define V4L2_I2C_ADDRS(addr, addrs...) \
>> > ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
>> >
>> > This can construct a list of one or more i2c addresses on the fly. But
>> > this is something that really belongs in i2c.h, renamed to I2C_ADDRS.
>> >
>> > With this macro we can just do:
>> >
>> > client = i2c_new_probed_device(adapter, &info, I2C_ADDRS(addr));
>> >
>> > Comments?
>> >
>> > Regards,
>> >
>> > Hans
>> >
>> > --
>> > Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
>> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
>
--
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
next prev parent reply other threads:[~2009-06-07 13:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-06 13:00 RFC: proposal for new i2c.h macro to initialize i2c address lists on the fly Hans Verkuil
2009-06-06 17:32 ` Trent Piepho
[not found] ` <200906061500.49338.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-06 21:38 ` Mauro Carvalho Chehab
2009-06-08 12:39 ` Jean Delvare
2009-06-09 13:04 ` Hans Verkuil
[not found] ` <200906091504.37330.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-09 14:54 ` Jean Delvare
2009-06-06 22:20 ` Jon Smirl
[not found] ` <9e4733910906061520o7b0b2858wf4530cf672b1adc9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-06 23:23 ` hermann pitton
2009-06-07 6:35 ` Hans Verkuil
[not found] ` <200906070835.46989.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-07 13:25 ` Jon Smirl [this message]
[not found] ` <9e4733910906070625i74477c9ma422b061eb61449d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-07 13:30 ` Jon Smirl
[not found] ` <9e4733910906070630i1ffcb821xb912f5ea662c7bef-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-07 13:38 ` Hans Verkuil
2009-06-07 20:00 ` Andy Walls
[not found] ` <1244404831.3141.33.camel-xioobY1GIEhKttHedORAlB2eb7JE58TQ@public.gmane.org>
2009-06-07 21:01 ` hermann pitton
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=9e4733910906070625i74477c9ma422b061eb61449d@mail.gmail.com \
--to=jonsmirl-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).