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

Camera PLLs on SM8550 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: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@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-10-02303b3a582d@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Jagadeesh Kona and committed by
Bjorn Andersson
adb50c76 eb65d754

+44 -41
+44 -41
drivers/clk/qcom/camcc-sm8550.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,sm8550-camcc.h> ··· 73 74 74 75 static struct clk_alpha_pll cam_cc_pll0 = { 75 76 .offset = 0x0, 77 + .config = &cam_cc_pll0_config, 76 78 .vco_table = lucid_ole_vco, 77 79 .num_vco = ARRAY_SIZE(lucid_ole_vco), 78 80 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 151 151 152 152 static struct clk_alpha_pll cam_cc_pll1 = { 153 153 .offset = 0x1000, 154 + .config = &cam_cc_pll1_config, 154 155 .vco_table = lucid_ole_vco, 155 156 .num_vco = ARRAY_SIZE(lucid_ole_vco), 156 157 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 202 201 203 202 static struct clk_alpha_pll cam_cc_pll2 = { 204 203 .offset = 0x2000, 204 + .config = &cam_cc_pll2_config, 205 205 .vco_table = rivian_ole_vco, 206 206 .num_vco = ARRAY_SIZE(rivian_ole_vco), 207 207 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_RIVIAN_EVO], ··· 234 232 235 233 static struct clk_alpha_pll cam_cc_pll3 = { 236 234 .offset = 0x3000, 235 + .config = &cam_cc_pll3_config, 237 236 .vco_table = lucid_ole_vco, 238 237 .num_vco = ARRAY_SIZE(lucid_ole_vco), 239 238 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 289 286 290 287 static struct clk_alpha_pll cam_cc_pll4 = { 291 288 .offset = 0x4000, 289 + .config = &cam_cc_pll4_config, 292 290 .vco_table = lucid_ole_vco, 293 291 .num_vco = ARRAY_SIZE(lucid_ole_vco), 294 292 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 344 340 345 341 static struct clk_alpha_pll cam_cc_pll5 = { 346 342 .offset = 0x5000, 343 + .config = &cam_cc_pll5_config, 347 344 .vco_table = lucid_ole_vco, 348 345 .num_vco = ARRAY_SIZE(lucid_ole_vco), 349 346 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 399 394 400 395 static struct clk_alpha_pll cam_cc_pll6 = { 401 396 .offset = 0x6000, 397 + .config = &cam_cc_pll6_config, 402 398 .vco_table = lucid_ole_vco, 403 399 .num_vco = ARRAY_SIZE(lucid_ole_vco), 404 400 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 454 448 455 449 static struct clk_alpha_pll cam_cc_pll7 = { 456 450 .offset = 0x7000, 451 + .config = &cam_cc_pll7_config, 457 452 .vco_table = lucid_ole_vco, 458 453 .num_vco = ARRAY_SIZE(lucid_ole_vco), 459 454 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 509 502 510 503 static struct clk_alpha_pll cam_cc_pll8 = { 511 504 .offset = 0x8000, 505 + .config = &cam_cc_pll8_config, 512 506 .vco_table = lucid_ole_vco, 513 507 .num_vco = ARRAY_SIZE(lucid_ole_vco), 514 508 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 564 556 565 557 static struct clk_alpha_pll cam_cc_pll9 = { 566 558 .offset = 0x9000, 559 + .config = &cam_cc_pll9_config, 567 560 .vco_table = lucid_ole_vco, 568 561 .num_vco = ARRAY_SIZE(lucid_ole_vco), 569 562 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 619 610 620 611 static struct clk_alpha_pll cam_cc_pll10 = { 621 612 .offset = 0xa000, 613 + .config = &cam_cc_pll10_config, 622 614 .vco_table = lucid_ole_vco, 623 615 .num_vco = ARRAY_SIZE(lucid_ole_vco), 624 616 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 674 664 675 665 static struct clk_alpha_pll cam_cc_pll11 = { 676 666 .offset = 0xb000, 667 + .config = &cam_cc_pll11_config, 677 668 .vco_table = lucid_ole_vco, 678 669 .num_vco = ARRAY_SIZE(lucid_ole_vco), 679 670 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 729 718 730 719 static struct clk_alpha_pll cam_cc_pll12 = { 731 720 .offset = 0xc000, 721 + .config = &cam_cc_pll12_config, 732 722 .vco_table = lucid_ole_vco, 733 723 .num_vco = ARRAY_SIZE(lucid_ole_vco), 734 724 .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE], ··· 3491 3479 [CAM_CC_SFE_1_BCR] = { 0x133dc }, 3492 3480 }; 3493 3481 3482 + static struct clk_alpha_pll *cam_cc_sm8550_plls[] = { 3483 + &cam_cc_pll0, 3484 + &cam_cc_pll1, 3485 + &cam_cc_pll2, 3486 + &cam_cc_pll3, 3487 + &cam_cc_pll4, 3488 + &cam_cc_pll5, 3489 + &cam_cc_pll6, 3490 + &cam_cc_pll7, 3491 + &cam_cc_pll8, 3492 + &cam_cc_pll9, 3493 + &cam_cc_pll10, 3494 + &cam_cc_pll11, 3495 + &cam_cc_pll12, 3496 + }; 3497 + 3498 + static u32 cam_cc_sm8550_critical_cbcrs[] = { 3499 + 0x1419c, /* CAM_CC_GDSC_CLK */ 3500 + 0x142cc, /* CAM_CC_SLEEP_CLK */ 3501 + }; 3502 + 3494 3503 static const struct regmap_config cam_cc_sm8550_regmap_config = { 3495 3504 .reg_bits = 32, 3496 3505 .reg_stride = 4, 3497 3506 .val_bits = 32, 3498 3507 .max_register = 0x16320, 3499 3508 .fast_io = true, 3509 + }; 3510 + 3511 + static struct qcom_cc_driver_data cam_cc_sm8550_driver_data = { 3512 + .alpha_plls = cam_cc_sm8550_plls, 3513 + .num_alpha_plls = ARRAY_SIZE(cam_cc_sm8550_plls), 3514 + .clk_cbcrs = cam_cc_sm8550_critical_cbcrs, 3515 + .num_clk_cbcrs = ARRAY_SIZE(cam_cc_sm8550_critical_cbcrs), 3500 3516 }; 3501 3517 3502 3518 static const struct qcom_cc_desc cam_cc_sm8550_desc = { ··· 3535 3495 .num_resets = ARRAY_SIZE(cam_cc_sm8550_resets), 3536 3496 .gdscs = cam_cc_sm8550_gdscs, 3537 3497 .num_gdscs = ARRAY_SIZE(cam_cc_sm8550_gdscs), 3498 + .use_rpm = true, 3499 + .driver_data = &cam_cc_sm8550_driver_data, 3538 3500 }; 3539 3501 3540 3502 static const struct of_device_id cam_cc_sm8550_match_table[] = { ··· 3547 3505 3548 3506 static int cam_cc_sm8550_probe(struct platform_device *pdev) 3549 3507 { 3550 - struct regmap *regmap; 3551 - int ret; 3552 - 3553 - ret = devm_pm_runtime_enable(&pdev->dev); 3554 - if (ret) 3555 - return ret; 3556 - 3557 - ret = pm_runtime_resume_and_get(&pdev->dev); 3558 - if (ret) 3559 - return ret; 3560 - 3561 - regmap = qcom_cc_map(pdev, &cam_cc_sm8550_desc); 3562 - if (IS_ERR(regmap)) { 3563 - pm_runtime_put(&pdev->dev); 3564 - return PTR_ERR(regmap); 3565 - } 3566 - 3567 - clk_lucid_ole_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config); 3568 - clk_lucid_ole_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config); 3569 - clk_rivian_evo_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config); 3570 - clk_lucid_ole_pll_configure(&cam_cc_pll3, regmap, &cam_cc_pll3_config); 3571 - clk_lucid_ole_pll_configure(&cam_cc_pll4, regmap, &cam_cc_pll4_config); 3572 - clk_lucid_ole_pll_configure(&cam_cc_pll5, regmap, &cam_cc_pll5_config); 3573 - clk_lucid_ole_pll_configure(&cam_cc_pll6, regmap, &cam_cc_pll6_config); 3574 - clk_lucid_ole_pll_configure(&cam_cc_pll7, regmap, &cam_cc_pll7_config); 3575 - clk_lucid_ole_pll_configure(&cam_cc_pll8, regmap, &cam_cc_pll8_config); 3576 - clk_lucid_ole_pll_configure(&cam_cc_pll9, regmap, &cam_cc_pll9_config); 3577 - clk_lucid_ole_pll_configure(&cam_cc_pll10, regmap, &cam_cc_pll10_config); 3578 - clk_lucid_ole_pll_configure(&cam_cc_pll11, regmap, &cam_cc_pll11_config); 3579 - clk_lucid_ole_pll_configure(&cam_cc_pll12, regmap, &cam_cc_pll12_config); 3580 - 3581 - /* Keep some clocks always-on */ 3582 - qcom_branch_set_clk_en(regmap, 0x1419c); /* CAM_CC_GDSC_CLK */ 3583 - qcom_branch_set_clk_en(regmap, 0x142cc); /* CAM_CC_SLEEP_CLK */ 3584 - 3585 - ret = qcom_cc_really_probe(&pdev->dev, &cam_cc_sm8550_desc, regmap); 3586 - 3587 - pm_runtime_put(&pdev->dev); 3588 - 3589 - return ret; 3508 + return qcom_cc_probe(pdev, &cam_cc_sm8550_desc); 3590 3509 } 3591 3510 3592 3511 static struct platform_driver cam_cc_sm8550_driver = {