All Forums
 Embedded Linux
 Linux FAQ
 Putting a board to sleep using RQONOFF
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

jlackey

213 Posts

Posted - 07 Jul 2003 :  15:23:11  Show Profile  Email Poster
Put a board to sleep using RQONOFF

Beginning with linux versions 2.4.19-rmk7-ads5 and 2.4.19-rmk7-pxa2-adsx3, a system can be put to sleep by grounding the the RQONOFF pin. A script file can wait for this event by writing to the file /proc/sys/pm/suspend_catch. This write will not complete until the RQONOFF pin is grounded. After the write completes, the script can put the board to sleep.

If the RQONOFF pin is grounded momentarily, then the system will wake up when the pin is grounded a second time. If the pin is held low until the system has gone to sleep then the system will wake when the pin is released from ground.

A noisy RQONOFF signal may cause the system to wake up and then go back to sleep immediately. Please make sure that the RQONOFF signal is clean.

In most cases applications will need to perform some operations before the system goes to sleep and after it wakes up. These actions can be accomplished by adding them to the script to execute the necessary operations before initiating sleep and/or waking up.

Here is sample catch_sleep.sh script:


#! /bin/bash

if [ -e /proc/sys/pm/suspend_catch ]
then
    while true
    do

      # note that the argument "Catch Sleep IRQ" is only present to help
      # identify this process from the output of 'ps'.

      if echo "Catch Sleep IRQ" > /proc/sys/pm/suspend_catch

      # wait for the process to finish, successful status indicates
      # that the process was not killed, instead it detected the sleep irq

      then

        # any clean-up required before sleeping goes here IE:
        # killall -STOP my_program
        # sync

        echo > /proc/sys/pm/suspend

        # any clean-up required after sleeping goes here IE:
        # killall -CONT my_program

      fi

    done
fi


If you are using one of our ramdisk root file systems, you'll find this file in the /root directory. Start with the example above and create your own if your root file system does not have this file.

31-Dec-2003: jlackey - clarify where script may be found
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000