Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Jonathan Marek and committed by
Bjorn Andersson
205737fe 160758b0

+65 -4
+3 -3
drivers/clk/qcom/Kconfig
··· 626 626 splash screen 627 627 628 628 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 631 631 help 632 632 Support for the display clock controller on Qualcomm Technologies, Inc 633 - SM8150 and SM8250 devices. 633 + SM8150/SM8250/SM8350 devices. 634 634 Say Y if you want to support display devices and functionality such as 635 635 splash screen. 636 636
+62 -1
drivers/clk/qcom/dispcc-sm8250.c
··· 43 43 { 249600000, 2000000000, 0 }, 44 44 }; 45 45 46 + static struct pll_vco lucid_5lpe_vco[] = { 47 + { 249600000, 1750000000, 0 }, 48 + }; 49 + 46 50 static struct alpha_pll_config disp_cc_pll0_config = { 47 51 .l = 0x47, 48 52 .alpha = 0xE000, ··· 1232 1228 { .compatible = "qcom,sc8180x-dispcc" }, 1233 1229 { .compatible = "qcom,sm8150-dispcc" }, 1234 1230 { .compatible = "qcom,sm8250-dispcc" }, 1231 + { .compatible = "qcom,sm8350-dispcc" }, 1235 1232 { } 1236 1233 }; 1237 1234 MODULE_DEVICE_TABLE(of, disp_cc_sm8250_match_table); ··· 1263 1258 return PTR_ERR(regmap); 1264 1259 } 1265 1260 1266 - /* note: trion == lucid, except for the prepare() op */ 1261 + /* Apply differences for SM8150 and SM8350 */ 1267 1262 BUILD_BUG_ON(CLK_ALPHA_PLL_TYPE_TRION != CLK_ALPHA_PLL_TYPE_LUCID); 1268 1263 if (of_device_is_compatible(pdev->dev.of_node, "qcom,sc8180x-dispcc") || 1269 1264 of_device_is_compatible(pdev->dev.of_node, "qcom,sm8150-dispcc")) { ··· 1275 1270 disp_cc_pll1_config.config_ctl_hi1_val = 0x00000024; 1276 1271 disp_cc_pll1_config.user_ctl_hi1_val = 0x000000D0; 1277 1272 disp_cc_pll1_init.ops = &clk_alpha_pll_trion_ops; 1273 + } else if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8350-dispcc")) { 1274 + static struct clk_rcg2 * const rcgs[] = { 1275 + &disp_cc_mdss_byte0_clk_src, 1276 + &disp_cc_mdss_byte1_clk_src, 1277 + &disp_cc_mdss_dp_aux1_clk_src, 1278 + &disp_cc_mdss_dp_aux_clk_src, 1279 + &disp_cc_mdss_dp_link1_clk_src, 1280 + &disp_cc_mdss_dp_link_clk_src, 1281 + &disp_cc_mdss_dp_pixel1_clk_src, 1282 + &disp_cc_mdss_dp_pixel2_clk_src, 1283 + &disp_cc_mdss_dp_pixel_clk_src, 1284 + &disp_cc_mdss_esc0_clk_src, 1285 + &disp_cc_mdss_mdp_clk_src, 1286 + &disp_cc_mdss_pclk0_clk_src, 1287 + &disp_cc_mdss_pclk1_clk_src, 1288 + &disp_cc_mdss_rot_clk_src, 1289 + &disp_cc_mdss_vsync_clk_src, 1290 + }; 1291 + static struct clk_regmap_div * const divs[] = { 1292 + &disp_cc_mdss_byte0_div_clk_src, 1293 + &disp_cc_mdss_byte1_div_clk_src, 1294 + &disp_cc_mdss_dp_link1_div_clk_src, 1295 + &disp_cc_mdss_dp_link_div_clk_src, 1296 + }; 1297 + unsigned int i; 1298 + static bool offset_applied; 1299 + 1300 + /* 1301 + * note: trion == lucid, except for the prepare() op 1302 + * only apply the offsets once (in case of deferred probe) 1303 + */ 1304 + if (!offset_applied) { 1305 + for (i = 0; i < ARRAY_SIZE(rcgs); i++) 1306 + rcgs[i]->cmd_rcgr -= 4; 1307 + 1308 + for (i = 0; i < ARRAY_SIZE(divs); i++) { 1309 + divs[i]->reg -= 4; 1310 + divs[i]->width = 4; 1311 + } 1312 + 1313 + disp_cc_mdss_ahb_clk.halt_reg -= 4; 1314 + disp_cc_mdss_ahb_clk.clkr.enable_reg -= 4; 1315 + 1316 + offset_applied = true; 1317 + } 1318 + 1319 + disp_cc_mdss_ahb_clk_src.cmd_rcgr = 0x22a0; 1320 + 1321 + disp_cc_pll0_config.config_ctl_hi1_val = 0x2a9a699c; 1322 + disp_cc_pll0_config.test_ctl_hi1_val = 0x01800000; 1323 + disp_cc_pll0_init.ops = &clk_alpha_pll_lucid_5lpe_ops; 1324 + disp_cc_pll0.vco_table = lucid_5lpe_vco; 1325 + disp_cc_pll1_config.config_ctl_hi1_val = 0x2a9a699c; 1326 + disp_cc_pll1_config.test_ctl_hi1_val = 0x01800000; 1327 + disp_cc_pll1_init.ops = &clk_alpha_pll_lucid_5lpe_ops; 1328 + disp_cc_pll1.vco_table = lucid_5lpe_vco; 1278 1329 } 1279 1330 1280 1331 clk_lucid_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);