linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Andy Gross <agross@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>, Taniya Das <tdas@codeaurora.org>,
	Jonathan Marek <jonathan@marek.ca>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Mark Brown <broonie@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 3/8] clk: qcom: dispcc-sm8250: use runtime PM for the clock controller
Date: Thu, 7 Oct 2021 08:09:45 -0700	[thread overview]
Message-ID: <YV8NudkKvURyNqg7@ripper> (raw)
In-Reply-To: <20210829154757.784699-4-dmitry.baryshkov@linaro.org>

On Sun 29 Aug 08:47 PDT 2021, Dmitry Baryshkov wrote:

> On sm8250 dispcc and videocc registers are powered up by the MMCX power
> domain. Use runtime PM calls to make sure that required power domain is
> powered on while we access clock controller's registers.
> 

As I said on previous iterations, the clock framework will ensure that
the power domain is powered up around all calls back into the clock
driver, so for clocks this isn't needed.

But after digging some more, the gdsc registration needs this and I
don't mind keeping it on for the duration of the registration, rather
than having the clock framework turn it on and off.

As far as I can see the reset_controller won't actually access the
hardware during registration.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>



That said, qcom_reset_{assert,deassert}() doesn't seem to be performed
under a pm_runtime_get() section, so I believe that should be addressed
as well.  I don't see that we have a problem with this in practice as of
today, but it seems worthy to correct - unless I'm just missing
something.

Regards,
Bjorn

> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  drivers/clk/qcom/dispcc-sm8250.c | 27 +++++++++++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/qcom/dispcc-sm8250.c b/drivers/clk/qcom/dispcc-sm8250.c
> index 601c7c0ba483..108dd1249b6a 100644
> --- a/drivers/clk/qcom/dispcc-sm8250.c
> +++ b/drivers/clk/qcom/dispcc-sm8250.c
> @@ -6,6 +6,7 @@
>  #include <linux/clk-provider.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>  #include <linux/reset-controller.h>
>  
> @@ -1226,13 +1227,31 @@ static const struct of_device_id disp_cc_sm8250_match_table[] = {
>  };
>  MODULE_DEVICE_TABLE(of, disp_cc_sm8250_match_table);
>  
> +static void disp_cc_sm8250_pm_runtime_disable(void *data)
> +{
> +	pm_runtime_disable(data);
> +}
> +
>  static int disp_cc_sm8250_probe(struct platform_device *pdev)
>  {
>  	struct regmap *regmap;
> +	int ret;
> +
> +	pm_runtime_enable(&pdev->dev);
> +
> +	ret = devm_add_action_or_reset(&pdev->dev, disp_cc_sm8250_pm_runtime_disable, &pdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pm_runtime_resume_and_get(&pdev->dev);
> +	if (ret)
> +		return ret;
>  
>  	regmap = qcom_cc_map(pdev, &disp_cc_sm8250_desc);
> -	if (IS_ERR(regmap))
> +	if (IS_ERR(regmap)) {
> +		pm_runtime_put(&pdev->dev);
>  		return PTR_ERR(regmap);
> +	}
>  
>  	/* note: trion == lucid, except for the prepare() op */
>  	BUILD_BUG_ON(CLK_ALPHA_PLL_TYPE_TRION != CLK_ALPHA_PLL_TYPE_LUCID);
> @@ -1257,7 +1276,11 @@ static int disp_cc_sm8250_probe(struct platform_device *pdev)
>  	/* DISP_CC_XO_CLK always-on */
>  	regmap_update_bits(regmap, 0x605c, BIT(0), BIT(0));
>  
> -	return qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap);
> +	ret = qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap);
> +
> +	pm_runtime_put(&pdev->dev);
> +
> +	return ret;
>  }
>  
>  static struct platform_driver disp_cc_sm8250_driver = {
> -- 
> 2.33.0
> 

  reply	other threads:[~2021-10-07 15:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29 15:47 [PATCH v7 0/6] clk: qcom: use power-domain for sm8250's clock controllers Dmitry Baryshkov
2021-08-29 15:47 ` [PATCH v7 1/8] dt-bindings: clock: qcom,dispcc-sm8x50: add mmcx power domain Dmitry Baryshkov
2021-10-15  0:55   ` Stephen Boyd
2021-08-29 15:47 ` [PATCH v7 2/8] dt-bindings: clock: qcom,videocc: " Dmitry Baryshkov
2021-10-15  0:56   ` Stephen Boyd
2021-08-29 15:47 ` [PATCH v7 3/8] clk: qcom: dispcc-sm8250: use runtime PM for the clock controller Dmitry Baryshkov
2021-10-07 15:09   ` Bjorn Andersson [this message]
2021-10-15  0:56   ` Stephen Boyd
2021-08-29 15:47 ` [PATCH v7 4/8] clk: qcom: videocc-sm8250: " Dmitry Baryshkov
2021-10-07 15:10   ` Bjorn Andersson
2021-10-15  0:56   ` Stephen Boyd
2021-08-29 15:47 ` [PATCH v7 5/8] clk: qcom: gdsc: enable optional power domain support Dmitry Baryshkov
2021-10-07 15:11   ` Bjorn Andersson
2021-10-15  0:56   ` Stephen Boyd
2021-08-29 15:47 ` [PATCH v7 6/8] arm64: dts: qcom: sm8250: remove mmcx regulator Dmitry Baryshkov
2021-08-29 15:47 ` [PATCH v7 7/8] clk: qcom: dispcc-sm8250: stop using " Dmitry Baryshkov
2021-10-07 15:48   ` Bjorn Andersson
2021-10-07 16:16     ` Dmitry Baryshkov
2021-10-13 19:50       ` Stephen Boyd
2021-10-14  9:53         ` Dmitry Baryshkov
2021-10-15  0:01           ` Stephen Boyd
2021-10-15  0:04           ` Stephen Boyd
2021-10-15  0:15             ` Dmitry Baryshkov
     [not found]               ` <163425751841.1688384.11770181770221059842@swboyd.mtv.corp.google.com>
2021-10-15  0:46                 ` Bjorn Andersson
2021-10-15  0:49                   ` Stephen Boyd
2022-01-31 16:15     ` Dmitry Baryshkov
2021-08-29 15:47 ` [PATCH v7 8/8] clk: qcom: videocc-sm8250: " Dmitry Baryshkov
2021-09-07 14:23 ` [PATCH v7 0/6] clk: qcom: use power-domain for sm8250's clock controllers Ulf Hansson
2021-10-06 11:42 ` Dmitry Baryshkov
2021-10-17 15:31 ` (subset) " Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YV8NudkKvURyNqg7@ripper \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=broonie@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tdas@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).