Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp323943imm; Wed, 18 Jul 2018 02:48:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdU9+2DnAKmj8LL9Nbl9WoZKI/HaTKT96lev9mG8qQcADGOCG4ZZIQZawYZnmyRrqUB9EO1 X-Received: by 2002:a17:902:a24:: with SMTP id 33-v6mr5232815plo.88.1531907339295; Wed, 18 Jul 2018 02:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531907339; cv=none; d=google.com; s=arc-20160816; b=kJ+JhOZXn6wAwaxRpULcepR7F+WRjXigwUAPMiQ+HyA2LK9sZGso7892pJkjDl/neH LHsRWfc6aIZF5dXxNIAiP/iLKpf4mtFXMjPsqq0PV/OZXkWed33qOnqSaiFgfHa6SphM OJo5HORST9/4IkNCGu4zcVsYwGU6Qnu8xxFyT/6PwGTQY3UzpiXf0IAg3siCdNkcmu+D ShlRnAgyUT5QDADdJfIw5UsbMF4mmtSIQ9UOSOLoFIS4PreDcXopCR9Z0CSroSEingWD Uk37Gge8166Q9jP496I9d8IBJIwSkM1Pw+I81RMAGbZqK4Izps118Gb20X4MjBXdev4E q0pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=zwm/LTVLDppwxDN2LK2WYQExG3UtxTVsIbHa44o98sQ=; b=fQIHo7TGppPYnLEkNXv7+9Z1hG2MFoMit+NTv6rZ5s/GwzgPosqnLC7rWMnAietOep z9stxwV2DAP07mSmNY8PYgUEQsl7qx38QVQPBI5rNJHu+gQkKTesvZ0azKrzFTeDc23K HaFJsvFvT77o1cc0UtbP7hl83TNKm1hv90t5BpmLa1ikhwozTRlqaBx9sOywB+e8XNEK pkPoFD6HP41EjLogEbOjRujjxDBFqfVJlqvCY1WHqJu6iN1xPjafcyna3x61cIQwUkwT /tNkhdzw3vheRs22YVG0yjYyV8ac+IMxjOhENxBUb5MZ2GeRQvV5CUpe0/a5P5ZAZDRo NLZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si3150357pgk.215.2018.07.18.02.48.44; Wed, 18 Jul 2018 02:48:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731075AbeGRKYf (ORCPT + 99 others); Wed, 18 Jul 2018 06:24:35 -0400 Received: from foss.arm.com ([217.140.101.70]:59284 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729126AbeGRKYf (ORCPT ); Wed, 18 Jul 2018 06:24:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DDE8780D; Wed, 18 Jul 2018 02:47:30 -0700 (PDT) Received: from red-moon (red-moon.cambridge.arm.com [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5E103F318; Wed, 18 Jul 2018 02:47:27 -0700 (PDT) Date: Wed, 18 Jul 2018 10:49:24 +0100 From: Lorenzo Pieralisi To: Honghui Zhang Cc: marc.zyngier@arm.com, bhelgaas@google.com, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, yingjoe.chen@mediatek.com, eddie.huang@mediatek.com, ryder.lee@mediatek.com, hongkun.cao@mediatek.com, youlin.pei@mediatek.com, yong.wu@mediatek.com, yt.shen@mediatek.com, sean.wang@mediatek.com, rjw@rjwysocki.net, khilman@kernel.org, ulf.hansson@linaro.org Subject: Re: [PATCH v3 3/4] PCI: mediatek: Add system pm support for MT2712 and MT7622 Message-ID: <20180718094924.GA21463@red-moon> References: <1530518264-6125-1-git-send-email-honghui.zhang@mediatek.com> <1530518264-6125-4-git-send-email-honghui.zhang@mediatek.com> <20180717171543.GA20991@red-moon> <1531893761.31406.15.camel@mhfsdcap03> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1531893761.31406.15.camel@mhfsdcap03> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 02:02:41PM +0800, Honghui Zhang wrote: > > > +static int __maybe_unused mtk_pcie_resume_noirq(struct device *dev) > > > +{ > > > + struct mtk_pcie *pcie = dev_get_drvdata(dev); > > > + const struct mtk_pcie_soc *soc = pcie->soc; > > > + struct mtk_pcie_port *port, *tmp; > > > + > > > + if (!soc->pm_support) > > > + return 0; > > > + > > > + if (list_empty(&pcie->ports)) > > > + return 0; > > > + > > > + if (dev->pm_domain) { > > > + pm_runtime_enable(dev); > > > + pm_runtime_get_sync(dev); > > > + } > > > > Are these runtime PM calls needed/abused here ? > > > > Mind explaining the logic ? > > > > There is certainly an asymmetry with the suspend callback which made me > > suspicious, I am pretty certain Rafael/Kevin/Ulf can help me clarify so > > that we can make progress with this patch. > > > > Lorenzo > > > Hi Lorenzo, thanks for your comments. > Sorry I don't get you. > I believe that in suspend callbacks the pm_runtime_put_sync and > pm_runtime_disable should be called to gated the CMOS for this module, > while the pm_rumtime_enable and pm_rumtime_get_sync should be called > in resume callback. That's why I CC'ed Rafael, Kevin and Ulf, to answer this question thoroughly, I am not sure it is needed and that's the right way of doing it in system suspend callbacks. > That's exactly this patch doing. > But the pm_rumtime_put_sync and pm_runtime_disable functions was wrapped > in the mtk_pcie_subsys_powerdown. Ah, sorry, I missed that. > I did not call mtk_pcie_subsys_powerup since it does not just wrapped > pm_rumtime related functions but also do the platform_resource_get, > devm_ioremap, and free_ck clock get which I do not needed in resume > callback. > > Do you think it will be much clear if I abstract the > platform_resource_get, devm_ioremap functions from > mtk_pcie_subsys_powerup and put it to a new functions like > mtk_pcie_subsys_resource_get, and then we may call the > mtk_pcie_subsys_powerup in the resume function? I think so but let's wait first for feedback on whether those runtime PM calls are needed in the first place. Lorenzo