From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Satya Priya Kakitapalli <quic_skakitap@quicinc.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Abhishek Sahu <absahu@codeaurora.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Ajit Pandey <quic_ajipan@quicinc.com>,
Imran Shaik <quic_imrashai@quicinc.com>,
Taniya Das <quic_tdas@quicinc.com>,
Jagadeesh Kona <quic_jkona@quicinc.com>
Subject: Re: [PATCH 4/5] clk: qcom: Add camera clock controller driver for SM8150
Date: Sat, 2 Mar 2024 16:13:19 +0000 [thread overview]
Message-ID: <18567989-fb60-49ae-92e6-94e1bc2fa1c7@linaro.org> (raw)
In-Reply-To: <20240229-camcc-support-sm8150-v1-4-8c28c6c87990@quicinc.com>
On 29/02/2024 5:38 a.m., Satya Priya Kakitapalli wrote:
> Add support for the camera clock controller for camera clients
> to be able to request for camcc clocks on SM8150 platform.
>
> Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@quicinc.com>
> ---
> +static int cam_cc_sm8150_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, &cam_cc_sm8150_desc);
> + if (IS_ERR(regmap)) {
> + pm_runtime_put(&pdev->dev);
> + return PTR_ERR(regmap);
> + }
> +
> + clk_trion_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config);
> + clk_trion_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config);
> + clk_regera_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config);
> + clk_trion_pll_configure(&cam_cc_pll3, regmap, &cam_cc_pll3_config);
> + clk_trion_pll_configure(&cam_cc_pll4, regmap, &cam_cc_pll4_config);
> +
> + /* Keep the critical clock always-on */
> + qcom_branch_set_clk_en(regmap, 0xc1e4); /* cam_cc_gdsc_clk */
Does this clock need to be specified this way ?
drivers/clk/qcom/camcc-sc8280xp.c::camcc_gdsc_clk specifies the gdsc
clock as a shared op clock.
Actually it looks to be register compatible, please try defining
titan_top_gdsc as per the example in 8280xp.
> +
> + ret = qcom_cc_really_probe(pdev, &cam_cc_sm8150_desc, regmap);
> +
> + pm_runtime_put(&pdev->dev);
> +
> + return ret;
> +}
So this is a pattern we keep repeating in the clock probe() functions
which I am writing a series to address. There's no need to continue to
replicate the bug in new code though.
Only switch on always-on clocks if probe succeeds.
ret = qcom_cc_really_probe(pdev, &cam_cc_sm8150_desc, regmap);
if (ret)
goto probe_err;
qcom_branch_set_clk_en(regmap, 0xc1e4); /* cam_cc_gdsc_clk */
pm_runtime_put(&pdev->dev);
return 0;
probe_err:
pm_runtime_put_sync(&pdev->dev);
Alternatively switch on the always-on clocks before the really_probe()
but then roll back in a probe_err: goto
probe_err:
remap_bits_update(regmap, 0xc1e4, BIT(0), 0);
pm_runtime_put_sync(&pdev->dev);
There may be corner cases where always-on has to happen before
really_probe() I suppose but as a general pattern the above should be
how we go.
Anyway I suspect the right thing to do is to define a titan_top_gdsc_clk
with shared ops to "park" the GDSC clock to 19.2 MHz instead of turning
it off.
You can get rid of the hard-coded always-on and indeed represent the
clock in /sysfs - which is preferable IMO to just whacking registers to
keep clocks always-on in probe anyway.
Please try to define the titan_top_gdsc_clk as a shared_ops clock
instead of hard coding to always on.
If that doesn't work for some reason, then please fix your always-on
logic in probe() to only make the clock fixed on, if really_probe()
succeeds.
---
bod
next prev parent reply other threads:[~2024-03-02 16:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 5:38 [PATCH 0/5] clk: qcom: sm8150: Add camera clock controller support for SM8150 Satya Priya Kakitapalli
2024-02-29 5:38 ` [PATCH 1/5] clk: qcom: alpha-pll: Fix the pll post div mask Satya Priya Kakitapalli
2024-03-01 23:48 ` Konrad Dybcio
2024-02-29 5:38 ` [PATCH 2/5] clk: qcom: clk-alpha-pll: Add support for Regera PLL ops Satya Priya Kakitapalli
2024-03-01 23:56 ` Konrad Dybcio
2024-03-08 8:26 ` Satya Priya Kakitapalli (Temp)
2024-03-13 18:43 ` Konrad Dybcio
2024-02-29 5:38 ` [PATCH 3/5] dt-bindings: clock: qcom: Add SM8150 camera clock controller Satya Priya Kakitapalli
2024-02-29 8:00 ` Krzysztof Kozlowski
2024-02-29 5:38 ` [PATCH 4/5] clk: qcom: Add camera clock controller driver for SM8150 Satya Priya Kakitapalli
2024-03-02 16:13 ` Bryan O'Donoghue [this message]
2024-03-06 8:30 ` Satya Priya Kakitapalli (Temp)
2024-03-06 13:55 ` Bryan O'Donoghue
2024-03-08 10:46 ` Satya Priya Kakitapalli (Temp)
2024-03-08 10:58 ` Bryan O'Donoghue
2024-03-08 10:59 ` Bryan O'Donoghue
2024-03-08 12:40 ` Satya Priya Kakitapalli (Temp)
2024-03-08 13:04 ` Bryan O'Donoghue
2024-03-08 11:54 ` Dmitry Baryshkov
2024-03-28 9:42 ` Satya Priya Kakitapalli (Temp)
2024-04-05 6:27 ` Satya Priya Kakitapalli (Temp)
2024-04-05 21:32 ` Stephen Boyd
2024-02-29 5:38 ` [PATCH 5/5] arm64: dts: qcom: Add camera clock controller for sm8150 Satya Priya Kakitapalli
2024-03-02 16:15 ` Bryan O'Donoghue
2024-03-06 8:32 ` Satya Priya Kakitapalli (Temp)
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=18567989-fb60-49ae-92e6-94e1bc2fa1c7@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=absahu@codeaurora.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.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@codeaurora.org \
--cc=sboyd@kernel.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).