Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3526042rwb; Fri, 20 Jan 2023 18:08:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXtVJCc/ujTvaFFeJMNg3SncGGOJarQSHEqPMARzi4St1WP8kI1WCBrZGPHJJWK+j1gMfE18 X-Received: by 2002:a17:90b:1d81:b0:22b:b51a:5652 with SMTP id pf1-20020a17090b1d8100b0022bb51a5652mr3695801pjb.26.1674266884659; Fri, 20 Jan 2023 18:08:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674266884; cv=none; d=google.com; s=arc-20160816; b=JG4sp4Ihq/igqpnWkJJm0SFoHFDQyGiSxNLRxfB1JeYWixhV6ykFe2bgLvWQ+1BoUN +YQKFOfVDMG/p7eEZCt0VA0QqGt7XI0DYRHw5i7sMCBs6DgN+cnIqwr3n4h1E8WiCFy7 se7tC/D4I3oV7vYaRo/3TUd4Oj19L/D41FdmvD07rg2rduECSFjxHxvQJDU9xJhKHcho 4YFxunXzFfXAUZ2uHIIBmEWcdfq8tRxnqxoLgAzokLcj9UZPZ4zU6ZZ77RxYSUKOZRup WWiUt1KIi5m8PBh2IMRehfBm7lMXtylEMJf6B5+JalNCstpOODqLVJMQN+pnz05bEbjK uDMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=KEBW7yH+FHwNsDeDx7uWvem7rzXyxO5pAv28Z9Ltpqg=; b=jwAoNcen+4O4Ip3r/khKtMTWmcmrPuk9pMCo/kwCVSAhMcs6plMQX/liimCK1fLbMS 4T+pxRrJ+15fRQ0Ru1zkO8QooLriiGw26OTBjcEQOIrXvUzRccNKtcYuhTZf+IU7i4RI pyU6B2yLRxPDS0MdVOoZ5iNYTx/2JCkxglKH53tOZ4B20rbF38Osv9p935MUrLblV7UD 5QOY5yAryq14K9sDa4aQv7A1k6pYmG6yDkLk35ypB2tcJfI9pACAmoyp0fgvFJ5jZm+U bCdPdSwFzPbl2ZrYl0+910D1PCGyhSz7XTVkF4WocO+EzxLu8g3FTe4mPXxIx5diZhQZ 5ALg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r132-20020a632b8a000000b00478a09699f8si15869892pgr.126.2023.01.20.18.07.53; Fri, 20 Jan 2023 18:08:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229464AbjAUBzQ (ORCPT + 52 others); Fri, 20 Jan 2023 20:55:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjAUBzP (ORCPT ); Fri, 20 Jan 2023 20:55:15 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 388C171BED for ; Fri, 20 Jan 2023 17:55:14 -0800 (PST) Received: (qmail 54822 invoked by uid 1000); 20 Jan 2023 20:55:13 -0500 Date: Fri, 20 Jan 2023 20:55:13 -0500 From: Alan Stern To: Thinh Nguyen Cc: Elson Serrao , "gregkh@linuxfoundation.org" , "balbi@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "quic_wcheng@quicinc.com" , "quic_jackp@quicinc.com" Subject: Re: [PATCH v2 1/5] usb: gadget: Add remote wakeup capable flag Message-ID: References: <1673992507-7823-1-git-send-email-quic_eserrao@quicinc.com> <1673992507-7823-2-git-send-email-quic_eserrao@quicinc.com> <20230119014409.yiw6xlp5cwlmu25s@synopsys.com> <20230120011513.ajwum224lfwwb6ws@synopsys.com> <045f9ac1-5d48-fad0-8e74-8d5144aa1431@quicinc.com> <20230121002059.mpiqavemelnntxd7@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230121002059.mpiqavemelnntxd7@synopsys.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 21, 2023 at 12:21:10AM +0000, Thinh Nguyen wrote: > The way gadget->rw_capable is named and described, it's a capability > flag. That is, its value shouldn't change from the user config. Perhaps > we don't need that in the usb_gadget, and we can have something that > looks like this: > > if (gadget->ops->wakeup && (c->bmAttributes & USB_CONFIG_ATT_WAKEUP)) > usb_gadget_enable_remote_wakeup(g); > else > usb_gadget_disable_remote_wakeup(g); > > The setting of the remote wakeup configuration can be tracked internally > by the dwc3 driver based on the usb_gadget_enable_remote_wakeup call. A UDC design might have multiple versions, some supporting remote wakeup and others not. But drivers generally use a single static usb_gadget_ops structure, and they don't modify it at runtime to account for hardware differences. So if a single driver controls those multiple versions, you can't rely on the presence of gadget->ops->wakeup to indicate whether there actually is hardware remote wakeup support. Ideally, the usb_gadget structure should have a wakeup_capable flag which the UDC driver would set appropriately (probably during its probe routine). Alan Stern