From: David Jander <david.jander@protonic.nl>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: H Hartley Sweeten <hartleys@visionengravers.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
David Jander <david@protonic.nl>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH v4 3/3] Input: gpio_keys.c: Enable use with non-local GPIO chips.
Date: Tue, 21 Jun 2011 08:55:57 +0200 [thread overview]
Message-ID: <20110621085557.78509a8f@archvile> (raw)
In-Reply-To: <BANLkTin1aZEm5EKHFi7kB4zK4mija9P=pw@mail.gmail.com>
On Mon, 20 Jun 2011 12:20:30 -0600
Grant Likely <grant.likely@secretlab.ca> wrote:
> On Mon, Jun 20, 2011 at 11:03 AM, H Hartley Sweeten
> <hartleys@visionengravers.com> wrote:
> > On Saturday, June 18, 2011 6:18 AM, Grant Likely wrote:
> >> On Sat, Jun 18, 2011 at 4:17 AM, Dmitry Torokhov wrote:
> >>> On Thu, Jun 16, 2011 at 01:27:32PM -0600, Grant Likely wrote:
> >>>> On Tue, Jun 14, 2011 at 11:08:11AM +0200, David Jander wrote:
> >>>>> Use a threaded interrupt handler in order to permit the handler to use
> >>>>> a GPIO driver that causes things like I2C transactions being done
> >>>>> inside the handler context.
> >>>>> Also, gpio_keys_init needs to be declared as a late_initcall, to make
> >>>>> sure all needed GPIO drivers have been loaded if the drivers are built
> >>>>> into the kernel.
> >>>>
> >>>> ...which is a horrid hack, but until device dependencies can be
> >>>> described, it isn't one that can be solved easily.
> >>>>
> >>>
> >>> I really do not want to apply this... Currently the order of
> >>> initialization does not matter since nothing actually happens until
> >>> corresponding device appears on the bus. Does the OF code creates
> >>> devices before all resources are ready?
> >>
> >> It's not an OF problem. The problem is that all the platform_devices
> >> typically get registered all at once at machine_init time (on arm),
> >> and if the gpio expander isn't a platform_device, (like an i2c gpio
> >> expander which would end up being a child of a platform_device), then
> >> it won't be ready. The real problem is that we have no mechanism for
> >> holding off or deferring a driver probe if it depends on an
> >> asynchronous resource.
> >
> > To avoid the registration order issue, isn't the proper fix to use a
> > "setup" method in the gpio expander driver? The gpio-pca953x.c driver has
> > this and I use it to hook the gpio_keys driver to those gpios. The
> > registration order ends up being:
> >
> > i2c-gpio as a platform_device in the machine init code
> > pca9539 as part of the i2c_board_info for the i2c-gpio device
> > gpio-keys as a platform_device via the .setup callback of pca9539
>
> Blech! That approach fell out of the ugly tree and hit every branch
> on the way down! Points for creativity though. :-) Essentially that
> ends up being a driver-specific notifier implementation.
>
> Yes, that works, but to me it just highlights a deficiency in the
> Linux device model.
Especially, how would I specify this setup handler in a device-tree? The DT
compiler still has no support for something like embedded DT-script ;-)
Still, an interesting (albeit smelly) idea I hadn't thought of before.
Best regards,
--
David Jander
Protonic Holland.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-06-21 6:55 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 9:08 [PATCH v4 0/3] Input: gpio_keys.c: Add support for OF and I2C GPIO chips David Jander
2011-06-14 9:08 ` [PATCH v4 1/3] Input: gpio_keys.c: Simplify platform_device -> device casting David Jander
2011-06-16 19:28 ` Grant Likely
2011-06-18 10:19 ` Dmitry Torokhov
2011-06-20 6:52 ` David Jander
2011-06-20 8:32 ` Dmitry Torokhov
2011-06-14 9:08 ` [PATCH v4 2/3] Input: gpio_keys.c: Added support for device-tree platform data David Jander
2011-06-16 19:25 ` Grant Likely
2011-06-17 8:58 ` David Jander
2011-06-17 12:54 ` Grant Likely
2011-06-23 8:24 ` Dmitry Torokhov
2011-06-23 8:55 ` David Jander
2011-06-14 9:08 ` [PATCH v4 3/3] Input: gpio_keys.c: Enable use with non-local GPIO chips David Jander
2011-06-16 19:27 ` Grant Likely
2011-06-18 10:17 ` Dmitry Torokhov
2011-06-18 13:18 ` Grant Likely
2011-06-18 14:51 ` Dmitry Torokhov
2011-06-18 15:16 ` Grant Likely
2011-06-20 7:48 ` David Jander
2011-06-20 8:45 ` Dmitry Torokhov
2011-06-20 9:33 ` David Jander
2011-06-20 18:49 ` Grant Likely
2011-06-20 18:13 ` Grant Likely
2011-06-21 11:46 ` Mark Brown
[not found] ` <BANLkTikjUR_9wq_tGfomLZNdurvmEH1Jxw@mail.gmail.com>
2011-06-21 14:36 ` David Jander
2011-06-21 17:27 ` Mark Brown
2011-06-21 20:48 ` Dmitry Torokhov
2011-06-21 23:02 ` Mark Brown
2011-06-22 6:11 ` David Jander
2011-06-22 7:00 ` Dmitry Torokhov
2011-06-22 11:38 ` Mark Brown
2011-06-22 14:58 ` Grant Likely
2011-06-22 21:43 ` Dmitry Torokhov
2011-06-20 17:03 ` H Hartley Sweeten
2011-06-20 18:20 ` Grant Likely
2011-06-21 6:55 ` David Jander [this message]
2011-06-21 7:04 ` Grant Likely
2012-03-16 7:20 ` Dmitry Torokhov
2012-03-16 8:17 ` David Jander
2012-03-16 8:32 ` Dmitry Torokhov
2012-03-16 8:48 ` David Jander
2012-03-16 10:19 ` Ben Dooks
2012-03-16 10:18 ` Ben Dooks
2012-03-16 11:08 ` David Jander
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=20110621085557.78509a8f@archvile \
--to=david.jander@protonic.nl \
--cc=david@protonic.nl \
--cc=dmitry.torokhov@gmail.com \
--cc=grant.likely@secretlab.ca \
--cc=hartleys@visionengravers.com \
--cc=linux-input@vger.kernel.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).