Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2653218rdb; Wed, 15 Nov 2023 07:03:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEojJn8k9APpi270s9mlAC/R332+1jEERnGLXARMQdz+ZuZaDIB09LwiRZNca5bLIKU7V6u X-Received: by 2002:aca:1c05:0:b0:3b2:dd32:2fe9 with SMTP id c5-20020aca1c05000000b003b2dd322fe9mr10591484oic.35.1700060623399; Wed, 15 Nov 2023 07:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700060623; cv=none; d=google.com; s=arc-20160816; b=gVXAUtC3uU0B8iL72Cpk/xnZ4FwM8nCSzcb9X3v4rvgEGVdYoZyeyfPaJ/dHkbrdD5 hCYxsrMtVjcxKLLDmN+My4qGs+mF08FgHX4wY23+iPNLnuP0ScD6zI3X4TfAQA6xOB4r /Ond1RhnMTdDmT0TIpM6D15faNBhGzSSKgUS7PfaMgU3ZFyn0lu680E6e20eWLQt7/7G LbSfVT3dH1pWweCqBKUVEsb0YWVxu6ijyrw2Xp0TyHoQQZlT4CULFOzo2pmAeGO0FwH4 znNJz9LdWLdszzsjY+tMfRWgcmgljs5cuuxW5oLVARHpjQIMTBhG2DbVdFss3/JaM7l3 svQQ== 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:to:cc:subject :from:date:content-transfer-encoding:mime-version:dkim-signature; bh=JuMmHRU7WxSl23gr7fM2+35JqsdaCo5TTlvcuNRvn+w=; fh=lsP7iQFP337AyyljmzAz8rYqytYptbwVogG7GVZItuA=; b=WveD0bNu8dw7khOCwRmFTqJlR5CmfkoQH941lDDv0qgNVfXOy9oXFtM3aLa2tlHj8t w/xVFLMQg6GjNrFB/1De1bCEA0dD9arRQGFk4fSxMFrKFQrl+ieOMKyrZLqM/5fQoDki mX6+4v6zul7Zc7ladFjPW0yyYZafeWfxDRPUIYEaJrrlQ1bmlYSHISQhOyWqvZLCeL0u uRvTSy5mCO+fUMASYWaBNQ9Z9Kgfk/aNK0c4mtDLxukLWTHA7Lzh970WbHSTnqb/lFjy WXsS9EVVl6Ugu8NxQqLIhbWz8OngJO28GIhebSeAhzHw5j9fty5toQCtLfNQpEOZFciO MI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=E+3jtFmS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id c17-20020a056830349100b006ce2eaacfd3si4066135otu.239.2023.11.15.07.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 07:03:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=E+3jtFmS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 59EFD801B9E6; Wed, 15 Nov 2023 07:03:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344352AbjKOPCt (ORCPT + 99 others); Wed, 15 Nov 2023 10:02:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344228AbjKOPCq (ORCPT ); Wed, 15 Nov 2023 10:02:46 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E20101; Wed, 15 Nov 2023 07:02:41 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 38517C0009; Wed, 15 Nov 2023 15:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700060559; 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=JuMmHRU7WxSl23gr7fM2+35JqsdaCo5TTlvcuNRvn+w=; b=E+3jtFmSUSOE6YViMZPusjln94T3SXtiCEd0IMzxKpVCKzYmSPkHnbXxf719uI263jg3fU kDJxKA55BPe/Mpfr/ytIS3ce4a3eG7ys9iJ5RbpWzM5jJv7A/3O0ZA4afvz1R8C6oXxdTi 2Mbi1gq526IQDVFX5Wy76aPo5sAuZ/lDIpNuyKWj6n6w1OBQp6cNfMBHCGiH/zpyKuMX3D xwhqarEViBVHku3IGueJo0lUNKFjOTsJW/fn8c3SZ4m4Iym+ICYDlEAOSvcE9BSuZp5TQA VOUnhv0tDDzC86GUmc6HafYMofWZHAeGe50PL/OWuoIyBOahYOd2CDA9D5wZ4w== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 15 Nov 2023 16:02:37 +0100 From: =?utf-8?q?Th=C3=A9o_Lebrun?= Subject: Re: [PATCH 3/6] usb: cdns3-ti: add suspend/resume procedures for J7200 Cc: , , , To: "Roger Quadros" , "Greg Kroah-Hartman" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Peter Chen" , "Pawel Laszczak" , "Nishanth Menon" , "Vignesh Raghavendra" , "Tero Kristo" 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: <5080372b-1f48-4cbc-a6c4-8689c28983cb@kernel.org> 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 15 Nov 2023 07:03:18 -0800 (PST) Hi Roger, On Wed Nov 15, 2023 at 12:37 PM CET, Roger Quadros wrote: > On 13/11/2023 16:26, Th=C3=A9o Lebrun wrote: > > Hardware initialisation is only done at probe. The J7200 USB controller > > is reset at resume because of power-domains toggling off & on. We > > therefore (1) toggle PM runtime at suspend/resume & (2) reconfigure the > > hardware at resume. > > at probe we are doing a pm_runtime_get() and never doing a put thus > preventing any runtime PM. Indeed. The get() from probe/resume are in symmetry with the put() from suspend. Is this wrong in some manner? > > index c331bcd2faeb..50b38c4b9c87 100644 > > --- a/drivers/usb/cdns3/cdns3-ti.c > > +++ b/drivers/usb/cdns3/cdns3-ti.c > > @@ -197,6 +197,50 @@ static int cdns_ti_probe(struct platform_device *p= dev) > > return error; > > } > > =20 > > +#ifdef CONFIG_PM > > + > > +static int cdns_ti_suspend(struct device *dev) > > +{ > > + struct cdns_ti *data =3D dev_get_drvdata(dev); > > + > > + if (!of_device_is_compatible(dev_of_node(dev), "ti,j7200-usb")) > > + return 0; > > + > > + pm_runtime_put_sync(data->dev); > > + > > + return 0; > > 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? - Using pm_runtime_status_suspended() to get the current PM runtime state & act on it? I don't see why because we know the pm_runtime state is a single put() at probe. - Having a `in_lpm` flag to track low-power mode state? I wouldn't see why we'd want that as we don't register runtime_suspend & runtime_resume callbacks and system syspend/resume can be assumed to be called in the right order. - Checking the `device_may_wakeup()`? That doesn't apply to this driver which cannot be a wakeup source. Thanks for your review! Regards, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ------------------------------------------------------------------------