FreeCalypso > hg > fc-tourmaline
changeset 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 | 35474f3a1782 |
children | 3eccca3ac219 |
files | src/cs/drivers/drv_app/power/board/power.c |
diffstat | 1 files changed, 9 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/power/board/power.c Mon May 03 04:43:06 2021 +0000 +++ b/src/cs/drivers/drv_app/power/board/power.c Mon May 03 06:51:29 2021 +0000 @@ -118,23 +118,7 @@ *******************************************************************************/ void Switch_ON(void) { - if (Power_abb_status & ONBSTS) - { - /* Switch on Condition on ON BUTTON Push */ - rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, - RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); - Power_ON_Button(); - } - - else if (Power_abb_status & ONRSTS) - { - /* Switch on Condition on ON REM transition 0->1 */ - rvf_send_trace("ON Remote",9, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, - LCC_USE_ID); - Power_ON_Remote(); - } - - else if (Power_abb_status & CHGSTS) + if (Power_abb_status & CHGPRES) { /* Switch on Condition on CHARGER IC PLUG */ rvf_send_trace("Boot: Charger Plug",18, NULL_PARAM, @@ -144,6 +128,14 @@ #endif } + else if (Power_abb_status & ONBSTS) + { + /* Switch on Condition on ON BUTTON Push */ + rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, + RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); + Power_ON_Button(); + } + else { /* In FreeCalypso start from reset is NOT the same as PWON! */