From dd80e3611194ae5ef7a3fbc07c486864691150a0 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sat, 2 Nov 2013 19:01:22 +0200 Subject: [PATCH] pandora-scripts: preliminary DSP overclocking script --- recipes/pandora-system/pandora-scripts.bb | 7 ++- .../pandora-system/pandora-scripts/dsp.conf | 2 + .../pandora-scripts/op_cpuspeed.sh | 11 ++-- .../pandora-scripts/op_dspspeed.sh | 52 +++++++++++++++++++ 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 recipes/pandora-system/pandora-scripts/dsp.conf create mode 100755 recipes/pandora-system/pandora-scripts/op_dspspeed.sh diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index f2dd874..05967e8 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -5,13 +5,14 @@ COMPATIBLE_MACHINE = "omap3-pandora" RDEPENDS = "bash sed gawk grep zenity" -PR = "r150" +PR = "r151" SRC_URI = " \ file://op_paths.sh \ file://op_bright.sh \ file://op_cpuspeed.sh \ file://op_cpuspeed.pnd \ + file://op_dspspeed.sh \ file://op_usbhost.sh \ file://op_usbhost.pnd \ file://op_osupgrade.sh \ @@ -56,6 +57,7 @@ SRC_URI = " \ file://op_inputtest.pnd \ file://gui.conf \ file://cpu.conf \ + file://dsp.conf \ file://led.conf \ file://gamma.conf \ file://service.conf \ @@ -95,6 +97,7 @@ do_install() { install -m 0755 ${WORKDIR}/op_osupgrade.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_bright.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_cpuspeed.sh ${D}${prefix}/pandora/scripts/ + install -m 0755 ${WORKDIR}/op_dspspeed.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_createsd.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_sysspeed.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_cpusettings.sh ${D}${prefix}/pandora/scripts/ @@ -168,6 +171,7 @@ do_install() { install -m 0644 ${WORKDIR}/gui.conf ${D}${sysconfdir}/pandora/conf/gui.conf install -m 0644 ${WORKDIR}/led.conf ${D}${sysconfdir}/pandora/conf/led.conf install -m 0644 ${WORKDIR}/cpu.conf ${D}${sysconfdir}/pandora/conf/cpu.conf + install -m 0644 ${WORKDIR}/dsp.conf ${D}${sysconfdir}/pandora/conf/dsp.conf install -m 0644 ${WORKDIR}/gamma.conf ${D}${sysconfdir}/pandora/conf/gamma.conf install -m 0644 ${WORKDIR}/service.conf ${D}${sysconfdir}/pandora/conf/service.conf install -m 0666 ${WORKDIR}/nub_profiles.conf ${D}${sysconfdir}/pandora/conf/nub_profiles.conf @@ -191,6 +195,7 @@ FILES_${PN} += "${prefix} ${datadir}" CONFFILES_${PN} += ${sysconfdir}/pandora/conf/gui.conf CONFFILES_${PN} += ${sysconfdir}/pandora/conf/cpu.conf +CONFFILES_${PN} += ${sysconfdir}/pandora/conf/dsp.conf CONFFILES_${PN} += ${sysconfdir}/pandora/conf/led.conf CONFFILES_${PN} += ${sysconfdir}/pandora/conf/gamma.conf CONFFILES_${PN} += ${sysconfdir}/pandora/conf/service.conf diff --git a/recipes/pandora-system/pandora-scripts/dsp.conf b/recipes/pandora-system/pandora-scripts/dsp.conf new file mode 100644 index 0000000..410b833 --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/dsp.conf @@ -0,0 +1,2 @@ +max:1000 +min:90 diff --git a/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh b/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh index 16a9a2e..3c2b84e 100755 --- a/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh +++ b/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh @@ -1,9 +1,10 @@ #!/bin/bash #get value range -minmhz="$(cat /etc/pandora/conf/cpu.conf | grep 'min:' | awk -F\: '{print $2}')" -safemhz="$(cat /etc/pandora/conf/cpu.conf | grep 'safe:' | awk -F\: '{print $2}')" -maxmhz="$(cat /etc/pandora/conf/cpu.conf | grep 'max:' | awk -F\: '{print $2}')" -warn="$(cat /etc/pandora/conf/cpu.conf | grep 'warn:' | awk -F\: '{print $2}')" +cpu_conf=/etc/pandora/conf/cpu.conf +minmhz="$(grep '^min:' $cpu_conf | awk -F\: '{print $2}')" +safemhz="$(grep '^safe:' $cpu_conf | awk -F\: '{print $2}')" +maxmhz="$(grep '^max:' $cpu_conf | awk -F\: '{print $2}')" +warn="$(grep '^warn:' $cpu_conf | awk -F\: '{print $2}')" device=/proc/pandora/cpu_mhz_max curmhz="$(cat $device)" newmhz="$(cat $device)" @@ -27,7 +28,7 @@ fi if [ ! $1 ]; then if [ $DISPLAY ]; then - newmhz=$(zenity --scale --text "Set CPU clockspeed" --min-value=$minmhz --max-value=$maxmhz --value=$curmhz --step 1) + newmhz=$(zenity --scale --title "CPU clockspeed" --text "Set CPU clockspeed" --min-value=$minmhz --max-value=$maxmhz --value=$curmhz --step 1) else read -p "Please enter the desired clockspeed: " newmhz fi diff --git a/recipes/pandora-system/pandora-scripts/op_dspspeed.sh b/recipes/pandora-system/pandora-scripts/op_dspspeed.sh new file mode 100755 index 0000000..2c7399b --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_dspspeed.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +cpu_conf=/etc/pandora/conf/dsp.conf +minmhz="$(grep '^min:' $cpu_conf | awk -F\: '{print $2}')" +maxmhz="$(grep '^max:' $cpu_conf | awk -F\: '{print $2}')" +test -z "$minmhz" && minmhz=90 +test -z "$maxmhz" && maxmhz=1000 + +device=/proc/pandora/dsp_mhz_max +curmhz="$(cat $device)" +newmhz="$(cat $device)" + +if [ "$1" = "-n" ]; then + shift + warn=no +fi + +if [ ! -e $device ]; then + if [ -z "$1" -a -n "$DISPLAY" ]; then + zenity --info --title="DSP overclocking not supported" --text \ + "Sorry, your kernel does not support DSP overclocking." + fi + exit 1 +fi + +if [ -z "$1" ]; then + if [ -n "$DISPLAY" ]; then + newmhz=$(zenity --scale --title "DSP clockspeed" --text "Set DSP clockspeed" --min-value=$minmhz --max-value=$maxmhz --value=$curmhz --step 1) + else + echo "Clock speed not specified" + exit 1 + fi +else + newmhz=$1 +fi + +if ! [ 0 -lt "$newmhz" -a "$newmhz" -lt 10000 ]; then + echo "invalid argument: $newmhz" + exit 1 +fi + +if [ "$newmhz" -lt "$minmhz" ]; then + echo "limiting clock to configured minimum of $minmhz" + newmhz=$minmhz +fi +if [ "$newmhz" -gt "$maxmhz" ]; then + echo "limiting clock to configured maximum of $maxmhz" + newmhz=$maxmhz +fi + +# not much else to do here.. +echo "$newmhz" > $device -- 2.39.5