Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6189BC636D4 for ; Mon, 6 Feb 2023 20:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229797AbjBFUOx (ORCPT ); Mon, 6 Feb 2023 15:14:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230189AbjBFUOt (ORCPT ); Mon, 6 Feb 2023 15:14:49 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 9C53E1E1FF for ; Mon, 6 Feb 2023 12:14:48 -0800 (PST) Received: (qmail 669114 invoked by uid 1000); 6 Feb 2023 15:14:47 -0500 Date: Mon, 6 Feb 2023 15:14:47 -0500 From: Alan Stern To: Elson Roy Serrao Cc: gregkh@linuxfoundation.org, Thinh.Nguyen@synopsys.com, balbi@kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, quic_wcheng@quicinc.com, quic_jackp@quicinc.com Subject: Re: [PATCH v3 1/5] usb: gadget: Properly configure the device for remote wakeup Message-ID: References: <1675710806-9735-1-git-send-email-quic_eserrao@quicinc.com> <1675710806-9735-2-git-send-email-quic_eserrao@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1675710806-9735-2-git-send-email-quic_eserrao@quicinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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