Skip to content

Commit 362be5c

Browse files
lumagandersson
authored andcommitted
clk: qcom: dispcc-sm8250: use special function for Lucid 5LPE PLL
According to msm-5.10 the lucid 5lpe PLLs have require slightly different configuration that trion / lucid PLLs, it doesn't set PLL_UPDATE_BYPASS bit. Add corresponding function and use it for the display clock controller on Qualcomm SM8350 platform. Fixes: 205737f ("clk: qcom: add support for SM8350 DISPCC") Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 0e93c63 commit 362be5c

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

drivers/clk/qcom/clk-alpha-pll.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,58 @@ const struct clk_ops clk_alpha_pll_agera_ops = {
18311831
};
18321832
EXPORT_SYMBOL_GPL(clk_alpha_pll_agera_ops);
18331833

1834+
/**
1835+
* clk_lucid_5lpe_pll_configure - configure the lucid 5lpe pll
1836+
*
1837+
* @pll: clk alpha pll
1838+
* @regmap: register map
1839+
* @config: configuration to apply for pll
1840+
*/
1841+
void clk_lucid_5lpe_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
1842+
const struct alpha_pll_config *config)
1843+
{
1844+
/*
1845+
* If the bootloader left the PLL enabled it's likely that there are
1846+
* RCGs that will lock up if we disable the PLL below.
1847+
*/
1848+
if (trion_pll_is_enabled(pll, regmap)) {
1849+
pr_debug("Lucid 5LPE PLL is already enabled, skipping configuration\n");
1850+
return;
1851+
}
1852+
1853+
clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l);
1854+
regmap_write(regmap, PLL_CAL_L_VAL(pll), TRION_PLL_CAL_VAL);
1855+
clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha);
1856+
clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL(pll),
1857+
config->config_ctl_val);
1858+
clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL_U(pll),
1859+
config->config_ctl_hi_val);
1860+
clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL_U1(pll),
1861+
config->config_ctl_hi1_val);
1862+
clk_alpha_pll_write_config(regmap, PLL_USER_CTL(pll),
1863+
config->user_ctl_val);
1864+
clk_alpha_pll_write_config(regmap, PLL_USER_CTL_U(pll),
1865+
config->user_ctl_hi_val);
1866+
clk_alpha_pll_write_config(regmap, PLL_USER_CTL_U1(pll),
1867+
config->user_ctl_hi1_val);
1868+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL(pll),
1869+
config->test_ctl_val);
1870+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U(pll),
1871+
config->test_ctl_hi_val);
1872+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U1(pll),
1873+
config->test_ctl_hi1_val);
1874+
1875+
/* Disable PLL output */
1876+
regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, 0);
1877+
1878+
/* Set operation mode to OFF */
1879+
regmap_write(regmap, PLL_OPMODE(pll), PLL_STANDBY);
1880+
1881+
/* Place the PLL in STANDBY mode */
1882+
regmap_update_bits(regmap, PLL_MODE(pll), PLL_RESET_N, PLL_RESET_N);
1883+
}
1884+
EXPORT_SYMBOL_GPL(clk_lucid_5lpe_pll_configure);
1885+
18341886
static int alpha_pll_lucid_5lpe_enable(struct clk_hw *hw)
18351887
{
18361888
struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);

drivers/clk/qcom/clk-alpha-pll.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ void clk_agera_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
211211

212212
void clk_zonda_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
213213
const struct alpha_pll_config *config);
214+
void clk_lucid_5lpe_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
215+
const struct alpha_pll_config *config);
214216
void clk_lucid_evo_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
215217
const struct alpha_pll_config *config);
216218
void clk_lucid_ole_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,

drivers/clk/qcom/dispcc-sm8250.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,13 @@ static int disp_cc_sm8250_probe(struct platform_device *pdev)
13601360
disp_cc_sm8250_clocks[DISP_CC_MDSS_EDP_GTC_CLK_SRC] = NULL;
13611361
}
13621362

1363-
clk_lucid_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
1364-
clk_lucid_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
1363+
if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8350-dispcc")) {
1364+
clk_lucid_5lpe_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
1365+
clk_lucid_5lpe_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
1366+
} else {
1367+
clk_lucid_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config);
1368+
clk_lucid_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config);
1369+
}
13651370

13661371
/* Enable clock gating for MDP clocks */
13671372
regmap_update_bits(regmap, 0x8000, 0x10, 0x10);

0 commit comments

Comments
 (0)