I am currently testing suspend mode in i.MX8 with Android 11.
I am suspending system via "echo mem > /sys/power/state" command and wakeup via ttymxc0 debug console.
Each time suspend is ok but during wakeup, it seems that all UART and USB ports are being reset.
Below is a log of the problem:
[ 2553.630352] PM: suspend entry (deep)
[ 2553.638561] Filesystems sync: 0.004 seconds
[ 2553.644527] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 2553.654510] OOM killer disabled.
[ 2553.657741] Freezing remaining freezable tasks ... (elapsed 0.096 seconds) done.
[ 2553.876136] android_work: sent uevent USB_STATE=DISCONNECTED
[ 2553.884352] fec 30be0000.ethernet eth0: Link is Down
[ 2553.928591] PM: suspend devices took 0.164 seconds
[ 2553.939156] Disabling non-boot CPUs ...
[ 2553.943605] CPU1: shutdown
[ 2553.956365] IRQ 6: no longer affine to CPU2
[ 2553.956462] CPU2: shutdown
[ 2553.973386] CPU3: shutdown
[ 2553.981238] PM: pm_system_irq_wakeup: 34 triggered 30860000.serial
[ 2553.987659] Enabling non-boot CPUs ...
[ 2553.992216] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[ 2553.992752] CPU1 is up
[ 2554.017619] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[ 2554.017958] CPU2 is up
[ 2554.042776] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[ 2554.042794] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[ 2554.043160] CPU3 is up
[ 2554.347423] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[ 2554.367700] android_work: sent uevent USB_STATE=CONNECTED
[ 2554.401449] configfs-gadget gadget: high-speed config #1: b
[ 2554.407099] android_work: sent uevent USB_STATE=CONFIGURED
[ 2554.521772] usb 1-1: reset high-speed USB device number 2 using xhci-hcd
[ 2555.098240] usb 1-1.1: reset full-speed USB device number 3 using xhci-hcd
[ 2555.287332] usb 1-1.4: reset full-speed USB device number 5 using xhci-hcd
[ 2555.408076] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 2555.416573] ftdi_sio 1-1.4:1.0: device disconnected
[ 2555.421634] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
[ 2555.430124] ftdi_sio 1-1.4:1.1: device disconnected
[ 2555.513812] usb 1-1.2: reset high-speed USB device number 4 using xhci-hcd
[ 2555.647049] PM: resume devices took 1.576 seconds
[ 2555.651908] ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
[ 2555.658855] usb 1-1.4: Detected FT2232C
[ 2555.662717] OOM killer enabled.
[ 2555.665874] Restarting tasks ...
[ 2555.671787] done.
[ 2555.682499] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
[ 2555.684713] hantro receive hot notification event: 0
[ 2555.694282] ftdi_sio 1-1.4:1.1: FTDI USB Serial Device converter detected
[ 2555.696791] Hot alarm is canceled. GPU3D clock will return to 64/64
[ 2555.704341] usb 1-1.4: Detected FT2232C
[ 2555.718055] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB1
[ 2555.721143] hantro receive hot notification event: 0
[ 2555.730443] Resume caused by IRQ 34, 30860000.serial
[ 2555.735758] PM: suspend exit
Kernel is resetting USB ports on wakeup and this is causing USB disconnections in user space applications. This seems to be not a correct way to reset USB on each wakeup.
Is this flow intentional or some kernel issue? And Is there any way to disable or patch this USB reset issue at kernel side for suspend mode?
Any workaround or suggestions are welcome.