FreeCalypso > hg > fc-tourmaline
comparison src/cs/drivers/drv_app/power/board/power.c @ 244:96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Consider the following scenario: the phone is on, the user plugs in
the charger, and then executes the power-off operation. In the Iota
VRPC this sequence translates to a switch-off immediately followed
by another switch-on - but the CHGSTS bit doesn't get set on the second
switch-on cycle! Disassembly of Pirelli's fw shows that they check
the CHGPRES bit, and furthermore, if both CHGPRES and ONBSTS are set,
the code they pass to their modified Power_ON_Button() function is
the one for charging - so let's adopt the same CHGPRES check and
the same priority order for switch-on causes.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 03 May 2021 06:51:29 +0000 |
parents | 184a031e38e6 |
children | a5b00817a60f |
comparison
equal
deleted
inserted
replaced
243:35474f3a1782 | 244:96784b8974eb |
---|---|
116 ** Warning The Set_Switch_ON_Cause() function has to be called prior. | 116 ** Warning The Set_Switch_ON_Cause() function has to be called prior. |
117 ** | 117 ** |
118 *******************************************************************************/ | 118 *******************************************************************************/ |
119 void Switch_ON(void) | 119 void Switch_ON(void) |
120 { | 120 { |
121 if (Power_abb_status & ONBSTS) | 121 if (Power_abb_status & CHGPRES) |
122 { | |
123 /* Switch on Condition on ON BUTTON Push */ | |
124 rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, | |
125 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); | |
126 Power_ON_Button(); | |
127 } | |
128 | |
129 else if (Power_abb_status & ONRSTS) | |
130 { | |
131 /* Switch on Condition on ON REM transition 0->1 */ | |
132 rvf_send_trace("ON Remote",9, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, | |
133 LCC_USE_ID); | |
134 Power_ON_Remote(); | |
135 } | |
136 | |
137 else if (Power_abb_status & CHGSTS) | |
138 { | 122 { |
139 /* Switch on Condition on CHARGER IC PLUG */ | 123 /* Switch on Condition on CHARGER IC PLUG */ |
140 rvf_send_trace("Boot: Charger Plug",18, NULL_PARAM, | 124 rvf_send_trace("Boot: Charger Plug",18, NULL_PARAM, |
141 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); | 125 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); |
142 #if (MMI != 0) | 126 #if (MMI != 0) |
143 fcbm_message_to_task(FCBM_START_CHG_MODE); | 127 fcbm_message_to_task(FCBM_START_CHG_MODE); |
144 #endif | 128 #endif |
129 } | |
130 | |
131 else if (Power_abb_status & ONBSTS) | |
132 { | |
133 /* Switch on Condition on ON BUTTON Push */ | |
134 rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, | |
135 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); | |
136 Power_ON_Button(); | |
145 } | 137 } |
146 | 138 |
147 else | 139 else |
148 { | 140 { |
149 /* In FreeCalypso start from reset is NOT the same as PWON! */ | 141 /* In FreeCalypso start from reset is NOT the same as PWON! */ |