Skip to content
Snippets Groups Projects
Commit 9146d138 authored by Mike Frysinger's avatar Mike Frysinger Committed by Wolfgang Denk
Browse files

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: default avatarMike Frysinger <vapier@gentoo.org>
parent 7b826c2f
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include <watchdog.h> #include <watchdog.h>
#include <post.h> #include <post.h>
#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
#include <asm/gpio.h>
#endif
#ifdef CONFIG_LOGBUFFER #ifdef CONFIG_LOGBUFFER
#include <logbuff.h> #include <logbuff.h>
#endif #endif
...@@ -68,6 +72,23 @@ int post_init_f (void) ...@@ -68,6 +72,23 @@ int post_init_f (void)
*/ */
int __post_hotkeys_pressed(void) int __post_hotkeys_pressed(void)
{ {
#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
int ret;
unsigned gpio = CONFIG_SYS_POST_HOTKEYS_GPIO;
ret = gpio_request(gpio, "hotkeys");
if (ret) {
printf("POST: gpio hotkey request failed\n");
return 0;
}
gpio_direction_input(gpio);
ret = gpio_get_value(gpio);
gpio_free(gpio);
return ret;
#endif
return 0; /* No hotkeys supported */ return 0; /* No hotkeys supported */
} }
int post_hotkeys_pressed(void) int post_hotkeys_pressed(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment