Skip to content

Commit bc48641

Browse files
Tooniisandersson
authored andcommitted
clk: qcom: cbf-msm8996: Add support for MSM8996 Pro
The CBF PLL on MSM8996 Pro has a /4 post divisor instead of /2. Handle the difference accordingly. Signed-off-by: Yassine Oudjana <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 434cb57 commit bc48641

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/clk/qcom/clk-cbf-8996.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static const u8 cbf_pll_regs[PLL_OFF_MAX_REGS] = {
5252
[PLL_OFF_STATUS] = 0x28,
5353
};
5454

55-
static const struct alpha_pll_config cbfpll_config = {
55+
static struct alpha_pll_config cbfpll_config = {
5656
.l = 72,
5757
.config_ctl_val = 0x200d4828,
5858
.config_ctl_hi_val = 0x006,
@@ -141,7 +141,7 @@ static int clk_cbf_8996_mux_determine_rate(struct clk_hw *hw,
141141
{
142142
struct clk_hw *parent;
143143

144-
if (req->rate < (DIV_THRESHOLD / 2))
144+
if (req->rate < (DIV_THRESHOLD / cbf_pll_postdiv.div))
145145
return -EINVAL;
146146

147147
if (req->rate < DIV_THRESHOLD)
@@ -312,6 +312,11 @@ static int qcom_msm8996_cbf_probe(struct platform_device *pdev)
312312
/* Switch CBF to use the primary PLL */
313313
regmap_update_bits(regmap, CBF_MUX_OFFSET, CBF_MUX_PARENT_MASK, 0x1);
314314

315+
if (of_device_is_compatible(dev->of_node, "qcom,msm8996pro-cbf")) {
316+
cbfpll_config.post_div_val = 0x3 << 8;
317+
cbf_pll_postdiv.div = 4;
318+
}
319+
315320
for (i = 0; i < ARRAY_SIZE(cbf_msm8996_hw_clks); i++) {
316321
ret = devm_clk_hw_register(dev, cbf_msm8996_hw_clks[i]);
317322
if (ret)
@@ -342,6 +347,7 @@ static int qcom_msm8996_cbf_remove(struct platform_device *pdev)
342347

343348
static const struct of_device_id qcom_msm8996_cbf_match_table[] = {
344349
{ .compatible = "qcom,msm8996-cbf" },
350+
{ .compatible = "qcom,msm8996pro-cbf" },
345351
{ /* sentinel */ },
346352
};
347353
MODULE_DEVICE_TABLE(of, qcom_msm8996_cbf_match_table);

0 commit comments

Comments
 (0)