omap3-pandora-kernel2: update
[openpandora.oe.git] / recipes / pandora-system / pandora-state / rc.pandora-state
index a7e9ee1..1995031 100644 (file)
@@ -11,7 +11,7 @@
 DESC="OpenPandora Save and Restore various settings"
 NAME="pandora-state"
 
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
 
 d_stop() {
        echo "Saving Pandora specific settings"
@@ -21,6 +21,8 @@ d_stop() {
        fi
        touch /etc/pandora/shutdown
        cat $SYSFS_GAMMA > /etc/pandora/conf/gamma.state
+
+       # pnd_run.sh and nub configurator depend on nubs.state format
         cat -v /proc/pandora/nub0/mode | sed -n '1p' > /etc/pandora/conf/nubs.state
        cat -v /proc/pandora/nub0/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
        cat -v /proc/pandora/nub0/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
@@ -35,6 +37,9 @@ d_stop() {
        cat -v /proc/pandora/nub1/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
        cat -v /proc/pandora/nub0/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
        cat -v /proc/pandora/nub1/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
+
+       # nub tools want to update this file
+       chmod a+w /etc/pandora/conf/nubs.state
 }
 
 d_start() {
@@ -91,6 +96,15 @@ d_start() {
        fi
        /usr/pandora/scripts/op_cpuspeed.sh -n $cpuspeed
        
+       # Set DSP Speed
+       
+       if [ "$pnd_version" == "OMAP3630" ]; then
+                 dspspeed="800"
+               else
+                 dspspeed="430"
+       fi
+       /usr/pandora/scripts/op_dspspeed.sh -n $dspspeed
+       
        # Set nubs
        sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mode
        sed -n '2p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mouse_sensitivity
@@ -107,15 +121,24 @@ d_start() {
        sed -n '13p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mbutton_delay
        sed -n '14p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mbutton_delay
        
-       # Enable ZRAM Swap
-       echo "Enabling ZRAM Swap"
-       mkswap /dev/zram0
-       swapon -p 5 /dev/zram0
+       # Enable ZRAM Swap if user has enabled the module in /etc/modules
+       if [ -e /dev/zram0 ]; then
+               echo "Enabling ZRAM Swap"
+               mkswap /dev/zram0
+               swapon -p 5 /dev/zram0
+       fi
 
        # set audio powerdown delay (ms)
        if [ -e /sys/devices/platform/soc-audio/PCM1773/pmdown_time ]; then
                echo 60000 > /sys/devices/platform/soc-audio/PCM1773/pmdown_time
        fi
+
+       # remove the mmap limit, useful for emulators
+       echo 0 > /proc/sys/vm/mmap_min_addr
+
+       # reduce watchdog threshold to reduce CPU wakeups - it's a debugging feature
+       # interval = watchdog_thresh * 2 / 5
+       echo 60 > /proc/sys/kernel/watchdog_thresh
 }
 
 case "$1" in