Skip to content

Commit

Permalink
osprey: Add Custom PowerHAL header
Browse files Browse the repository at this point in the history
With this PowerHAL cpu-boost is not needed, so disable it.

Change-Id: I57b02100c891cb0808ad045bc3b4f8eb33031194
  • Loading branch information
desaishivam26 committed Aug 23, 2016
1 parent a2b6c93 commit 2be88b5
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 20 deletions.
2 changes: 1 addition & 1 deletion BoardConfig.mk
Expand Up @@ -38,7 +38,7 @@ BOARD_PERSISTIMAGE_PARTITION_SIZE := 8388608 # 8192 * 1024 mmcblk0p29
BOARD_USERDATAIMAGE_PARTITION_SIZE := 4865261568 # 4751232 * 1024 mmcblk0p42

# Power
TARGET_POWERHAL_VARIANT := qcom
TARGET_POWERHAL_HEADER_PATH := $(DEVICE_PATH)/power

# Properties
TARGET_SYSTEM_PROP += $(DEVICE_PATH)/system.prop
84 changes: 84 additions & 0 deletions power/power_device.h
@@ -0,0 +1,84 @@
/*
* Copyright (C) 2016 The CyanogenMod Project
*
* 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.
*/

static power_profile profiles[PROFILE_MAX] = {
[PROFILE_POWER_SAVE] = {
.boost = 0,
.boostpulse_duration = 0,
.go_hispeed_load = 90,
.go_hispeed_load_off = 90,
.hispeed_freq = 800000,
.hispeed_freq_off = 800000,
.min_sample_time = 60000,
.timer_rate = 20000,
.above_hispeed_delay = 20000,
.target_loads = 90,
.target_loads_off = 90,
.scaling_max_freq = 998400,
.scaling_min_freq = 400000,
.scaling_min_freq_off = 200000,
},
[PROFILE_BALANCED] = {
.boost = 0,
.boostpulse_duration = 60000,
.go_hispeed_load = 80,
.go_hispeed_load_off = 90,
.hispeed_freq = 998400,
.hispeed_freq_off = 800000,
.min_sample_time = 60000,
.timer_rate = 20000,
.above_hispeed_delay = 20000,
.target_loads = 80,
.target_loads_off = 90,
.scaling_max_freq = 1363200,
.scaling_min_freq = 800000,
.scaling_min_freq_off = 200000,
},
[PROFILE_HIGH_PERFORMANCE] = {
.boost = 1,
/* The CPU is already boosted, set duration to zero
* to avoid unneccessary writes to boostpulse */
.boostpulse_duration = 0,
.go_hispeed_load = 60,
.go_hispeed_load_off = 70,
.hispeed_freq = 998400,
.hispeed_freq_off = 998400,
.min_sample_time = 60000,
.timer_rate = 20000,
.above_hispeed_delay = 20000,
.target_loads = 60,
.target_loads_off = 70,
.scaling_max_freq = 1363200,
.scaling_min_freq = 800000,
.scaling_min_freq_off = 200000,
},
[PROFILE_BIAS_POWER_SAVE] = {
.boost = 0,
.boostpulse_duration = 40000,
.go_hispeed_load = 90,
.go_hispeed_load_off = 90,
.hispeed_freq = 800000,
.hispeed_freq_off = 800000,
.min_sample_time = 60000,
.timer_rate = 20000,
.above_hispeed_delay = 20000,
.target_loads = 90,
.target_loads_off = 90,
.scaling_max_freq = 1363200,
.scaling_min_freq = 400000,
.scaling_min_freq_off = 200000,
},
};
40 changes: 21 additions & 19 deletions rootdir/etc/init.target.rc
@@ -1,5 +1,5 @@
# Copyright (c) 2009-2012, 2014, The Linux Foundation. All rights reserved.
# Copyright (c) 2015 The CyanogenMod Project
# Copyright (c) 2015-2016 The CyanogenMod Project
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -43,6 +43,25 @@ on boot
chown system compass /sys/class/compass/akm09912/enable_mag
chmod 0660 /sys/class/compass/akm09912/enable_mag

# Switch to interactive and let PowerHAL configure it
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/boostpulse
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
chmod 0644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
chmod 0644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/target_loads
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

on post-fs-data
# AK09912 calibration file directory
mkdir /data/misc/akmd 0770 system compass
Expand All @@ -66,26 +85,9 @@ on property:sys.boot_completed=1
# HMP Task packing settings for 8916
write /proc/sys/kernel/sched_small_task 50

# disable thermal core_control to update scaling_min_freq
write /sys/module/msm_thermal/core_control/enabled 0
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 400000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
# enable thermal core_control now
# enable thermal core_control
write /sys/module/msm_thermal/core_control/enabled 1

# Interactive governor setup
write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 60000
write /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq 998400
write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 80
write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay 20000
write /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration 60000
write /sys/devices/system/cpu/cpufreq/interactive/target_loads 80

write /sys/module/cpu_boost/parameters/boost_ms 20
write /sys/module/cpu_boost/parameters/sync_threshold 998400
write /sys/module/cpu_boost/parameters/input_boost_freq 1094400
write /sys/module/cpu_boost/parameters/input_boost_ms 40
start batt_health

write /sys/class/devfreq/1c00000.qcom,kgsl-3d0/governor "msm-adreno-tz"
Expand Down

0 comments on commit 2be88b5

Please sign in to comment.