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-sm8650: Move PLL & clk configuration to really probe

Camera PLLs on SM8650 require both MMCX and MXC rails to be kept ON
to configure the PLLs properly. Hence move runtime power management,
PLL configuration and enabling critical clocks to qcom_cc_really_probe()
which ensures all required power domains are in enabled state before
configuring the PLLs or enabling the clocks.

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20250530-videocc-pll-multi-pd-voting-v5-11-02303b3a582d@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Jagadeesh Kona and committed by
Bjorn Andersson
3f8dd231 adb50c76

+42 -41
+42 -41
drivers/clk/qcom/camcc-sm8650.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,sm8650-camcc.h> ··· 71 72 72 73 static struct clk_alpha_pll cam_cc_pll0 = { 73 74 .offset = 0x0, 75 + .config = &cam_cc_pll0_config, 74 76 .vco_table = lucid_ole_vco, 75 77 .num_vco = ARRAY_SIZE(lucid_ole_vco), 76 78 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 149 149 150 150 static struct clk_alpha_pll cam_cc_pll1 = { 151 151 .offset = 0x1000, 152 + .config = &cam_cc_pll1_config, 152 153 .vco_table = lucid_ole_vco, 153 154 .num_vco = ARRAY_SIZE(lucid_ole_vco), 154 155 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 200 199 201 200 static struct clk_alpha_pll cam_cc_pll2 = { 202 201 .offset = 0x2000, 202 + .config = &cam_cc_pll2_config, 203 203 .vco_table = rivian_ole_vco, 204 204 .num_vco = ARRAY_SIZE(rivian_ole_vco), 205 205 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_RIVIAN_EVO], ··· 232 230 233 231 static struct clk_alpha_pll cam_cc_pll3 = { 234 232 .offset = 0x3000, 233 + .config = &cam_cc_pll3_config, 235 234 .vco_table = lucid_ole_vco, 236 235 .num_vco = ARRAY_SIZE(lucid_ole_vco), 237 236 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 287 284 288 285 static struct clk_alpha_pll cam_cc_pll4 = { 289 286 .offset = 0x4000, 287 + .config = &cam_cc_pll4_config, 290 288 .vco_table = lucid_ole_vco, 291 289 .num_vco = ARRAY_SIZE(lucid_ole_vco), 292 290 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 342 338 343 339 static struct clk_alpha_pll cam_cc_pll5 = { 344 340 .offset = 0x5000, 341 + .config = &cam_cc_pll5_config, 345 342 .vco_table = lucid_ole_vco, 346 343 .num_vco = ARRAY_SIZE(lucid_ole_vco), 347 344 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 397 392 398 393 static struct clk_alpha_pll cam_cc_pll6 = { 399 394 .offset = 0x6000, 395 + .config = &cam_cc_pll6_config, 400 396 .vco_table = lucid_ole_vco, 401 397 .num_vco = ARRAY_SIZE(lucid_ole_vco), 402 398 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 452 446 453 447 static struct clk_alpha_pll cam_cc_pll7 = { 454 448 .offset = 0x7000, 449 + .config = &cam_cc_pll7_config, 455 450 .vco_table = lucid_ole_vco, 456 451 .num_vco = ARRAY_SIZE(lucid_ole_vco), 457 452 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 507 500 508 501 static struct clk_alpha_pll cam_cc_pll8 = { 509 502 .offset = 0x8000, 503 + .config = &cam_cc_pll8_config, 510 504 .vco_table = lucid_ole_vco, 511 505 .num_vco = ARRAY_SIZE(lucid_ole_vco), 512 506 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 562 554 563 555 static struct clk_alpha_pll cam_cc_pll9 = { 564 556 .offset = 0x9000, 557 + .config = &cam_cc_pll9_config, 565 558 .vco_table = lucid_ole_vco, 566 559 .num_vco = ARRAY_SIZE(lucid_ole_vco), 567 560 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 640 631 641 632 static struct clk_alpha_pll cam_cc_pll10 = { 642 633 .offset = 0xa000, 634 + .config = &cam_cc_pll10_config, 643 635 .vco_table = lucid_ole_vco, 644 636 .num_vco = ARRAY_SIZE(lucid_ole_vco), 645 637 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 3519 3509 [CAM_CC_SFE_2_BCR] = { 0x130f4 }, 3520 3510 }; 3521 3511 3512 + static struct clk_alpha_pll *cam_cc_sm8650_plls[] = { 3513 + &cam_cc_pll0, 3514 + &cam_cc_pll1, 3515 + &cam_cc_pll2, 3516 + &cam_cc_pll3, 3517 + &cam_cc_pll4, 3518 + &cam_cc_pll5, 3519 + &cam_cc_pll6, 3520 + &cam_cc_pll7, 3521 + &cam_cc_pll8, 3522 + &cam_cc_pll9, 3523 + &cam_cc_pll10, 3524 + }; 3525 + 3526 + static u32 cam_cc_sm8650_critical_cbcrs[] = { 3527 + 0x132ec, /* CAM_CC_GDSC_CLK */ 3528 + 0x13308, /* CAM_CC_SLEEP_CLK */ 3529 + 0x13314, /* CAM_CC_DRV_XO_CLK */ 3530 + 0x13318, /* CAM_CC_DRV_AHB_CLK */ 3531 + }; 3532 + 3522 3533 static const struct regmap_config cam_cc_sm8650_regmap_config = { 3523 3534 .reg_bits = 32, 3524 3535 .reg_stride = 4, 3525 3536 .val_bits = 32, 3526 3537 .max_register = 0x1603c, 3527 3538 .fast_io = true, 3539 + }; 3540 + 3541 + static struct qcom_cc_driver_data cam_cc_sm8650_driver_data = { 3542 + .alpha_plls = cam_cc_sm8650_plls, 3543 + .num_alpha_plls = ARRAY_SIZE(cam_cc_sm8650_plls), 3544 + .clk_cbcrs = cam_cc_sm8650_critical_cbcrs, 3545 + .num_clk_cbcrs = ARRAY_SIZE(cam_cc_sm8650_critical_cbcrs), 3528 3546 }; 3529 3547 3530 3548 static const struct qcom_cc_desc cam_cc_sm8650_desc = { ··· 3563 3525 .num_resets = ARRAY_SIZE(cam_cc_sm8650_resets), 3564 3526 .gdscs = cam_cc_sm8650_gdscs, 3565 3527 .num_gdscs = ARRAY_SIZE(cam_cc_sm8650_gdscs), 3528 + .use_rpm = true, 3529 + .driver_data = &cam_cc_sm8650_driver_data, 3566 3530 }; 3567 3531 3568 3532 static const struct of_device_id cam_cc_sm8650_match_table[] = { ··· 3575 3535 3576 3536 static int cam_cc_sm8650_probe(struct platform_device *pdev) 3577 3537 { 3578 - struct regmap *regmap; 3579 - int ret; 3580 - 3581 - ret = devm_pm_runtime_enable(&pdev->dev); 3582 - if (ret) 3583 - return ret; 3584 - 3585 - ret = pm_runtime_resume_and_get(&pdev->dev); 3586 - if (ret) 3587 - return ret; 3588 - 3589 - regmap = qcom_cc_map(pdev, &cam_cc_sm8650_desc); 3590 - if (IS_ERR(regmap)) { 3591 - pm_runtime_put(&pdev->dev); 3592 - return PTR_ERR(regmap); 3593 - } 3594 - 3595 - clk_lucid_ole_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config); 3596 - clk_lucid_ole_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config); 3597 - clk_rivian_evo_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config); 3598 - clk_lucid_ole_pll_configure(&cam_cc_pll3, regmap, &cam_cc_pll3_config); 3599 - clk_lucid_ole_pll_configure(&cam_cc_pll4, regmap, &cam_cc_pll4_config); 3600 - clk_lucid_ole_pll_configure(&cam_cc_pll5, regmap, &cam_cc_pll5_config); 3601 - clk_lucid_ole_pll_configure(&cam_cc_pll6, regmap, &cam_cc_pll6_config); 3602 - clk_lucid_ole_pll_configure(&cam_cc_pll7, regmap, &cam_cc_pll7_config); 3603 - clk_lucid_ole_pll_configure(&cam_cc_pll8, regmap, &cam_cc_pll8_config); 3604 - clk_lucid_ole_pll_configure(&cam_cc_pll9, regmap, &cam_cc_pll9_config); 3605 - clk_lucid_ole_pll_configure(&cam_cc_pll10, regmap, &cam_cc_pll10_config); 3606 - 3607 - /* Keep clocks always enabled */ 3608 - qcom_branch_set_clk_en(regmap, 0x13318); /* CAM_CC_DRV_AHB_CLK */ 3609 - qcom_branch_set_clk_en(regmap, 0x13314); /* CAM_CC_DRV_XO_CLK */ 3610 - qcom_branch_set_clk_en(regmap, 0x132ec); /* CAM_CC_GDSC_CLK */ 3611 - qcom_branch_set_clk_en(regmap, 0x13308); /* CAM_CC_SLEEP_CLK */ 3612 - 3613 - ret = qcom_cc_really_probe(&pdev->dev, &cam_cc_sm8650_desc, regmap); 3614 - 3615 - pm_runtime_put(&pdev->dev); 3616 - 3617 - return ret; 3538 + return qcom_cc_probe(pdev, &cam_cc_sm8650_desc); 3618 3539 } 3619 3540 3620 3541 static struct platform_driver cam_cc_sm8650_driver = {