From 64ef70082473b8371c994473b95250fcf0e9a0b3 Mon Sep 17 00:00:00 2001 From: Donghua Yan Date: Fri, 18 Oct 2019 16:16:10 -0500 Subject: [PATCH] input: misc: add dvdd flag for non-kungpow device For device without kungpow, KPDPWR bark irq is recommended to halt the kernel. But since this is a hard reset, a dvdd flag (reuse the kungpow bit flag) is needed to indicate this is an intended HW reset by s1 timer, even if s2 is not fired. In this way, bootloader is able to detect correct power up reason (0x100000). Dependency: BL need to detect this bit flag for power up reason amendment. Change-Id: If4f2cffc87bd75fd03fcb5cbf87cd90664eb71bf Signed-off-by: Donghua Yan Reviewed-on: https://gerrit.mot.com/1439390 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Qing Chang Submit-Approved: Jira Key --- .../misc/qpnp_power_on_mmi/qpnp-power-on-mmi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/qpnp_power_on_mmi/qpnp-power-on-mmi.c b/drivers/input/misc/qpnp_power_on_mmi/qpnp-power-on-mmi.c index 53828197406c..4e2b152296b5 100644 --- a/drivers/input/misc/qpnp_power_on_mmi/qpnp-power-on-mmi.c +++ b/drivers/input/misc/qpnp_power_on_mmi/qpnp-power-on-mmi.c @@ -42,6 +42,21 @@ struct qpnp_pon_mmi { u32 kpd_bark_irq; }; +static bool mmi_kungpow_check(void) +{ + struct device_node *soc = of_find_node_by_path("/soc"); + struct device_node *kungpow = NULL; + bool has_kungpow = false; + if (soc) + kungpow = of_find_node_by_name(soc, "kungpow_default"); + + has_kungpow = (kungpow != NULL); + + of_node_put(kungpow); + of_node_put(soc); + + return has_kungpow; +} static void kpd_bark_work_func(struct work_struct *work) { @@ -49,7 +64,8 @@ static void kpd_bark_work_func(struct work_struct *work) container_of(work, struct qpnp_pon_mmi, kpd_bark_work.work); dev_err(&pon->pdev->dev, "HW User Reset! 2 sec to Reset!\n"); - qpnp_pon_store_extra_reset_info(RESET_EXTRA_RESET_KUNPOW_REASON, 0); + qpnp_pon_store_extra_reset_info(RESET_EXTRA_RESET_KUNPOW_REASON, + mmi_kungpow_check() ? 0 : RESET_EXTRA_RESET_KUNPOW_REASON); qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET); kernel_halt(); }