diff options
author | Caesar Wang <wxt@rock-chips.com> | 2016-05-25 18:48:45 +0800 |
---|---|---|
committer | Caesar Wang <wxt@rock-chips.com> | 2016-05-27 09:39:56 +0800 |
commit | 195889829e3f3fc4eabb3297b3d686daf14af7f5 (patch) | |
tree | 0ed6d6aa607ae30ef5a7f5fc582a981764393b53 /drivers/gpio | |
parent | e141aa0357fd4977ba874f4f86874e2cadc73498 (diff) |
gpio: support gpio set/get pull status
On some platform gpio can set/get pull status when input, add these
function so we can set/get gpio pull status when need it. And they are
optional function.
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c index c06172fc..ef6bb9c8 100644 --- a/drivers/gpio/gpio.c +++ b/drivers/gpio/gpio.c @@ -80,6 +80,26 @@ void gpio_set_value(int gpio, int value) ops->set_value(gpio, value); } +void gpio_set_pull(int gpio, int pull) +{ + assert(ops); + assert(ops->set_pull != 0); + assert((pull == GPIO_PULL_NONE) || (pull == GPIO_PULL_UP) || + (pull == GPIO_PULL_DOWN)); + assert(gpio >= 0); + + ops->set_pull(gpio, pull); +} + +int gpio_get_pull(int gpio) +{ + assert(ops); + assert(ops->get_pull != 0); + assert(gpio >= 0); + + return ops->get_pull(gpio); +} + /* * Initialize the gpio. The fields in the provided gpio * ops pointer must be valid. |