# HG changeset patch # User Mychaela Falconia # Date 1632448988 0 # Node ID a75eefbf8be4d9dd9628b50f0be8295dd149a788 # Parent 82665effff306f5caea1395f2bc5db08af348f84 Phone boot with PWON: weed out short button presses Every standard end user phone has a design provision, most naturally implemented in firmware, whereby the PWON button effects a boot only if it is held down long enough - short presses of this PWON button are detected, assumed to be spurious and cause the fw to power back off instead of proceeding with boot. The present change introduces this standard function in FreeCalypso. diff -r 82665effff30 -r a75eefbf8be4 src/cs/drivers/drv_app/power/board/power.c --- a/src/cs/drivers/drv_app/power/board/power.c Fri Sep 24 00:47:12 2021 +0000 +++ b/src/cs/drivers/drv_app/power/board/power.c Fri Sep 24 02:03:08 2021 +0000 @@ -23,6 +23,8 @@ #include "rvm/rvm_use_id_list.h" #include "spi/spi_env.h" #include "power/power.h" +#include "rv/rv_general.h" +#include "rvf/rvf_api.h" #include "rv/rv_defined_swe.h" // for RVM_PWR_SWE #ifndef _WINDOWS @@ -63,6 +65,27 @@ while (!fchg_first_vbat || !r2d_is_running || !mmi_task_init_done) rvf_delay(8); + /* + * Is PWON button still held down? If it isn't, we power off. + * We use a raw VRPCDEV write instead of ABB_Power_Off() + * in order to skip the PWON release wait and BZ_KeyBeep_OFF(): + * the off-beep would be very confusing to users in this scenario, + * and we need to skip the PWON release wait so that if the user's + * finger slips but the user really does wish to turn the phone on, + * we won't get stuck in that PWON release wait. + */ + if (ABB_Read_Status() & ONREFLT) { + rvf_send_trace("PWON short press, not accepting", 31, NULL_PARAM, + RV_TRACE_LEVEL_DEBUG_HIGH, LCC_USE_ID); + /* + * Delay so that all trace output up to the last line above + * will be visible in rvtdump or rvinterf for debugging. + */ + rvf_delay(RVF_MS_TO_TICKS(600)); + ABB_Write_Register_on_page(PAGE0, VRPCDEV, 0x0001); + } + + /* proceed with phone boot */ fchs_pwon_button_boot(); #endif }