高通平台配置开机后长按power key功能

开机后长按power key可实现系统重启、关机等功能,如下可配置长按时间以及长按功能:
在kernel中有的配置项将覆盖xbl中的配置,即只配置如下第1点即可

1. kernel/…/pmxxx.dtsi

		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.

  • qcom,s1-timer
    The debounce timer for the BARK interrupt for that reset source. Value is specified in ms. Supported values are: 0, 32, 56, 80, 128, 184, 272, 408, 608, 904, 1352, 2048, 3072, 4480, 6720, 10256
  • qcom,s2-timer
    The debounce timer for the S2 reset specified in ms. On the expiry of this timer, the PMIC executes the reset sequence. Supported values are: 0, 10, 50, 100, 250, 500, 1000, 2000
  • qcom,s2-type
    The type of reset associated with this source. The supported resets are: SOFT(0), WARM(1), SHUTDOWN(4), HARD(7)

2. boot_image/…/pm_sbl_boot_oem.c

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
}

你可能感兴趣的:(PMIC)