Skip to content

Commit 1a3de8e

Browse files
nunojsafourmone
authored andcommitted
gpiolib: of: support bias pull disable
On top of looking at PULL_UP and PULL_DOWN flags, also look at PULL_DISABLE and set the appropriate GPIO flag. The GPIO core will then pass down this to controllers that support it. Change-Id: I4ea291dbd4165f5744cc0677a7d20dfed3fa1f3b Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com> Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/312114 Tested-by: Eric FOURMONT <eric.fourmont-ext@st.com> Reviewed-by: Eric FOURMONT <eric.fourmont-ext@st.com> Domain-Review: Eric FOURMONT <eric.fourmont-ext@st.com>
1 parent 7524535 commit 1a3de8e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

drivers/gpio/gpiolib-of.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node,
354354
if (flags & OF_GPIO_PULL_DOWN)
355355
lflags |= GPIO_PULL_DOWN;
356356

357+
if (flags & OF_GPIO_PULL_DISABLE)
358+
lflags |= GPIO_PULL_DISABLE;
359+
357360
ret = gpiod_configure_flags(desc, propname, lflags, dflags);
358361
if (ret < 0) {
359362
gpiod_put(desc);
@@ -556,6 +559,8 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
556559
*flags |= GPIO_PULL_UP;
557560
if (of_flags & OF_GPIO_PULL_DOWN)
558561
*flags |= GPIO_PULL_DOWN;
562+
if (of_flags & OF_GPIO_PULL_DISABLE)
563+
*flags |= GPIO_PULL_DISABLE;
559564

560565
return desc;
561566
}
@@ -621,6 +626,8 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np,
621626
*lflags |= GPIO_PULL_UP;
622627
if (xlate_flags & OF_GPIO_PULL_DOWN)
623628
*lflags |= GPIO_PULL_DOWN;
629+
if (xlate_flags & OF_GPIO_PULL_DISABLE)
630+
*lflags |= GPIO_PULL_DISABLE;
624631

625632
if (of_property_read_bool(np, "input"))
626633
*dflags |= GPIOD_IN;

include/linux/of_gpio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum of_gpio_flags {
2929
OF_GPIO_TRANSITORY = 0x8,
3030
OF_GPIO_PULL_UP = 0x10,
3131
OF_GPIO_PULL_DOWN = 0x20,
32+
OF_GPIO_PULL_DISABLE = 0x40,
3233
};
3334

3435
#ifdef CONFIG_OF_GPIO

0 commit comments

Comments
 (0)