android_device_samsung_msm8.../rootdir/etc/init.qcom.power.rc
Bruno Martins 1bb48181f8 msm8976-common: Enable low-power mode on boot complete
Change-Id: I2d6b1acda1bff74fd3c6c005d889213854ef625e
2018-02-12 18:34:13 +01:00

203 lines
9.1 KiB
Text

on boot
# add a cpuset for the camera daemon
# we want all the little cores for camera
mkdir /dev/cpuset/camera-daemon
write /dev/cpuset/camera-daemon/cpus 0
write /dev/cpuset/camera-daemon/mems 0
chown system system /dev/cpuset/camera-daemon
chown system system /dev/cpuset/camera-daemon/tasks
chmod 0664 /dev/cpuset/camera-daemon/tasks
# Update foreground cpuset now that processors are up
# reserve CPU 3 for the top app and camera daemon
write /dev/cpuset/foreground/cpus 0-2,4-7
write /dev/cpuset/foreground/boost/cpus 4-7
write /dev/cpuset/background/cpus 0
write /dev/cpuset/system-background/cpus 0-2
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/camera-daemon/cpus 0-3
# Enable sched boost
write /proc/sys/kernel/sched_boost 1
on enable-low-power
# HMP scheduler (big.Little cluster related) settings
write /proc/sys/kernel/sched_upmigrate 95
write /proc/sys/kernel/sched_downmigrate 85
write /proc/sys/kernel/sched_window_stats_policy 2
write /proc/sys/kernel/sched_ravg_hist_size 5
write /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run 3
write /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run 3
write /sys/class/devfreq/mincpubw/governor "cpufreq"
write /sys/class/devfreq/cpubw/governor "bw_hwmon"
write /sys/class/devfreq/cpubw/bw_hwmon/io_percent 20
write /sys/class/devfreq/cpubw/bw_hwmon/guard_band_mbps 30
write /sys/class/devfreq/gpubw/bw_hwmon/io_percent 40
# Disable thermal
write /sys/module/msm_thermal/core_control/enabled 0
# Disable thermal bcl hotplug to switch governor
write /sys/devices/soc.0/qcom,bcl.55/mode "disable"
write /sys/devices/soc.0/qcom,bcl.55/hotplug_mask 0
write /sys/devices/soc.0/qcom,bcl.55/hotplug_soc_mask 0
write /sys/devices/soc.0/qcom,bcl.55/mode "enable"
# Enable governor for power cluster
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 80
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy 0
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 40000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 691200
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 59000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 1305600
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads "1 691200:80"
# Enable governor for perf cluster
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor "interactive"
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 85
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy 0
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 40000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor 40000
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 883200
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 60000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1382400
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay "19000 1382400:39000"
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads "85 1382400:90 1747200:80"
# HMP Task packing settings for 8976
write /proc/sys/kernel/sched_small_task 30
write /sys/devices/system/cpu/cpu0/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu1/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu2/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu3/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu4/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu5/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu6/sched_mostly_idle_load 20
write /sys/devices/system/cpu/cpu7/sched_mostly_idle_load 20
# Disable sched boost
write /proc/sys/kernel/sched_boost 0
# Enable LPM Prediction
write /sys/module/lpm_levels/parameters/lpm_prediction 1
# Enable Low power modes
write /sys/module/lpm_levels/parameters/sleep_disabled 0
# Bring up all cores online
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1
# Disable L2 GDHS on 8976
write /sys/module/lpm_levels/system/a53/a53-l2-gdhs/idle_enabled "N"
write /sys/module/lpm_levels/system/a72/a72-l2-gdhs/idle_enabled "N"
# Enable sched guided freq control
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1
write /proc/sys/kernel/sched_freq_inc_notify 50000
write /proc/sys/kernel/sched_freq_dec_notify 50000
# Enable core control for 8976
write /sys/devices/system/cpu/cpu4/core_ctl/min_cpus 2
write /sys/devices/system/cpu/cpu4/core_ctl/max_cpus 4
write /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres 68
write /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres 40
write /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms 100
write /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster 1
# Re-enable thermal
write /sys/module/msm_thermal/core_control/enabled 1
# Re-enable BCL hotplug
write /sys/devices/soc.0/qcom,bcl.55/mode "disable"
write /sys/devices/soc.0/qcom,bcl.55/hotplug_mask 48
write /sys/devices/soc.0/qcom,bcl.55/hotplug_soc_mask 32
write /sys/devices/soc.0/qcom,bcl.55/mode "enable"
# Enable timer migration to little cluster
write /proc/sys/kernel/power_aware_timer_migration 1
# Enable sched colocation and colocation inheritance
write /proc/sys/kernel/sched_grp_upmigrate 130
write /proc/sys/kernel/sched_grp_downmigrate 110
write /proc/sys/kernel/sched_enable_thread_grouping 1
# LMK & Process reclaim
write /sys/module/lowmemorykiller/parameters/adj_max_shift 354
write /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk 1
write /sys/module/lowmemorykiller/parameters/minfree "18432,23040,27648,32256,55296,80640"
write /sys/module/lowmemorykiller/parameters/vmpressure_file_min 81250
write /sys/module/process_reclaim/parameters/enable_process_reclaim 1
write /sys/module/process_reclaim/parameters/min_score_adj 354
write /sys/module/process_reclaim/parameters/per_swap_size 1024
write /sys/module/process_reclaim/parameters/pressure_max 70
write /sys/module/process_reclaim/parameters/pressure_min 10
write /sys/module/process_reclaim/parameters/swap_opt_eff 30
on charger
# Disable thermal
write /sys/module/msm_thermal/core_control/enabled 0
# Bring CPUs online
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1
# Configure governor settings for little cluster
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave"
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 400000
# Configure governor settings for big cluster
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor "powersave"
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 400000
# Bring CPUs offline
write /sys/devices/system/cpu/cpu1/online 0
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/devices/system/cpu/cpu4/online 0
write /sys/devices/system/cpu/cpu5/online 0
write /sys/devices/system/cpu/cpu6/online 0
write /sys/devices/system/cpu/cpu7/online 0
# Enable thermal
write /sys/module/msm_thermal/core_control/enabled 1
# Set perfd properties
rm /data/system/perfd/default_values
start perfd
on property:init.svc.recovery=running
trigger enable-low-power
on property:dev.bootcomplete=1
trigger enable-low-power
setprop sys.io.scheduler "bfq"