Facing an issue with Selective Suspend after removing the USB OTG Cable of the device expected the device to go into Sleep mode but it is seen that the device is not entering the selective suspend mode.
Attached are the logs, from the logs it is seen that the Active wakeup source is timerfd, eventfd and signal fd. Would like to understand is there a way to identify the wakeup source from the system?
Currently there is no timer used in the application. attached is the sample app which is used for testing the scenario. logs wakeup source.txt (655.8 KB)
my test here with mangoh green board:
if USB OTG cable is connected to the mangoh board, it won’t go to sleep mode.
if USB OTG cable is disconnected, it will immediately go to sleep mode.
Selective suspend mode should be for USB client.
So if problem happens after USB OTG disconnect, can you try if you still see this issue after connecting to host PC?
I am finding a similar problem with WP7702. I found this in Legato Documentation that points to the possible problem. But it doesn’t explain how to remove this system wake lock:
A wakeup source is being held
Test
Dump contents of /sys/kernel/debug/wakeup_sources to find the fields that have a non-zero active_since field. Also dump contents of /sys/power/wake_lock to find active user-space wakeup sources.
Command
cat /sys/kernel/debug/wakeup_sources |sed -e s/"^ "/“unnamed”/ | awk ‘{print $6 “\t” $1}’ | grep -v “^0” |sort -n
cat /sys/power/wake_lock
Since I do see a wakeup source that matches the description: msm_otg, with a non-zero active since, I would like to try getting rid of it. Sadly the Legato doc does not describe how to delete the system wakeup_sources. Probably very simple. Any suggestions?
Thank you jyijyi for responding. By using le_pm_Relax() I am now confident that there are no wakeup sources in the user space. That leaves system wakeup sources, and I think I have found one, but do not know how to relax it, as the le_pm_Relax command does nothing to it.
Another similar possibility that the Legato document provides a way to diagnose, but not to clear it when found. Any suggestion for that? Here is the entry in the Power Manager doc that seems to apply to my case:
Under the same Troubleshooting section, it says:
"System perpetually suspends and resumes.
Probable cause
Interrupt is constantly triggered.
Test
Dump contents of /proc/interrupts to find the IRQ that’s constantly incrementing.
Command
cat /proc/interrupts
— end of documentation —
On repeating the “cat /proc/interrupts” command, saving the output to successive files, I do see some interrupts that are constantly incrementing. They are not ones that I believe to be related to our hardware, so I assume they are system-related interrupts.
That is the end of the documentation. I wish it added a sentence to explain how to remove or turn off an interrupt found by the “cat /proc/interrupts” command.
Ok no worries. Also BTW in researching this, I did find a way to cancel the wakeup source(s) from /sys/power/wake_lock. It doesn’t work to simply echo nil into that file. Instead, one must
cat /sys/power/wake_lock to see what is in there, multiple items separated by space might be there.
write the same string into /sys/power/wake_unlock
For example, if “cat /sys/power/wake_lock” shows NO_SLEEP then
echo “NO_SLEEP” > /sys/power/wake_unlock
is needed to remove the wake_lock.
I add this so that others might find it by googling Sierra Wireless wake_lock.
I always hope that someone might direct me to a treasure trove of documentation about arcana like this