From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: "Jan Kundrát" <jan.kundrat@cesnet.cz>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Frank Rowand <frowand.list@gmail.com>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
Marek Vasut <marek.vasut@gmail.com>
Subject: Re: [PATCH 3/4] gpio: add core support for pull-up/pull-down configuration
Date: Tue, 8 Jan 2019 15:04:55 +0100 [thread overview]
Message-ID: <20190108150455.60b03b02@windsurf> (raw)
In-Reply-To: <d0e6a519-fb38-4aa0-81d0-b1781129055d@cesnet.cz>
Hello Jan,
Thanks for your feedback.
On Tue, 08 Jan 2019 15:00:22 +0100, Jan Kundrát wrote:
> > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> > index 7f1260c78270..6518dc8c7c4c 100644
> > --- a/drivers/gpio/gpiolib-of.c
> > +++ b/drivers/gpio/gpiolib-of.c
> > @@ -323,6 +323,11 @@ struct gpio_desc *of_find_gpio(struct
> > device *dev, const char *con_id,
> > if (of_flags & OF_GPIO_TRANSITORY)
> > *flags |= GPIO_TRANSITORY;
> >
> > + if (of_flags & OF_GPIO_PULL_UP)
> > + *flags |= GPIO_PULL_UP;
> > + else if (of_flags & OF_GPIO_PULL_DOWN)
> > + *flags |= GPIO_PULL_DOWN;
> > +
> > return desc;
> > }
> >
>
> Hi Thomas,
> my recommendation is to add an explicit "error handling" code here to warn
> when the DT specifies both pull-up and pull-down bits. It's outside of any
> hot path, and it will help identify mistakes instead of silently prefering
> a random bit choice.
Sure.
> > +/* Bit 4 express pull up */
> > +#define GPIO_PULL_UP 16
> > +
> > +/* Bit 5 express pull down */
> > +#define GPIO_PULL_DOWN 32
> > +
>
> > + GPIO_PULL_UP = (1 << 4),
> > + GPIO_PULL_DOWN = (1 << 5),
>
> > + OF_GPIO_PULL_UP = 0x10,
> > + OF_GPIO_PULL_DOWN = 0x20,
>
> I understand that it's already there, but I wonder if this duplication can
> be removed. Am I missing something, perhaps a reason why
> include/linux/of_gpio.h and include/dt-bindings/gpio/gpio.h are separate
> files?
I also wondered why there was such duplication when writing the
patches. I've assumed it was done so that
include/dt-bindings/gpio/gpio.h is "clean" enough to be included in DT,
while include/linux/of_gpio.h some more elaborate definitions. But
indeed <linux/of_gpio.h> could include <dt-bindings/gpio/gpio.h>.
Perhaps there's a good reason for this duplication? Let's see the
feedback of GPIO maintainers about this.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-01-08 14:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 16:40 [PATCH 0/4] Proposal to support pull-up/pull-down GPIO configuration Thomas Petazzoni
2019-01-03 16:40 ` [PATCH 1/4] dt-bindings: gpio: document the new pull-up/pull-down flags Thomas Petazzoni
2019-01-11 9:57 ` Linus Walleij
2019-01-03 16:41 ` [PATCH 2/4] gpio: rename gpio_set_drive_single_ended() to gpio_set_config() Thomas Petazzoni
2019-01-11 10:01 ` Linus Walleij
2019-01-03 16:41 ` [PATCH 3/4] gpio: add core support for pull-up/pull-down configuration Thomas Petazzoni
2019-01-08 14:00 ` Jan Kundrát
2019-01-08 14:04 ` Thomas Petazzoni [this message]
2019-01-11 10:11 ` Linus Walleij
2019-01-11 10:05 ` Linus Walleij
2019-01-11 12:58 ` Thomas Petazzoni
2019-01-11 14:38 ` Linus Walleij
2019-01-11 16:41 ` Rob Herring
2019-01-03 16:41 ` [PATCH 4/4] gpio: pca953x: add ->set_config implementation Thomas Petazzoni
2019-01-11 10:14 ` Linus Walleij
2019-02-07 14:44 ` Thomas Petazzoni
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=20190108150455.60b03b02@windsurf \
--to=thomas.petazzoni@bootlin.com \
--cc=bgolaszewski@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=jan.kundrat@cesnet.cz \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@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).