Skip to content

Commit 205737f

Browse files
fltoandersson
authored andcommitted
clk: qcom: add support for SM8350 DISPCC
Add support to the SM8350 display clock controller by extending the SM8250 display clock controller, which is almost identical but has some minor differences. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Robert Foss <robert.foss@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220706154337.2026269-5-robert.foss@linaro.org
1 parent 160758b commit 205737f

2 files changed

Lines changed: 65 additions & 4 deletions

File tree

drivers/clk/qcom/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,11 @@ config SM_DISPCC_6125
626626
splash screen
627627

628628
config SM_DISPCC_8250
629-
tristate "SM8150 and SM8250 Display Clock Controller"
630-
depends on SM_GCC_8150 || SM_GCC_8250
629+
tristate "SM8150/SM8250/SM8350 Display Clock Controller"
630+
depends on SM_GCC_8150 || SM_GCC_8250 || SM_GCC_8350
631631
help
632632
Support for the display clock controller on Qualcomm Technologies, Inc
633-
SM8150 and SM8250 devices.
633+
SM8150/SM8250/SM8350 devices.
634634
Say Y if you want to support display devices and functionality such as
635635
splash screen.
636636

drivers/clk/qcom/dispcc-sm8250.c

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ static struct pll_vco vco_table[] = {
4343
{ 249600000, 2000000000, 0 },
4444
};
4545

46+
static struct pll_vco lucid_5lpe_vco[] = {
47+
{ 249600000, 1750000000, 0 },
48+
};
49+
4650
static struct alpha_pll_config disp_cc_pll0_config = {
4751
.l = 0x47,
4852
.alpha = 0xE000,
@@ -1228,6 +1232,7 @@ static const struct of_device_id disp_cc_sm8250_match_table[] = {
12281232
{ .compatible = "qcom,sc8180x-dispcc" },
12291233
{ .compatible = "qcom,sm8150-dispcc" },
12301234
{ .compatible = "qcom,sm8250-dispcc" },
1235+
{ .compatible = "qcom,sm8350-dispcc" },
12311236
{ }
12321237
};
12331238
MODULE_DEVICE_TABLE(of, disp_cc_sm8250_match_table);
@@ -1258,7 +1263,7 @@ static int disp_cc_sm8250_probe(struct platform_device *pdev)
12581263
return PTR_ERR(regmap);
12591264
}
12601265

1261-
/* note: trion == lucid, except for the prepare() op */
1266+
/* Apply differences for SM8150 and SM8350 */
12621267
BUILD_BUG_ON(CLK_ALPHA_PLL_TYPE_TRION != CLK_ALPHA_PLL_TYPE_LUCID);
12631268
if (of_device_is_compatible(pdev->dev.of_node, "qcom,sc8180x-dispcc") ||
12641269
of_device_is_compatible(pdev->dev.of_node, "qcom,sm8150-dispcc")) {
@@ -1270,6 +1275,62 @@ static int disp_cc_sm8250_probe(struct platform_device *pdev)
12701275
disp_cc_pll1_config.config_ctl_hi1_val = 0x00000024;
12711276
disp_cc_pll1_config.user_ctl_hi1_val = 0x000000D0;
12721277
disp_cc_pll1_init.ops = &clk_alpha_pll_trion_ops;
1278+
} else if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8350-dispcc")) {
1279+
static struct clk_rcg2 * const rcgs[] = {
1280+
&disp_cc_mdss_byte0_clk_src,
1281+
&disp_cc_mdss_byte1_clk_src,
1282+
&disp_cc_mdss_dp_aux1_clk_src,
1283+
&disp_cc_mdss_dp_aux_clk_src,
1284+
&disp_cc_mdss_dp_link1_clk_src,
1285+
&disp_cc_mdss_dp_link_clk_src,
1286+
&disp_cc_mdss_dp_pixel1_clk_src,
1287+
&disp_cc_mdss_dp_pixel2_clk_src,
1288+
&disp_cc_mdss_dp_pixel_clk_src,
1289+
&disp_cc_mdss_esc0_clk_src,
1290+
&disp_cc_mdss_mdp_clk_src,
1291+
&disp_cc_mdss_pclk0_clk_src,
1292+
&disp_cc_mdss_pclk1_clk_src,
1293+
&disp_cc_mdss_rot_clk_src,
1294+
&disp_cc_mdss_vsync_clk_src,
1295+
};
1296+
static struct clk_regmap_div * const divs[] = {
1297+
&disp_cc_mdss_byte0_div_clk_src,
1298+
&disp_cc_mdss_byte1_div_clk_src,
1299+
&disp_cc_mdss_dp_link1_div_clk_src,
1300+
&disp_cc_mdss_dp_link_div_clk_src,
1301+
};
1302+
unsigned int i;
1303+
static bool offset_applied;
1304+
1305+
/*
1306+
* note: trion == lucid, except for the prepare() op
1307+
* only apply the offsets once (in case of deferred probe)
1308+
*/
1309+
if (!offset_applied) {
1310+
for (i = 0; i < ARRAY_SIZE(rcgs); i++)
1311+
rcgs[i]->cmd_rcgr -= 4;
1312+
1313+
for (i = 0; i < ARRAY_SIZE(divs); i++) {
1314+
divs[i]->reg -= 4;
1315+
divs[i]->width = 4;
1316+
}
1317+
1318+
disp_cc_mdss_ahb_clk.halt_reg -= 4;
1319+
disp_cc_mdss_ahb_clk.clkr.enable_reg -= 4;
1320+
1321+
offset_applied = true;
1322+
}
1323+
1324+
disp_cc_mdss_ahb_clk_src.cmd_rcgr = 0x22a0;
1325+
1326+
disp_cc_pll0_config.config_ctl_hi1_val = 0x2a9a699c;
1327+
disp_cc_pll0_config.test_ctl_hi1_val = 0x01800000;
1328+
disp_cc_pll0_init.ops = &clk_alpha_pll_lucid_5lpe_ops;
1329+
disp_cc_pll0.vco_table = lucid_5lpe_vco;
1330+
disp_cc_pll1_config.config_ctl_hi1_val = 0x2a9a699c;
1331+
disp_cc_pll1_config.test_ctl_hi1_val = 0x01800000;
1332+
disp_cc_pll1_init.ops = &clk_alpha_pll_lucid_5lpe_ops;
1333+
disp_cc_pll1.vco_table = lucid_5lpe_vco;
12731334
}
12741335

12751336
clk_lucid_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);

0 commit comments

Comments
 (0)