Message ID | 20230717-topic-branch_aon_cleanup-v1-4-27784d27a4f4@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1177110vqt; Mon, 17 Jul 2023 08:20:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlF7+D98OA6oY9b0O1xxLDQmu4mXNGDdWl6Y8Ulg8R5EJaa4GLR2GeBIbTNbntqV/hpiZqw3 X-Received: by 2002:a05:6a00:218c:b0:67b:2eba:bed4 with SMTP id h12-20020a056a00218c00b0067b2ebabed4mr15844844pfi.14.1689607215601; Mon, 17 Jul 2023 08:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689607215; cv=none; d=google.com; s=arc-20160816; b=TlfytzoL2/TSufeqb60Nnuj0J/hj9mDYeysVXFlO+iNfRZCduO8XyBjgisYtzHjXKF mwz/XkCZRyH/+DdW9TUfwgznF2TPq0E0wHOTLSO9/xc2OS8TyuiGcxNzl55PLQwD/3ez U3TY8nH9zJGxC1s3mKyY1z1MiKO2gJ3IFYQPmYzYXBsbQ++aY7iI/WoLB2n8UCbeh5Rs DN5hQlmpddSJucMIMXIc7MoTpsM8pkggKAmTWiPkPNirobkkSABgKfaAJCVDDNJj6SQn /i8SC7/jl6k6W/b+Og3EGlhon44UC2faf56uEpTjusoDsuTHFh8u/LC5M2ekGJNCSn8B 7iiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=v5UGzoa3/koIQxPCbuvsSf/gSJDcDpJCJzVPK7lHYGg=; fh=E58dWdTK3D0DoIKuSZYoE/gJoipBIXlqiTk01lLVuRg=; b=jYxTNcJrbg7tKC2QP/WLoaehaiF2GEzLa/6/m1eK3NvZuX1U8iqs/o7Ts3rc00b1j/ DPb6ushcWVj0g6DwDfuTskyL+G7ZfrOYhX6P4gbouW+LH9Hxf8h5mZWRv1a7l5gIg6My SS/atKdV7fLwaLpX4dgicO16Fy6pX76uap0cC9fCGzhH7wf/NFxNh7U7FlMEGrmtmI43 VogLnyWiI7CQqyWqrn//BmCpb4DodJe3o2GpSOR2LsgyfuVl6SMDZu5fYLG8rhUvpFUl kxmy8EPNMS67PrzCvBuIFmd3TlBqCIEXOTb4b3vGpAz+HH/ulygAibxi7C//YRlwbke1 KqLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lvVIY5Hn; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h190-20020a636cc7000000b0055bc2561b72si11733306pgc.739.2023.07.17.08.20.01; Mon, 17 Jul 2023 08:20:15 -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=@linaro.org header.s=google header.b=lvVIY5Hn; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231560AbjGQPT3 (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Mon, 17 Jul 2023 11:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbjGQPTW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Jul 2023 11:19:22 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E60B10C8 for <linux-kernel@vger.kernel.org>; Mon, 17 Jul 2023 08:19:18 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4fbf1f6c771so7448562e87.1 for <linux-kernel@vger.kernel.org>; Mon, 17 Jul 2023 08:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689607156; x=1692199156; 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=v5UGzoa3/koIQxPCbuvsSf/gSJDcDpJCJzVPK7lHYGg=; b=lvVIY5HnPn775etSZkJURynY2sELYdbHS1aL5KCIr3doLxGDLnqsV3pw6iT8ywcyv7 PXv6Q3CxYOk/JR9hmr4AZwP8LJS1PKxZLfMDtahvpo3yZf3ocFX1E4shgymv645TRCKo IBM2c/D8OEJf6r/WzIWy0VHZAG8Ubm9cCvdF0eXtplWUp8863aHM844dbanbe21l+QNk KU9toeof+Es9vrY2kqbu0trTogO/L69I4Qiss7nPWr5qHSp8GPxFNzzlc6VmWCKsYODr 3UN+B1Smhq1wZWAisUEpXf/YmX3AK42rKdHkPlUiduUKG4UoWKQm8/A1snZ/W8aKezxN 5Svg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689607156; x=1692199156; 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=v5UGzoa3/koIQxPCbuvsSf/gSJDcDpJCJzVPK7lHYGg=; b=IsU4QtHepXCj7dc3sYefckYiF5JpUAoUr3OPo4uumymljQNA+gqZqOFxzGx+IG4TSx QttyUF4Wd43E6uq04d+zfqiEVBKlFKBPvH01V0iss/SHqGNgQBTeQEYY/XmCj8om0kQA JNYWECTKtigFOEo+EXfiRbTNQ62CxDtXX9m/9h5lvjOKBIy0q0CZd+ZigaOEG9GvZpsh EgC9Y3x64ednkUZhyKg0fyn9P/sd2GJoBeqb1BqotMC+G2eFk2RbDttEWFvchSo+9wkY 6728CSe4lihbZks9zi9kCcW3u+PTC1w0lzSNCJ3b8jwcsyBP8ZQgh80LrQ+ixBSilcdE mvwQ== X-Gm-Message-State: ABy/qLZOJXOFOh2AVUUVWmogqwL6DmB1l/sqNA94v1PFMjpud1ncrsnM wA/Y36lkPQUa6v6v+hMbItYeVQ== X-Received: by 2002:a05:6512:114e:b0:4f8:56cd:da8c with SMTP id m14-20020a056512114e00b004f856cdda8cmr8589577lfg.34.1689607156634; Mon, 17 Jul 2023 08:19:16 -0700 (PDT) Received: from [192.168.1.101] (abyj181.neoplus.adsl.tpnet.pl. [83.9.29.181]) by smtp.gmail.com with ESMTPSA id z7-20020ac24187000000b004f26d63f823sm2873949lfh.237.2023.07.17.08.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 08:19:16 -0700 (PDT) From: Konrad Dybcio <konrad.dybcio@linaro.org> Date: Mon, 17 Jul 2023 17:19:11 +0200 Subject: [PATCH 04/15] clk: qcom: gcc-sm6375: Add runtime PM MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230717-topic-branch_aon_cleanup-v1-4-27784d27a4f4@linaro.org> References: <20230717-topic-branch_aon_cleanup-v1-0-27784d27a4f4@linaro.org> In-Reply-To: <20230717-topic-branch_aon_cleanup-v1-0-27784d27a4f4@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=1689607149; l=1780; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=WXWB5RGonBM5RqpbxW2SMsHOf815i9gADOm2q9pJjmc=; b=pWDCxZlE9tVeTMDDwCA3p9Rrnt12uzwSvlwHXrl1IvLIW1632NI1TETMDnuB+qC3FrRMZgcEF TtvljvXN3azCzTks/QYfkOJ+xYNaQKKqWTAnKYaUWJ/hO2MD6rDpj2Y X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1771681575680081656 X-GMAIL-MSGID: 1771681575680081656 |
Series |
Unregister critical branch clocks + some RPM
|
|
Commit Message
Konrad Dybcio
July 17, 2023, 3:19 p.m. UTC
The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure
that it's enabled to prevent unwanted power collapse.
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 | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
Comments
On Mon, Jul 17, 2023 at 05:19:11PM +0200, Konrad Dybcio wrote: > The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure > that it's enabled to prevent unwanted power collapse. > > Enable runtime PM to keep the power flowing only when necessary. > Are you sure this is necessary? If VDD_CX was really possible to fully "power collapse" then I would expect that you lose all register settings. This is not something we want or can even handle for GCC. You would need to restore all frequency settings, branch bits etc etc. Otherwise it's a retention state, but these are covered by the corners/levels, not the enable/disable state. I think most of these power domains are effectively always-on. The important part is voting for minimal corners/levels so they can go to minimal retention state with vlow/vmin. Thanks, Stephan
On Mon, Jul 17, 2023 at 06:26:35PM +0200, Stephan Gerhold wrote: > On Mon, Jul 17, 2023 at 05:19:11PM +0200, Konrad Dybcio wrote: > > The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure > > that it's enabled to prevent unwanted power collapse. > > > > Enable runtime PM to keep the power flowing only when necessary. > > > > Are you sure this is necessary? If VDD_CX was really possible to fully > "power collapse" then I would expect that you lose all register > settings. This is not something we want or can even handle for GCC. > You would need to restore all frequency settings, branch bits etc etc. > This differ between platforms, some allow us to completely power down CX while keeping registers state using MX, others require that CX stays in retention at least. So, CX isn't the only rail powering GCC. For the most part though, we have a relationship between frequencies votes for by clients and the corner of CX, and hence I think the current description is ok... > Otherwise it's a retention state, but these are covered by the > corners/levels, not the enable/disable state. > I _think_ we still want to suspend each individual device (and the vote from Linux), and let the system keep us at retention, instead of off... > I think most of these power domains are effectively always-on. The > important part is voting for minimal corners/levels so they can go to > minimal retention state with vlow/vmin. > When you hit s2idle, you should expect to have the majority of the rpm(h) PDs be voted off. Regards, Bjorn > Thanks, > Stephan
On Mon, Jul 17, 2023 at 09:02:29PM -0700, Bjorn Andersson wrote: > On Mon, Jul 17, 2023 at 06:26:35PM +0200, Stephan Gerhold wrote: > > On Mon, Jul 17, 2023 at 05:19:11PM +0200, Konrad Dybcio wrote: > > > The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure > > > that it's enabled to prevent unwanted power collapse. > > > > > > Enable runtime PM to keep the power flowing only when necessary. > > > > > > > Are you sure this is necessary? If VDD_CX was really possible to fully > > "power collapse" then I would expect that you lose all register > > settings. This is not something we want or can even handle for GCC. > > You would need to restore all frequency settings, branch bits etc etc. > > > > This differ between platforms, some allow us to completely power down CX > while keeping registers state using MX, others require that CX stays in > retention at least. > > So, CX isn't the only rail powering GCC. For the most part though, we > have a relationship between frequencies votes for by clients and the > corner of CX, and hence I think the current description is ok... > This patch is just about sending enable/disable votes for the power domains though, based on runtime PM which triggers when all the clocks are disabled. It's unrelated to voting for CX corners required by certain clock frequencies (we handle those in the OPP tables of the consumers). And it's also unrelated to ensuring rentention of register contents since we actually release all votes when the clocks are idle. So while adding runtime PM to all the clock drivers sounds nice, I'm a bit confused what problem we're actually solving with this patch. :) Thanks, Stephan
On 18.07.2023 14:07, Stephan Gerhold wrote: > On Mon, Jul 17, 2023 at 09:02:29PM -0700, Bjorn Andersson wrote: >> On Mon, Jul 17, 2023 at 06:26:35PM +0200, Stephan Gerhold wrote: >>> On Mon, Jul 17, 2023 at 05:19:11PM +0200, Konrad Dybcio wrote: >>>> The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure >>>> that it's enabled to prevent unwanted power collapse. >>>> >>>> Enable runtime PM to keep the power flowing only when necessary. >>>> >>> >>> Are you sure this is necessary? If VDD_CX was really possible to fully >>> "power collapse" then I would expect that you lose all register >>> settings. This is not something we want or can even handle for GCC. >>> You would need to restore all frequency settings, branch bits etc etc. >>> >> >> This differ between platforms, some allow us to completely power down CX >> while keeping registers state using MX, others require that CX stays in >> retention at least. >> >> So, CX isn't the only rail powering GCC. For the most part though, we >> have a relationship between frequencies votes for by clients and the >> corner of CX, and hence I think the current description is ok... >> > > This patch is just about sending enable/disable votes for the power > domains though, based on runtime PM which triggers when all the clocks > are disabled. > > It's unrelated to voting for CX corners required by certain clock > frequencies (we handle those in the OPP tables of the consumers). > And it's also unrelated to ensuring rentention of register contents > since we actually release all votes when the clocks are idle. > > So while adding runtime PM to all the clock drivers sounds nice, I'm > a bit confused what problem we're actually solving with this patch. :) In a very specific and unfortunate situation, there could be no other CX votes, and trying to access (perhaps at least parts of) GCC would result in a failure. Konrad
On Mon, Jul 17, 2023 at 05:19:11PM +0200, Konrad Dybcio wrote: > The GCC block on SM6375 is powered by the VDD_CX rail. We need to ensure > that it's enabled to prevent unwanted power collapse. This bit is not correct either (and similar throughout the series). > Enable runtime PM to keep the power flowing only when necessary. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > + 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) Looks like you forgot to update this error path. > @@ -3817,7 +3828,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; Johan
diff --git a/drivers/clk/qcom/gcc-sm6375.c b/drivers/clk/qcom/gcc-sm6375.c index 14dafea45ac9..4b2de545d3f8 100644 --- a/drivers/clk/qcom/gcc-sm6375.c +++ b/drivers/clk/qcom/gcc-sm6375.c @@ -7,6 +7,7 @@ #include <linux/clk-provider.h> #include <linux/module.h> #include <linux/of_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <dt-bindings/clock/qcom,sm6375-gcc.h> @@ -3784,9 +3785,19 @@ 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) @@ -3817,7 +3828,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 = {