From: Guenter Roeck <linux@roeck-us.net>
To: Mark Rutland <mark.rutland@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
Pawel Moll <Pawel.Moll@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Ian Campbell <ian.campbell@citrix.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
"grant.likely@linaro.org" <grant.likely@linaro.org>
Subject: Re: [RFC PATCH 4/6] extcon-gpio: Add devicetree support
Date: Thu, 12 Sep 2013 10:00:29 -0700 [thread overview]
Message-ID: <20130912170029.GB12202@roeck-us.net> (raw)
In-Reply-To: <20130912164545.GG22013@e106331-lin.cambridge.arm.com>
On Thu, Sep 12, 2013 at 05:45:45PM +0100, Mark Rutland wrote:
> On Fri, Aug 30, 2013 at 05:29:36AM +0100, Guenter Roeck wrote:
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > drivers/extcon/extcon-gpio.c | 59 ++++++++++++++++++++++++++++++++++++++++--
> > 1 file changed, 57 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
> > index d4e3c89..16951fe 100644
> > --- a/drivers/extcon/extcon-gpio.c
> > +++ b/drivers/extcon/extcon-gpio.c
> > @@ -30,6 +30,8 @@
> > #include <linux/gpio.h>
> > #include <linux/extcon.h>
> > #include <linux/extcon/extcon-gpio.h>
> > +#include <linux/of_gpio.h>
> > +#include <linux/err.h>
> >
> > struct gpio_extcon_data {
> > struct extcon_dev edev;
> > @@ -77,14 +79,66 @@ static ssize_t extcon_gpio_print_state(struct extcon_dev *edev, char *buf)
> > return -EINVAL;
> > }
> >
> > +#ifdef CONFIG_OF_GPIO
> > +
> > +static struct gpio_extcon_platform_data *
> > +extcon_gpio_config_of(struct device *dev)
> > +{
> > + struct gpio_extcon_platform_data *pdata;
> > + struct device_node *np = dev->of_node;
> > + enum of_gpio_flags flags;
> > + int gpio, ret;
> > + u32 debounce;
> > +
> > + gpio = of_get_named_gpio_flags(np, "presence-detect-gpios", 0, &flags);
> > + if (gpio < 0)
> > + return ERR_PTR(gpio);
> > +
> > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > + if (!pdata)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + pdata->gpio = gpio;
> > + pdata->gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;
> > + pdata->irq_flags = IRQ_TYPE_EDGE_BOTH;
> > +
> > + if (!of_property_read_u32(np, "debounce-interval", &debounce))
> > + pdata->debounce = debounce;
> > +
> > + ret = of_property_read_string(np, "name", &pdata->name);
>
> This wasn't listed in the binding. What's this for?
>
This returns the node name.
For example, if the bindings are
my-connector {
...
};
it returns the string "my-connector".
I can add a reference to the bindings document if that helps. It is typically
not mentioned in bindings, though, so I didn't do it either.
Thanks,
Guenter
next prev parent reply other threads:[~2013-09-12 17:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-30 4:29 [PATCH 0/6] " Guenter Roeck
2013-08-30 4:29 ` [PATCH 1/6] extcon-gpio: Do not unnecessarily initialize variables Guenter Roeck
2013-09-11 1:16 ` Chanwoo Choi
2013-08-30 4:29 ` [PATCH 2/6] extcon-gpio: If the gpio driver/chip supports debounce, use it Guenter Roeck
2013-09-11 1:16 ` Chanwoo Choi
2013-09-11 1:57 ` Guenter Roeck
2013-09-11 2:03 ` Chanwoo Choi
2013-09-11 2:16 ` [PATCH v2 2/6] extcon-gpio: Use gpio driver/chip debounce if supported Guenter Roeck
2013-09-11 2:29 ` Chanwoo Choi
2013-09-11 2:39 ` Guenter Roeck
2013-08-30 4:29 ` [PATCH 3/6] extcon-gpio: Add support for active-low presence detect pins Guenter Roeck
2013-09-11 2:14 ` Chanwoo Choi
2013-09-11 2:25 ` [PATCH v2 " Guenter Roeck
2013-09-11 23:57 ` Chanwoo Choi
2013-09-12 0:23 ` Guenter Roeck
2013-08-30 4:29 ` [RFC PATCH 4/6] extcon-gpio: Add devicetree support Guenter Roeck
2013-09-12 16:45 ` Mark Rutland
2013-09-12 17:00 ` Guenter Roeck [this message]
2013-08-30 4:29 ` [RFC PATCH 5/6] extcon-gpio: Describe devicetree bindings Guenter Roeck
2013-09-12 16:41 ` Mark Rutland
2013-09-12 16:53 ` Guenter Roeck
2013-09-16 14:21 ` Mark Rutland
2013-09-16 15:19 ` Guenter Roeck
2013-09-18 15:38 ` Mark Rutland
2013-09-19 16:42 ` Mark Brown
2013-09-19 18:28 ` Guenter Roeck
2013-09-19 18:35 ` Mark Brown
2013-08-30 4:29 ` [RFC PATCH 6/6] extcon-gpio: Describe possible properties to support multi-type cables Guenter Roeck
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=20130912170029.GB12202@roeck-us.net \
--to=linux@roeck-us.net \
--cc=Pawel.Moll@arm.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=myungjoo.ham@samsung.com \
--cc=rob.herring@calxeda.com \
--cc=swarren@wwwdotorg.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
all inboxes | Powered by JetHome®