1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-19 10:21:55 +01:00

cpufreq: switch to usage of shutils functions

This patch convert some functions to the usage of shutils provided calls.
This approach is more portable and allows to use these calls also on
an Android target.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
Patrick Bellasi
2015-11-27 16:38:30 +00:00
parent f2eac51c69
commit cf761317bd
2 changed files with 50 additions and 19 deletions

View File

@@ -7,12 +7,46 @@ BUSYBOX=${BUSYBOX:-__DEVLIB_BUSYBOX__}
GREP=${GREP:-$BUSYBOX grep}
SED=${SED:-$BUSYBOX sed}
################################################################################
# CPUFrequency Utility Functions
################################################################################
cpufreq_set_all_frequencies() {
FREQ=$1
for CPU in /sys/devices/system/cpu/cpu[0-9]*; do
echo $FREQ > $CPU/cpufreq/scaling_cur_freq
done
}
cpufreq_set_all_governors() {
GOV=$1
for CPU in /sys/devices/system/cpu/cpu[0-9]*; do
echo $GOV > $CPU/cpufreq/scaling_governor
done
}
cpufreq_trace_all_frequencies() {
FREQS=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq)
CPU=0; for F in $FREQS; do
echo "cpu_frequency: state=$F cpu_id=$CPU" > /sys/kernel/debug/tracing/trace_marker
CPU=$((CPU + 1))
done
}
################################################################################
# Main Function Dispatcher
################################################################################
case $CMD in
cpufreq_set_all_frequencies)
cpufreq_set_all_frequencies $*
;;
cpufreq_set_all_governors)
cpufreq_set_all_governors $*
;;
cpufreq_trace_all_frequencies)
cpufreq_trace_all_frequencies $*
;;
*)
echo "Command [$CMD] not supported"
exit -1