1#!/system/bin/sh 2 3################################################################################ 4# helper functions to allow Android init like script 5 6function write() { 7 echo -n $2 > $1 8} 9 10function copy() { 11 cat $1 > $2 12} 13 14function get-set-forall() { 15 for f in $1 ; do 16 cat $f 17 write $f $2 18 done 19} 20 21################################################################################ 22 23# take the A57s offline when thermal hotplug is disabled 24write /sys/devices/system/cpu/cpu4/online 0 25write /sys/devices/system/cpu/cpu5/online 0 26 27# disable thermal bcl hotplug to switch governor 28write /sys/module/msm_thermal/core_control/enabled 0 29get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode disable 30bcl_hotplug_mask=`get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_mask 0` 31bcl_hotplug_soc_mask=`get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask 0` 32get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode enable 33 34# some files in /sys/devices/system/cpu are created after the restorecon of 35# /sys/. These files receive the default label "sysfs". 36# Restorecon again to give new files the correct label. 37restorecon -R /sys/devices/system/cpu 38 39# Best effort limiting for first time boot if msm_performance module is absent 40write /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 960000 41 42# Limit A57 max freq from msm_perf module in case CPU 4 is offline 43write /sys/module/msm_performance/parameters/cpu_max_freq "4:960000 5:960000" 44 45# Disable CPU retention 46write /sys/module/lpm_levels/system/a53/cpu0/retention/idle_enabled 0 47write /sys/module/lpm_levels/system/a53/cpu1/retention/idle_enabled 0 48write /sys/module/lpm_levels/system/a53/cpu2/retention/idle_enabled 0 49write /sys/module/lpm_levels/system/a53/cpu3/retention/idle_enabled 0 50write /sys/module/lpm_levels/system/a57/cpu4/retention/idle_enabled 0 51write /sys/module/lpm_levels/system/a57/cpu5/retention/idle_enabled 0 52 53# Disable L2 retention 54write /sys/module/lpm_levels/system/a53/a53-l2-retention/idle_enabled 0 55write /sys/module/lpm_levels/system/a57/a57-l2-retention/idle_enabled 0 56 57# configure governor settings for little cluster 58write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive 59restorecon -R /sys/devices/system/cpu # must restore after interactive 60write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load 1 61write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif 1 62write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 19000 63write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 99 64write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 19000 65write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000 66write /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy 1 67write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads "65 460800:75 960000:80" 68write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 40000 69write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 80000 70write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000 71 72# online CPU4 73write /sys/devices/system/cpu/cpu4/online 1 74 75# configure governor settings for big cluster 76write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor interactive 77restorecon -R /sys/devices/system/cpu # must restore after interactive 78write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1 79write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1 80write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay 19000 81write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 99 82write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 19000 83write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1248000 84write /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy 1 85write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads "70 960000:80 1248000:85" 86write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 40000 87write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 80000 88write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600 89 90# restore A57's max 91copy /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 92 93# plugin remaining A57s 94write /sys/devices/system/cpu/cpu5/online 1 95 96# Restore CPU 4 max freq from msm_performance 97write /sys/module/msm_performance/parameters/cpu_max_freq "4:4294967295 5:4294967295" 98 99# input boost configuration 100write /sys/module/cpu_boost/parameters/input_boost_freq "0:960000" 101write /sys/module/cpu_boost/parameters/input_boost_ms 40 102 103# Setting B.L scheduler parameters 104write /proc/sys/kernel/sched_migration_fixup 1 105write /proc/sys/kernel/sched_upmigrate 95 106write /proc/sys/kernel/sched_downmigrate 85 107write /proc/sys/kernel/sched_freq_inc_notify 400000 108write /proc/sys/kernel/sched_freq_dec_notify 400000 109 110#enable rps static configuration 111write /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus 8 112 113# android background processes are set to nice 10. Never schedule these on the a57s. 114write /proc/sys/kernel/sched_upmigrate_min_nice 9 115 116get-set-forall /sys/class/devfreq/qcom,cpubw*/governor bw_hwmon 117 118# Disable sched_boost 119write /proc/sys/kernel/sched_boost 0 120 121# re-enable thermal and BCL hotplug 122write /sys/module/msm_thermal/core_control/enabled 1 123get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode disable 124get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_mask $bcl_hotplug_mask 125get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask $bcl_hotplug_soc_mask 126get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode enable 127 128# set GPU default power level to 5 (180MHz) instead of 4 (305MHz) 129write /sys/class/kgsl/kgsl-3d0/default_pwrlevel 5 130