On Mon, Feb 06, 2023 at 11:13:22AM -0800, Elson Roy Serrao wrote: > The wakeup bit in the bmAttributes field indicates whether the device > is configured for remote wakeup. But this field should be allowed to > set only if the UDC supports such wakeup mechanism. So configure this > field based on UDC capability. Also inform the UDC whether the device > is configured for remote wakeup by implementing a gadget op. > > Signed-off-by: Elson Roy Serrao <quic_eserrao@xxxxxxxxxxx> > --- > drivers/usb/gadget/composite.c | 24 +++++++++++++++++++++++- > drivers/usb/gadget/udc/core.c | 27 +++++++++++++++++++++++++++ > drivers/usb/gadget/udc/trace.h | 5 +++++ > include/linux/usb/gadget.h | 8 ++++++++ > 4 files changed, 63 insertions(+), 1 deletion(-) > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index dc3092c..05d1449 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -309,6 +309,7 @@ struct usb_udc; > struct usb_gadget_ops { > int (*get_frame)(struct usb_gadget *); > int (*wakeup)(struct usb_gadget *); > + int (*set_remotewakeup)(struct usb_gadget *, int set); > int (*set_selfpowered) (struct usb_gadget *, int is_selfpowered); > int (*vbus_session) (struct usb_gadget *, int is_active); > int (*vbus_draw) (struct usb_gadget *, unsigned mA); > @@ -383,6 +384,8 @@ struct usb_gadget_ops { > * @connected: True if gadget is connected. > * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag > * indicates that it supports LPM as per the LPM ECN & errata. > + * @rw_capable: True if gadget is capable of sending remote wakeup. > + * @rw_armed: True if gadget is armed by the host for remote wakeup. Minor stylistic request: Could you choose something other than "rw" to start these field names? For too many people, that abbreviation is firmly associated with "read/write". Maybe just "wakeup"? Alan Stern