[PATCH 48/48] clk: qcom: videocc-sm8350: Use common probe handling for always-on clocks
From: Abel Vesa
Date: Wed Sep 16 2026 - 06:50:54 EST
Describe the always-on branches in a critical_cbcrs array and reference
it through qcom_cc_driver_data. Let qcom_cc_really_probe() enable these
branches instead of programming them directly in the driver's probe.
Keep separate CBCR arrays for SM8350 and SC8280XP to preserve their
different XO clock register offsets.
Assisted-by: LLM
Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
---
drivers/clk/qcom/videocc-sm8350.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/qcom/videocc-sm8350.c b/drivers/clk/qcom/videocc-sm8350.c
index 057a9474894a..8528aeb3a342 100644
--- a/drivers/clk/qcom/videocc-sm8350.c
+++ b/drivers/clk/qcom/videocc-sm8350.c
@@ -510,7 +510,28 @@ static const struct regmap_config video_cc_sm8350_regmap_config = {
.fast_io = true,
};
+static const u32 video_cc_sm8350_critical_cbcrs[] = {
+ 0xe58, /* VIDEO_CC_AHB_CLK */
+ 0xeec, /* VIDEO_CC_XO_CLK */
+};
+
+static const u32 video_cc_sc8280xp_critical_cbcrs[] = {
+ 0xe58, /* VIDEO_CC_AHB_CLK */
+ 0xf34, /* VIDEO_CC_XO_CLK */
+};
+
+static const struct qcom_cc_driver_data video_cc_sm8350_driver_data = {
+ .clk_cbcrs = video_cc_sm8350_critical_cbcrs,
+ .num_clk_cbcrs = ARRAY_SIZE(video_cc_sm8350_critical_cbcrs),
+};
+
+static const struct qcom_cc_driver_data video_cc_sc8280xp_driver_data = {
+ .clk_cbcrs = video_cc_sc8280xp_critical_cbcrs,
+ .num_clk_cbcrs = ARRAY_SIZE(video_cc_sc8280xp_critical_cbcrs),
+};
+
static const struct qcom_cc_desc video_cc_sm8350_desc = {
+ .driver_data = &video_cc_sm8350_driver_data,
.config = &video_cc_sm8350_regmap_config,
.clks = video_cc_sm8350_clocks,
.num_clks = ARRAY_SIZE(video_cc_sm8350_clocks),
@@ -522,7 +543,7 @@ static const struct qcom_cc_desc video_cc_sm8350_desc = {
static int video_cc_sm8350_probe(struct platform_device *pdev)
{
- u32 video_cc_xo_clk_cbcr = 0xeec;
+ struct qcom_cc_desc desc = video_cc_sm8350_desc;
struct regmap *regmap;
int ret;
@@ -539,7 +560,7 @@ static int video_cc_sm8350_probe(struct platform_device *pdev)
video_cc_sleep_clk.halt_reg = 0xf58;
video_cc_sleep_clk.clkr.enable_reg = 0xf58;
video_cc_xo_clk_src.cmd_rcgr = 0xf14;
- video_cc_xo_clk_cbcr = 0xf34;
+ desc.driver_data = &video_cc_sc8280xp_driver_data;
video_pll0.vco_table = video_pll1.vco_table = lucid_5lpe_vco_8280xp;
/* No change, but assign it for completeness */
@@ -558,11 +579,7 @@ static int video_cc_sm8350_probe(struct platform_device *pdev)
clk_lucid_pll_configure(&video_pll0, regmap, &video_pll0_config);
clk_lucid_pll_configure(&video_pll1, regmap, &video_pll1_config);
- /* Keep some clocks always-on */
- qcom_branch_set_clk_en(regmap, 0xe58); /* VIDEO_CC_AHB_CLK */
- qcom_branch_set_clk_en(regmap, video_cc_xo_clk_cbcr); /* VIDEO_CC_XO_CLK */
-
- ret = qcom_cc_really_probe(&pdev->dev, &video_cc_sm8350_desc, regmap);
+ ret = qcom_cc_really_probe(&pdev->dev, &desc, regmap);
pm_runtime_put(&pdev->dev);
return ret;
--
2.54.0