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