aboutsummaryrefslogtreecommitdiff
path: root/init/init_msm8996.cpp
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2017-09-06 01:30:19 +0300
committerDavide Garberi <dade.garberi@gmail.com>2017-12-02 18:10:04 +0100
commit08bf55a6b266f9046dca73c45a60809834c5492d (patch)
tree19651728a3aea72b17204f811a80b9449985b7a8 /init/init_msm8996.cpp
parent2f6ed763cbab1a7f4c5bda7836398ef6e5583089 (diff)
msm8996-common: init: Check if power off alarm is set
Check if power off alarm is set, then set alarm's properties Adapted from Mao Jinlong <c_jmao@codeaurora.org> patch in init.qcom.early_boot.sh Change-Id: Ib86584d1c09aba07c47435ac8bed39aac79a80f7 Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'init/init_msm8996.cpp')
-rw-r--r--init/init_msm8996.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/init/init_msm8996.cpp b/init/init_msm8996.cpp
index 11bf5e4..5b3fa46 100644
--- a/init/init_msm8996.cpp
+++ b/init/init_msm8996.cpp
@@ -47,10 +47,13 @@ char const *heapmaxfree;
static void init_alarm_boot_properties()
{
char const *boot_reason_file = "/proc/sys/kernel/boot_reason";
+ char const *power_off_alarm_file = "/persist/alarm/powerOffAlarmSet";
std::string boot_reason;
+ std::string power_off_alarm;
std::string reboot_reason = property_get("ro.boot.alarmboot");
- if (read_file(boot_reason_file, &boot_reason)) {
+ if (read_file(boot_reason_file, &boot_reason)
+ && read_file(power_off_alarm_file, &power_off_alarm)) {
/*
* Setup ro.alarm_boot value to true when it is RTC triggered boot up
* For existing PMIC chips, the following mapping applies
@@ -66,7 +69,8 @@ static void init_alarm_boot_properties()
* 7 -> CBLPWR_N pin toggled (for external power supply)
* 8 -> KPDPWR_N pin toggled (power key pressed)
*/
- if (Trim(boot_reason) == "3" || reboot_reason == "true") {
+ if ((Trim(boot_reason) == "3" || reboot_reason == "true")
+ && Trim(power_off_alarm) == "1") {
property_set("ro.alarm_boot", "true");
} else {
property_set("ro.alarm_boot", "false");