[PATCH 01/48] clk: qcom: camcc-sa8775p: Use common probe handling for always-on clocks
From: Abel Vesa
Date: Wed Sep 16 2026 - 06:33:16 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 SA8775P and QCS8300 to preserve their
different CAMNOC XO, GDSC and sleep clock register offsets.
Assisted-by: LLM
Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
---
drivers/clk/qcom/camcc-sa8775p.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/drivers/clk/qcom/camcc-sa8775p.c b/drivers/clk/qcom/camcc-sa8775p.c
index 914478139e97..b0a8f0077dd8 100644
--- a/drivers/clk/qcom/camcc-sa8775p.c
+++ b/drivers/clk/qcom/camcc-sa8775p.c
@@ -1818,7 +1818,30 @@ static const struct regmap_config cam_cc_sa8775p_regmap_config = {
.fast_io = true,
};
+static const u32 cam_cc_sa8775p_critical_cbcrs[] = {
+ 0x13194, /* CAM_CC_CAMNOC_XO_CLK */
+ 0x131ec, /* CAM_CC_GDSC_CLK */
+ 0x13208, /* CAM_CC_SLEEP_CLK */
+};
+
+static const u32 cam_cc_qcs8300_critical_cbcrs[] = {
+ 0x13178, /* CAM_CC_CAMNOC_XO_CLK */
+ 0x131d0, /* CAM_CC_GDSC_CLK */
+ 0x131ec, /* CAM_CC_SLEEP_CLK */
+};
+
+static const struct qcom_cc_driver_data cam_cc_sa8775p_driver_data = {
+ .clk_cbcrs = cam_cc_sa8775p_critical_cbcrs,
+ .num_clk_cbcrs = ARRAY_SIZE(cam_cc_sa8775p_critical_cbcrs),
+};
+
+static const struct qcom_cc_driver_data cam_cc_qcs8300_driver_data = {
+ .clk_cbcrs = cam_cc_qcs8300_critical_cbcrs,
+ .num_clk_cbcrs = ARRAY_SIZE(cam_cc_qcs8300_critical_cbcrs),
+};
+
static const struct qcom_cc_desc cam_cc_sa8775p_desc = {
+ .driver_data = &cam_cc_sa8775p_driver_data,
.config = &cam_cc_sa8775p_regmap_config,
.clks = cam_cc_sa8775p_clocks,
.num_clks = ARRAY_SIZE(cam_cc_sa8775p_clocks),
@@ -1837,6 +1860,7 @@ MODULE_DEVICE_TABLE(of, cam_cc_sa8775p_match_table);
static int cam_cc_sa8775p_probe(struct platform_device *pdev)
{
+ struct qcom_cc_desc desc = cam_cc_sa8775p_desc;
struct regmap *regmap;
int ret;
@@ -1927,18 +1951,10 @@ static int cam_cc_sa8775p_probe(struct platform_device *pdev)
cam_cc_sa8775p_clocks[CAM_CC_TITAN_TOP_ACCU_SHIFT_CLK] =
&cam_cc_titan_top_accu_shift_clk.clkr;
- /* Keep some clocks always enabled */
- qcom_branch_set_clk_en(regmap, 0x13178); /* CAM_CC_CAMNOC_XO_CLK */
- qcom_branch_set_clk_en(regmap, 0x131d0); /* CAM_CC_GDSC_CLK */
- qcom_branch_set_clk_en(regmap, 0x131ec); /* CAM_CC_SLEEP_CLK */
- } else {
- /* Keep some clocks always enabled */
- qcom_branch_set_clk_en(regmap, 0x13194); /* CAM_CC_CAMNOC_XO_CLK */
- qcom_branch_set_clk_en(regmap, 0x131ec); /* CAM_CC_GDSC_CLK */
- qcom_branch_set_clk_en(regmap, 0x13208); /* CAM_CC_SLEEP_CLK */
+ desc.driver_data = &cam_cc_qcs8300_driver_data;
}
- ret = qcom_cc_really_probe(&pdev->dev, &cam_cc_sa8775p_desc, regmap);
+ ret = qcom_cc_really_probe(&pdev->dev, &desc, regmap);
pm_runtime_put(&pdev->dev);
--
2.54.0