Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp409906rdb; Fri, 17 Nov 2023 02:18:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrLQQ/oC8cWLI4OAQ1H6fdvp5WFvgcCnXi8j33hn/BCLlPuYf8zq6kMRbNcZKOOBeNDHeI X-Received: by 2002:a17:902:c949:b0:1cc:4f55:db72 with SMTP id i9-20020a170902c94900b001cc4f55db72mr15408415pla.0.1700216299514; Fri, 17 Nov 2023 02:18:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700216299; cv=none; d=google.com; s=arc-20160816; b=SfOB1F2XFEoB9l5JXRljJyK6sUUCEUSNHGbWFHA6llfT7MgPPetAeaLBMEndLDJA2m VZuBAIjAHYSU2BJyHZHxox4oWC6JNkje0/9F74gGVL+Bq3KQZyQTHpp9EtUzIKNDsVy6 n2syNUvM7rt/4WeloTNtkSvDxcPJEMYRNf8K+WK8rZR92KGJ9zbpfFymc9aKGN7djHZl TX9K7nMHbUGHwetSiNYksA+xgP43uSl4WgNpQFxQbSNGhWY0JwEJ01Lhm9S53WszGO0O xRT8392KD4ZE/cC5hXN/VUsWJWSr3Rb7DbyV3Y7UaXjeoLmGrj/VHxAykF68BrdMnrXv ty7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:message-id:subject:from :to:cc:date:content-transfer-encoding:mime-version:dkim-signature; bh=NrnMvNkij+pm+ptSQQPTR3DS11MmkWMm02wu6vVa9G4=; fh=4W9mmQyknMrj+YMHTVJEYWIAumBJmHsMZMpQEj+92NU=; b=ZqJm/pJPoyuY2joNwwBPtCFjf8Ghwhm5thSRka2uj9LMQ6dGPArDSO+QXFJDjd3mRs vdzhtQDpEIna0AaUtOUiVq5jNOO/Z92jbu+e968CatWD2I5tp4kT9szgliyJCaiC3tXe s5055XsRXFhND2zlOGT2JA9hxtQLC/PXKNWLrXqb179Nx3ysi8PJDcEUDMjaheqWSxjD 9etoRMj+Vm1QQNSm2zZOpmkoKRzj2wYFs3AstbRraYJsJfPcu/bHcF+LxCDYQsjAZWqy VaqNdjSUAvZorZtP538Zw0CQrmQ1UDkdk/ZdQSQDZZEA5dOVLzUMhO+hixDPbeztyIQw MJiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YJVEvi2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id w2-20020a170902904200b001c9b15bf936si1496610plz.220.2023.11.17.02.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 02:18:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YJVEvi2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7039581DD255; Fri, 17 Nov 2023 02:18:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345744AbjKQKSD (ORCPT + 99 others); Fri, 17 Nov 2023 05:18:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345722AbjKQKSC (ORCPT ); Fri, 17 Nov 2023 05:18:02 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC85BC1; Fri, 17 Nov 2023 02:17:57 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 68BD7C0003; Fri, 17 Nov 2023 10:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700216276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrnMvNkij+pm+ptSQQPTR3DS11MmkWMm02wu6vVa9G4=; b=YJVEvi2fbCzXl6yb1+NDpyTGrjd0huD9Rht0w8qWS9fKDB12gcR8pk4cO1A/9fcw41VC77 OsqS2dR7/gTpQp0ZeoluEt4UE5WeNfdEKRSx96PBSTq0lG5cN0YBeAHlXVWRdGbGU6bCe9 pRdyqJmYSv1rvwa72r7kJycr6qW5nx4JPOD8s6avtasNVZMSsUgNIVOhuHc334El06L3Vz +JtHZshd7pczvusNmBl+vGb9uCmJkYU3Z2Gwf7osEISYtnB0HMGopNj5zL1z0t7GOsPykG n9s/CkcyQ1KhU8Gkcnb0qca29Jnfu3/wL/BfSf49zWxIWlaZWO9uvX0EPQ43XA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 17 Nov 2023 11:17:55 +0100 Cc: , , , , =?utf-8?q?Gr=C3=A9gory_Clement?= , "Thomas Petazzoni" To: "Roger Quadros" , "Greg Kroah-Hartman" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Peter Chen" , "Pawel Laszczak" , "Nishanth Menon" , "Vignesh Raghavendra" , "Tero Kristo" , "Vardhan, Vibhore" From: =?utf-8?q?Th=C3=A9o_Lebrun?= Subject: Re: [PATCH 3/6] usb: cdns3-ti: add suspend/resume procedures for J7200 Message-Id: X-Mailer: aerc 0.15.2 References: <20231113-j7200-usb-suspend-v1-0-ad1ee714835c@bootlin.com> <20231113-j7200-usb-suspend-v1-3-ad1ee714835c@bootlin.com> <5080372b-1f48-4cbc-a6c4-8689c28983cb@kernel.org> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 02:18:11 -0800 (PST) Hello, On Thu Nov 16, 2023 at 10:44 PM CET, Roger Quadros wrote: > On 16/11/2023 20:56, Th=C3=A9o Lebrun wrote: > > On Thu Nov 16, 2023 at 1:40 PM CET, Roger Quadros wrote: > >> On 15/11/2023 17:02, Th=C3=A9o Lebrun wrote: > >>> On Wed Nov 15, 2023 at 12:37 PM CET, Roger Quadros wrote: > >>>> You might want to check suspend/resume ops in cdns3-plat and > >>>> do something similar here. > >>> > >>> I'm unsure what you are referring to specifically in cdns3-plat? > >> > >> What I meant is, calling pm_runtime_get/put() from system suspend/resu= me > >> hooks doesn't seem right. > >> > >> How about using something like pm_runtime_forbid(dev) on devices which > >> loose USB context on runtime suspend e.g. J7200. > >> So at probe we can get rid of the pm_runtime_get_sync() call. > >=20 > > What is the goal of enabling PM runtime to then block (ie forbid) it in > > its enabled state until system suspend? > > If USB controller retains context on runtime_suspend on some platforms > then we don't want to forbid PM runtime. What's the point of runtime PM if nothing is done based on it? This is the current behavior of the driver. > > Thinking some more about it and having read parts of the genpd source, > > it's unclear to me why there even is some PM runtime calls in this > > driver. No runtime_suspend/runtime_resume callbacks are registered. > > Also, power-domains work as expected without any PM runtime calls. > > Probably it was required when the driver was introduced. I'm not seeing any behavior change in cdns3-ti since its addition in Oct 2019. > > The power domain is turned on when attached to a device > > (see genpd_dev_pm_attach). It gets turned off automatically at > > suspend_noirq (taking into account the many things that make genpd > > complex: multiple devices per PD, subdomains, flags to customise the > > behavior, etc.). Removing calls to PM runtime at probe keeps the driver > > working. > >=20 > > So my new proposal would be: remove all all PM runtime calls from this > > driver. Anything wrong with this approach? > > Nothing wrong if we don't expect runtime_pm to work with this driver. > > >=20 > > Only possible reason I see for having PM runtime in this wrapper driver > > would be cut the full power-domain when USB isn't used, with some PM > > runtime interaction with the children node. But that cannot work > > currently as we don't register a runtime_resume to init the hardware, > > so this cannot be the current expected behavior. > >=20 > >> e.g. > >> > >> pm_runtime_set_active(dev); > >> pm_runtime_enable(dev); > >> if (cnds_ti->can_loose_context) > >> pm_runtime_forbid(dev); > >> > >> pm_runtime_set_autosuspend_delay(dev, CNDS_TI_AUTOSUSPEND_DELA= Y); /* could be 20ms? */ > >=20 > > Why mention autosuspend in this driver? This will turn the device off i= n > > CNDS_TI_AUTOSUSPEND_DELAY then nothing enables it back using > > pm_runtime_get. We have nothing to reconfigure the device, ie no > > runtime_resume, so we must not go into runtime suspend. > > It would be enabled/disabled based on when the child "cdns3,usb" > does runtime_resume/suspend. Why care about being enabled or disabled if we don't do anything based on that? Children does do runtime PM stuff but I don't understand how that could influence us. Regards, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com