mån 2014-03-24 klockan 01:18 +0100 skrev Henrik Nordström:
> sön 2014-03-16 klockan 17:34 +0000 skrev Ian Campbell:
> > This code hasn't been called since the calls to it randomly disappeared in
> > 71e6be0ccbd5 "sunxi: get u-boot mmc spl work" and 4d29a5dd7414 "sunxi: 
> > further
> > clean sunxi platform". It seems to have only ever been used as test code 
> > anyway.
> 
> It's left as a reminder to implement something that uses it. Almost
> every device have LRADC keys and could be very useful for controlling
> boot process (i.e. boot recoery/failsafe mode).
> 
> I guess a command that sets a variable with the current pressed key
> value would be suitable.

I.e. something like this patch:

>From ee16a3deaa41aa5b10ffa586cf1353a3c88468f9 Mon Sep 17 00:00:00 2001
From: Henrik Nordstrom <[email protected]>
Date: Mon, 24 Mar 2014 02:02:29 +0100
Subject: [PATCH] sunxi: readkey command for reading lradc key value

readkey variable
reads ldarc key value into specified variable to allow scripts
to take actions based on lradc key presses.

Signed-off-by: Henrik Nordstrom <[email protected]>
---
 arch/arm/cpu/armv7/sunxi/board.c |  3 +++
 arch/arm/cpu/armv7/sunxi/key.c   | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/cpu/armv7/sunxi/board.c
b/arch/arm/cpu/armv7/sunxi/board.c
index 94c5cd0..6ad4345 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -98,6 +98,9 @@ void s_init(void)
        clock_init();
        timer_init();
        gpio_init();
+#ifndef CONFIG_SPL_BUILD
+       sunxi_key_init();
+#endif
 
 #ifdef CONFIG_SPL_BUILD
        gd = &gdata;
diff --git a/arch/arm/cpu/armv7/sunxi/key.c
b/arch/arm/cpu/armv7/sunxi/key.c
index fcdabd3..578a519 100644
--- a/arch/arm/cpu/armv7/sunxi/key.c
+++ b/arch/arm/cpu/armv7/sunxi/key.c
@@ -52,3 +52,21 @@ u32 sunxi_read_key(void)
        writel(ints, &sunxi_key_base->ints);
        return key;
 }
+
+int do_readkey(cmd_tbl_t *cmdtp, int flag, int argc, const char
*argv[])
+{
+       u32 key;
+
+       if (argc < 2) {
+               printf("usage: readkey variable\n");
+       }
+       setenv_ulong(argv[1], sunxi_read_key());
+       
+       return 0;
+}
+
+U_BOOT_CMD(
+       readkey, 2, 1, do_readkey,
+       "Read LDADC key value into specified variable",
+       ""
+);
-- 
1.8.5.3



-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to