land: 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: Darshan Manjrekar <darshanmanjrekar1205@gmail.com>
This commit is contained in:
parent
c868346a6a
commit
333bf8080e
1 changed files with 6 additions and 2 deletions
|
@ -54,10 +54,13 @@ char const *large_cache_height;
|
||||||
static void init_alarm_boot_properties()
|
static void init_alarm_boot_properties()
|
||||||
{
|
{
|
||||||
char const *boot_reason_file = "/proc/sys/kernel/boot_reason";
|
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 boot_reason;
|
||||||
|
std::string power_off_alarm;
|
||||||
std::string reboot_reason = property_get("ro.boot.alarmboot");
|
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
|
* Setup ro.alarm_boot value to true when it is RTC triggered boot up
|
||||||
* For existing PMIC chips, the following mapping applies
|
* For existing PMIC chips, the following mapping applies
|
||||||
|
@ -73,7 +76,8 @@ static void init_alarm_boot_properties()
|
||||||
* 7 -> CBLPWR_N pin toggled (for external power supply)
|
* 7 -> CBLPWR_N pin toggled (for external power supply)
|
||||||
* 8 -> KPDPWR_N pin toggled (power key pressed)
|
* 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");
|
property_set("ro.alarm_boot", "true");
|
||||||
} else {
|
} else {
|
||||||
property_set("ro.alarm_boot", "false");
|
property_set("ro.alarm_boot", "false");
|
||||||
|
|
Loading…
Reference in a new issue