Skip to content

Commit 0b71e3b

Browse files
JIaxygaandersson
authored andcommitted
clk: qcom: gpucc-sm8450: Add SM8475 support
Add support to the SM8475 graphics clock controller by extending the SM8450 graphics 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 7c0e876 commit 0b71e3b

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

drivers/clk/qcom/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,8 @@ config SM_GPUCC_8450
11501150
depends on ARM64 || COMPILE_TEST
11511151
select SM_GCC_8450
11521152
help
1153-
Support for the graphics clock controller on SM8450 devices.
1153+
Support for the graphics clock controller on SM8450 or SM8475
1154+
devices.
11541155
Say Y if you want to support graphics controller devices and
11551156
functionality such as 3D graphics.
11561157

drivers/clk/qcom/gpucc-sm8450.c

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const struct pll_vco lucid_evo_vco[] = {
4040
{ 249600000, 2000000000, 0 },
4141
};
4242

43-
static struct alpha_pll_config gpu_cc_pll0_config = {
43+
static const struct alpha_pll_config gpu_cc_pll0_config = {
4444
.l = 0x1d,
4545
.alpha = 0xb000,
4646
.config_ctl_val = 0x20485699,
@@ -50,6 +50,20 @@ static struct alpha_pll_config gpu_cc_pll0_config = {
5050
.user_ctl_hi_val = 0x00000805,
5151
};
5252

53+
static const struct alpha_pll_config sm8475_gpu_cc_pll0_config = {
54+
.l = 0x1d,
55+
.alpha = 0xb000,
56+
.config_ctl_val = 0x20485699,
57+
.config_ctl_hi_val = 0x00182261,
58+
.config_ctl_hi1_val = 0x82aa299c,
59+
.test_ctl_val = 0x00000000,
60+
.test_ctl_hi_val = 0x00000003,
61+
.test_ctl_hi1_val = 0x00009000,
62+
.test_ctl_hi2_val = 0x00000034,
63+
.user_ctl_val = 0x00000000,
64+
.user_ctl_hi_val = 0x00000005,
65+
};
66+
5367
static struct clk_alpha_pll gpu_cc_pll0 = {
5468
.offset = 0x0,
5569
.vco_table = lucid_evo_vco,
@@ -67,7 +81,7 @@ static struct clk_alpha_pll gpu_cc_pll0 = {
6781
},
6882
};
6983

70-
static struct alpha_pll_config gpu_cc_pll1_config = {
84+
static const struct alpha_pll_config gpu_cc_pll1_config = {
7185
.l = 0x34,
7286
.alpha = 0x1555,
7387
.config_ctl_val = 0x20485699,
@@ -77,6 +91,20 @@ static struct alpha_pll_config gpu_cc_pll1_config = {
7791
.user_ctl_hi_val = 0x00000805,
7892
};
7993

94+
static const struct alpha_pll_config sm8475_gpu_cc_pll1_config = {
95+
.l = 0x34,
96+
.alpha = 0x1555,
97+
.config_ctl_val = 0x20485699,
98+
.config_ctl_hi_val = 0x00182261,
99+
.config_ctl_hi1_val = 0x82aa299c,
100+
.test_ctl_val = 0x00000000,
101+
.test_ctl_hi_val = 0x00000003,
102+
.test_ctl_hi1_val = 0x00009000,
103+
.test_ctl_hi2_val = 0x00000034,
104+
.user_ctl_val = 0x00000000,
105+
.user_ctl_hi_val = 0x00000005,
106+
};
107+
80108
static struct clk_alpha_pll gpu_cc_pll1 = {
81109
.offset = 0x1000,
82110
.vco_table = lucid_evo_vco,
@@ -736,6 +764,7 @@ static const struct qcom_cc_desc gpu_cc_sm8450_desc = {
736764

737765
static const struct of_device_id gpu_cc_sm8450_match_table[] = {
738766
{ .compatible = "qcom,sm8450-gpucc" },
767+
{ .compatible = "qcom,sm8475-gpucc" },
739768
{ }
740769
};
741770
MODULE_DEVICE_TABLE(of, gpu_cc_sm8450_match_table);
@@ -748,8 +777,19 @@ static int gpu_cc_sm8450_probe(struct platform_device *pdev)
748777
if (IS_ERR(regmap))
749778
return PTR_ERR(regmap);
750779

751-
clk_lucid_evo_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config);
752-
clk_lucid_evo_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config);
780+
if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8475-gpucc")) {
781+
/* Update GPUCC PLL0 */
782+
gpu_cc_pll0.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
783+
784+
/* Update GPUCC PLL1 */
785+
gpu_cc_pll1.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
786+
787+
clk_lucid_ole_pll_configure(&gpu_cc_pll0, regmap, &sm8475_gpu_cc_pll0_config);
788+
clk_lucid_ole_pll_configure(&gpu_cc_pll1, regmap, &sm8475_gpu_cc_pll1_config);
789+
} else {
790+
clk_lucid_evo_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config);
791+
clk_lucid_evo_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config);
792+
}
753793

754794
return qcom_cc_really_probe(&pdev->dev, &gpu_cc_sm8450_desc, regmap);
755795
}
@@ -763,5 +803,5 @@ static struct platform_driver gpu_cc_sm8450_driver = {
763803
};
764804
module_platform_driver(gpu_cc_sm8450_driver);
765805

766-
MODULE_DESCRIPTION("QTI GPU_CC SM8450 Driver");
806+
MODULE_DESCRIPTION("QTI GPU_CC SM8450 / SM8475 Driver");
767807
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)