Skip to content

Commit 7c0e876

Browse files
JIaxygaandersson
authored andcommitted
clk: qcom: dispcc-sm8450: Add SM8475 support
Add support to the SM8475 display clock controller by extending the SM8450 display 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 20e06dc commit 7c0e876

File tree

2 files changed

+64
-4
lines changed

2 files changed

+64
-4
lines changed

drivers/clk/qcom/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ config SM_DISPCC_8450
952952
depends on SM_GCC_8450
953953
help
954954
Support for the display clock controller on Qualcomm Technologies, Inc
955-
SM8450 devices.
955+
SM8450 or SM8475 devices.
956956
Say Y if you want to support display devices and functionality such as
957957
splash screen.
958958

drivers/clk/qcom/dispcc-sm8450.c

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ static const struct alpha_pll_config disp_cc_pll0_config = {
8585
.user_ctl_hi_val = 0x00000805,
8686
};
8787

88+
static const struct alpha_pll_config sm8475_disp_cc_pll0_config = {
89+
.l = 0xd,
90+
.alpha = 0x6492,
91+
.config_ctl_val = 0x20485699,
92+
.config_ctl_hi_val = 0x00182261,
93+
.config_ctl_hi1_val = 0x82aa299c,
94+
.test_ctl_val = 0x00000000,
95+
.test_ctl_hi_val = 0x00000003,
96+
.test_ctl_hi1_val = 0x00009000,
97+
.test_ctl_hi2_val = 0x00000034,
98+
.user_ctl_val = 0x00000000,
99+
.user_ctl_hi_val = 0x00000005,
100+
};
101+
102+
static struct clk_init_data sm8475_disp_cc_pll0_init = {
103+
.name = "disp_cc_pll0",
104+
.parent_data = &(const struct clk_parent_data) {
105+
.index = DT_BI_TCXO,
106+
},
107+
.num_parents = 1,
108+
.ops = &clk_alpha_pll_reset_lucid_ole_ops,
109+
};
110+
88111
static struct clk_alpha_pll disp_cc_pll0 = {
89112
.offset = 0x0,
90113
.vco_table = lucid_evo_vco,
@@ -112,6 +135,29 @@ static const struct alpha_pll_config disp_cc_pll1_config = {
112135
.user_ctl_hi_val = 0x00000805,
113136
};
114137

138+
static const struct alpha_pll_config sm8475_disp_cc_pll1_config = {
139+
.l = 0x1f,
140+
.alpha = 0x4000,
141+
.config_ctl_val = 0x20485699,
142+
.config_ctl_hi_val = 0x00182261,
143+
.config_ctl_hi1_val = 0x82aa299c,
144+
.test_ctl_val = 0x00000000,
145+
.test_ctl_hi_val = 0x00000003,
146+
.test_ctl_hi1_val = 0x00009000,
147+
.test_ctl_hi2_val = 0x00000034,
148+
.user_ctl_val = 0x00000000,
149+
.user_ctl_hi_val = 0x00000005,
150+
};
151+
152+
static struct clk_init_data sm8475_disp_cc_pll1_init = {
153+
.name = "disp_cc_pll1",
154+
.parent_data = &(const struct clk_parent_data) {
155+
.index = DT_BI_TCXO,
156+
},
157+
.num_parents = 1,
158+
.ops = &clk_alpha_pll_reset_lucid_ole_ops,
159+
};
160+
115161
static struct clk_alpha_pll disp_cc_pll1 = {
116162
.offset = 0x1000,
117163
.vco_table = lucid_evo_vco,
@@ -1746,6 +1792,7 @@ static struct qcom_cc_desc disp_cc_sm8450_desc = {
17461792

17471793
static const struct of_device_id disp_cc_sm8450_match_table[] = {
17481794
{ .compatible = "qcom,sm8450-dispcc" },
1795+
{ .compatible = "qcom,sm8475-dispcc" },
17491796
{ }
17501797
};
17511798
MODULE_DEVICE_TABLE(of, disp_cc_sm8450_match_table);
@@ -1769,8 +1816,21 @@ static int disp_cc_sm8450_probe(struct platform_device *pdev)
17691816
goto err_put_rpm;
17701817
}
17711818

1772-
clk_lucid_evo_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
1773-
clk_lucid_evo_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
1819+
if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8475-dispcc")) {
1820+
/* Update DISPCC PLL0 */
1821+
disp_cc_pll0.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
1822+
disp_cc_pll0.clkr.hw.init = &sm8475_disp_cc_pll0_init;
1823+
1824+
/* Update DISPCC PLL1 */
1825+
disp_cc_pll1.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_OLE];
1826+
disp_cc_pll1.clkr.hw.init = &sm8475_disp_cc_pll1_init;
1827+
1828+
clk_lucid_ole_pll_configure(&disp_cc_pll0, regmap, &sm8475_disp_cc_pll0_config);
1829+
clk_lucid_ole_pll_configure(&disp_cc_pll1, regmap, &sm8475_disp_cc_pll1_config);
1830+
} else {
1831+
clk_lucid_evo_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
1832+
clk_lucid_evo_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
1833+
}
17741834

17751835
/* Enable clock gating for MDP clocks */
17761836
regmap_update_bits(regmap, DISP_CC_MISC_CMD, 0x10, 0x10);
@@ -1802,5 +1862,5 @@ static struct platform_driver disp_cc_sm8450_driver = {
18021862

18031863
module_platform_driver(disp_cc_sm8450_driver);
18041864

1805-
MODULE_DESCRIPTION("QTI DISPCC SM8450 Driver");
1865+
MODULE_DESCRIPTION("QTI DISPCC SM8450 / SM8475 Driver");
18061866
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)