[PATCH] charger-dbg-blinkenlights

Mike Montour mail at mmontour.net
Mon Aug 25 09:33:36 CEST 2008


This patch holds u-boot in wait_for_power() until the Aux key is pressed,
and indicates battery charge and USB current limit via the Power LEDs.

diff --git a/board/neo1973/gta02/gta02.c b/board/neo1973/gta02/gta02.c
index 2369d95..a0a56fa 100644
--- a/board/neo1973/gta02/gta02.c
+++ b/board/neo1973/gta02/gta02.c
@@ -398,7 +398,7 @@ static void wait_for_power(void)
 			pcf50633_usb_maxcurrent(new_max);
 
 		/* we have plenty of external power -> try to boot */
-		if (pcf50633_usb_last_maxcurrent >= 500)
+		if (neo1973_aux_key_pressed() && pcf50633_usb_last_maxcurrent >= 500)
 			break;
 
 		/* cpu_idle sits with interrupts off destroying USB operation
@@ -414,7 +414,7 @@ static void wait_for_power(void)
 			 * Probe the battery only if the current LED cycle is
 			 * about to end, so that it had time to discharge.
 			 */
-			if (led_cycle && battery_is_good())
+			if (neo1973_aux_key_pressed() && led_cycle && battery_is_good())
 				break;
 			seconds++;
 			
@@ -443,6 +443,20 @@ static void wait_for_power(void)
 #endif
 			neo1973_led(GTA02_LED_AUX_RED, led_cycle);
 
+		if (pcf50633_reg_read(PCF50633_REG_BVMCTL) & 1)
+			neo1973_led(GTA02_LED_PWR_BLUE, 1);
+		else if (pcf50633_read_battvolt() < SAFE_POWER_MILLIVOLT)
+			neo1973_led(GTA02_LED_PWR_BLUE, led_cycle);
+		else
+			neo1973_led(GTA02_LED_PWR_BLUE, 0);
+
+		if (pcf50633_usb_last_maxcurrent == 1000)
+			neo1973_led(GTA02_LED_PWR_ORANGE, 1);
+		else if (pcf50633_usb_last_maxcurrent == 500)
+			neo1973_led(GTA02_LED_PWR_ORANGE, !led_cycle);
+		else	
+			neo1973_led(GTA02_LED_PWR_ORANGE, 0);
+		
 		/* alternate LED and charger cycles */
 		pcf50633_reg_set_bit_mask(PCF50633_REG_MBCC1, 1, !led_cycle);
 	}
-- 
1.5.2.4


--------------000800090609030004090709--




More information about the openmoko-kernel mailing list