summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-03-15 14:58:15 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-03-15 15:01:11 +0100
commita4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a (patch)
tree5c35337c12a983e7155f517aac6c1496225ef849 /bootloader
parent5edae54e0d11e810040380aace455af7ec7c8d08 (diff)
downloadrockbox-a4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a.tar.gz
rockbox-a4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a.tar.bz2
rockbox-a4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a.zip
imx233: enable charging in bootloader USB mode by including powermgmt
Change-Id: I8b91b3ab60cb9ffaa127333e9bcef8c33be742fa
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/imx233.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/bootloader/imx233.c b/bootloader/imx233.c
index 2380dfae5b..6d356b9cce 100644
--- a/bootloader/imx233.c
+++ b/bootloader/imx233.c
@@ -39,6 +39,7 @@
#include "system-target.h"
#include "fmradio_i2c.h"
#include "version.h"
+#include "powermgmt.h"
#include "usb.h"
@@ -81,6 +82,8 @@ static void usb_mode(int connect_timeout)
{
/* Got the message - wait for disconnect */
printf("Bootloader USB mode");
+ /* Enable power management to charge */
+ powermgmt_init();
usb_acknowledge(SYS_USB_CONNECTED_ACK);
@@ -89,6 +92,16 @@ static void usb_mode(int connect_timeout)
button = button_get_w_tmo(HZ/2);
if(button == SYS_USB_DISCONNECTED)
break;
+ struct imx233_powermgmt_info_t info = imx233_powermgmt_get_info();
+ lcd_putsf(0, 7, "Charging status: %s",
+ info.state == CHARGE_STATE_DISABLED ? "disabled" :
+ info.state == CHARGE_STATE_ERROR ? "error" :
+ info.state == DISCHARGING ? "discharging" :
+ info.state == TRICKLE ? "trickle" :
+ info.state == TOPOFF ? "topoff" :
+ info.state == CHARGING ? "charging" : "<unknown>");
+ lcd_putsf(0, 8, "Battery: %d%%", battery_level());
+ lcd_update();
}
}