raspberrypi: added a cpu frequency startup script

This commit is contained in:
Calin Crisan 2016-06-05 12:46:08 +03:00
parent 6b69e1b0b0
commit e26a3717f9
5 changed files with 116 additions and 18 deletions

View File

@ -0,0 +1,36 @@
#!/bin/bash
test -n "$os_version" || source /etc/init.d/base
gov="ondemand"
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
govdir="/sys/devices/system/cpu/cpufreq/$gov"
configure() {
echo $gov > $cpufreqdir/scaling_governor
if [ $gov == "ondemand" ]; then
echo 50 > $govdir/up_threshold
echo 100000 > $govdir/sampling_rate
echo 50 > $govdir/sampling_down_factor
echo 1 > $govdir/io_is_busy
fi
}
case "$1" in
start)
msg_begin "Configuring CPU Frequency"
configure
test $? == 0 && msg_done || msg_fail
;;
stop)
true
;;
*)
echo $"Usage: $0 {start}"
exit 1
esac
exit $?

View File

@ -0,0 +1,36 @@
#!/bin/bash
test -n "$os_version" || source /etc/init.d/base
gov="ondemand"
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
govdir="/sys/devices/system/cpu/cpufreq/$gov"
configure() {
echo $gov > $cpufreqdir/scaling_governor
if [ $gov == "ondemand" ]; then
echo 50 > $govdir/up_threshold
echo 100000 > $govdir/sampling_rate
echo 50 > $govdir/sampling_down_factor
echo 1 > $govdir/io_is_busy
fi
}
case "$1" in
start)
msg_begin "Configuring CPU Frequency"
configure
test $? == 0 && msg_done || msg_fail
;;
stop)
true
;;
*)
echo $"Usage: $0 {start}"
exit 1
esac
exit $?

View File

@ -1,16 +1,12 @@
#!/bin/bash
gpio=35
check_interval=30
export=/sys/class/gpio/export
readv=/sys/class/gpio/gpio$gpio/value
readv=/sys/class/leds/led1/brightness
test -e "$readv" || exit 0
test -n "$os_version" || source /etc/init.d/base
configure() {
echo $gpio > $export
}
watch() {
while true; do
if [ "$(cat $readv)" == "0" ]; then
@ -23,9 +19,8 @@ watch() {
case "$1" in
start)
msg_begin "Starting brownout detector"
configure
test $? == 0 && msg_done || msg_fail
watch &
test $? == 0 && msg_done || msg_fail
;;
stop)

View File

@ -0,0 +1,36 @@
#!/bin/bash
test -n "$os_version" || source /etc/init.d/base
gov="ondemand"
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
govdir="/sys/devices/system/cpu/cpufreq/$gov"
configure() {
echo $gov > $cpufreqdir/scaling_governor
if [ $gov == "ondemand" ]; then
echo 50 > $govdir/up_threshold
echo 100000 > $govdir/sampling_rate
echo 50 > $govdir/sampling_down_factor
echo 1 > $govdir/io_is_busy
fi
}
case "$1" in
start)
msg_begin "Configuring CPU Frequency"
configure
test $? == 0 && msg_done || msg_fail
;;
stop)
true
;;
*)
echo $"Usage: $0 {start}"
exit 1
esac
exit $?

View File

@ -1,16 +1,12 @@
#!/bin/bash
gpio=35
check_interval=30
export=/sys/class/gpio/export
readv=/sys/class/gpio/gpio$gpio/value
readv=/sys/class/leds/led1/brightness
test -e "$readv" || exit 0
test -n "$os_version" || source /etc/init.d/base
configure() {
echo $gpio > $export
}
watch() {
while true; do
if [ "$(cat $readv)" == "0" ]; then
@ -23,9 +19,8 @@ watch() {
case "$1" in
start)
msg_begin "Starting brownout detector"
configure
test $? == 0 && msg_done || msg_fail
watch &
test $? == 0 && msg_done || msg_fail
;;
stop)