diff --git a/BoardConfig.mk b/BoardConfig.mk index e8c8ece7..c84faa2f 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -28,7 +28,7 @@ TARGET_2ND_CPU_ABI := armeabi-v7a TARGET_2ND_CPU_ABI2 := armeabi TARGET_2ND_CPU_VARIANT := cortex-a73 -BOARD_KERNEL_CMDLINE += androidboot.hardware=$(TARGET_BOOTLOADER_BOARD_NAME) androidboot.console=ttyMSM0 +BOARD_KERNEL_CMDLINE += androidboot.hardware=$(TARGET_BOOTLOADER_BOARD_NAME) androidboot.console=ttyMSM0 lpm_levels.sleep_disabled=1 BOARD_KERNEL_CMDLINE += user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 BOARD_KERNEL_CMDLINE += service_locator.enable=1 BOARD_KERNEL_CMDLINE += swiotlb=2048 diff --git a/init.hardware.rc b/init.hardware.rc index 689305e9..8393a2fe 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -24,6 +24,11 @@ on charger write /sys/devices/system/cpu/cpu6/online 0 write /sys/devices/system/cpu/cpu7/online 0 wait /dev/block/bootdevice + # Enable UFS powersaving + write /sys/devices/soc/1da4000.ufshc/clkscale_enable 1 + write /sys/devices/soc/1da4000.ufshc/clkgate_enable 1 + write /sys/devices/soc/1da4000.ufshc/hibern8_on_idle_enable 1 + write /sys/module/lpm_levels/parameters/sleep_disabled N service charger /charger class charger @@ -34,10 +39,11 @@ on early-init chmod 0755 /sys/kernel/debug on init - # Disable UFS clk scaling + # Disable UFS powersaving write /sys/devices/soc/1da4000.ufshc/clkscale_enable 0 write /sys/devices/soc/1da4000.ufshc/clkgate_enable 0 write /sys/devices/soc/1da4000.ufshc/hibern8_on_idle_enable 0 + write /sys/module/lpm_levels/parameters/sleep_disabled Y # Loading kernel modules in background start insmod_sh @@ -68,8 +74,6 @@ on init write /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us 500 write /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us 20000 - start power_sh - # set default schedTune value for foreground/top-app write /dev/stune/foreground/schedtune.prefer_idle 1 write /dev/stune/top-app/schedtune.boost 10 @@ -141,7 +145,6 @@ on init write /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled N write /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled N write /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled N - write /sys/module/lpm_levels/parameters/sleep_disabled N # b/37682684 Enable suspend clock reporting write /sys/kernel/debug/clk/debug_suspend 1 @@ -248,7 +251,7 @@ on post-fs-data # zygote need to be started after otapreopt which will be done on post-fs-data on zygote-start # zygote is started in common init.rc - # and now we can continue initialize /data/ + # and now we can continue to initialize /data/ mkdir /data/tombstones 0771 system system mkdir /tombstones/modem 0771 system system mkdir /tombstones/lpass 0771 system system @@ -474,6 +477,7 @@ service perfd /vendor/bin/perfd user root group root readproc system socket perfd seqpacket 0666 root system + disabled service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf} class main @@ -508,11 +512,19 @@ service per_proxy /vendor/bin/pm-proxy group system disabled +on property:sys.post_boot.parsed=1 + start perfd + on property:sys.boot_completed=1 - # Enable UFS clk scaling + # Enable power setting and set sys.post_boot.parsed to 1 + # to start perfd + start power_sh + + # Enable UFS powersaving write /sys/devices/soc/1da4000.ufshc/clkscale_enable 1 write /sys/devices/soc/1da4000.ufshc/clkgate_enable 1 write /sys/devices/soc/1da4000.ufshc/hibern8_on_idle_enable 1 + write /sys/module/lpm_levels/parameters/sleep_disabled N # Enable ZRAM on boot_complete swapon_all /vendor/etc/fstab.${ro.hardware} diff --git a/init.power.sh b/init.power.sh old mode 100644 new mode 100755 diff --git a/power/Power.cpp b/power/Power.cpp index 28914d8c..c74cb573 100644 --- a/power/Power.cpp +++ b/power/Power.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include "Power.h" @@ -59,6 +60,11 @@ Return Power::setInteractive(bool interactive) { } Return Power::powerHint(PowerHint hint, int32_t data) { + if (android::base::GetProperty("init.svc.perfd", "") != "running") { + ALOGW("perfd is not started"); + return Void(); + } + power_hint_t h = static_cast(hint); if (!isSupportedGovernor()) { return Void();