Message ID | 20230320093447.32105-2-rogerq@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1120019wrt; Mon, 20 Mar 2023 02:56:31 -0700 (PDT) X-Google-Smtp-Source: AK7set/OcW1BUSIgNMbehcIuc8vQSMDaOGmTK+JnzeWJjbeONXer1bbXQh9evg2WI41Gx3R3p3f4 X-Received: by 2002:a17:90b:4b4d:b0:23b:3f18:a8fe with SMTP id mi13-20020a17090b4b4d00b0023b3f18a8femr18602545pjb.31.1679306191295; Mon, 20 Mar 2023 02:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679306191; cv=none; d=google.com; s=arc-20160816; b=qkL0Pb5Oul9Pr18Cwzb/6jZ2eakATwLs5HlPfm8msS/dijJzoo/t1vFrKmFKVsjpYJ mK5MhYRRTmkdNbyKMLnnSHMb9IrrfvgXF0uq6q/9H+AUGi+/3ycLU09Q3Kp+LTlpI8Hr DYMlEAFcNGmJlZkb+9UFGuXCsdBpNFbGi+Og6nGs+TOBd8qEn0ej0MQHpIHxn6iW15nN 7W4593P8ezQ8g0qj0GJqMJSqjjt89ljAIYSBmkYcjrOrOHxPRfk8kFAOipLSYDvnL0w2 W4kdpLByJpuM++sByoZx6oUnywI0VokanoElk5EkH5ts7NePN1x7OXrxvorWZCJCtIha yIkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G4qLjt0iGf1q1R/7efqPZVpjxVSC6vPNIylJvomJDgM=; b=DgalSC14JC5+SeeE4/dKRfz5m8R3huh2oZw6tEbdYQ8kIc9n4sZSbT35WRFvNdwUQM Dp4V5sBCAMzyhMW2Gj3zbhxVjLk0O6q3SRHpbJUpdwGwa0Y3K9sqXewIscKjolocUHWe 1Lag5m7IUaivho40hza4ky7M853CnVVSVeWzTCTK3yN4a8dpaqIvXHo6rwajMz3FEI2S +68Z05UTfb00HkHOdU9lpwRCAbU0ojlwf3F3cFJ9vk6bnmGybjPUQqmZM0kq8gJRT9LK XQvWe48KXpv1chLVnvc6+ta14J9wR0b0NB9SemwpnAwg6C1BSLko5uk1ClcDfvJl2Yky 0Ihw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JRdYEgRj; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk2-20020a17090b224200b0023d282930e7si16772401pjb.76.2023.03.20.02.56.19; Mon, 20 Mar 2023 02:56:31 -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=@kernel.org header.s=k20201202 header.b=JRdYEgRj; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbjCTJfG (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Mon, 20 Mar 2023 05:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbjCTJfA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Mar 2023 05:35:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 750F41B572; Mon, 20 Mar 2023 02:34:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D868B80DB5; Mon, 20 Mar 2023 09:34:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84F77C433D2; Mon, 20 Mar 2023 09:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679304897; bh=7f7xBrz/th4eNUqDR98uCTdNi7uY7ScAKlNZDYRKTts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRdYEgRjJLA0V9YqyikvA55oBQFK2hrVxrsQHsj9NHQc4KqqqCx9K7g0O1bwcQCa+ XVlHdEAlrhOYpLRo5XK7S6hKCSOJAtReSKoXUDYR8D6PypnlDvX23K7h8u0cfQbq/d +0r5HkWwMVBEKHBFxWuPXqT79fRIl4mdkB8CmwfM71tuEPxJFh+m7mJAhY6I29vV9O +nUNjnwnZMbwKb6Nim+KHmy5lfNjWpPg+CWFO0n+7XH6i4XEJLScYvpMCIZJ0nEhLL jOVjmsM5DtRmHxQoXmtRFxpxscN+ISUx31nvpY8ET89zf3kaf4SOfBxQVPsTtYpfmT aRCR/3WpEypLg== From: Roger Quadros <rogerq@kernel.org> To: Thinh.Nguyen@synopsys.com, stern@rowland.harvard.edu Cc: gregkh@linuxfoundation.org, vigneshr@ti.com, srk@ti.com, r-gunasekaran@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros <rogerq@kernel.org>, devicetree@vger.kernel.org Subject: [RFC PATCH 1/2] dt-bindings: usb: snps,dwc3: Add 'snps,gadget-keep-connect-sys-sleep' Date: Mon, 20 Mar 2023 11:34:46 +0200 Message-Id: <20230320093447.32105-2-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230320093447.32105-1-rogerq@kernel.org> References: <20230320093447.32105-1-rogerq@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760880168789534248?= X-GMAIL-MSGID: =?utf-8?q?1760880168789534248?= |
Series |
usb: dwc3: Support wake-up from USB suspend.
|
|
Commit Message
Roger Quadros
March 20, 2023, 9:34 a.m. UTC
The current USB gadget driver behaviour is to stop the controller
and disconnect from the bus during System sleep.
The 'snps,gadget-keep-connect-sys-sleep' property can be used to
change this behaviour and keep the controller active and connected
to the bus during System sleep. This is useful for applications
that want to enter a low power state when USB is suspended but
remain connected so they can resume activity on USB resume.
This feature introduces a new constraint if Gadget driver is connected
to USB host: i.e. the gadget must be in USB suspend state to allow
a System sleep as we cannot process any USB transactions
when in System sleep.
The system hardware is responsible to detect the end of USB suspend
and wake up the system so we can begin processing the USB transactions
as soon as possible.
Cc: devicetree@vger.kernel.org
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Mon, 20 Mar 2023 11:34:46 +0200, Roger Quadros wrote: > The current USB gadget driver behaviour is to stop the controller > and disconnect from the bus during System sleep. > > The 'snps,gadget-keep-connect-sys-sleep' property can be used to > change this behaviour and keep the controller active and connected > to the bus during System sleep. This is useful for applications > that want to enter a low power state when USB is suspended but > remain connected so they can resume activity on USB resume. > > This feature introduces a new constraint if Gadget driver is connected > to USB host: i.e. the gadget must be in USB suspend state to allow > a System sleep as we cannot process any USB transactions > when in System sleep. > > The system hardware is responsible to detect the end of USB suspend > and wake up the system so we can begin processing the USB transactions > as soon as possible. > > Cc: devicetree@vger.kernel.org > Signed-off-by: Roger Quadros <rogerq@kernel.org> > --- > Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13): yamllint warnings/errors: dtschema/dtc warnings/errors: ./Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/intel,keembay-dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/rockchip,dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/qcom,dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/rockchip,rk3399-dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/snps,dwc3.yaml: properties:snps,gadget-keep-connect-sys-sleep: 'oneOf' conditional failed, one must be fixed: 'type' is a required property hint: A vendor boolean property can use "type: boolean" /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/snps,dwc3.yaml: properties:snps,gadget-keep-connect-sys-sleep: 'oneOf' conditional failed, one must be fixed: 'enum' is a required property 'const' is a required property hint: A vendor string property with exact values has an implicit type from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml# /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/snps,dwc3.yaml: properties:snps,gadget-keep-connect-sys-sleep: 'oneOf' conditional failed, one must be fixed: '$ref' is a required property 'allOf' is a required property hint: A vendor property needs a $ref to types.yaml from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml# hint: Vendor specific properties must have a type and description unless they have a defined, common suffix. from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml# ./Documentation/devicetree/bindings/usb/dwc3-xilinx.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml ./Documentation/devicetree/bindings/usb/ti,am62-usb.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230320093447.32105-2-rogerq@kernel.org The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
On Mon, Mar 20, 2023 at 11:34:46AM +0200, Roger Quadros wrote: > The current USB gadget driver behaviour is to stop the controller > and disconnect from the bus during System sleep. What's USB gadget? ;) > The 'snps,gadget-keep-connect-sys-sleep' property can be used to > change this behaviour and keep the controller active and connected > to the bus during System sleep. This is useful for applications > that want to enter a low power state when USB is suspended but > remain connected so they can resume activity on USB resume. > > This feature introduces a new constraint if Gadget driver is connected > to USB host: i.e. the gadget must be in USB suspend state to allow > a System sleep as we cannot process any USB transactions > when in System sleep. > > The system hardware is responsible to detect the end of USB suspend > and wake up the system so we can begin processing the USB transactions > as soon as possible. Sounds like something the user/OS would want to choose rather than fixed by your board's firmware. Is this somehow DWC3 specific? If not, why a DWC3 specific property? > > Cc: devicetree@vger.kernel.org > Signed-off-by: Roger Quadros <rogerq@kernel.org> > --- > Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml > index be36956af53b..1ce8008e7fef 100644 > --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml > +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml > @@ -262,6 +262,11 @@ properties: > asserts utmi_sleep_n. > type: boolean > > + snps,gadget-keep-connect-sys-sleep: > + description: > + If True then gadget driver will not disconnect during system sleep. > + System sleep will not be allowed if gadget is not already in USB suspend. 'gadget' is a Linuxism. > + > snps,hird-threshold: > description: HIRD threshold > $ref: /schemas/types.yaml#/definitions/uint8 > -- > 2.34.1 >
On 20/03/2023 15:22, Rob Herring wrote: > On Mon, Mar 20, 2023 at 11:34:46AM +0200, Roger Quadros wrote: >> The current USB gadget driver behaviour is to stop the controller >> and disconnect from the bus during System sleep. > > What's USB gadget? ;) :) > >> The 'snps,gadget-keep-connect-sys-sleep' property can be used to >> change this behaviour and keep the controller active and connected >> to the bus during System sleep. This is useful for applications >> that want to enter a low power state when USB is suspended but >> remain connected so they can resume activity on USB resume. >> >> This feature introduces a new constraint if Gadget driver is connected >> to USB host: i.e. the gadget must be in USB suspend state to allow >> a System sleep as we cannot process any USB transactions >> when in System sleep. >> >> The system hardware is responsible to detect the end of USB suspend >> and wake up the system so we can begin processing the USB transactions >> as soon as possible. > > Sounds like something the user/OS would want to choose rather than fixed > by your board's firmware. Yes. > > Is this somehow DWC3 specific? If not, why a DWC3 specific property? This is not DWC3 specific. Should we make this a UDC class device's sysfs attribute instead? Only concern is that in dual-role case, if a role switch from device mode to host mode and back to device mode happens, we loose the UDC device's attributes as we re-init the UDC device. Or should we make it a udc_core module parameter? This should be persistent between role switches. > >> >> Cc: devicetree@vger.kernel.org >> Signed-off-by: Roger Quadros <rogerq@kernel.org> >> --- >> Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml >> index be36956af53b..1ce8008e7fef 100644 >> --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml >> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml >> @@ -262,6 +262,11 @@ properties: >> asserts utmi_sleep_n. >> type: boolean >> >> + snps,gadget-keep-connect-sys-sleep: >> + description: >> + If True then gadget driver will not disconnect during system sleep. >> + System sleep will not be allowed if gadget is not already in USB suspend. > > 'gadget' is a Linuxism. Got it. Will avoid using it ;) > >> + >> snps,hird-threshold: >> description: HIRD threshold >> $ref: /schemas/types.yaml#/definitions/uint8 >> -- >> 2.34.1 >> cheers, -roger
diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml index be36956af53b..1ce8008e7fef 100644 --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml @@ -262,6 +262,11 @@ properties: asserts utmi_sleep_n. type: boolean + snps,gadget-keep-connect-sys-sleep: + description: + If True then gadget driver will not disconnect during system sleep. + System sleep will not be allowed if gadget is not already in USB suspend. + snps,hird-threshold: description: HIRD threshold $ref: /schemas/types.yaml#/definitions/uint8