开机后长按power key可实现系统重启、关机等功能,如下可配置长按时间以及长按功能:
在kernel中有的配置项将覆盖xbl中的配置,即只配置如下第1点即可
pmxxx_pon: qcom,power-on@800 {
compatible = "qcom,qpnp-power-on";
...
qcom,pon_1 {
qcom,pon-type = <0>;
qcom,support-reset = <1>;
qcom,pull-up = <1>;
qcom,s1-timer = <4480>;
qcom,s2-timer = <1000>; //debounce time = s1+s2
qcom,s2-type = <4>; //4 shutdown, 7 hard reset
linux,code = <116>;
};
};
The below mentioned properties are required only when qcom,support-reset property is defined and is set to 1.
pm_device_post_init(void)
{
...
/* PON KPDPWR configuration: s1_timer=10256ms, S2_timer=2000ms, Hard Reset */
err_flag |= pm_pon_reset_source_cfg(0, PM_PON_RESET_SOURCE_KPDPWR, 10256, 2000, PM_PON_RESET_CFG_HARD_RESET);
/* Disable Qcom original S2 reset configuration */
err_flag |= pm_pon_reset_source_ctl(0, PM_PON_RESET_SOURCE_KPDPWR, PM_ON);
err_flag |= pm_pon_reset_source_ctl(0, PM_PON_RESET_SOURCE_RESIN_AND_KPDPWR, PM_OFF);
err_flag |= pm_pon_reset_source_ctl(0, PM_PON_RESET_SOURCE_RESIN, PM_OFF);
/* Set s3 reset configuration: time is 16 sec.*/
err_flag |= pm_pon_stage3_reset_source_cfg(0, PM_PON_RESET_SOURCE_KPDPWR, 32);
}
另外,如下配置可实现系统在触发crash时自动进入dump模式
pm_err_flag_type pm_oem_pon_reset_cfg()
{
...
//These configurations is only used for development phones and should be commented out for production phones
err_flag |= pm_app_pon_pshold_cfg(PM_APP_PON_CFG_WARM_RESET);
//err_flag |= pm_app_pon_reset_cfg( PM_APP_PON_RESET_SOURCE_KPDPWR, reset_type, 10256, 2000); //PON KPDPWR PON Reset configuration
err_flag |= pm_pon_set_option_bit( 0, PM_PON_OPTION_KPDPWR_FEDGE_PON, TRUE); //Configure KPDPWR for edge trigger
err_flag |= pm_app_pon_reset_cfg( PM_APP_PON_RESET_SOURCE_KPDPWR, PM_APP_PON_CFG_DVDD_SHUTDOWN, 10256, 2000); //PON KPDPWR PON Shutdown configuration
err_flag |= pm_app_pon_reset_cfg( PM_APP_PON_RESET_SOURCE_RESIN_AND_KPDPWR, PM_APP_PON_CFG_DVDD_HARD_RESET, 10256, 2000); //PON RESIN_AND_KPDPWR PON Reset configuration
}