Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2694217imn; Tue, 2 Aug 2022 12:24:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vd/SzPKJVHMogBZBsypI1VwbkaK6eXBQsnFLxl8kJDlUvzv9VjgLzOC0aIaNFcTc6iOoEG X-Received: by 2002:a17:907:8a04:b0:72b:9173:2fef with SMTP id sc4-20020a1709078a0400b0072b91732fefmr17191157ejc.346.1659468253417; Tue, 02 Aug 2022 12:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659468253; cv=none; d=google.com; s=arc-20160816; b=Cst2oYg0ppyoIddc7mCx4ZEskvM9imMB3txsiuPFXgguCn2fjwPf+zatDKJq328m11 2qmnFbTK7D1iWYSUcn1aaolQHNFuLTWh1kSlc+fHZYM3+TDjtUHF/Y9wjxYNI19iUavB deKrVOdJtxccvB3LY8wd3pj7XY6/0F21jDW2+Vn0xRqTP2Bx1XCsg3dYFbyTzujUhXLd FW6c/ptkgLLxqXHlLvTFREndaIg1aq/Q1FJviN+qd0Dvkn+LjukS4G6mI0hg5XohTZLA Ygq2KE/eDnOPqFWpUxWu9tyVuueylAQlmtuHOcpNEaAYg20+NmeeIdAUH1eLSPffcw+B NwxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=r/XIqJc2dKNK2b3maiJp5sGmbG73g16hBKrnIKFiztA=; b=PX8wYQAHgDQgUpOO+OsSCGhB/fRvdyl6OMJF7Ehqhv2sC3HBVdBoPYw5DpIhOsoW8Z e2QRgFWL2mJLlxhPBglDLnW14qgkZbShGpEwnohuxKS6BOTzh+6WIkDqNm3aakcR6N9c Y/CZN7iQXBIlI7A+pr8UixBfwUiEaCM85+ASFkku7XoZTCH/ktEZiuCX6vRaqvN0XU8u bEIc35ekuQRvgtqUgiOrN1mmJWq7UAkYoUB1x2TE/IXjaXr3iV/es7cRn9GYh+acDdlj 1dHEb5Qp/I5aWwbLsMl/qPzcgk0Vb3NE2hByQ4kcr9pVOg03kBeluGSKsxwhilqSVinW ckng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Nur0TIhO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr18-20020a1709073f9200b006f88b28f31asi3345760ejc.382.2022.08.02.12.23.48; Tue, 02 Aug 2022 12:24:13 -0700 (PDT) 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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Nur0TIhO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229869AbiHBTS5 (ORCPT + 99 others); Tue, 2 Aug 2022 15:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiHBTSq (ORCPT ); Tue, 2 Aug 2022 15:18:46 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C2D312D28; Tue, 2 Aug 2022 12:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1659467925; x=1691003925; h=from:to:cc:subject:date:message-id; bh=r/XIqJc2dKNK2b3maiJp5sGmbG73g16hBKrnIKFiztA=; b=Nur0TIhOiqGjJwiR047e8XQXxISanqjiVSkLuB/gjr7CDhvJfxD2RuLp 1lx57Yasp1ohvGWxO4qUlbcyT644Nn8z4BWAE1R/dBiSlx1w8Y+nJd/OR LfAzV2p48iecGMSTPmm0KmeZLDeRXCfXre48Y25J1qsZZsuf1PLUi38VL c=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 02 Aug 2022 12:18:42 -0700 X-QCInternal: smtphost Received: from hu-eserrao-lv.qualcomm.com (HELO hu-devc-lv-c.qualcomm.com) ([10.47.235.164]) by ironmsg09-lv.qualcomm.com with ESMTP; 02 Aug 2022 12:18:42 -0700 Received: by hu-devc-lv-c.qualcomm.com (Postfix, from userid 464172) id 706982118B; Tue, 2 Aug 2022 12:18:42 -0700 (PDT) From: Elson Roy Serrao To: balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, quic_wcheng@quicinc.com, quic_jackp@quicinc.com, quic_mrana@quicinc.com, Thinh.Nguyen@synopsys.com, Elson Roy Serrao Subject: [PATCH 0/5] Add function suspend/resume and remote wakeup support Date: Tue, 2 Aug 2022 12:18:35 -0700 Message-Id: <1659467920-9095-1-git-send-email-quic_eserrao@quicinc.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 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