diff mbox

[U-Boot,12/12] sniper: Keypad support, with recovery and fastboot key combinations

Message ID 1437398238-27912-13-git-send-email-contact@paulk.fr
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Paul Kocialkowski July 20, 2015, 1:17 p.m. UTC
Using the twl4030 keypad allows booting directly into some special boot modes,
such as recovery or fastboot. the VOL+ key will trigger a boot to recovery while
the VOL- key will trigger a boot to fastboot.

The G (gesture) key remains unused at this point.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 board/lge/sniper/sniper.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Tom Rini Aug. 4, 2015, 2:08 a.m. UTC | #1
On Mon, Jul 20, 2015 at 03:17:18PM +0200, Paul Kocialkowski wrote:

> Using the twl4030 keypad allows booting directly into some special boot modes,
> such as recovery or fastboot. the VOL+ key will trigger a boot to recovery while
> the VOL- key will trigger a boot to fastboot.
> 
> The G (gesture) key remains unused at this point.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini Aug. 13, 2015, 1:19 p.m. UTC | #2
On Mon, Jul 20, 2015 at 03:17:18PM +0200, Paul Kocialkowski wrote:

> Using the twl4030 keypad allows booting directly into some special boot modes,
> such as recovery or fastboot. the VOL+ key will trigger a boot to recovery while
> the VOL- key will trigger a boot to fastboot.
> 
> The G (gesture) key remains unused at this point.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index c94a3fa..a43f640 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -91,18 +91,34 @@  int board_init(void)
 
 int misc_init_r(void)
 {
+	unsigned char keypad_matrix[64] = { 0 };
 	char serial_string[17] = { 0 };
 	char reboot_mode[2] = { 0 };
 	u32 dieid[4] = { 0 };
+	unsigned char keys[3];
 	unsigned char data = 0;
 
 	/* Power button reset init */
 
 	twl4030_power_reset_init();
 
+	/* Keypad */
+
+	twl4030_keypad_scan((unsigned char *)&keypad_matrix);
+
+	keys[0] = twl4030_keypad_key((unsigned char *)&keypad_matrix, 0, 0);
+	keys[1] = twl4030_keypad_key((unsigned char *)&keypad_matrix, 0, 1);
+	keys[2] = twl4030_keypad_key((unsigned char *)&keypad_matrix, 0, 2);
+
 	/* Reboot mode */
 
 	reboot_mode[0] = omap_reboot_mode();
+
+	if (keys[0])
+		reboot_mode[0] = 'r';
+	else if (keys[1])
+		reboot_mode[0] = 'b';
+
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
 		if (!getenv("reboot-mode"))
 			setenv("reboot-mode", (char *)reboot_mode);