Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: qcom: camcc-sc8180x: Refactor to use qcom_cc_driver_data

Use a qcom_cc_driver_data struct instead of a long custom probe
callback to align with modern qcom/gcc-*.c style.

No functional change intended.

Signed-off-by: Val Packett <val@packett.cool>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260312112321.370983-12-val@packett.cool
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Val Packett and committed by
Bjorn Andersson
b39ae8c2 acf7a91d

+32 -35
+32 -35
drivers/clk/qcom/camcc-sc8180x.c
··· 7 7 #include <linux/mod_devicetable.h> 8 8 #include <linux/module.h> 9 9 #include <linux/platform_device.h> 10 - #include <linux/pm_runtime.h> 11 10 #include <linux/regmap.h> 12 11 13 12 #include <dt-bindings/clock/qcom,sc8180x-camcc.h> ··· 62 63 63 64 static struct clk_alpha_pll cam_cc_pll0 = { 64 65 .offset = 0x0, 66 + .config = &cam_cc_pll0_config, 65 67 .vco_table = trion_vco, 66 68 .num_vco = ARRAY_SIZE(trion_vco), 67 69 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ··· 138 138 139 139 static struct clk_alpha_pll cam_cc_pll1 = { 140 140 .offset = 0x1000, 141 + .config = &cam_cc_pll1_config, 141 142 .vco_table = trion_vco, 142 143 .num_vco = ARRAY_SIZE(trion_vco), 143 144 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ··· 168 167 169 168 static struct clk_alpha_pll cam_cc_pll2 = { 170 169 .offset = 0x2000, 170 + .config = &cam_cc_pll2_config, 171 171 .vco_table = regera_vco, 172 172 .num_vco = ARRAY_SIZE(regera_vco), 173 173 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_REGERA], ··· 221 219 222 220 static struct clk_alpha_pll cam_cc_pll3 = { 223 221 .offset = 0x3000, 222 + .config = &cam_cc_pll3_config, 224 223 .vco_table = trion_vco, 225 224 .num_vco = ARRAY_SIZE(trion_vco), 226 225 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ··· 251 248 252 249 static struct clk_alpha_pll cam_cc_pll4 = { 253 250 .offset = 0x4000, 251 + .config = &cam_cc_pll4_config, 254 252 .vco_table = trion_vco, 255 253 .num_vco = ARRAY_SIZE(trion_vco), 256 254 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ··· 281 277 282 278 static struct clk_alpha_pll cam_cc_pll5 = { 283 279 .offset = 0x4078, 280 + .config = &cam_cc_pll5_config, 284 281 .vco_table = trion_vco, 285 282 .num_vco = ARRAY_SIZE(trion_vco), 286 283 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ··· 311 306 312 307 static struct clk_alpha_pll cam_cc_pll6 = { 313 308 .offset = 0x40f0, 309 + .config = &cam_cc_pll6_config, 314 310 .vco_table = trion_vco, 315 311 .num_vco = ARRAY_SIZE(trion_vco), 316 312 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], ··· 2819 2813 [CAM_CC_MCLK7_BCR] = { 0x50e0 }, 2820 2814 }; 2821 2815 2816 + static struct clk_alpha_pll *cam_cc_sc8180x_plls[] = { 2817 + &cam_cc_pll0, 2818 + &cam_cc_pll1, 2819 + &cam_cc_pll2, 2820 + &cam_cc_pll3, 2821 + &cam_cc_pll4, 2822 + &cam_cc_pll5, 2823 + &cam_cc_pll6, 2824 + }; 2825 + 2826 + static u32 cam_cc_sc8180x_critical_cbcrs[] = { 2827 + 0xc1e4, /* CAM_CC_GDSC_CLK */ 2828 + 0xc200, /* CAM_CC_SLEEP_CLK */ 2829 + }; 2830 + 2822 2831 static const struct regmap_config cam_cc_sc8180x_regmap_config = { 2823 2832 .reg_bits = 32, 2824 2833 .reg_stride = 4, 2825 2834 .val_bits = 32, 2826 2835 .max_register = 0xf0d4, 2827 2836 .fast_io = true, 2837 + }; 2838 + 2839 + static struct qcom_cc_driver_data cam_cc_sc8180x_driver_data = { 2840 + .alpha_plls = cam_cc_sc8180x_plls, 2841 + .num_alpha_plls = ARRAY_SIZE(cam_cc_sc8180x_plls), 2842 + .clk_cbcrs = cam_cc_sc8180x_critical_cbcrs, 2843 + .num_clk_cbcrs = ARRAY_SIZE(cam_cc_sc8180x_critical_cbcrs), 2828 2844 }; 2829 2845 2830 2846 static const struct qcom_cc_desc cam_cc_sc8180x_desc = { ··· 2857 2829 .num_resets = ARRAY_SIZE(cam_cc_sc8180x_resets), 2858 2830 .gdscs = cam_cc_sc8180x_gdscs, 2859 2831 .num_gdscs = ARRAY_SIZE(cam_cc_sc8180x_gdscs), 2832 + .use_rpm = true, 2833 + .driver_data = &cam_cc_sc8180x_driver_data, 2860 2834 }; 2861 2835 2862 2836 static const struct of_device_id cam_cc_sc8180x_match_table[] = { ··· 2869 2839 2870 2840 static int cam_cc_sc8180x_probe(struct platform_device *pdev) 2871 2841 { 2872 - struct regmap *regmap; 2873 - int ret; 2874 - 2875 - ret = devm_pm_runtime_enable(&pdev->dev); 2876 - if (ret) 2877 - return ret; 2878 - 2879 - ret = pm_runtime_resume_and_get(&pdev->dev); 2880 - if (ret) 2881 - return ret; 2882 - 2883 - regmap = qcom_cc_map(pdev, &cam_cc_sc8180x_desc); 2884 - if (IS_ERR(regmap)) { 2885 - pm_runtime_put(&pdev->dev); 2886 - return PTR_ERR(regmap); 2887 - } 2888 - 2889 - clk_trion_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config); 2890 - clk_trion_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config); 2891 - clk_regera_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config); 2892 - clk_trion_pll_configure(&cam_cc_pll3, regmap, &cam_cc_pll3_config); 2893 - clk_trion_pll_configure(&cam_cc_pll4, regmap, &cam_cc_pll4_config); 2894 - clk_trion_pll_configure(&cam_cc_pll5, regmap, &cam_cc_pll5_config); 2895 - clk_trion_pll_configure(&cam_cc_pll6, regmap, &cam_cc_pll6_config); 2896 - 2897 - /* Keep some clocks always enabled */ 2898 - qcom_branch_set_clk_en(regmap, 0xc1e4); /* CAM_CC_GDSC_CLK */ 2899 - qcom_branch_set_clk_en(regmap, 0xc200); /* CAM_CC_SLEEP_CLK */ 2900 - 2901 - ret = qcom_cc_really_probe(&pdev->dev, &cam_cc_sc8180x_desc, regmap); 2902 - 2903 - pm_runtime_put(&pdev->dev); 2904 - 2905 - return ret; 2842 + return qcom_cc_probe(pdev, &cam_cc_sc8180x_desc); 2906 2843 } 2907 2844 2908 2845 static struct platform_driver cam_cc_sc8180x_driver = {