diff options
author | Tom Rini <trini@konsulko.com> | 2016-06-04 12:12:26 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-06-04 12:12:26 -0400 |
commit | cc749523ae1adec3856f2b7fe77a6d856da4652a (patch) | |
tree | d386320f6f69ead4a461619dd8348347ae7cc7dd /drivers/gpio/gpio-uclass.c | |
parent | 8aa57a95a2efc8174c5482f9b3abc4920b479ff2 (diff) | |
parent | 23d4e5ba49b878e01321be2af4e94f73389f4958 (diff) | |
download | u-boot-imx-cc749523ae1adec3856f2b7fe77a6d856da4652a.zip u-boot-imx-cc749523ae1adec3856f2b7fe77a6d856da4652a.tar.gz u-boot-imx-cc749523ae1adec3856f2b7fe77a6d856da4652a.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
Diffstat (limited to 'drivers/gpio/gpio-uclass.c')
-rw-r--r-- | drivers/gpio/gpio-uclass.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 732b6c2..4559739 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -367,6 +367,38 @@ int dm_gpio_set_value(const struct gpio_desc *desc, int value) return 0; } +int dm_gpio_get_open_drain(struct gpio_desc *desc) +{ + struct dm_gpio_ops *ops = gpio_get_ops(desc->dev); + int ret; + + ret = check_reserved(desc, "get_open_drain"); + if (ret) + return ret; + + if (ops->set_open_drain) + return ops->get_open_drain(desc->dev, desc->offset); + else + return -ENOSYS; +} + +int dm_gpio_set_open_drain(struct gpio_desc *desc, int value) +{ + struct dm_gpio_ops *ops = gpio_get_ops(desc->dev); + int ret; + + ret = check_reserved(desc, "set_open_drain"); + if (ret) + return ret; + + if (ops->set_open_drain) + ret = ops->set_open_drain(desc->dev, desc->offset, value); + else + return 0; /* feature not supported -> ignore setting */ + + return ret; +} + int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags) { struct udevice *dev = desc->dev; |