Linux clock framework development
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bod.linux@nxsw.ie>
To: Jagadeesh Kona <quic_jkona@quicinc.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Dmitry Baryshkov <lumag@kernel.org>
Cc: Ajit Pandey <quic_ajipan@quicinc.com>,
	Imran Shaik <quic_imrashai@quicinc.com>,
	Taniya Das <quic_tdas@quicinc.com>,
	Satya Priya Kakitapalli <quic_skakitap@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Subject: Re: [PATCH v5 08/18] clk: qcom: videocc-sm8550: Move PLL & clk configuration to really probe
Date: Tue, 03 Jun 2025 08:02:51 +0000	[thread overview]
Message-ID: <dc8d4ca9-93bf-4aed-a744-d8b799e01606@nxsw.ie> (raw)
In-Reply-To: <20250530-videocc-pll-multi-pd-voting-v5-8-02303b3a582d@quicinc.com>

On 30/05/2025 14:20, Jagadeesh Kona wrote:
> Video PLLs on SM8550/SM8650 require both MMCX and MXC rails to be kept ON
> to configure the PLLs properly. Hence move runtime power management, PLL
> configuration and enable critical clocks to qcom_cc_really_probe() which
> ensures all required power domains are in enabled state before configuring
> the PLLs or enabling the clocks.
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com>
> ---
>   drivers/clk/qcom/videocc-sm8550.c | 66 +++++++++++++++++++--------------------
>   1 file changed, 33 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/clk/qcom/videocc-sm8550.c b/drivers/clk/qcom/videocc-sm8550.c
> index fcfe0cade6d0a95e749aabbc2af1174e5a70f0db..3e5891b43ee404edc6c99bbf8f2583cb44df9e37 100644
> --- a/drivers/clk/qcom/videocc-sm8550.c
> +++ b/drivers/clk/qcom/videocc-sm8550.c
> @@ -7,7 +7,6 @@
>   #include <linux/mod_devicetable.h>
>   #include <linux/module.h>
>   #include <linux/platform_device.h>
> -#include <linux/pm_runtime.h>
>   #include <linux/regmap.h>
> 
>   #include <dt-bindings/clock/qcom,sm8650-videocc.h>
> @@ -51,6 +50,7 @@ static struct alpha_pll_config video_cc_pll0_config = {
> 
>   static struct clk_alpha_pll video_cc_pll0 = {
>   	.offset = 0x0,
> +	.config = &video_cc_pll0_config,
>   	.vco_table = lucid_ole_vco,
>   	.num_vco = ARRAY_SIZE(lucid_ole_vco),
>   	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE],
> @@ -82,6 +82,7 @@ static struct alpha_pll_config video_cc_pll1_config = {
> 
>   static struct clk_alpha_pll video_cc_pll1 = {
>   	.offset = 0x1000,
> +	.config = &video_cc_pll1_config,
>   	.vco_table = lucid_ole_vco,
>   	.num_vco = ARRAY_SIZE(lucid_ole_vco),
>   	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE],
> @@ -511,6 +512,23 @@ static const struct qcom_reset_map video_cc_sm8550_resets[] = {
>   	[VIDEO_CC_XO_CLK_ARES] = { .reg = 0x8124, .bit = 2, .udelay = 100 },
>   };
> 
> +static struct clk_alpha_pll *video_cc_sm8550_plls[] = {
> +	&video_cc_pll0,
> +	&video_cc_pll1,
> +};
> +
> +static u32 video_cc_sm8550_critical_cbcrs[] = {
> +	0x80f4, /* VIDEO_CC_AHB_CLK */
> +	0x8124, /* VIDEO_CC_XO_CLK */
> +	0x8140, /* VIDEO_CC_SLEEP_CLK */
> +};
> +
> +static u32 video_cc_sm8650_critical_cbcrs[] = {
> +	0x80f4, /* VIDEO_CC_AHB_CLK */
> +	0x8124, /* VIDEO_CC_XO_CLK */
> +	0x8150, /* VIDEO_CC_SLEEP_CLK */
> +};
> +
>   static const struct regmap_config video_cc_sm8550_regmap_config = {
>   	.reg_bits = 32,
>   	.reg_stride = 4,
> @@ -519,6 +537,13 @@ static const struct regmap_config video_cc_sm8550_regmap_config = {
>   	.fast_io = true,
>   };
> 
> +static struct qcom_cc_driver_data video_cc_sm8550_driver_data = {
> +	.alpha_plls = video_cc_sm8550_plls,
> +	.num_alpha_plls = ARRAY_SIZE(video_cc_sm8550_plls),
> +	.clk_cbcrs = video_cc_sm8550_critical_cbcrs,
> +	.num_clk_cbcrs = ARRAY_SIZE(video_cc_sm8550_critical_cbcrs),
> +};
> +
>   static const struct qcom_cc_desc video_cc_sm8550_desc = {
>   	.config = &video_cc_sm8550_regmap_config,
>   	.clks = video_cc_sm8550_clocks,
> @@ -527,6 +552,8 @@ static const struct qcom_cc_desc video_cc_sm8550_desc = {
>   	.num_resets = ARRAY_SIZE(video_cc_sm8550_resets),
>   	.gdscs = video_cc_sm8550_gdscs,
>   	.num_gdscs = ARRAY_SIZE(video_cc_sm8550_gdscs),
> +	.use_rpm = true,
> +	.driver_data = &video_cc_sm8550_driver_data,
>   };
> 
>   static const struct of_device_id video_cc_sm8550_match_table[] = {
> @@ -538,26 +565,7 @@ MODULE_DEVICE_TABLE(of, video_cc_sm8550_match_table);
> 
>   static int video_cc_sm8550_probe(struct platform_device *pdev)
>   {
> -	struct regmap *regmap;
> -	int ret;
> -	u32 sleep_clk_offset = 0x8140;
> -
> -	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, &video_cc_sm8550_desc);
> -	if (IS_ERR(regmap)) {
> -		pm_runtime_put(&pdev->dev);
> -		return PTR_ERR(regmap);
> -	}
> -
>   	if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8650-videocc")) {
> -		sleep_clk_offset = 0x8150;
>   		video_cc_pll0_config.l = 0x1e;
>   		video_cc_pll0_config.alpha = 0xa000;
>   		video_cc_pll1_config.l = 0x2b;
> @@ -569,21 +577,13 @@ static int video_cc_sm8550_probe(struct platform_device *pdev)
>   		video_cc_sm8550_clocks[VIDEO_CC_MVS1_SHIFT_CLK] = &video_cc_mvs1_shift_clk.clkr;
>   		video_cc_sm8550_clocks[VIDEO_CC_MVS1C_SHIFT_CLK] = &video_cc_mvs1c_shift_clk.clkr;
>   		video_cc_sm8550_clocks[VIDEO_CC_XO_CLK_SRC] = &video_cc_xo_clk_src.clkr;
> -	}
> -
> -	clk_lucid_ole_pll_configure(&video_cc_pll0, regmap, &video_cc_pll0_config);
> -	clk_lucid_ole_pll_configure(&video_cc_pll1, regmap, &video_cc_pll1_config);
> 
> -	/* Keep some clocks always-on */
> -	qcom_branch_set_clk_en(regmap, 0x80f4); /* VIDEO_CC_AHB_CLK */
> -	qcom_branch_set_clk_en(regmap, sleep_clk_offset); /* VIDEO_CC_SLEEP_CLK */
> -	qcom_branch_set_clk_en(regmap, 0x8124); /* VIDEO_CC_XO_CLK */
> -
> -	ret = qcom_cc_really_probe(&pdev->dev, &video_cc_sm8550_desc, regmap);
> -
> -	pm_runtime_put(&pdev->dev);
> +		video_cc_sm8550_driver_data.clk_cbcrs = video_cc_sm8650_critical_cbcrs;
> +		video_cc_sm8550_driver_data.num_clk_cbcrs =
> +							ARRAY_SIZE(video_cc_sm8650_critical_cbcrs);
> +	}
> 
> -	return ret;
> +	return qcom_cc_probe(pdev, &video_cc_sm8550_desc);
>   }
> 
>   static struct platform_driver video_cc_sm8550_driver = {
> 
> --
> 2.34.1
> 
> 
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>


  parent reply	other threads:[~2025-06-03  8:03 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 13:20 [PATCH v5 00/18] clk: qcom: Add support to attach multiple power domains in cc probe Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 01/18] dt-bindings: clock: qcom,sm8450-videocc: Add MXC power domain Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 02/18] dt-bindings: clock: qcom,sm8450-camcc: Allow to specify two power domains Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 03/18] dt-bindings: clock: qcom,sm8450-camcc: Move sc8280xp camcc to sa8775p camcc Jagadeesh Kona
2025-06-03  7:04   ` Krzysztof Kozlowski
2025-05-30 13:20 ` [PATCH v5 04/18] clk: qcom: clk-alpha-pll: Add support for common PLL configuration function Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 05/18] clk: qcom: common: Handle runtime power management in qcom_cc_really_probe Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 06/18] clk: qcom: common: Add support to configure clk regs " Jagadeesh Kona
2025-05-30 23:00   ` Konrad Dybcio
2025-05-30 13:20 ` [PATCH v5 07/18] clk: qcom: videocc-sm8450: Move PLL & clk configuration to really probe Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 08/18] clk: qcom: videocc-sm8550: " Jagadeesh Kona
2025-05-30 22:57   ` Konrad Dybcio
2025-06-03  8:02   ` Bryan O'Donoghue [this message]
2025-05-30 13:20 ` [PATCH v5 09/18] clk: qcom: camcc-sm8450: " Jagadeesh Kona
2025-06-03  8:05   ` Bryan O'Donoghue
2025-05-30 13:20 ` [PATCH v5 10/18] clk: qcom: camcc-sm8550: " Jagadeesh Kona
2025-06-03  8:06   ` Bryan O'Donoghue
2025-05-30 13:20 ` [PATCH v5 11/18] clk: qcom: camcc-sm8650: " Jagadeesh Kona
2025-06-03  8:07   ` Bryan O'Donoghue
2025-05-30 13:20 ` [PATCH v5 12/18] clk: qcom: camcc-x1e80100: " Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 13/18] arm64: dts: qcom: sm8450: Additionally manage MXC power domain in videocc Jagadeesh Kona
2025-05-30 13:20 ` [PATCH v5 14/18] arm64: dts: qcom: sm8550: " Jagadeesh Kona
2025-05-30 13:21 ` [PATCH v5 15/18] arm64: dts: qcom: sm8650: " Jagadeesh Kona
2025-05-30 13:21 ` [PATCH v5 16/18] arm64: dts: qcom: sm8450: Additionally manage MXC power domain in camcc Jagadeesh Kona
2025-06-03  8:08   ` Bryan O'Donoghue
2025-05-30 13:21 ` [PATCH v5 17/18] arm64: dts: qcom: sm8550: " Jagadeesh Kona
2025-06-03  8:09   ` Bryan O'Donoghue
2025-05-30 13:21 ` [PATCH v5 18/18] arm64: dts: qcom: sm8650: " Jagadeesh Kona
2025-06-03  8:09   ` Bryan O'Donoghue
2025-06-03  8:09 ` [PATCH v5 00/18] clk: qcom: Add support to attach multiple power domains in cc probe Bryan O'Donoghue
2025-06-12  4:00 ` (subset) " Bjorn Andersson
2025-06-12 10:03   ` Jagadeesh Kona
2025-06-12 10:52     ` Krzysztof Kozlowski
2025-06-16  7:25       ` Jagadeesh Kona
2025-06-17 13:27         ` Bjorn Andersson
2025-06-17 19:16           ` Jagadeesh Kona
2025-07-29 14:49 ` neil.armstrong
2025-07-30  9:50   ` Jagadeesh Kona

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=dc8d4ca9-93bf-4aed-a744-d8b799e01606@nxsw.ie \
    --to=bod.linux@nxsw.ie \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=quic_ajipan@quicinc.com \
    --cc=quic_imrashai@quicinc.com \
    --cc=quic_jkona@quicinc.com \
    --cc=quic_skakitap@quicinc.com \
    --cc=quic_tdas@quicinc.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vladimir.zapolskiy@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