android_device_samsung_msm8.../rootdir/etc/init.qcom.power.rc

216 lines
9.5 KiB
Text
Raw Normal View History

2018-07-19 12:48:02 +02:00
# Copyright (c) 2016, Code Aurora Forum. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Code Aurora nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
on init
write /sys/module/lpm_levels/parameters/sleep_disabled "Y"
# Drop write bit from cpu_max_freq so that libqti-perfd can't set it
chmod 0444 /sys/module/msm_performance/parameters/cpu_max_freq
on boot
# Add a cpuset for the camera daemon
# we want all cores for camera
mkdir /dev/cpuset/camera-daemon
write /dev/cpuset/camera-daemon/cpus 0-3
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
# Enable sched boost
write /proc/sys/kernel/sched_boost 1
on charger
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
wait /dev/block/bootdevice/by-name/efs
mount ext4 /dev/block/bootdevice/by-name/efs /efs nosuid nodev noatime noauto_da_alloc,discard,data=ordered,errors=panic
mkdir /efs/Battery 0775 radio system
chown radio system /efs/Battery
chmod 0775 /efs/Battery
chmod 0664 /sys/class/power_supply/battery/batt_temp_table
chown system radio /sys/class/power_supply/battery/batt_temp_table
chmod 0664 /sys/class/power_supply/battery/batt_capacity_max
chown system radio /sys/class/power_supply/battery/batt_capacity_max
chmod 0664 /efs/Battery/batt_capacity_max
chown radio system /efs/Battery/batt_capacity_max
chmod 0664 /sys/class/power_supply/battery/battery_cycle
chown system radio /sys/class/power_supply/battery/battery_cycle
chmod 0664 /sys/class/power_supply/battery/batt_after_manufactured
chown system radio /sys/class/power_supply/battery/batt_after_manufactured
chown system radio /sys/class/power_supply/battery/cisd_fullcaprep_max
chmod 0660 /sys/class/power_supply/battery/cisd_fullcaprep_max
chown system radio /sys/class/power_supply/battery/cisd_data
chmod 0660 /sys/class/power_supply/battery/cisd_data
chown system system /efs/FactoryApp/cisd_data
chmod 0660 /efs/FactoryApp/cisd_data
chown system system /efs/FactoryApp/cisd_wc_data
chmod 0660 /efs/FactoryApp/cisd_wc_data
chown system system /efs/FactoryApp/asoc
chmod 0660 /efs/FactoryApp/asoc
chown system system /efs/FactoryApp/batt_after_manufactured
chmod 0640 /efs/FactoryApp/batt_after_manufactured
chown system system /efs/FactoryApp/batt_discharge_level
chmod 0640 /efs/FactoryApp/batt_discharge_level
chown system radio /sys/class/power_supply/battery/cisd_data_json
chmod 0660 /sys/class/power_supply/battery/cisd_data_json
copy /system/vendor/firmware/battery_data.dat /efs/Battery/battery_data.dat
chmod 0400 /efs/Battery/battery_data.dat
write /sys/class/power_supply/battery/batt_update_data "/efs/Battery/battery_data.dat"
chown radio system /efs
chmod 0771 /efs
chown radio system /efs/usb_hw_param
chmod 771 /efs/usb_hw_param
chown system system /efs/usb_hw_param/usb_hw_param.log
chmod 0660 /efs/usb_hw_param/usb_hw_param.log
mkdir /efs/lpm 0775 system system
2018-07-19 12:48:02 +02:00
write /sys/module/lpm_levels/parameters/sleep_disabled "N"
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "userspace"
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed 300000
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "userspace"
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed 300000
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/module/msm_thermal/parameters/enabled "N"
class_start sec-charger
2018-07-19 12:48:02 +02:00
start thermal-engine
setprop sys.usb.configfs 1
2018-07-19 12:48:02 +02:00
on enable-low-power
# Disable thermal hotplug to switch governor
write /sys/module/msm_thermal/core_control/enabled 0
# Enable Adaptive LMK
write /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk 1
write /sys/module/lowmemorykiller/parameters/vmpressure_file_min 81250
# Set sync wakee policy tunable
write /proc/sys/kernel/sched_prefer_sync_wakee_to_waker 1
# Configure governor settings for little cluster
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/iowait_boost_enable 1
2018-07-19 12:48:02 +02:00
# Bring CPU2 online
write /sys/devices/system/cpu/cpu2/online 1
# Configure governor settings for big cluster
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu2/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu2/cpufreq/schedutil/down_rate_limit_us 20000
write /sys/devices/system/cpu/cpu2/cpufreq/schedutil/iowait_boost_enable 1
# Set boottime stune value
write /dev/stune/schedtune.prefer_idle 1
write /dev/stune/schedtune.boost 10
# set default schedTune value for foreground/top-app (only affects EAS)
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.boost 10
write /dev/stune/top-app/schedtune.prefer_idle 1
write /dev/stune/rt/schedtune.boost 30
write /dev/stune/rt/schedtune.prefer_idle 1
2018-07-19 12:48:02 +02:00
# Re-enable thermal hotplug
write /sys/module/msm_thermal/core_control/enabled 1
# Dynamic stune boost config
write /sys/module/cpu_boost/parameters/dynamic_stune_boost 10
2018-07-19 12:48:02 +02:00
# Input boost config
write /sys/module/cpu_boost/parameters/input_boost_freq "0:1324800 2:1324800"
write /sys/module/cpu_boost/parameters/input_boost_ms 40
# Enable bus-dcvs
write /sys/class/devfreq/soc:qcom,cpubw/governor "bw_hwmon"
write /sys/class/devfreq/soc:qcom,cpubw/polling_interval 50
write /sys/class/devfreq/soc:qcom,cpubw/min_freq 1525
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/mbps_zones "1525 5195 11863 13763"
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/sample_ms 4
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent 34
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory 20
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length 10
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_ceil_mbps 0
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_io_percent 34
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_delay 20
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps 0
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/up_scale 250
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/idle_mbps 1600
write /sys/class/devfreq/soc:qcom,memlat-cpu0/governor "mem_latency"
write /sys/class/devfreq/soc:qcom,memlat-cpu0/polling_interval 10
write /sys/class/devfreq/soc:qcom,memlat-cpu2/governor "mem_latency"
write /sys/class/devfreq/soc:qcom,memlat-cpu2/polling_interval 10
write /sys/class/devfreq/soc:qcom,mincpubw/governor "cpufreq"
# Enable all LPMs (this will enable C4, D4, D3, E4 and M3 LPMs)
write /sys/module/lpm_levels/parameters/sleep_disabled "N"
# Set perfd properties
setprop vendor.post_boot.parsed 1
2018-07-19 12:48:02 +02:00
on property:sys.boot_completed=1
# Set runtime stune value
write /dev/stune/schedtune.prefer_idle 0
write /dev/stune/schedtune.boost 0
2018-07-19 12:48:02 +02:00
trigger enable-low-power
# Set I/O squeduler
setprop sys.io.scheduler "bfq"
2019-02-11 21:56:38 +01:00
# Update cpusets now that boot is complete and we want better load balancing
write /dev/cpuset/top-app/cpus 0-3
write /dev/cpuset/foreground/cpus 0-2
write /dev/cpuset/background/cpus 0
write /dev/cpuset/system-background/cpus 0-2
write /dev/cpuset/restricted/cpus 0-1
2019-02-11 21:56:38 +01:00
2018-07-19 12:48:02 +02:00
on property:init.svc.recovery=running
trigger enable-low-power
service charger /system/bin/lpm
class sec-charger
user system
group system radio graphics input
capabilities SYS_BOOT
seclabel u:r:charger:s0
2018-07-19 12:48:02 +02:00
service energy-awareness /vendor/bin/energy-awareness
class main
user root
group system
oneshot