From: David Jander <david.jander@protonic.nl>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
David Jander <david@protonic.nl>,
linux-input@vger.kernel.org
Subject: Re: [PATCH v4 2/3] Input: gpio_keys.c: Added support for device-tree platform data
Date: Thu, 23 Jun 2011 10:55:38 +0200 [thread overview]
Message-ID: <20110623105538.064957e0@archvile> (raw)
In-Reply-To: <20110623082409.GA2493@core.coreip.homeip.net>
On Thu, 23 Jun 2011 01:24:10 -0700
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On Fri, Jun 17, 2011 at 06:54:17AM -0600, Grant Likely wrote:
> > On Fri, Jun 17, 2011 at 2:58 AM, David Jander <david.jander@protonic.nl>
> > wrote:
> > >
> > > Hi Grant,
> > >
> > > On Thu, 16 Jun 2011 13:25:59 -0600
> > > Grant Likely <grant.likely@secretlab.ca> wrote:
> > >
> > >> On Tue, Jun 14, 2011 at 11:08:10AM +0200, David Jander wrote:
> > >> > This patch enables fetching configuration data which is normally
> > >> > provided via platform_data from the device-tree instead.
> > >> > If the device is configured from device-tree data, the platform_data
> > >> > struct is not used, and button data needs to be allocated dynamically.
> > >> > Big part of this patch deals with confining pdata usage to the probe
> > >> > function, to make this possible.
> > >> >
> > >> > Signed-off-by: David Jander <david@protonic.nl>
> > >> > ---
> > >> > .../devicetree/bindings/gpio/gpio_keys.txt | 49 +++++++
> > >> > drivers/input/keyboard/gpio_keys.c | 147
> > >> > ++++++++++++++++++-- 2 files changed, 186 insertions(+), 10
> > >> > deletions(-) create mode 100644
> > >> > Documentation/devicetree/bindings/gpio/gpio_keys.txt
> > >> >
> > >> > diff --git a/Documentation/devicetree/bindings/gpio/gpio_keys.txt
> > >> > b/Documentation/devicetree/bindings/gpio/gpio_keys.txt new file mode
> > >> > 100644 index 0000000..60a4d8e
> > >> > --- /dev/null
> > >> > +++ b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
> > >> > @@ -0,0 +1,49 @@
> > >> > +Device-Tree bindings for input/gpio_keys.c keyboard driver
> > >> > +
> > >> > +Required properties:
> > >> > + - compatible = "gpio-keys";
> > >> > +
> > >> > +Optional properties:
> > >> > + - autorepeat: Boolean, Enable auto repeat feature of Linux input
> > >> > + subsystem.
> > >> > +
> > >> > +Each button (key) is represented as a sub-node of "gpio-keys":
> > >> > +Subnode properties:
> > >> > +
> > >> > + - reg: GPIO number the key is bound to if linux GPIO numbering is
> > >> > used.
> > >>
> > >> Wait. That won't work. There is no concept of "linux gpio numbering"
> > >> in the device tree data. When using device tree, the gpio numbers
> > >> usually get dynamically assigned.
> > >
> > > Yes I know, but suppose you want to use this driver with a GPIO-driver
> > > that does not have devaice-tree support yet? I need a way of binding the
> > > button to a GPIO pin that does not have a device-tree definition. How
> > > should I do this otherwise?
> > > I am using this driver with a pca963x, as you might have suspected
> > > already, and I just added OF device-tree support to it, so that will
> > > work, but others...?
> >
> > The solution is to add OF support to the GPIO driver being used.
> >
> > > Before "fixing" pca963x, I used this property and it worked perfectly
> > > well, so please explain what is not supposed to work. Please keep in
> > > mind that this is meant as more of a backwards-compatibility feature. If
> > > you think that being backwards compatible with non-OF GPIO drivers is a
> > > bad idea, I'll remove this.
> >
> > It is. Something that we've been very careful about is to avoid
> > encoding Linux-specific implementation details into the device tree
> > bindings. The implementation details, such as how gpio controllers
> > are enumerated, are subject to change just in the normal progress of
> > development. By focusing the DT bindings on HW description, the DT
> > data is insulated to a degree from kernel churn.
> >
> > >> > + - wakeup: Boolean, button can wake-up the system.
> > >>
> > >> "wakeup" is potentially too generic a property name (potential to
> > >> conflict with a generic wakeup binding if one ever exists). Just to
> > >> be defencive, I'd suggest prefixing these custom gpio keys properties
> > >> with something like "gpio-key,".
> > >
> > > Ok, "gpio-key,wakeup" it will be then? But isn't this function something
> > > potentially other IO-pins/keys/buttons/interrupts/etc... could have to
> > > be able to wake up the system?
> >
> > Can you foresee how all bindings would potentially use a 'wakeup'
> > property? It's really hard to define a common binding without first
> > having several use cases ready to use it. It's better to start being
> > cautious, and then create a common binding at some point in the
> > future.
> >
> >
> > >> > + reg = of_get_property(pp, "linux,input-type", &len);
> > >> > + if (reg)
> > >> > + buttons[i].type = be32_to_cpup(reg);
> > >> > + else
> > >> > + buttons[i].type = EV_KEY;
> > >> how about:
> > >> buttons[i].type = reg ? be32_to_cpup(reg) : EV_KEY;
> > >
> > > Ok, if you prefer this notation.... just an "if...else" in another
> > > dress ;-)
> >
> > Yup, but it's shorter, and I like painting bike sheds.
> >
>
> So is there an updated version of this patch coming?
Yes, I'm preparing v5 right now.
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-23 8: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 [this message]
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
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=20110623105538.064957e0@archvile \
--to=david.jander@protonic.nl \
--cc=david@protonic.nl \
--cc=dmitry.torokhov@gmail.com \
--cc=grant.likely@secretlab.ca \
--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).