Exemplo n.º 1
0
uint32_t target_is_pwrkey_pon_reason()
{
	uint8_t pon_reason = pm8950_get_pon_reason();
	if (pm8x41_get_is_cold_boot() && ((pon_reason == KPDPWR_N) || (pon_reason == (KPDPWR_N|PON1))))
		return 1;
	else
		return 0;
}
Exemplo n.º 2
0
Arquivo: init.c Projeto: M1cha/lktris
bool target_warm_boot(void)
{
	uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
	if (is_cold_boot)
		return false;
	else
		return true;
}
/*
 * Function to check if the power on reason is power key triggered.
 * Return 1 if it is triggered by power key.
 * Return 0 if it is not triggered by power key.
 */
static uint32_t is_pwrkey_pon_reason()
{
	uint8_t pon_reason = pm8x41_get_pon_reason();

	if (pm8x41_get_is_cold_boot() && (pon_reason == KPDPWR_N))
		return 1;
	else
		return 0;
}
Exemplo n.º 4
0
/* Return true if it is triggered by alarm. */
uint32_t check_alarm_boot(void)
{
	/* Check reboot reason and power on reason */
	if (pm8x41_get_is_cold_boot()) {
		if (pm8x41_get_pon_reason() == RTC_TRG)
			return 1;
	} else {
		if (readl(RESTART_REASON_ADDR) == ALARM_BOOT)
			return 1;
	}

	return 0;
}
Exemplo n.º 5
0
/* Return 1 if it is a force resin triggered by user. */
uint32_t is_user_force_reset(void)
{
	uint8_t poff_reason1 = pm8x41_get_pon_poff_reason1();
	uint8_t poff_reason2 = pm8x41_get_pon_poff_reason2();

	dprintf(SPEW, "poff_reason1: %d\n", poff_reason1);
	dprintf(SPEW, "poff_reason2: %d\n", poff_reason2);
	if (pm8x41_get_is_cold_boot() && (poff_reason1 == KPDPWR_AND_RESIN ||
							poff_reason2 == STAGE3))
		return 1;
	else
		return 0;
}
Exemplo n.º 6
0
/*
 * Function to check if the power on reason is power key triggered.
 * Return 1 if it is triggered by power key.
 * Return 0 if it is not triggered by power key.
 */
static uint32_t is_pwrkey_pon_reason()
{
#if PMI_CONFIGURED
	return target_is_pwrkey_pon_reason();
#else
	uint8_t pon_reason = pm8x41_get_pon_reason();

	if (pm8x41_get_is_cold_boot() && (pon_reason == KPDPWR_N))
		return 1;
	else
		return 0;
#endif
}
Exemplo n.º 7
0
unsigned target_pause_for_battery_charge(void)
{
	uint8_t pon_reason = pm8x41_get_pon_reason();
	uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
	dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
			pon_reason, is_cold_boot);
	/* In case of fastboot reboot,adb reboot or if we see the power key
	 * pressed we do not want go into charger mode.
	 * fastboot reboot is warm boot with PON hard reset bit not set
	 * adb reboot is a cold boot with PON hard reset bit set
	 */
	if (is_cold_boot &&
			(!(pon_reason & HARD_RST)) &&
			(!(pon_reason & KPDPWR_N)) &&
			((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
		return 1;
	else
		return 0;
}
Exemplo n.º 8
0
unsigned target_pause_for_battery_charge(void)
{
	uint8_t pon_reason = pm8x41_get_pon_reason();
	uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
	bool usb_present_sts = !(USBIN_UV_RT_STS &
				pm8x41_reg_read(SMBCHG_USB_RT_STS));
	dprintf(INFO, "%s : pon_reason is:0x%x cold_boot:%d usb_sts:%d\n", __func__,
		pon_reason, is_cold_boot, usb_present_sts);
	/* In case of fastboot reboot,adb reboot or if we see the power key
	* pressed we do not want go into charger mode.
	* fastboot reboot is warm boot with PON hard reset bit not set
	* adb reboot is a cold boot with PON hard reset bit set
	*/
	if (is_cold_boot &&
			(!(pon_reason & HARD_RST)) &&
			(!(pon_reason & KPDPWR_N)) &&
			usb_present_sts)
		return 1;
	else
		return 0;
}