Selective Suspend mode issue with Timer FD

Hi,

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)

Thanks

Pankaj

app.c (1.6 KB)

you can see the wakeup source here:
cat /sys/power/wake_lock

@jyijyi ,

Connected the USB CF3 to check the wakelock and it is showing empty :

root@swi-mdm9x28-wp:~# cat /sys/kernel/debug/wakeup_sources | awk ‘{print $6 “\t” $1 }’ | grep -v “^0”
active_since name
132491 msm_otg
root@swi-mdm9x28-wp:~# cat /sys/power/wake_lock

root@swi-mdm9x28-wp:~# cat /sys/power/wake_unlock

Any other way to check what else is hoding the wakelock?

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.

@jyijyi,

In case if the issue is faced how do we know what is holding the wakeup source?

Is there a way to investigate the timer FD or event FD which is holding the wakeup source?

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?

@jyijyi ,

After removing the USB expected the device to go into sleep mode, but it did not. When replugged the USB and checked the logs this is what we see.

Would like to know how do we know which services are using the timerfd or evenpollfd? do we need to completely stop legato application?

you can stop the legato by “legato stop”

BTW, do you connect again to host PC to indicate this is USB client?

Yes if the device does not enter selective suspend only then I am connecting the USB to check for why the device did not enter suspend mode.

Also is it necessary to stop legato? In that case how will wake up and do some activity when GPIO is triggered?

Didn’t you say you want to completely stop legato app? In this case, only yocto linux is running

@jyijyi ,

I meant stopping only the application using app stop but I want the legato framework running.

btw how can we know what is that wakeup source which is active? Do we have a chart of what legato services may hold a wakeup source?

Thanks & Regards,

Pankaj Sant

If you stop the legato, issue still happens, that means it is not related to legato

Two things you can do to narrow down the root cause:

  1. see if this issue is only related to USB OTG only. I believe selective suspend should be working fine for USB client mode.

  2. if this is related to USB OTG only, see if this issue is related to legato framework. You can stop the legato framework by “legato stop”.

Here is my testing on mangoh green board with WP76 FW16:

  1. before power on the board, connect the USB OTG cable with USB thumb drive

  2. power on the mangoh green board

  3. after boot up, the USB thumb drive content can be seen

  4. unplug the USB OTG cable together with the USB thumb drive, the board does not sleep as it is still in host mode

  5. plug the USB cable from PC to the board to indicate it is USB client

  6. wait for 10 seconds

  7. disconnect the USB cable, the board goes to sleep mode