Skip to content

Commit f7f4afd

Browse files
JIaxygaandersson
authored andcommitted
clk: qcom: videocc-sm8450: Add SM8475 support
Add support to the SM8475 video clock controller by extending the SM8450 video clock controller, which is almost identical but has some minor differences. Signed-off-by: Danila Tikhonov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 0b71e3b commit f7f4afd

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

drivers/clk/qcom/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ config SM_VIDEOCC_8450
12851285
select QCOM_GDSC
12861286
help
12871287
Support for the video clock controller on Qualcomm Technologies, Inc.
1288-
SM8450 devices.
1288+
SM8450 or SM8475 devices.
12891289
Say Y if you want to support video devices and functionality such as
12901290
video encode/decode.
12911291
endif

drivers/clk/qcom/videocc-sm8450.c

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ static const struct alpha_pll_config video_cc_pll0_config = {
4646
.user_ctl_hi_val = 0x00000805,
4747
};
4848

49+
static const struct alpha_pll_config sm8475_video_cc_pll0_config = {
50+
/* .l includes CAL_L_VAL, L_VAL fields */
51+
.l = 0x1e,
52+
.alpha = 0x0,
53+
.config_ctl_val = 0x20485699,
54+
.config_ctl_hi_val = 0x00182261,
55+
.config_ctl_hi1_val = 0x82aa299c,
56+
.test_ctl_val = 0x00000000,
57+
.test_ctl_hi_val = 0x00000003,
58+
.test_ctl_hi1_val = 0x00009000,
59+
.test_ctl_hi2_val = 0x00000034,
60+
.user_ctl_val = 0x00000000,
61+
.user_ctl_hi_val = 0x00000005,
62+
};
63+
4964
static struct clk_alpha_pll video_cc_pll0 = {
5065
.offset = 0x0,
5166
.vco_table = lucid_evo_vco,
@@ -74,6 +89,21 @@ static const struct alpha_pll_config video_cc_pll1_config = {
7489
.user_ctl_hi_val = 0x00000805,
7590
};
7691

92+
static const struct alpha_pll_config sm8475_video_cc_pll1_config = {
93+
/* .l includes CAL_L_VAL, L_VAL fields */
94+
.l = 0x2b,
95+
.alpha = 0xc000,
96+
.config_ctl_val = 0x20485699,
97+
.config_ctl_hi_val = 0x00182261,
98+
.config_ctl_hi1_val = 0x82aa299c,
99+
.test_ctl_val = 0x00000000,
100+
.test_ctl_hi_val = 0x00000003,
101+
.test_ctl_hi1_val = 0x00009000,
102+
.test_ctl_hi2_val = 0x00000034,
103+
.user_ctl_val = 0x00000000,
104+
.user_ctl_hi_val = 0x00000005,
105+
};
106+
77107
static struct clk_alpha_pll video_cc_pll1 = {
78108
.offset = 0x1000,
79109
.vco_table = lucid_evo_vco,
@@ -397,6 +427,7 @@ static struct qcom_cc_desc video_cc_sm8450_desc = {
397427

398428
static const struct of_device_id video_cc_sm8450_match_table[] = {
399429
{ .compatible = "qcom,sm8450-videocc" },
430+
{ .compatible = "qcom,sm8475-videocc" },
400431
{ }
401432
};
402433
MODULE_DEVICE_TABLE(of, video_cc_sm8450_match_table);
@@ -420,8 +451,19 @@ static int video_cc_sm8450_probe(struct platform_device *pdev)
420451
return PTR_ERR(regmap);
421452
}
422453

423-
clk_lucid_evo_pll_configure(&video_cc_pll0, regmap, &video_cc_pll0_config);
424-
clk_lucid_evo_pll_configure(&video_cc_pll1, regmap, &video_cc_pll1_config);
454+
if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8475-videocc")) {
455+
/* Update VideoCC PLL0 */
456+
video_cc_pll0.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
457+
458+
/* Update VideoCC PLL1 */
459+
video_cc_pll1.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
460+
461+
clk_lucid_ole_pll_configure(&video_cc_pll0, regmap, &sm8475_video_cc_pll0_config);
462+
clk_lucid_ole_pll_configure(&video_cc_pll1, regmap, &sm8475_video_cc_pll1_config);
463+
} else {
464+
clk_lucid_evo_pll_configure(&video_cc_pll0, regmap, &video_cc_pll0_config);
465+
clk_lucid_evo_pll_configure(&video_cc_pll1, regmap, &video_cc_pll1_config);
466+
}
425467

426468
/* Keep some clocks always-on */
427469
qcom_branch_set_clk_en(regmap, 0x80e4); /* VIDEO_CC_AHB_CLK */
@@ -445,5 +487,5 @@ static struct platform_driver video_cc_sm8450_driver = {
445487

446488
module_platform_driver(video_cc_sm8450_driver);
447489

448-
MODULE_DESCRIPTION("QTI VIDEOCC SM8450 Driver");
490+
MODULE_DESCRIPTION("QTI VIDEOCC SM8450 / SM8475 Driver");
449491
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)