[PATCH 21/48] clk: qcom: gcc-sc7280: Use common clock controller probe data
From: Abel Vesa
Date: Wed Sep 16 2026 - 06:45:01 EST
Move the always-on branch register offsets into a critical_cbcrs array,
describe the DFS RCGs through qcom_cc_driver_data and move the register
programming into the clk_regs_configure callback.
Use qcom_cc_probe() to perform the common initialization instead of
open-coding it in the driver's probe.
Assisted-by: LLM
Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
---
drivers/clk/qcom/gcc-sc7280.c | 54 ++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/drivers/clk/qcom/gcc-sc7280.c b/drivers/clk/qcom/gcc-sc7280.c
index 4502926a2691..03913ae16e8f 100644
--- a/drivers/clk/qcom/gcc-sc7280.c
+++ b/drivers/clk/qcom/gcc-sc7280.c
@@ -3438,7 +3438,34 @@ static const struct regmap_config gcc_sc7280_regmap_config = {
.fast_io = true,
};
+static const u32 gcc_sc7280_critical_cbcrs[] = {
+ 0x26004, /* GCC_CAMERA_AHB_CLK */
+ 0x26028, /* GCC_CAMERA_XO_CLK */
+ 0x27004, /* GCC_DISP_AHB_CLK */
+ 0x2701c, /* GCC_DISP_XO_CLK */
+ 0x28004, /* GCC_VIDEO_AHB_CLK */
+ 0x28014, /* GCC_VIDEO_XO_CLK */
+ 0x71004, /* GCC_GPU_CFG_AHB_CLK */
+};
+
+static void gcc_sc7280_regs_configure(struct device *dev, struct regmap *regmap)
+{
+ regmap_update_bits(regmap, 0x7100C, BIT(13), BIT(13));
+
+ /* FORCE_MEM_CORE_ON for ufs phy ice core clocks */
+ qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true);
+}
+
+static const struct qcom_cc_driver_data gcc_sc7280_driver_data = {
+ .clk_cbcrs = gcc_sc7280_critical_cbcrs,
+ .num_clk_cbcrs = ARRAY_SIZE(gcc_sc7280_critical_cbcrs),
+ .dfs_rcgs = gcc_dfs_clocks,
+ .num_dfs_rcgs = ARRAY_SIZE(gcc_dfs_clocks),
+ .clk_regs_configure = gcc_sc7280_regs_configure,
+};
+
static const struct qcom_cc_desc gcc_sc7280_desc = {
+ .driver_data = &gcc_sc7280_driver_data,
.config = &gcc_sc7280_regmap_config,
.clks = gcc_sc7280_clocks,
.num_clks = ARRAY_SIZE(gcc_sc7280_clocks),
@@ -3456,32 +3483,7 @@ MODULE_DEVICE_TABLE(of, gcc_sc7280_match_table);
static int gcc_sc7280_probe(struct platform_device *pdev)
{
- struct regmap *regmap;
- int ret;
-
- regmap = qcom_cc_map(pdev, &gcc_sc7280_desc);
- if (IS_ERR(regmap))
- return PTR_ERR(regmap);
-
- /* Keep some clocks always-on */
- qcom_branch_set_clk_en(regmap, 0x26004);/* GCC_CAMERA_AHB_CLK */
- qcom_branch_set_clk_en(regmap, 0x26028);/* GCC_CAMERA_XO_CLK */
- qcom_branch_set_clk_en(regmap, 0x27004);/* GCC_DISP_AHB_CLK */
- qcom_branch_set_clk_en(regmap, 0x2701c);/* GCC_DISP_XO_CLK */
- qcom_branch_set_clk_en(regmap, 0x28004);/* GCC_VIDEO_AHB_CLK */
- qcom_branch_set_clk_en(regmap, 0x28014);/* GCC_VIDEO_XO_CLK */
- qcom_branch_set_clk_en(regmap, 0x71004);/* GCC_GPU_CFG_AHB_CLK */
- regmap_update_bits(regmap, 0x7100C, BIT(13), BIT(13));
-
- /* FORCE_MEM_CORE_ON for ufs phy ice core clocks */
- qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true);
-
- ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks,
- ARRAY_SIZE(gcc_dfs_clocks));
- if (ret)
- return ret;
-
- return qcom_cc_really_probe(&pdev->dev, &gcc_sc7280_desc, regmap);
+ return qcom_cc_probe(pdev, &gcc_sc7280_desc);
}
static struct platform_driver gcc_sc7280_driver = {
--
2.54.0