diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 5 | ||||
-rw-r--r-- | firmware/target/arm/imx233/powermgmt-imx233.c | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index 979f743601..01058c40fd 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c | |||
@@ -420,6 +420,8 @@ bool dbg_hw_info_powermgmt(void) | |||
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | #if IMX233_SUBTARGET >= 3780 | ||
424 | /* stmp < 3780 does not have a 4.2V rail and thus cannot do this magic trick */ | ||
423 | bool dbg_hw_info_power2(void) | 425 | bool dbg_hw_info_power2(void) |
424 | { | 426 | { |
425 | lcd_setfont(FONT_SYSFIXED); | 427 | lcd_setfont(FONT_SYSFIXED); |
@@ -504,6 +506,7 @@ bool dbg_hw_info_power2(void) | |||
504 | yield(); | 506 | yield(); |
505 | } | 507 | } |
506 | } | 508 | } |
509 | #endif /* IMX233_SUBTARGET >= 3780 */ | ||
507 | 510 | ||
508 | bool dbg_hw_info_rtc(void) | 511 | bool dbg_hw_info_rtc(void) |
509 | { | 512 | { |
@@ -1192,7 +1195,9 @@ static struct | |||
1192 | {"dma", dbg_hw_info_dma}, | 1195 | {"dma", dbg_hw_info_dma}, |
1193 | {"lradc", dbg_hw_info_lradc}, | 1196 | {"lradc", dbg_hw_info_lradc}, |
1194 | {"power", dbg_hw_info_power}, | 1197 | {"power", dbg_hw_info_power}, |
1198 | #if IMX233_SUBTARGET >= 3780 | ||
1195 | {"power2", dbg_hw_info_power2}, | 1199 | {"power2", dbg_hw_info_power2}, |
1200 | #endif | ||
1196 | {"powermgmt", dbg_hw_info_powermgmt}, | 1201 | {"powermgmt", dbg_hw_info_powermgmt}, |
1197 | {"rtc", dbg_hw_info_rtc}, | 1202 | {"rtc", dbg_hw_info_rtc}, |
1198 | {"dcp", dbg_hw_info_dcp}, | 1203 | {"dcp", dbg_hw_info_dcp}, |
diff --git a/firmware/target/arm/imx233/powermgmt-imx233.c b/firmware/target/arm/imx233/powermgmt-imx233.c index 2706ee99fa..3aee5934b9 100644 --- a/firmware/target/arm/imx233/powermgmt-imx233.c +++ b/firmware/target/arm/imx233/powermgmt-imx233.c | |||
@@ -70,6 +70,7 @@ void imx233_powermgmt_init(void) | |||
70 | 70 | ||
71 | #define MAX_4P2_ILIMIT 0x3f | 71 | #define MAX_4P2_ILIMIT 0x3f |
72 | 72 | ||
73 | #if IMX233_SUBTARGET >= 3780 | ||
73 | /* The code below assumes HZ = 100 so that it runs every 10ms */ | 74 | /* The code below assumes HZ = 100 so that it runs every 10ms */ |
74 | #if HZ != 100 | 75 | #if HZ != 100 |
75 | #warning The ramp_up_4p2_rail() tick task assumes HZ = 100, this may break charging | 76 | #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) | |||
81 | if(charge_state == TRICKLE && BF_RD(POWER_5VCTRL, CHARGE_4P2_ILIMIT) < MAX_4P2_ILIMIT) | 82 | if(charge_state == TRICKLE && BF_RD(POWER_5VCTRL, CHARGE_4P2_ILIMIT) < MAX_4P2_ILIMIT) |
82 | HW_POWER_5VCTRL += BF_POWER_5VCTRL_CHARGE_4P2_ILIMIT(1); | 83 | HW_POWER_5VCTRL += BF_POWER_5VCTRL_CHARGE_4P2_ILIMIT(1); |
83 | } | 84 | } |
85 | #endif /* IMX233_SUBTARGET >= 3780 */ | ||
84 | 86 | ||
85 | void powermgmt_init_target(void) | 87 | void powermgmt_init_target(void) |
86 | { | 88 | { |
87 | charge_state = DISCHARGING; | 89 | charge_state = DISCHARGING; |
90 | /* stmp < 3780 does not have a 4.2 rail */ | ||
91 | #if IMX233_SUBTARGET >= 3780 | ||
88 | tick_add_task(&ramp_up_4p2_rail); | 92 | tick_add_task(&ramp_up_4p2_rail); |
93 | #endif | ||
89 | } | 94 | } |
90 | 95 | ||
91 | void charging_algorithm_step(void) | 96 | void charging_algorithm_step(void) |
@@ -191,7 +196,9 @@ void charging_algorithm_step(void) | |||
191 | 196 | ||
192 | void charging_algorithm_close(void) | 197 | void charging_algorithm_close(void) |
193 | { | 198 | { |
199 | #if IMX233_SUBTARGET >= 3780 | ||
194 | tick_remove_task(&ramp_up_4p2_rail); | 200 | tick_remove_task(&ramp_up_4p2_rail); |
201 | #endif | ||
195 | } | 202 | } |
196 | 203 | ||
197 | struct imx233_powermgmt_info_t imx233_powermgmt_get_info(void) | 204 | struct imx233_powermgmt_info_t imx233_powermgmt_get_info(void) |