Message ID | 20230717-topic-branch_aon_cleanup-v3-4-3e31bce9c626@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-6173-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2327925dyi; Tue, 19 Dec 2023 16:32:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXfsK4dW2eW5bRejZWKYsz+8ERxkA3S7CAWE0b8jRD+jZxEAe9JTBRJZYvTxEqQFdxdIgM X-Received: by 2002:a05:6870:3929:b0:204:20b:2de with SMTP id b41-20020a056870392900b00204020b02demr886832oap.35.1703032355260; Tue, 19 Dec 2023 16:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703032355; cv=none; d=google.com; s=arc-20160816; b=pEzOaipQcUS5fauDX16+gWihtCAP3QJZU3+qy1+RXnJ+bUfeLe5P0rAAiDspcr0JYq ymD3rHNswX+LSJDRaMT+ka5cmzowcWXHfUAUWixYDHp6vLbR46IQdoj7b9h/47icV4i9 hSFjacyGeCu55mHA+PswPTYWgDJvUjdJVh0yYXSATeVdexiK0rBxD+v5crS25S+BaDSM jln2hUSit09GiPy7OSP/1zDEKJF6x8o34jPdn2U4T07Hn+I4gFOecJgQwZWcQ6EwNhmU 1ggBPfgx1LJYkXJQ+YD5XEN9+sPtNES4JWusyGAwK8l7XrpMMcFewocL/158+LqAXlDk 6wxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=F/XYeH7WpVmrRfjifn0LxMiuPs0oZ+EZwghWZGkWLzI=; fh=M4SmwWZ/7iHrjhlTFT5OMF7TTciupAxAdgRVURl8aUM=; b=CaBn+23D+ISExU2/pdMCJrw5DKdYUKR1pSPlDCmy/LwerxtjO/Yy3uX3rfvbvsY23H W+4sLqkh9Lz5kUTI7P/EfTQp55fxtiEH2byP3r7vGAEIrqd5tfkHtnWNXMdbtTlAyzsE U/5gjdn0vp3N8KA/Et9Wac97/OhpctgCeJouhuYPZQbmIAjnYHUfDBqdZd77s4uY9XvF whA6eBzC2gj5wmQwku9pC5fEvkoN/VhszHsEDN39mOVJ7eacfE364dGJNnCpX3M6qDTg ktOK7V5lNndqs/8+SiWC5cxjTHHEX3OFzcXpYEVoWLeacWULg3ltHccwXy00vX+9i+sK D8Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B1wiASmD; spf=pass (google.com: domain of linux-kernel+bounces-6173-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6173-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id br17-20020a05622a1e1100b00403f0dfedb7si29981351qtb.193.2023.12.19.16.32.35 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 16:32:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6173-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B1wiASmD; spf=pass (google.com: domain of linux-kernel+bounces-6173-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6173-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D4FCC1C24F44 for <ouuuleilei@gmail.com>; Wed, 20 Dec 2023 00:32:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E51117D8; Wed, 20 Dec 2023 00:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="B1wiASmD" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BCF86FCE for <linux-kernel@vger.kernel.org>; Wed, 20 Dec 2023 00:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-552d39ac3ccso442544a12.0 for <linux-kernel@vger.kernel.org>; Tue, 19 Dec 2023 16:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703032259; x=1703637059; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=F/XYeH7WpVmrRfjifn0LxMiuPs0oZ+EZwghWZGkWLzI=; b=B1wiASmDbWdNpJW1qrAy0VLJyNG7zvBTwgCHbq6JnjBQPkXVCvFfEf2e/Kj+pZt/u9 OOqK4ot1qeFRVb0NrWnZ+MQqvpQ4ZPJplaovtmaxtf2plKDa5dRs2y6a+mnHcx/eqilt hJBCek1SCcNdigUkq8pFjJWZJztV5tVaYH7DGWIFGyw6xyXMMTLSzalRAK5cqaU16j8G xbR7K8eJMYbPQsLB4rNx5jbc64XOh/K/5xNtffScxMfiwagXY6JPN+xHUlYfNZeKHgXF FwwKxb6ql8bV54CZU8FLBftUIEE1a1PwvFtPy2CCMR+B9efxdFuEc/HDP96YauSk/IJY fi2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703032259; x=1703637059; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F/XYeH7WpVmrRfjifn0LxMiuPs0oZ+EZwghWZGkWLzI=; b=J1Q+cgp5t0f4oCqgxsdNHmZ8aN/v2g6EA9bybl8lGdVvylWkGbUb3eOcthqvs1uE0w tJykUOAxPUxNViYkK9XDaUh6VhNwgkb9aWzDJda8QM7XnYb5Gq9EFbIjabbxwY90nena iQQc3sYKAI76l2iphZ66xkFnakVTWGbAO+UWRk602LMZl4YyItbijEO/7RQG8Nv+AEQY 1BEToCKFnuMpB1hHkxw/8nrsoZovRqYQHf1Y3SAgwqkwOTeGhcqBhk13076NdMjCG+7w jXq1tQZrbpLLjOasgvyyjPLLvT8cRdV4kEF/Gobrm0DlESHlhLvyy13ihUsix7UHXVVi JBDQ== X-Gm-Message-State: AOJu0YzydXVcTZKFJaArqPmoK8eoqxhCbWw+oXIYi7RPPJwEqjEQO0MS PMc8ERXxDbFZY2dDkDg0KQm5oGrxlm50vw== X-Received: by 2002:a05:6402:3d1:b0:54a:ff0f:78d6 with SMTP id t17-20020a05640203d100b0054aff0f78d6mr2069269edw.0.1703032259623; Tue, 19 Dec 2023 16:30:59 -0800 (PST) Received: from [10.167.154.1] (178235179206.dynamic-4-waw-k-1-3-0.vectranet.pl. [178.235.179.206]) by smtp.gmail.com with ESMTPSA id k16-20020a056402049000b00552d03a17acsm4824397edv.61.2023.12.19.16.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 16:30:59 -0800 (PST) From: Konrad Dybcio <konrad.dybcio@linaro.org> Date: Wed, 20 Dec 2023 01:30:45 +0100 Subject: [PATCH v3 04/15] clk: qcom: gcc-sm6375: Add runtime PM Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230717-topic-branch_aon_cleanup-v3-4-3e31bce9c626@linaro.org> References: <20230717-topic-branch_aon_cleanup-v3-0-3e31bce9c626@linaro.org> In-Reply-To: <20230717-topic-branch_aon_cleanup-v3-0-3e31bce9c626@linaro.org> To: Bjorn Andersson <andersson@kernel.org>, Andy Gross <agross@kernel.org>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org> Cc: Marijn Suijten <marijn.suijten@somainline.org>, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Konrad Dybcio <konrad.dybcio@linaro.org> X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703032250; l=2103; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=4UqVyq+AxibHs92QeNlETxsytT0HCThfcpvGOwkFOrI=; b=iiSeyWs/O2OzHZmgBEJRedCWaba3810lLJ3uOd1HuHXPKwcNas15q3llZzKivf1j0k5R+CVyG 64XDCxRuzftCQE18X1QayaGxOhMJjD7K/qKRoBUdjbrvpkjMZIkWJNv X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785758854603795572 X-GMAIL-MSGID: 1785758854603795572 |
Series |
Unregister critical branch clocks + some RPM
|
|
Commit Message
Konrad Dybcio
Dec. 20, 2023, 12:30 a.m. UTC
The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure
that CX is enabled to prevent unwanted power collapse and that the
reference is dropped when unused so that the system can enter a
firmware-managed lower power state.
Enable runtime PM to keep the power flowing only when necessary.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/clk/qcom/gcc-sm6375.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
Comments
On Wed, Dec 20, 2023 at 01:30:45AM +0100, Konrad Dybcio wrote: > The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure > that CX is enabled to prevent unwanted power collapse As I pointed out earlier, this bit of the commit message is incorrect and misleading as the power domain will never be disabled until you enable runtime PM as part of this very patch: https://lore.kernel.org/all/ZLaSpFFBzP_Yz5yY@hovoldconsulting.com/ Specifically, genpd will not power off CX (at runtime) while the driver is bound when runtime PM is left disabled. > and that the > reference is dropped when unused so that the system can enter a > firmware-managed lower power state. > > Enable runtime PM to keep the power flowing only when necessary. The rest is correct. Johan
On 20.12.2023 10:26, Johan Hovold wrote: > On Wed, Dec 20, 2023 at 01:30:45AM +0100, Konrad Dybcio wrote: >> The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure >> that CX is enabled to prevent unwanted power collapse > > As I pointed out earlier, this bit of the commit message is incorrect > and misleading as the power domain will never be disabled until you > enable runtime PM as part of this very patch: > > https://lore.kernel.org/all/ZLaSpFFBzP_Yz5yY@hovoldconsulting.com/ > > Specifically, genpd will not power off CX (at runtime) while the driver > is bound when runtime PM is left disabled. OK I only now see what you really meant. What this bit says is true, but it may be confusing within the context of this patch. The CX domain must be turned on [for the SoC to function], however this patch does not solve the issue of it being powered down [like you've said just binding the PD will keep it always-active for RPM-disabled devices]. It complements this process, by allowing it to shut down when unnecessary. > >> and that the >> reference is dropped when unused so that the system can enter a >> firmware-managed lower power state. >> >> Enable runtime PM to keep the power flowing only when necessary. > > The rest is correct. Let me try to reword this and see if you like it: The GCC block on SM6375 is powered by the VDD_CX rail. The Device Tree description of this dependency lets Linux keep the rail online to prevent power outages. It is however undesirable to keep it enabled at all times, as that consumes additional power. Moreover, failing to drop the "enabled" vote prevents firmware-managed, SoC-wide power collapse in suspend, which leads to even more wasted power. Enable runtime PM to keep the power flowing only when necessary. Konrad
On Wed, Dec 20, 2023 at 01:26:55PM +0100, Konrad Dybcio wrote: > On 20.12.2023 10:26, Johan Hovold wrote: > > On Wed, Dec 20, 2023 at 01:30:45AM +0100, Konrad Dybcio wrote: > >> The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure > >> that CX is enabled to prevent unwanted power collapse > > > > As I pointed out earlier, this bit of the commit message is incorrect > > and misleading as the power domain will never be disabled until you > > enable runtime PM as part of this very patch: > > > > https://lore.kernel.org/all/ZLaSpFFBzP_Yz5yY@hovoldconsulting.com/ > > > > Specifically, genpd will not power off CX (at runtime) while the driver > > is bound when runtime PM is left disabled. > OK I only now see what you really meant. > > What this bit says is true, but it may be confusing within the context > of this patch. I'd say it's misleading since it suggests that something can currently cause an "unwanted power collapse" which is not the case. > The CX domain must be turned on [for the SoC to function], however this > patch does not solve the issue of it being powered down [like you've said > just binding the PD will keep it always-active for RPM-disabled devices]. > It complements this process, by allowing it to shut down when unnecessary. Right, so just skip the misleading bits about "unwanted power collapse". > >> and that the > >> reference is dropped when unused so that the system can enter a > >> firmware-managed lower power state. > >> > >> Enable runtime PM to keep the power flowing only when necessary. > > > > The rest is correct. > Let me try to reword this and see if you like it: > > > The GCC block on SM6375 is powered by the VDD_CX rail. The Device Tree > description of this dependency lets Linux keep the rail online to prevent > power outages. It is however undesirable to keep it enabled at all times, > as that consumes additional power. I'd skip or rephrase the second sentence myself. > Moreover, failing to drop the "enabled" vote prevents firmware-managed, > SoC-wide power collapse in suspend, which leads to even more wasted power. However if this is what you meant by "firmware-managed lower power state" then this is not correct either. genpd will still power off the power domain during system suspend, regardless of whether a driver implements runtime PM. > Enable runtime PM to keep the power flowing only when necessary. So I'm starting to question whether we need this at all. AFAIK CX is never going to be disabled at runtime and this patch is not needed to disable CX during system suspend. Johan
On 20.12.2023 13:48, Johan Hovold wrote: > On Wed, Dec 20, 2023 at 01:26:55PM +0100, Konrad Dybcio wrote: >> On 20.12.2023 10:26, Johan Hovold wrote: >>> On Wed, Dec 20, 2023 at 01:30:45AM +0100, Konrad Dybcio wrote: >>>> The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure >>>> that CX is enabled to prevent unwanted power collapse >>> >>> As I pointed out earlier, this bit of the commit message is incorrect >>> and misleading as the power domain will never be disabled until you >>> enable runtime PM as part of this very patch: >>> >>> https://lore.kernel.org/all/ZLaSpFFBzP_Yz5yY@hovoldconsulting.com/ >>> >>> Specifically, genpd will not power off CX (at runtime) while the driver >>> is bound when runtime PM is left disabled. > >> OK I only now see what you really meant. >> >> What this bit says is true, but it may be confusing within the context >> of this patch. > > I'd say it's misleading since it suggests that something can currently > cause an "unwanted power collapse" which is not the case. > >> The CX domain must be turned on [for the SoC to function], however this >> patch does not solve the issue of it being powered down [like you've said >> just binding the PD will keep it always-active for RPM-disabled devices]. >> It complements this process, by allowing it to shut down when unnecessary. > > Right, so just skip the misleading bits about "unwanted power collapse". > >>>> and that the >>>> reference is dropped when unused so that the system can enter a >>>> firmware-managed lower power state. >>>> >>>> Enable runtime PM to keep the power flowing only when necessary. >>> >>> The rest is correct. > >> Let me try to reword this and see if you like it: >> >> >> The GCC block on SM6375 is powered by the VDD_CX rail. The Device Tree >> description of this dependency lets Linux keep the rail online to prevent >> power outages. It is however undesirable to keep it enabled at all times, >> as that consumes additional power. > > I'd skip or rephrase the second sentence myself. > >> Moreover, failing to drop the "enabled" vote prevents firmware-managed, >> SoC-wide power collapse in suspend, which leads to even more wasted power. > > However if this is what you meant by "firmware-managed lower power > state" then this is not correct either. genpd will still power off the > power domain during system suspend, regardless of whether a driver > implements runtime PM. Hm, right, I'm confusing runtime and system suspend in this message.. > >> Enable runtime PM to keep the power flowing only when necessary. > > So I'm starting to question whether we need this at all. AFAIK CX is > never going to be disabled at runtime and this patch is not needed to > disable CX during system suspend. After a bit of reconsideration, I think it would still be useful in rare circumstances, i.e. when all of the peripherals are runtime suspended, but at least one consumer that doesn't depend on GCC isn't (some remote procs, venus on some platforms). Remoteprocs actually directly tap into RPM/RPMh themselves, so that may not be necessary, but with Venus I'm not sure.. Then again, running Venus without e.g. GCC-dependent storage seems counter-intuitive. Then I suppose adding RPM to GCC may not be necessary after all (at least on platforms that don't use any different collapsible power domains).. As opposed to disp/gpu/whatever_cc which usually come with either a different domain, or a hefty required-opp and aren't required to be on 24/7 One last concern I have is, AFAICU currently CX is assumed by Linux to be the parent domain of all GDSCs within GCC (which is not true, but that's a separate topic). Can the PM core cope with properly dropping CX votes that are propagated up the chain? i.e. take this excerpt from sc8280xp.dtsi: // usb_0: usb@a6f8800 power-domains = <&gcc USB30_PRIM_GDSC>; required-opps = <&rpmhpd_opp_nom>; will runtime suspending USB drop the NOM (val = 256) vote from CX if runtime PM is disabled for GCC? I may be totally mixing up genpd, OPP and RPM, but to my defense it's not particularly hard to do so :D Konrad
diff --git a/drivers/clk/qcom/gcc-sm6375.c b/drivers/clk/qcom/gcc-sm6375.c index 44c74e74885f..dff0b2f20759 100644 --- a/drivers/clk/qcom/gcc-sm6375.c +++ b/drivers/clk/qcom/gcc-sm6375.c @@ -8,6 +8,7 @@ #include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <dt-bindings/clock/qcom,sm6375-gcc.h> @@ -3785,13 +3786,25 @@ static int gcc_sm6375_probe(struct platform_device *pdev) struct regmap *regmap; int ret; + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; + + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret) + return ret; + regmap = qcom_cc_map(pdev, &gcc_sm6375_desc); - if (IS_ERR(regmap)) + if (IS_ERR(regmap)) { + pm_runtime_put(&pdev->dev); return PTR_ERR(regmap); + } ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, ARRAY_SIZE(gcc_dfs_clocks)); - if (ret) + if (ret) { + pm_runtime_put(&pdev->dev); return ret; + } qcom_branch_set_clk_en(regmap, 0x17028); /* GCC_CAMERA_XO_CLK */ qcom_branch_set_clk_en(regmap, 0x2b004); /* GCC_CPUSS_GNOC_CLK */ @@ -3807,7 +3820,10 @@ static int gcc_sm6375_probe(struct platform_device *pdev) clk_lucid_pll_configure(&gpll8, regmap, &gpll8_config); clk_zonda_pll_configure(&gpll9, regmap, &gpll9_config); - return qcom_cc_really_probe(pdev, &gcc_sm6375_desc, regmap); + ret = qcom_cc_really_probe(pdev, &gcc_sm6375_desc, regmap); + pm_runtime_put(&pdev->dev); + + return ret; } static struct platform_driver gcc_sm6375_driver = {