comparison src/cs/drivers/drv_app/power/board/power.c @ 281:a75eefbf8be4

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.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 24 Sep 2021 02:03:08 +0000
parents b5e8dfd114a7
children
comparison
equal deleted inserted replaced
280:82665effff30 281:a75eefbf8be4
21 21
22 #include "abb/abb.h" 22 #include "abb/abb.h"
23 #include "rvm/rvm_use_id_list.h" 23 #include "rvm/rvm_use_id_list.h"
24 #include "spi/spi_env.h" 24 #include "spi/spi_env.h"
25 #include "power/power.h" 25 #include "power/power.h"
26 #include "rv/rv_general.h"
27 #include "rvf/rvf_api.h"
26 #include "rv/rv_defined_swe.h" // for RVM_PWR_SWE 28 #include "rv/rv_defined_swe.h" // for RVM_PWR_SWE
27 29
28 #ifndef _WINDOWS 30 #ifndef _WINDOWS
29 #include "kpd/kpd_power_api.h" 31 #include "kpd/kpd_power_api.h"
30 #include "ffs/ffs.h" 32 #include "ffs/ffs.h"
61 extern UINT16 fchg_first_vbat; 63 extern UINT16 fchg_first_vbat;
62 64
63 while (!fchg_first_vbat || !r2d_is_running || !mmi_task_init_done) 65 while (!fchg_first_vbat || !r2d_is_running || !mmi_task_init_done)
64 rvf_delay(8); 66 rvf_delay(8);
65 67
68 /*
69 * Is PWON button still held down? If it isn't, we power off.
70 * We use a raw VRPCDEV write instead of ABB_Power_Off()
71 * in order to skip the PWON release wait and BZ_KeyBeep_OFF():
72 * the off-beep would be very confusing to users in this scenario,
73 * and we need to skip the PWON release wait so that if the user's
74 * finger slips but the user really does wish to turn the phone on,
75 * we won't get stuck in that PWON release wait.
76 */
77 if (ABB_Read_Status() & ONREFLT) {
78 rvf_send_trace("PWON short press, not accepting", 31, NULL_PARAM,
79 RV_TRACE_LEVEL_DEBUG_HIGH, LCC_USE_ID);
80 /*
81 * Delay so that all trace output up to the last line above
82 * will be visible in rvtdump or rvinterf for debugging.
83 */
84 rvf_delay(RVF_MS_TO_TICKS(600));
85 ABB_Write_Register_on_page(PAGE0, VRPCDEV, 0x0001);
86 }
87
88 /* proceed with phone boot */
66 fchs_pwon_button_boot(); 89 fchs_pwon_button_boot();
67 #endif 90 #endif
68 } 91 }
69 92
70 93