From: Linus Walleij <linus.walleij@linaro.org>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Frank Rowand <frowand.list@gmail.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<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: Fri, 11 Jan 2019 11:05:03 +0100 [thread overview]
Message-ID: <CACRpkdbypbX0-NsSG4DmFCv6hC2gYEQZSUyoKdJbgwiMDZ4yvg@mail.gmail.com> (raw)
In-Reply-To: <20190103164102.31437-4-thomas.petazzoni@bootlin.com>
On Thu, Jan 3, 2019 at 5:41 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> This commit adds support for configuring the pull-up and pull-down
> resistors available in some GPIO controllers. While configuring
> pull-up/pull-down is already possible through the pinctrl subsystem,
> some GPIO controllers, especially simple ones such as GPIO expanders
> on I2C, don't have any pinmuxing capability and therefore do not use
> the pinctrl subsystem.
>
> This commit implements the GPIO_PULL_UP and GPIO_PULL_DOWN flags,
> which can be used from the Device Tree, to enable a pull-up or
> pull-down resistor on a given GPIO.
>
> The flag is simply propagated all the way to the core GPIO subsystem,
> where it is used to call the gpio_chip ->set_config callback with the
> appropriate existing PIN_CONFIG_BIAS_* values.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
I'm overall happy with this approach.
> +/* Bit 4 express pull up */
> +#define GPIO_PULL_UP 16
> +
> +/* Bit 5 express pull down */
> +#define GPIO_PULL_DOWN 32
Please use
#define GPIO_PULL_UP BIT(5)
#define GPIO_PULL_DOWN BIT(6)
> @@ -12,6 +12,8 @@ enum gpio_lookup_flags {
> GPIO_OPEN_SOURCE = (1 << 2),
> GPIO_PERSISTENT = (0 << 3),
> GPIO_TRANSITORY = (1 << 3),
> + GPIO_PULL_UP = (1 << 4),
> + GPIO_PULL_DOWN = (1 << 5),
You can keep this to follow the pattern set by the others.
> @@ -28,6 +28,8 @@ enum of_gpio_flags {
> OF_GPIO_SINGLE_ENDED = 0x2,
> OF_GPIO_OPEN_DRAIN = 0x4,
> OF_GPIO_TRANSITORY = 0x8,
> + OF_GPIO_PULL_UP = 0x10,
> + OF_GPIO_PULL_DOWN = 0x20,
Same here: this is fine.
Yours,
Linus Walleij
next prev parent reply other threads:[~2019-01-11 10:05 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
2019-01-11 10:11 ` Linus Walleij
2019-01-11 10:05 ` Linus Walleij [this message]
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=CACRpkdbypbX0-NsSG4DmFCv6hC2gYEQZSUyoKdJbgwiMDZ4yvg@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=bgolaszewski@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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).