1
0
Fork 0
forked from len0rd/rockbox

imx233: fix red

stop pretending that stmp3600 and stmp3700 have a 4.2V power rail

Change-Id: If2506ed3e7c5db96dedc668f0931d59a5197dd88
This commit is contained in:
Amaury Pouly 2016-05-28 16:50:07 +01:00
parent c926a5269e
commit ae7dd5388d
2 changed files with 12 additions and 0 deletions

View file

@ -420,6 +420,8 @@ bool dbg_hw_info_powermgmt(void)
} }
} }
#if IMX233_SUBTARGET >= 3780
/* stmp < 3780 does not have a 4.2V rail and thus cannot do this magic trick */
bool dbg_hw_info_power2(void) bool dbg_hw_info_power2(void)
{ {
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
@ -504,6 +506,7 @@ bool dbg_hw_info_power2(void)
yield(); yield();
} }
} }
#endif /* IMX233_SUBTARGET >= 3780 */
bool dbg_hw_info_rtc(void) bool dbg_hw_info_rtc(void)
{ {
@ -1192,7 +1195,9 @@ static struct
{"dma", dbg_hw_info_dma}, {"dma", dbg_hw_info_dma},
{"lradc", dbg_hw_info_lradc}, {"lradc", dbg_hw_info_lradc},
{"power", dbg_hw_info_power}, {"power", dbg_hw_info_power},
#if IMX233_SUBTARGET >= 3780
{"power2", dbg_hw_info_power2}, {"power2", dbg_hw_info_power2},
#endif
{"powermgmt", dbg_hw_info_powermgmt}, {"powermgmt", dbg_hw_info_powermgmt},
{"rtc", dbg_hw_info_rtc}, {"rtc", dbg_hw_info_rtc},
{"dcp", dbg_hw_info_dcp}, {"dcp", dbg_hw_info_dcp},

View file

@ -70,6 +70,7 @@ void imx233_powermgmt_init(void)
#define MAX_4P2_ILIMIT 0x3f #define MAX_4P2_ILIMIT 0x3f
#if IMX233_SUBTARGET >= 3780
/* The code below assumes HZ = 100 so that it runs every 10ms */ /* The code below assumes HZ = 100 so that it runs every 10ms */
#if HZ != 100 #if HZ != 100
#warning The ramp_up_4p2_rail() tick task assumes HZ = 100, this may break charging #warning The ramp_up_4p2_rail() tick task assumes HZ = 100, this may break charging
@ -81,11 +82,15 @@ static void ramp_up_4p2_rail(void)
if(charge_state == TRICKLE && BF_RD(POWER_5VCTRL, CHARGE_4P2_ILIMIT) < MAX_4P2_ILIMIT) if(charge_state == TRICKLE && BF_RD(POWER_5VCTRL, CHARGE_4P2_ILIMIT) < MAX_4P2_ILIMIT)
HW_POWER_5VCTRL += BF_POWER_5VCTRL_CHARGE_4P2_ILIMIT(1); HW_POWER_5VCTRL += BF_POWER_5VCTRL_CHARGE_4P2_ILIMIT(1);
} }
#endif /* IMX233_SUBTARGET >= 3780 */
void powermgmt_init_target(void) void powermgmt_init_target(void)
{ {
charge_state = DISCHARGING; charge_state = DISCHARGING;
/* stmp < 3780 does not have a 4.2 rail */
#if IMX233_SUBTARGET >= 3780
tick_add_task(&ramp_up_4p2_rail); tick_add_task(&ramp_up_4p2_rail);
#endif
} }
void charging_algorithm_step(void) void charging_algorithm_step(void)
@ -191,7 +196,9 @@ void charging_algorithm_step(void)
void charging_algorithm_close(void) void charging_algorithm_close(void)
{ {
#if IMX233_SUBTARGET >= 3780
tick_remove_task(&ramp_up_4p2_rail); tick_remove_task(&ramp_up_4p2_rail);
#endif
} }
struct imx233_powermgmt_info_t imx233_powermgmt_get_info(void) struct imx233_powermgmt_info_t imx233_powermgmt_get_info(void)