diff options
author | Heiko Schocher | 2019-07-17 06:59:51 +0200 |
---|---|---|
committer | Tom Rini | 2019-07-29 09:32:10 -0400 |
commit | 49b10cb4926285b856b207c1f5bb40c75487f08b (patch) | |
tree | 5fabb5d8f10d8f0ab412d6abbe168dbec7965ff9 /doc/device-tree-bindings/gpio | |
parent | 5917d0b877af8d553934c77247f1aa75f2dd048b (diff) |
gpio: fixes for gpio-hog support
recently added gpio hog patch was "in discussion"
state with Simon Glass. This patch now adds most
of comments from Simon Glass.
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'doc/device-tree-bindings/gpio')
-rw-r--r-- | doc/device-tree-bindings/gpio/gpio.txt | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/doc/device-tree-bindings/gpio/gpio.txt b/doc/device-tree-bindings/gpio/gpio.txt index e7744393697..e146917ff33 100644 --- a/doc/device-tree-bindings/gpio/gpio.txt +++ b/doc/device-tree-bindings/gpio/gpio.txt @@ -252,6 +252,7 @@ Example: boot_rescue { gpio-hog; input; + line-name = "foo-bar-gpio"; gpios = <7 GPIO_ACTIVE_LOW>; }; }; @@ -259,9 +260,13 @@ Example: For the above Example you can than access the gpio in your boardcode with: - desc = gpio_hog_lookup_name("boot_rescue.gpio-hog"); - if (desc) { - if (dm_gpio_get_value(desc)) - printf("\nBooting into Rescue System\n"); - else - printf("\nBoot normal\n"); + struct gpio_desc *desc; + int ret; + + ret = gpio_hog_lookup_name("boot_rescue", &desc); + if (ret) + return; + if (dm_gpio_get_value(desc) == 1) + printf("\nBooting into Rescue System\n"); + else if (dm_gpio_get_value(desc) == 0) + printf("\nBoot normal\n"); |