Tegra-xudc gadget wakeup is unstable

I am using the Linux HID Gadget Driver to emulate a USB keyboard and mouse. I want enable remote wakeup functionality to wake up the connected host. The kernel provides the usb_gadget_wakeup() function to send this wakeup signal. That function, in turn, calls the controller-specific wakeup function. The tegra_xudc_gadget_wakeup() command successfully wakes up the host in my testing. But the behavior is unstable. Sometimes the host wakes up and the USB devices work fine. Sometimes one or more of the USB devices stop working, even requiring a restart of the host to fix. Sometimes the following error messages are output in the kernel logs:

tegra-xudc-new 700d0000.xudc: setup request failed: -22
tegra-xudc-new 700d0000.xudc: sequence number error

From testing and comparing the gadget driver in other kernels, it seems to me that this behavior is specific to the tegra-xudc implementation.

Has anyone attempted USB remote wakeup on the Jetson? Has anyone encountered these issue before and found a way to improve the unstable behavior?

We don’t have much experience in the use-case. It would need other users to share suggestion. And the latest release for Jetson Nano is 4.6.3. If you use previous release, may upgrade to the latest one and give it a try.