mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
gpiolib: of: improve gpiolib-of support of pull up/down on expanders
When using GPIO expanders attached to I2C ports, their set_config function needs to be passed a config setting which contains options to enable pull up or pull down bias feature. In order to set this config properly, the gpio parser needs to handle GPIO_PULL_UP and GPIO_PULL_DOWN. This patch enables the flags corresponding to GPIO_PULL_UP and GPIO_PULL_DOWN. Signed-off-by: Adam Ford <aford173@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
616844408d
commit
ea06a482a4
1 changed files with 10 additions and 0 deletions
|
@ -344,6 +344,12 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
|
||||||
if (transitory)
|
if (transitory)
|
||||||
lflags |= GPIO_TRANSITORY;
|
lflags |= GPIO_TRANSITORY;
|
||||||
|
|
||||||
|
if (flags & OF_GPIO_PULL_UP)
|
||||||
|
lflags |= GPIO_PULL_UP;
|
||||||
|
|
||||||
|
if (flags & OF_GPIO_PULL_DOWN)
|
||||||
|
lflags |= GPIO_PULL_DOWN;
|
||||||
|
|
||||||
ret = gpiod_configure_flags(desc, propname, lflags, dflags);
|
ret = gpiod_configure_flags(desc, propname, lflags, dflags);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
gpiod_put(desc);
|
gpiod_put(desc);
|
||||||
|
@ -585,6 +591,10 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np,
|
||||||
*lflags |= GPIO_ACTIVE_LOW;
|
*lflags |= GPIO_ACTIVE_LOW;
|
||||||
if (xlate_flags & OF_GPIO_TRANSITORY)
|
if (xlate_flags & OF_GPIO_TRANSITORY)
|
||||||
*lflags |= GPIO_TRANSITORY;
|
*lflags |= GPIO_TRANSITORY;
|
||||||
|
if (xlate_flags & OF_GPIO_PULL_UP)
|
||||||
|
*lflags |= GPIO_PULL_UP;
|
||||||
|
if (xlate_flags & OF_GPIO_PULL_DOWN)
|
||||||
|
*lflags |= GPIO_PULL_DOWN;
|
||||||
|
|
||||||
if (of_property_read_bool(np, "input"))
|
if (of_property_read_bool(np, "input"))
|
||||||
*dflags |= GPIOD_IN;
|
*dflags |= GPIOD_IN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue