public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] post: add gpio hotkey support
@ 2011-05-10 17:01 Mike Frysinger
  2011-05-11 11:42 ` Sergei Shtylyov
  2011-07-26 14:47 ` Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-05-10 17:01 UTC (permalink / raw)
  To: u-boot

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>
---
 post/post.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/post/post.c b/post/post.c
index 1b7f2aa..ecea1e1 100644
--- a/post/post.c
+++ b/post/post.c
@@ -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)
-- 
1.7.5.rc3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] post: add gpio hotkey support
  2011-05-10 17:01 [U-Boot] [PATCH] post: add gpio hotkey support Mike Frysinger
@ 2011-05-11 11:42 ` Sergei Shtylyov
  2011-05-11 14:54   ` Mike Frysinger
  2011-07-26 14:47 ` Wolfgang Denk
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-05-11 11:42 UTC (permalink / raw)
  To: u-boot

Hello.

On 10-05-2011 21:01, Mike Frysinger 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<vapier@gentoo.org>
> ---
>   post/post.c |   21 +++++++++++++++++++++
>   1 files changed, 21 insertions(+), 0 deletions(-)

> diff --git a/post/post.c b/post/post.c
> index 1b7f2aa..ecea1e1 100644
> --- a/post/post.c
> +++ b/post/post.c
[...]
> @@ -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

    You surely meant #else here?

> +
>   	return 0;	/* No hotkeys supported */
>   }
>   int post_hotkeys_pressed(void)

WBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] post: add gpio hotkey support
  2011-05-11 11:42 ` Sergei Shtylyov
@ 2011-05-11 14:54   ` Mike Frysinger
  2011-05-12 12:47     ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2011-05-11 14:54 UTC (permalink / raw)
  To: u-boot

On Wednesday, May 11, 2011 07:42:09 Sergei Shtylyov wrote:
> On 10-05-2011 21:01, Mike Frysinger wrote:
> > @@ -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
> 
>     You surely meant #else here?
> 
> > +
> > 
> >   	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 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] post: add gpio hotkey support
  2011-05-11 14:54   ` Mike Frysinger
@ 2011-05-12 12:47     ` Sergei Shtylyov
  2011-05-12 15:08       ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-05-12 12:47 UTC (permalink / raw)
  To: u-boot

Hello.

On 11-05-2011 18:54, Mike Frysinger wrote:

>>> @@ -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

>>      You surely meant #else here?

>>> +

>>>    	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...

> -mike

WBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] post: add gpio hotkey support
  2011-05-12 12:47     ` Sergei Shtylyov
@ 2011-05-12 15:08       ` Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-05-12 15:08 UTC (permalink / raw)
  To: u-boot

On Thursday, May 12, 2011 08:47:56 Sergei Shtylyov wrote:
> On 11-05-2011 18:54, Mike Frysinger wrote:
> >>>    int __post_hotkeys_pressed(void)
> >>>    {
> >>> +#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
> >>> +	return ret;
> >>> +#endif
> >>> 
> >>      You surely meant #else here?
> >>> 
> >>>    	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 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] post: add gpio hotkey support
  2011-05-10 17:01 [U-Boot] [PATCH] post: add gpio hotkey support Mike Frysinger
  2011-05-11 11:42 ` Sergei Shtylyov
@ 2011-07-26 14:47 ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2011-07-26 14:47 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <1305046881-5818-1-git-send-email-vapier@gentoo.org> 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 <vapier@gentoo.org>
> ---
>  post/post.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-26 14:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 17:01 [U-Boot] [PATCH] post: add gpio hotkey support Mike Frysinger
2011-05-11 11:42 ` Sergei Shtylyov
2011-05-11 14:54   ` Mike Frysinger
2011-05-12 12:47     ` Sergei Shtylyov
2011-05-12 15:08       ` Mike Frysinger
2011-07-26 14:47 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox