From: Jean Delvare <khali@linux-fr.org>
To: "Hennerich, Michael" <Michael.Hennerich@analog.com>
Cc: Mike Frysinger <vapier@gentoo.org>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"uclinux-dist-devel@blackfin.uclinux.org"
<uclinux-dist-devel@blackfin.uclinux.org>,
"device-drivers-devel@blackfin.uclinux.org"
<device-drivers-devel@blackfin.uclinux.org>,
David Brownell <david-b@pacbell.net>
Subject: Re: [PATCH] i2c: add irq_flags to board info
Date: Mon, 18 Oct 2010 14:01:36 +0200 [thread overview]
Message-ID: <20101018140136.2b44d29e@endymion.delvare> (raw)
In-Reply-To: <544AC56F16B56944AEC3BD4E3D5917713094520EDB@LIMKCMBX1.ad.analog.com>
Hi Michael,
On Mon, 18 Oct 2010 10:55:57 +0100, Hennerich, Michael wrote:
> Jean Delvare wrote on 2010-10-18:
> > Hi Mike,
> >
> > On Sun, 17 Oct 2010 19:43:39 -0400, Mike Frysinger wrote:
> >> From: Michael Hennerich <michael.hennerich@analog.com>
> >>
> >> These flags can be optionally defined - slave drivers may use them as
> >> flags argument for request_irq(). In case they are left uninitialized
> >> they will default to zero, and therefore shouldn't cause problems.
> >>
> >> This allows us to avoid having to add dedicated platform init code
> >> just to call set_irq_type()
> >
> > Do you have examples of this? Can we see a preview of the amount of
> > cleanups this patch would allow?
>
> Examples can be found in various board setup files:
>
> One example arch/sh/boards/mach-ecovec24/setup.c:
>
> static struct i2c_board_info ts_i2c_clients = {
> I2C_BOARD_INFO("tsc2007", 0x48),
> .type = "tsc2007",
> .platform_data = &tsc2007_info,
> .irq = IRQ0,
> };
>
> [--snip--]
>
> /* enable TouchScreen */
> i2c_register_board_info(0, &ts_i2c_clients, 1);
> set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
This example doesn't quite match the patch description. There's no
"dedicated platform init code just to call set_irq_type()", as you
already have platform code to call i2c_register_board_info(). It's
really only calling set_irq_type() from platform code vs. from driver
code.
> >> -- which doesn't work very well when coupled with module drivers.
> >
> > I don't quite get what you mean here.
>
> Since the driver doesn't setup the irq_type itself you need to do it
> manually in advance using set_irq_type().
> This happens most likely from your paltform setup/configuration file.
>
> Assuming the driver is built as a module, this code gets executed unconditionally,
> no matter if the driver gets finally loaded or not.
>
> Assuming you have several drivers build as modules, using the same irq but with
> different irq types, you run into problems here.
I do not get why.
You're not going to register several I2C devices using the same IRQ but
requiring different IRQ flags anyway, as it wouldn't work. So you'll
have to only register the I2C devices which are actually present on the
system. Setting the IRQ type at the same time or deferring this action
to the driver(s) doesn't make any difference then, does it?
> There are some development boards featuring extension options, which all plug on the same
> socket but required different drivers/irq types.
How do you figure out which extension option is plugged? You can't
instantiate an I2C device which isn't present, so you must have a way
to know what extension option is used, to instantiate the right I2C
device at the right address.
> The ideal way is therefore to pass the irq_flags together with the SPI/I2C board info.
All I see so far is two data structures made slightly larger, for no
actual benefit.
--
Jean Delvare
next prev parent reply other threads:[~2010-10-18 12:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-17 23:43 [PATCH] i2c: add irq_flags to board info Mike Frysinger
[not found] ` <1287359019-1476-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2010-10-18 8:36 ` Jean Delvare
[not found] ` <20101018103610.77b7e605-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-10-18 9:55 ` Hennerich, Michael
2010-10-18 12:01 ` Jean Delvare [this message]
[not found] ` <20101018140136.2b44d29e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-10-18 12:31 ` Hennerich, Michael
[not found] ` <544AC56F16B56944AEC3BD4E3D5917713094520FA6-gpnycfiEEVR7xzP2fcxY8GoKb0G9Rp+C@public.gmane.org>
2010-10-18 14:33 ` Jean Delvare
[not found] ` <20101018163357.659efe25-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-10-18 15:38 ` David Brownell
2010-10-18 15:46 ` Hennerich, Michael
2010-10-18 19:51 ` [Device-drivers-devel] " Mike Frysinger
[not found] ` <AANLkTi=fAYqxsGre9kOt9Z8nDXZ9JFjZtKUiMrE3Qn9b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-25 0:45 ` Ben Dooks
[not found] ` <20101025004541.GD21564-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-10-25 14:12 ` Jonathan Cameron
2011-01-07 1:33 ` Mike Frysinger
2010-10-20 18:59 ` Mark Brown
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=20101018140136.2b44d29e@endymion.delvare \
--to=khali@linux-fr.org \
--cc=Michael.Hennerich@analog.com \
--cc=david-b@pacbell.net \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.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).