imx233: enable charging in bootloader USB mode by including powermgmt
Change-Id: I8b91b3ab60cb9ffaa127333e9bcef8c33be742fa
This commit is contained in:
parent
5edae54e0d
commit
a4fd5bf7cb
3 changed files with 18 additions and 3 deletions
|
@ -39,6 +39,7 @@
|
||||||
#include "system-target.h"
|
#include "system-target.h"
|
||||||
#include "fmradio_i2c.h"
|
#include "fmradio_i2c.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "powermgmt.h"
|
||||||
|
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
|
|
||||||
|
@ -81,6 +82,8 @@ static void usb_mode(int connect_timeout)
|
||||||
{
|
{
|
||||||
/* Got the message - wait for disconnect */
|
/* Got the message - wait for disconnect */
|
||||||
printf("Bootloader USB mode");
|
printf("Bootloader USB mode");
|
||||||
|
/* Enable power management to charge */
|
||||||
|
powermgmt_init();
|
||||||
|
|
||||||
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
||||||
|
|
||||||
|
@ -89,6 +92,16 @@ static void usb_mode(int connect_timeout)
|
||||||
button = button_get_w_tmo(HZ/2);
|
button = button_get_w_tmo(HZ/2);
|
||||||
if(button == SYS_USB_DISCONNECTED)
|
if(button == SYS_USB_DISCONNECTED)
|
||||||
break;
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1335,9 +1335,9 @@ target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c
|
||||||
target/arm/imx233/sansa-fuzeplus/debug-fuzeplus.c
|
target/arm/imx233/sansa-fuzeplus/debug-fuzeplus.c
|
||||||
target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c
|
target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c
|
||||||
target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c
|
target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c
|
||||||
|
target/arm/imx233/sansa-fuzeplus/powermgmt-fuzeplus.c
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
target/arm/imx233/sansa-fuzeplus/audio-fuzeplus.c
|
target/arm/imx233/sansa-fuzeplus/audio-fuzeplus.c
|
||||||
target/arm/imx233/sansa-fuzeplus/powermgmt-fuzeplus.c
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -889,9 +889,9 @@ void set_keypress_restarts_sleep_timer(bool enable)
|
||||||
sleeptimer_key_restarts = enable;
|
sleeptimer_key_restarts = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER
|
||||||
static void handle_sleep_timer(void)
|
static void handle_sleep_timer(void)
|
||||||
{
|
{
|
||||||
#ifndef BOOTLOADER
|
|
||||||
if (!sleeptimer_active)
|
if (!sleeptimer_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -912,8 +912,8 @@ static void handle_sleep_timer(void)
|
||||||
sys_poweroff();
|
sys_poweroff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* BOOTLOADER */
|
|
||||||
}
|
}
|
||||||
|
#endif /* BOOTLOADER */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We shut off in the following cases:
|
* We shut off in the following cases:
|
||||||
|
@ -929,6 +929,7 @@ static void handle_sleep_timer(void)
|
||||||
*/
|
*/
|
||||||
void handle_auto_poweroff(void)
|
void handle_auto_poweroff(void)
|
||||||
{
|
{
|
||||||
|
#ifndef BOOTLOADER
|
||||||
long timeout = poweroff_timeout*60*HZ;
|
long timeout = poweroff_timeout*60*HZ;
|
||||||
int audio_stat = audio_status();
|
int audio_stat = audio_status();
|
||||||
long tick = current_tick;
|
long tick = current_tick;
|
||||||
|
@ -968,4 +969,5 @@ void handle_auto_poweroff(void)
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
handle_sleep_timer();
|
handle_sleep_timer();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue