[PATCH 0/5] Add function suspend/resume and remote wakeup support

Elson Roy Serrao
2022-08-02T19:19:00Z

An usb device can initate a remote wakeup and bring the link out of
suspend as dictated by the DEVICE_REMOTE_WAKEUP feature selector.
To achieve this an interface can invoke gadget_wakeup op and wait for the
device to come out of LPM. But the current polling based implementation
fails if the host takes a long time to drive the resume signaling specially
in high speed capable devices. Switching to an interrupt based approach is
more robust and efficient. This can be leveraged by enabling link status
change events and triggering a gadget resume when the link comes to active
state.

If the device is super-speed/super-speed-plus capable, individual
interfaces can also be put into suspend state. An interface can be
in function suspend state even when the device is not in suspend state.
Function suspend state is retained throughout the device suspend entry
and exit process. A function can be put to function suspend through
FUNCTION_SUSPEND feature selector sent by the host. This setup packet also
decides whether that function is capable of initiating a function remote
wakeup. When the function sends a wakeup notification to the host the link
must be first brought to a non-U0 state and then this notification
is sent.

This change adds the infrastructure needed to support the above
functionalities.

Elson Roy Serrao (5):
usb: dwc3: Add remote wakeup handling
usb: gadget: Add function wakeup support
usb: dwc3: Add function suspend and function wakeup support
usb: gadget: f_ecm: Add suspend/resume and remote wakeup support
usb: gadget: f_ecm: Add function suspend and wakeup support

drivers/usb/dwc3/core.h | 5 ++
drivers/usb/dwc3/ep0.c | 16 +++---
drivers/usb/dwc3/gadget.c | 99 +++++++++++++++++++++++++++++++++--
drivers/usb/gadget/composite.c | 32 +++++++++++
drivers/usb/gadget/function/f_ecm.c | 67 ++++++++++++++++++++++++
drivers/usb/gadget/function/u_ether.c | 98 ++++++++++++++++++++++++++++++++++
drivers/usb/gadget/function/u_ether.h | 6 +++
drivers/usb/gadget/udc/core.c | 9 ++++
include/linux/usb/composite.h | 1 +
include/linux/usb/gadget.h | 2 +
10 files changed, 324 insertions(+), 11 deletions(-)

--
2.7.4