sanders: Add spectrum support

Co-authored-by: Anushek Prasal <anushekprasal@gmail.com>
Co-authored-by: ronaxdevil <pratabidya.007@gmail.com>
Signed-off-by: ronaxdevil <pratabidya.007@gmail.com>
This commit is contained in:
andr68rus
2018-12-10 22:13:32 +05:30
committed by ronaxdevil
parent 290696e1e5
commit d598491ffa
10 changed files with 182 additions and 1 deletions

View File

@@ -341,7 +341,9 @@ PRODUCT_PACKAGES += \
init.mmi.usb.rc \
init.qcom.rc \
init.qcom.sensors.sh \
init.sanders.rc
init.sanders.rc \
init.spectrum.rc \
init.spectrum.sh
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/rootdir/etc/ueventd.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 Havoc-OS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Whether to display spectrum settings -->
<bool name="device_supports_spectrum">true</bool>
</resources>

View File

@@ -91,3 +91,19 @@ LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.sanders.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := init.spectrum.rc
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.spectrum.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := init.spectrum.sh
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.spectrum.sh
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
include $(BUILD_PREBUILT)

View File

@@ -27,6 +27,7 @@
import /vendor/etc/init/hw/init.mmi.rc
import /vendor/etc/init/hw/init.sanders.rc
import /vendor/etc/init/hw/init.spectrum.rc
on early-init
mount debugfs debugfs /sys/kernel/debug

View File

@@ -0,0 +1,123 @@
# Initialization
on property:sys.boot_completed=1
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chown system system /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
chown system system /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
chown system system /sys/module/workqueue/paramaters/power_efficient
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
chmod system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
chmod system system /sys/class/kgsl/kgsl-3d0/devfreq/governor
chmod 0664 /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
chmod 0664 /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
chmod 0664 /sys/class/kgsl/kgsl-3d0/devfreq/governor
# Set default profile on first boot
exec u:r:init:s0 root root -- /vendor/bin/init.spectrum.sh
exec u:r:magisk:s0 root root -- /vendor/bin/init.spectrum.sh
exec u:r:su:s0 root root -- /vendor/bin/init.spectrum.sh
# Enable Spectrum support
setprop spectrum.support 1
# Add kernel name
setprop persist.spectrum.kernel MAYHEM
# Balance (default profile)
on property:persist.spectrum.profile=0
# CPU
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor blu_schedutil
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 652800
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 2016000
write /sys/devices/system/cpu/cpu0/cpufreq/blu_schedutil/down_rate_limit_us 200
write /sys/devices/system/cpu/cpu0/cpufreq/blu_schedutil/iowait_boost_enable 0
write /sys/devices/system/cpu/cpu0/cpufreq/blu_schedutil/up_rate_limit_us 4500
write /sys/module/msm_performance/parameters/touchboost 1
write /sys/module/workqueue/parameters/power_efficient Y
# GPU
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/governor msm-adreno-tz
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/min_freq 133000000
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/max_freq 650000000
write /sys/class/kgsl/kgsl-3d0/max_gpuclk 650000000
# I/O Scheduler
write /sys/block/mmcblk0/queue/read_ahead_kb 512
write /sys/block/mmcblk0/queue/scheduler bfq
# Set thermal restrictions
write /sys/kernel/msm_thermal/enabled 0
write /sys/kernel/msm_thermal/zone0 "1401600 1785600 40 38"
write /sys/kernel/msm_thermal/zone1 "1324800 1555200 41 40"
write /sys/kernel/msm_thermal/zone2 "1228800 1478400 42 41"
write /sys/kernel/msm_thermal/zone3 "1228800 1401600 43 42"
write /sys/kernel/msm_thermal/zone4 "1190400 1324800 44 43"
write /sys/kernel/msm_thermal/zone5 "1190400 1248000 46 44"
write /sys/kernel/msm_thermal/zone6 "1113600 1190400 48 46"
write /sys/kernel/msm_thermal/zone7 "1036800 940800 53 50"
write /sys/kernel/msm_thermal/zone8 "729600 729600 65 60"
write /sys/kernel/msm_thermal/sampling_ms 8000
write /sys/kernel/msm_thermal/enabled 1
# Performance
on property:persist.spectrum.profile=1
# CPU
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 652800
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 2208000
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
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
write /sys/module/msm_performance/parameters/touchboost 1
write /sys/module/workqueue/parameters/power_efficient N
# GPU
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/governor msm-adreno-tz
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/min_freq 133000000
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/max_freq 700000000
write /sys/class/kgsl/kgsl-3d0/max_gpuclk 700000000
# I/O Scheduler
write /sys/block/mmcblk0/queue/read_ahead_kb 2048
write /sys/block/mmcblk0/queue/scheduler cfq
# Battery
on property:persist.spectrum.profile=2
# CPU
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor smartmax_eps
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 652800
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1689600
write /sys/module/msm_performance/parameters/touchboost 0
write /sys/module/workqueue/parameters/power_efficient Y
# GPU
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/governor msm-adreno-tz
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/min_freq 133000000
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/max_freq 510000000
write /sys/class/kgsl/kgsl-3d0/max_gpuclk 510000000
# I/O Scheduler
write /sys/block/mmcblk0/queue/read_ahead_kb 128
write /sys/block/mmcblk0/queue/scheduler sio
# Gaming
on property:persist.spectrum.profile=3
# CPU
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 652800
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 2208000
write /sys/module/msm_performance/parameters/touchboost 1
write /sys/module/workqueue/parameters/power_efficient N
# GPU
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/governor performance
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/min_freq 133000000
write /sys/devices/soc/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0/max_freq 750000000
write /sys/class/kgsl/kgsl-3d0/max_gpuclk 750000000
# I/O Scheduler
write /sys/block/mmcblk0/queue/read_ahead_kb 2048
write /sys/block/mmcblk0/queue/scheduler deadline

View File

@@ -0,0 +1,6 @@
#!/system/bin/sh
# If there is not a persist value, we need to set one
if [ ! -f /data/property/persist.spectrum.profile ]; then
setprop persist.spectrum.profile 0
fi

View File

@@ -5,3 +5,7 @@ type touch_prop, property_type;
type diag_prop, property_type;
type thermal_prop, property_type;
type qti_telephony_prop, property_type;
type dirac_prop, property_type;
# Spectrum
type spectrum_prop, property_type;

View File

@@ -3,3 +3,7 @@ hw.aov.hotword_dsp_path u:object_r:adspd_prop:s0
hw.motosh.booted u:object_r:motosh_prop:s0
ro.boot.hardware.revision u:object_r:hw_rev_prop:s0
hw.touch.status u:object_r:touch_prop:s0
persist.audio.dirac. u:object_r:dirac_prop:s0
# Spectrum
persist.spectrum.profile u:object_r:spectrum_prop:s0

View File

@@ -15,3 +15,4 @@ get_prop(system_app, diag_prop);
binder_call(system_app, qtitetherservice_service);
binder_call(system_app, wificond);
get_prop(system_app, spectrum_prop);

View File

@@ -365,3 +365,8 @@ persist.dbg.volte_avail_ovr=1 \
persist.dbg.vt_avail_ovr=1 \
persist.dbg.wfc_avail_ovr=1 \
persist.radio.data_lte_sys_ind=1
# Spectrum
PRODUCT_PROPERTY_OVERRIDES += \
spectrum.support=1 \
persist.spectrum.kernel=MAYHEM