summaryrefslogtreecommitdiff
path: root/bootloader/imx233.c
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/imx233.c
parent5edae54e0d11e810040380aace455af7ec7c8d08 (diff)
downloadrockbox-a4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a.tar.gz
rockbox-a4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a.zip
imx233: enable charging in bootloader USB mode by including powermgmt
Change-Id: I8b91b3ab60cb9ffaa127333e9bcef8c33be742fa
Diffstat (limited to 'bootloader/imx233.c')
-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 @@
39#include "system-target.h" 39#include "system-target.h"
40#include "fmradio_i2c.h" 40#include "fmradio_i2c.h"
41#include "version.h" 41#include "version.h"
42#include "powermgmt.h"
42 43
43#include "usb.h" 44#include "usb.h"
44 45
@@ -81,6 +82,8 @@ static void usb_mode(int connect_timeout)
81 { 82 {
82 /* Got the message - wait for disconnect */ 83 /* Got the message - wait for disconnect */
83 printf("Bootloader USB mode"); 84 printf("Bootloader USB mode");
85 /* Enable power management to charge */
86 powermgmt_init();
84 87
85 usb_acknowledge(SYS_USB_CONNECTED_ACK); 88 usb_acknowledge(SYS_USB_CONNECTED_ACK);
86 89
@@ -89,6 +92,16 @@ static void usb_mode(int connect_timeout)
89 button = button_get_w_tmo(HZ/2); 92 button = button_get_w_tmo(HZ/2);
90 if(button == SYS_USB_DISCONNECTED) 93 if(button == SYS_USB_DISCONNECTED)
91 break; 94 break;
95 struct imx233_powermgmt_info_t info = imx233_powermgmt_get_info();
96 lcd_putsf(0, 7, "Charging status: %s",
97 info.state == CHARGE_STATE_DISABLED ? "disabled" :
98 info.state == CHARGE_STATE_ERROR ? "error" :
99 info.state == DISCHARGING ? "discharging" :
100 info.state == TRICKLE ? "trickle" :
101 info.state == TOPOFF ? "topoff" :
102 info.state == CHARGING ? "charging" : "<unknown>");
103 lcd_putsf(0, 8, "Battery: %d%%", battery_level());
104 lcd_update();
92 } 105 }
93 } 106 }
94 107