Commit 9146d13821a20c49703e1f8f7e4a4f028678883d
Committed by
Wolfgang Denk
1 parent
7b826c2f35
Exists in
master
and in
54 other branches
post: add gpio hotkey support
Now that we have the generic GPIO layer, we can easily provide a common implementation for the post_hotkeys_pressed() function based on it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Showing 1 changed file with 21 additions and 0 deletions Side-by-side Diff
post/post.c
... | ... | @@ -26,6 +26,10 @@ |
26 | 26 | #include <watchdog.h> |
27 | 27 | #include <post.h> |
28 | 28 | |
29 | +#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO | |
30 | +#include <asm/gpio.h> | |
31 | +#endif | |
32 | + | |
29 | 33 | #ifdef CONFIG_LOGBUFFER |
30 | 34 | #include <logbuff.h> |
31 | 35 | #endif |
... | ... | @@ -68,6 +72,23 @@ |
68 | 72 | */ |
69 | 73 | int __post_hotkeys_pressed(void) |
70 | 74 | { |
75 | +#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO | |
76 | + int ret; | |
77 | + unsigned gpio = CONFIG_SYS_POST_HOTKEYS_GPIO; | |
78 | + | |
79 | + ret = gpio_request(gpio, "hotkeys"); | |
80 | + if (ret) { | |
81 | + printf("POST: gpio hotkey request failed\n"); | |
82 | + return 0; | |
83 | + } | |
84 | + | |
85 | + gpio_direction_input(gpio); | |
86 | + ret = gpio_get_value(gpio); | |
87 | + gpio_free(gpio); | |
88 | + | |
89 | + return ret; | |
90 | +#endif | |
91 | + | |
71 | 92 | return 0; /* No hotkeys supported */ |
72 | 93 | } |
73 | 94 | int post_hotkeys_pressed(void) |