post: add gpio hotkey support
PATCH 1/1 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.
--- post/post.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
post/post.c +21 -0
@@ -26,6 +26,10 @@#include <watchdog.h> #include <post.h> +#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO +#include <asm/gpio.h> +#endif +#ifdef CONFIG_LOGBUFFER #include <logbuff.h> #endif
@@ -68,6 +72,23 @@ int post_init_f (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 */ }int post_hotkeys_pressed (void )
Signature · 1 line
1.7.5.rc3
PATCH 1/1 post: add gpio hotkey support
Hello.
Quoted 12 lines · Mike Frysinger
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<[email protected]>--- post/post.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)post/post.c +0
-0
[...]
Quoted 10 lines
post/post.c +6
-0@@ -68,6 +72,23 @@ int post_init_f (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) {
post/post.c int post_init_f (void) · line 90
Quoted 10 lines
post/post.c +10
-0+printf ("POST: gpio hotkey request failed\n" ); + return 0; + } + +gpio_direction_input (gpio); + ret =gpio_get_value (gpio); +gpio_free (gpio); + +return ret; +#endif
You surely meant #else here?
post/post.c int post_init_f (void) · line 94
Quoted 4 lines
post/post.c +1
-0+return 0 ;/* No hotkeys supported */ }int post_hotkeys_pressed (void )
WBR, Sergei
PATCH 1/1 post: add gpio hotkey support
Quoted 14 lines · On Wednesday, May 11, 2011 07:42:09 Sergei Shtylyov wrote:
Quoted 13 lines · Mike Frysinger
post/post.c +10
-0@@ -68,6 +72,23 @@ int post_init_f (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 ; + } +
Quoted 12 lines
post/post.c int post_init_f (void) · line 90
Quoted 6 lines
post/post.c +6
-0+gpio_direction_input (gpio); + ret =gpio_get_value (gpio); +gpio_free (gpio); + +return ret; +#endif You surely meant #else here?
Quoted 3 lines
post/post.c +1
-0+return 0 ;/* No hotkeys supported */
not really what i was going for. it's fine either way though.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110511/56d7dffd/attachment.pgp
PATCH 1/1 post: add gpio hotkey support
Hello.
Quoted 22 lines · Mike Frysinger
Quoted 21 lines
Quoted 9 lines
post/post.c +6
-0@@ -68,6 +72,23 @@ int post_init_f (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) {post/post.c int post_init_f (void) · line 89
Quoted 10 lines
post/post.c +10
-0+printf ("POST: gpio hotkey request failed\n" ); + return 0; + } + +gpio_direction_input (gpio); + ret =gpio_get_value (gpio); +gpio_free (gpio); + +return ret; +#endif You surely meant #else here?
Quoted 5 lines
Quoted 3 lines
post/post.c int post_init_f (void) · line 92
Quoted 3 lines
post/post.c +1
-0+return 0 ;/* No hotkeys supported */ not really what i was going for. it's fine either way though.
I don't think 2 returns in a row is fine...
Quoted 1 line
-mike
WBR, Sergei
PATCH 1/1 post: add gpio hotkey support
Quoted 9 lines · On Thursday, May 12, 2011 08:47:56 Sergei Shtylyov wrote:
Quoted 8 lines · Mike Frysinger
Quoted 8 lines
post/post.c int post_init_f (void) · line 90
Quoted 6 lines
int __post_hotkeys_pressed(void) {post/post.c +3
-0+#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO +return ret; +#endif You surely meant #else here?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
return 0; /* No hotkeys supported */
not really what i was going for. it's fine either way though.
I don't think 2 returns in a row is fine...
if there were no CPP here, then obviously you'd be right. but there is, and i dont see much point now in adding a little more wrapping. gcc doesnt warn about it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110512/d9f86960/attachment.pgp
Wolfgang Denk
AppliedPATCH 1/1 post: add gpio hotkey support
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 7 lines · In message <[email protected]> you wrote:
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 <[email protected]>--- post/post.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Knowledge, sir, should be free to all! -- Harry Mudd, "I, Mudd", stardate 4513.3