From 19d8b0de33abd2e46d909f9a07067620c97a0f35 Mon Sep 17 00:00:00 2001 From: Vara Prasad A V S G Date: Fri, 7 Apr 2017 17:32:37 +0530 Subject: [PATCH] Added HW configurations for SDM660 Change-Id: I2626945b7412f339e4db66b6d57e4bd27573cc0e --- base.mk | 11 +- power/Android.mk | 4 + power/power-660.c | 287 +++++++++++++++++++++++++ rootdir/etc/init.class_main.sh | 4 +- rootdir/etc/init.qcom.bt.sh | 4 +- rootdir/etc/init.qcom.post_boot.sh | 325 ++++++++++++++++++++++++++++- rootdir/etc/init.qcom.sh | 33 +++ rootdir/etc/init.qcom.usb.sh | 8 +- 8 files changed, 666 insertions(+), 10 deletions(-) create mode 100644 power/power-660.c diff --git a/base.mk b/base.mk index d8702417..7487a0bc 100644 --- a/base.mk +++ b/base.mk @@ -30,7 +30,7 @@ TARGET_USE_VENDOR_CAMERA_EXT := true MSM_VIDC_TARGET_LIST := msm8974 msm8610 msm8226 apq8084 msm8916 msm8994 msm8909 msm8992 msm8996 msm8952 msm8937 msm8953 msm8998 sdm660 sdm845 #List of targets that use master side content protection -MASTER_SIDE_CP_TARGET_LIST := msm8996 msm8998 +MASTER_SIDE_CP_TARGET_LIST := msm8996 msm8998 sdm660 # Below projects/packages with LOCAL_MODULEs will be used by # PRODUCT_PACKAGES to build LOCAL_MODULEs that are tagged with @@ -102,6 +102,7 @@ AUDIO_HARDWARE += audio.primary.msm8937 AUDIO_HARDWARE += audio.primary.msm8953 AUDIO_HARDWARE += audio.primary.msmgold AUDIO_HARDWARE += audio.primary.msm8998 +AUDIO_HARDWARE += audio.primary.sdm660 # AUDIO_POLICY := audio_policy.mpq8064 AUDIO_POLICY += audio_policy.apq8084 @@ -402,6 +403,9 @@ LIBCOPYBIT += copybit.msm8952 LIBCOPYBIT += copybit.msm8937 LIBCOPYBIT += copybit.msm8953 LIBCOPYBIT += copybit.msm8998 +LIBCOPYBIT += copybit.sdm630 +LIBCOPYBIT += copybit.sdm660 +LIBCOPYBIT += copybit.sda630 #LIBGESTURES LIBGESTURES := libgestures @@ -432,6 +436,8 @@ LIBGRALLOC += gralloc.msm8937 LIBGRALLOC += gralloc.msm8953 LIBGRALLOC += gralloc.msm8998 LIBGRALLOC += libmemalloc +LIBGRALLOC += gralloc.sdm630 +LIBGRALLOC += gralloc.sdm660 #memtrack LIBMEMTRACK := memtrack.default @@ -448,6 +454,7 @@ LIBMEMTRACK += memtrack.msm8952 LIBMEMTRACK += memtrack.msm8937 LIBMEMTRACK += memtrack.msm8953 LIBMEMTRACK += memtrack.msm8998 +LIBMEMTRACK += memtrack.sdm660 #LIBLIGHTS LIBLIGHTS := lights.msm8660 @@ -471,6 +478,7 @@ LIBLIGHTS += lights.msm8952 LIBLIGHTS += lights.msm8937 LIBLIGHTS += lights.msm8953 LIBLIGHTS += lights.msm8998 +LIBLIGHTS += lights.sdm660 #LIBHWCOMPOSER LIBHWCOMPOSER := hwcomposer.msm8660 @@ -495,6 +503,7 @@ LIBHWCOMPOSER += hwcomposer.msm8952 LIBHWCOMPOSER += hwcomposer.msm8937 LIBHWCOMPOSER += hwcomposer.msm8953 LIBHWCOMPOSER += hwcomposer.msm8998 +LIBHWCOMPOSER += hwcomposer.sdm660 #LIBAUDIOPARAM -- Exposing AudioParameter as dynamic library for SRS TruMedia to work LIBAUDIOPARAM := libaudioparameter diff --git a/power/Android.mk b/power/Android.mk index c0988dfe..b20349a6 100644 --- a/power/Android.mk +++ b/power/Android.mk @@ -53,6 +53,10 @@ ifeq ($(call is-board-platform-in-list,msm8998), true) LOCAL_SRC_FILES += power-8998.c endif +ifeq ($(call is-board-platform-in-list,sdm660), true) +LOCAL_SRC_FILES += power-660.c +endif + ifeq ($(TARGET_USES_INTERACTION_BOOST),true) LOCAL_CFLAGS += -DINTERACTION_BOOST endif diff --git a/power/power-660.c b/power/power-660.c new file mode 100644 index 00000000..ff2e058d --- /dev/null +++ b/power/power-660.c @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2017, The Linux Foundation. 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 The Linux Foundation 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 "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. + */ + +#define LOG_NIDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include + +#define LOG_TAG "QTI PowerHAL" +#include +#include +#include + +#include "utils.h" +#include "metadata-defs.h" +#include "hint-data.h" +#include "performance.h" +#include "power-common.h" + +static int saved_interactive_mode = -1; +static int display_hint_sent; +static int video_encode_hint_sent; +static int cam_preview_hint_sent; + +pthread_mutex_t camera_hint_mutex = PTHREAD_MUTEX_INITIALIZER; +static int camera_hint_ref_count; +static void process_video_encode_hint(void *metadata); +//static void process_cam_preview_hint(void *metadata); + +static bool is_target_SDM630() /* Returns value=630 if target is SDM630 else value 0 */ +{ + int fd; + bool is_target_SDM630=false; + char buf[10] = {0}; + fd = open("/sys/devices/soc0/soc_id", O_RDONLY); + if (fd >= 0) { + if (read(fd, buf, sizeof(buf) - 1) == -1) { + ALOGW("Unable to read soc_id"); + is_target_SDM630 = false; + } else { + int soc_id = atoi(buf); + if (soc_id == 318 || soc_id== 327) { + is_target_SDM630 = true; /* Above SOCID for SDM630 */ + } + } + } + close(fd); + return is_target_SDM630; +} + +int power_hint_override(struct power_module *module, power_hint_t hint, + void *data) +{ + + switch(hint) { + case POWER_HINT_VSYNC: + break; + case POWER_HINT_VIDEO_ENCODE: + { + process_video_encode_hint(data); + return HINT_HANDLED; + } + } + return HINT_NONE; +} + +int set_interactive_override(struct power_module *module, int on) +{ + char governor[80]; + char tmp_str[NODE_MAX]; + int resource_values[20]; + int num_resources; + struct video_encode_metadata_t video_encode_metadata; + int rc; + + ALOGI("Got set_interactive hint"); + + if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU0) == -1) { + if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU1) == -1) { + if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU2) == -1) { + if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU3) == -1) { + ALOGE("Can't obtain scaling governor."); + return HINT_HANDLED; + } + } + } + } + + if (!on) { + /* Display off. */ + if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) && + (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { + /* + 1. CPUfreq params + - hispeed freq for big - 1113Mhz + - go hispeed load for big - 95 + - above_hispeed_delay for big - 40ms + 2. BusDCVS V2 params + - Sample_ms of 10ms + */ + if(is_target_SDM630()){ + int res[] = { 0x41414000, 0x459, + 0x41410000, 0x5F, + 0x41400000, 0x4, + 0x41820000, 0xA }; + memcpy(resource_values, res, sizeof(resource_values)); + num_resources = sizeof(res)/sizeof(res[0]); + } + /* + 1. CPUfreq params + - hispeed freq for little - 902Mhz + - go hispeed load for little - 95 + - above_hispeed_delay for little - 40ms + 2. BusDCVS V2 params + - Sample_ms of 10ms + 3. Sched group upmigrate - 500 + */ + else{ + int res[] = { 0x41414100, 0x386, + 0x41410100, 0x5F, + 0x41400100, 0x4, + 0x41820000, 0xA, + 0x40C54000, 0x1F4}; + memcpy(resource_values, res, sizeof(resource_values)); + num_resources = sizeof(res)/sizeof(res[0]); + + } + if (!display_hint_sent) { + perform_hint_action(DISPLAY_STATE_HINT_ID, + resource_values, num_resources); + display_hint_sent = 1; + } + } + + } else { + /* Display on. */ + if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) && + (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { + + undo_hint_action(DISPLAY_STATE_HINT_ID); + display_hint_sent = 0; + } + } + saved_interactive_mode = !!on; + return HINT_HANDLED; +} + + +/* Video Encode Hint */ +static void process_video_encode_hint(void *metadata) +{ + char governor[80]; + int resource_values[20]; + int num_resources; + struct video_encode_metadata_t video_encode_metadata; + + ALOGI("Got process_video_encode_hint"); + + if (get_scaling_governor_check_cores(governor, + sizeof(governor),CPU0) == -1) { + if (get_scaling_governor_check_cores(governor, + sizeof(governor),CPU1) == -1) { + if (get_scaling_governor_check_cores(governor, + sizeof(governor),CPU2) == -1) { + if (get_scaling_governor_check_cores(governor, + sizeof(governor),CPU3) == -1) { + ALOGE("Can't obtain scaling governor."); + // return HINT_HANDLED; + } + } + } + } + + /* Initialize encode metadata struct fields. */ + memset(&video_encode_metadata, 0, sizeof(struct video_encode_metadata_t)); + video_encode_metadata.state = -1; + video_encode_metadata.hint_id = DEFAULT_VIDEO_ENCODE_HINT_ID; + + if (metadata) { + if (parse_video_encode_metadata((char *)metadata, + &video_encode_metadata) == -1) { + ALOGE("Error occurred while parsing metadata."); + return; + } + } else { + return; + } + + if (video_encode_metadata.state == 1) { + if ((strncmp(governor, INTERACTIVE_GOVERNOR, + strlen(INTERACTIVE_GOVERNOR)) == 0) && + (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { + /* + 1. CPUfreq params + - hispeed freq for big - 1113Mhz + - go hispeed load for big - 95 + - above_hispeed_delay for big - 40ms + - target loads - 90 + 2. BusDCVS V2 params + - Sample_ms of 10ms + */ + if(is_target_SDM630()){ + int res[] = { 0x41414000, 0x459, + 0x41410000, 0x5F, + 0x41400000, 0x4, + 0x41420000, 0x5A, + 0x41820000, 0xA};; + memcpy(resource_values, res, sizeof(resource_values)); + num_resources = sizeof(res)/sizeof(res[0]); + + } + /* + 1. CPUfreq params + - hispeed freq for little - 902Mhz + - go hispeed load for little - 95 + - above_hispeed_delay for little - 40ms + 2. BusDCVS V2 params + - Sample_ms of 10ms + */ + else{ + int res[] = { 0x41414100, 0x386, + 0x41410100, 0x5F, + 0x41400100, 0x4, + 0x41820000, 0xA}; + memcpy(resource_values, res, sizeof(resource_values)); + num_resources = sizeof(res)/sizeof(res[0]); + } + pthread_mutex_lock(&camera_hint_mutex); + camera_hint_ref_count++; + if (camera_hint_ref_count == 1) { + if (!video_encode_hint_sent) { + perform_hint_action(video_encode_metadata.hint_id, + resource_values, num_resources); + video_encode_hint_sent = 1; + } + } + pthread_mutex_unlock(&camera_hint_mutex); + } + } else if (video_encode_metadata.state == 0) { + if ((strncmp(governor, INTERACTIVE_GOVERNOR, + strlen(INTERACTIVE_GOVERNOR)) == 0) && + (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { + pthread_mutex_lock(&camera_hint_mutex); + camera_hint_ref_count--; + if (!camera_hint_ref_count) { + undo_hint_action(video_encode_metadata.hint_id); + video_encode_hint_sent = 0; + } + pthread_mutex_unlock(&camera_hint_mutex); + return ; + } + } + return; +} + + diff --git a/rootdir/etc/init.class_main.sh b/rootdir/etc/init.class_main.sh index 1fdb9dcb..0469f982 100644 --- a/rootdir/etc/init.class_main.sh +++ b/rootdir/etc/init.class_main.sh @@ -34,13 +34,13 @@ sgltecsfb=`getprop persist.radio.sglte_csfb` datamode=`getprop persist.data.mode` case "$baseband" in - "apq") + "apq" | "sda" ) setprop ro.radio.noril yes stop ril-daemon esac case "$baseband" in - "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3") + "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx") start qmuxd start ipacm-diag start ipacm diff --git a/rootdir/etc/init.qcom.bt.sh b/rootdir/etc/init.qcom.bt.sh index ba30cb85..6ccb7978 100644 --- a/rootdir/etc/init.qcom.bt.sh +++ b/rootdir/etc/init.qcom.bt.sh @@ -72,7 +72,7 @@ config_bt () btsoc=`getprop qcom.bluetooth.soc` case $baseband in - "apq") + "apq" | "sdc") setprop ro.qualcomm.bluetooth.opp true setprop ro.qualcomm.bluetooth.ftp true setprop ro.qualcomm.bluetooth.nap false @@ -113,7 +113,7 @@ config_bt () ;; esac ;; - "msm") + "msm" | "sdm") setprop ro.qualcomm.bluetooth.opp true setprop ro.qualcomm.bluetooth.hfp true setprop ro.qualcomm.bluetooth.hsp true diff --git a/rootdir/etc/init.qcom.post_boot.sh b/rootdir/etc/init.qcom.post_boot.sh index f7b73f19..e559a406 100644 --- a/rootdir/etc/init.qcom.post_boot.sh +++ b/rootdir/etc/init.qcom.post_boot.sh @@ -1602,6 +1602,329 @@ case "$target" in ;; esac +case "$target" in + "sdm660") + + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + panel=`cat /sys/class/graphics/fb0/modes` + if [ "${panel:5:1}" == "x" ]; then + panel=${panel:2:3} + else + panel=${panel:2:4} + fi + + if [ $panel -gt 1080 ]; then + echo 2 > /proc/sys/kernel/sched_window_stats_policy + echo 5 > /proc/sys/kernel/sched_ravg_hist_size + else + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + fi + #Apply settings for sdm660 + case "$soc_id" in + "317" | "324" | "325" | "326" ) + + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 96 > /proc/sys/kernel/sched_upmigrate + echo 90 > /proc/sys/kernel/sched_downmigrate + echo 200 > /proc/sys/kernel/sched_group_upmigrate + echo 180 > /proc/sys/kernel/sched_group_downmigrate + echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + echo 5 > /proc/sys/kernel/sched_spill_nr_run + echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill + echo 100000 > /proc/sys/kernel/sched_short_burst_ns + + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + + # online CPU0 + echo 1 > /sys/devices/system/cpu/cpu0/online + # configure governor settings for little cluster + echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo "19000 1401600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay + echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate + echo 1401600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo "85 1747200:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 633600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # configure governor settings for big cluster + echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif + echo "19000 1401600:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay + echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate + echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "85 1401600:90 2150400:95" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 59000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 1113600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/fast_ramp_down + + # bring all cores online + echo 1 > /sys/devices/system/cpu/cpu0/online + echo 1 > /sys/devices/system/cpu/cpu1/online + echo 1 > /sys/devices/system/cpu/cpu2/online + echo 1 > /sys/devices/system/cpu/cpu3/online + echo 1 > /sys/devices/system/cpu/cpu4/online + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # configure LPM + echo N > /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled + # enable LPM + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 762 > $cpubw/min_freq + echo "1525 3143 5859 7759 9887 10327 11863 13763" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 85 > $cpubw/bw_hwmon/io_percent + echo 100 > $cpubw/bw_hwmon/decay_rate + echo 50 > $cpubw/bw_hwmon/bw_step + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 34 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start hbtp + ;; + esac + ;; + esac + #Apply settings for sdm630 + case "$soc_id" in + "318" | "327" ) + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start hbtp + ;; + esac + + # Setting b.L scheduler parameters + echo 85 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_downmigrate + echo 900 > /proc/sys/kernel/sched_group_upmigrate + echo 900 > /proc/sys/kernel/sched_group_downmigrate + echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + echo 3 > /proc/sys/kernel/sched_spill_nr_run + + #init task load, restrict wakeups to preferred cluster + echo 15 > /proc/sys/kernel/sched_init_task_load + echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill + echo 50000 > /proc/sys/kernel/sched_short_burst_ns + + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # online CPU0 + echo 1 > /sys/devices/system/cpu/cpu0/online + # configure governor settings for Big cluster(CPU0 to CPU3) + echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo "19000 1344000:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay + echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate + echo 1344000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo "85 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 787200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif + + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # configure governor settings for Little cluster(CPU4 to CPU7) + echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif + echo "19000 1094400:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate + echo 1094400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "85 1094400:80" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 614400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif + + # bring all cores online + echo 1 > /sys/devices/system/cpu/cpu0/online + echo 1 > /sys/devices/system/cpu/cpu1/online + echo 1 > /sys/devices/system/cpu/cpu2/online + echo 1 > /sys/devices/system/cpu/cpu3/online + echo 1 > /sys/devices/system/cpu/cpu4/online + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # configure LPM + echo N > /sys/module/lpm_levels/system/perf/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu7/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled + # enable LPM + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 762 > $cpubw/min_freq + echo "1525 3143 4173 5195 5859 7759 9887 10327" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 85 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 100 > $cpubw/bw_hwmon/decay_rate + echo 50 > $cpubw/bw_hwmon/bw_step + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 50 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + ;; + esac + ;; +esac + case "$target" in "apq8084") echo 4 > /sys/module/lpm_levels/enable_low_power/l2 @@ -2316,7 +2639,7 @@ case "$target" in start mpdecision echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb ;; - "msm8994" | "msm8992" | "msm8996" | "msm8998") + "msm8994" | "msm8992" | "msm8996" | "msm8998" | "sdm660") setprop sys.post_boot.parsed 1 ;; "apq8084") diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh index c0409109..b22e3473 100644 --- a/rootdir/etc/init.qcom.sh +++ b/rootdir/etc/init.qcom.sh @@ -168,6 +168,39 @@ case "$target" in esac start_charger_monitor ;; + "sdm660") + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + case "$soc_id" in + "317" | "324" | "325" | "326" | "318" | "327" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + start_msm_irqbalance + ;; "apq8084") platformvalue=`cat /sys/devices/soc0/hw_platform` case "$platformvalue" in diff --git a/rootdir/etc/init.qcom.usb.sh b/rootdir/etc/init.qcom.usb.sh index 8250e7df..9708267f 100644 --- a/rootdir/etc/init.qcom.usb.sh +++ b/rootdir/etc/init.qcom.usb.sh @@ -162,7 +162,7 @@ case "$usb_config" in "msm8952" | "msm8953") setprop persist.sys.usb.config diag,serial_smd,rmnet_ipa,adb ;; - "msm8998" | "msmfalcon") + "msm8998" | "sdm660") setprop persist.sys.usb.config diag,serial_cdev,rmnet,adb ;; *) @@ -193,10 +193,10 @@ case "$target" in setprop sys.usb.rndis.func.name "gsi" setprop sys.usb.rmnet.func.name "gsi" ;; - "msmfalcon") - setprop sys.usb.controller "a800000.dwc3" - setprop sys.usb.rmnet.func.name "rmnet_bam" + "sdm660") + setprop sys.usb.controller "a800000.dwc3" setprop sys.usb.rndis.func.name "rndis_bam" + setprop sys.usb.rmnet.func.name "rmnet_bam" ;; "sdm845") setprop sys.usb.controller "a600000.dwc3"