#!/bin/sh /etc/rc.common START=99 # ipq806x_power_auto() # Changes the governor to ondemand and sets the default parameters for cpu ondemand governor. # The parameters are tuned for best performance than for power. # Also, the up_thresholds have been set to low value, to workaround the cpu # utilization anamolies we are seeing with kcpustat with tickless kernel. ipq806x_power_auto() { echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor # Change the minimum operating frequency for CPU0. # This is required for cases where large amount of network traffic is sent # instantaneously without any ramp-up time , when CPU is at minimum perf level. # At 384 MHz, CPU0 stays fully busy in softirq context and doesn't move to ksoftirqd, and # doesn't give any other thread including cpufreq thread a chance to run. # Hence, the CPU frequency is locked up at 384MHz till the traffic is stopped. # Increasing the min frequency for CPU0 to 800 MHz (L2=1GHz), allows 4 Gbps instantaneous # traffic without any hangs/lockups. # # CPU1 min frequency also has to be increased because there is a hardware constraint # kraits cannot operate at 384MHz when L2 is at 1GHz. # # The impact on idle-state power with this change is about ~40-45mW. echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo "800000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq # Change sampling rate for frequency scaling decisions to 1s, from 10 ms echo "1000000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate # Change sampling rate for frequency down scaling decision to 10s echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor # Change the CPU load threshold above which frequency is up-scaled to # turbo frequency,to 50% echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core # Change the CPU load threshold below which frequency is down-scaled to # 10% (down_threshold = up_threshold - down_differential) echo 40 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential # Set sync_freq and optimal_freq used for multicore scenarios to max # freq echo "1000000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq echo "1000000" > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq } # ipq806x_power_turbo() # Sets the Krait CPU/L2 and NSS NetAP core clock frequencies to fixed Turbo frequencies # No frequency scaling is done in this profile ipq806x_power_turbo() { echo "userspace" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo "userspace" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor echo "1400000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed echo "1400000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed echo 733000000 > /proc/sys/dev/nss/clock/current_freq } start() { config_load system config_get mode powerctl mode "auto" if eval "type ipq806x_power_${mode}" 2>/dev/null >/dev/null; then eval ipq806x_power_${mode} else echo "\"${mode}\" power mode not supported" fi }