Skip to content

Commit e5e527d

Browse files
konradybcioandersson
authored andcommitted
clk: qcom: videocc-sm8350: Add SC8280XP support
SC8280XP, being a partial derivative of SM8350, shares almost the exact same videocc block. Extend the 8350 driver to support the bigger brother. The only notable changes are higher possible frequencies on some clocks and some switcheroo within the XO/sleep registers (probably due to some different board crystal configuration). Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230703-topic-8280_videocc-v2-2-c88269806269@linaro.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent dfe488d commit e5e527d

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

drivers/clk/qcom/videocc-sm8350.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ static const struct pll_vco lucid_5lpe_vco[] = {
4141
{ 249600000, 1750000000, 0 },
4242
};
4343

44+
static const struct pll_vco lucid_5lpe_vco_8280xp[] = {
45+
{ 249600000, 1800000000, 0 },
46+
};
47+
4448
static const struct alpha_pll_config video_pll0_config = {
4549
.l = 0x25,
4650
.alpha = 0x8000,
@@ -159,6 +163,16 @@ static const struct freq_tbl ftbl_video_cc_mvs0_clk_src[] = {
159163
{ }
160164
};
161165

166+
static const struct freq_tbl ftbl_video_cc_mvs0_clk_src_8280xp[] = {
167+
F(720000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
168+
F(1014000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
169+
F(1098000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
170+
F(1332000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
171+
F(1599000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
172+
F(1680000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
173+
{ }
174+
};
175+
162176
static struct clk_rcg2 video_cc_mvs0_clk_src = {
163177
.cmd_rcgr = 0xb94,
164178
.mnd_width = 0,
@@ -181,6 +195,15 @@ static const struct freq_tbl ftbl_video_cc_mvs1_clk_src[] = {
181195
{ }
182196
};
183197

198+
static const struct freq_tbl ftbl_video_cc_mvs1_clk_src_8280xp[] = {
199+
F(840000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0),
200+
F(1098000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0),
201+
F(1332000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0),
202+
F(1600000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0),
203+
F(1800000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0),
204+
{ }
205+
};
206+
184207
static struct clk_rcg2 video_cc_mvs1_clk_src = {
185208
.cmd_rcgr = 0xbb4,
186209
.mnd_width = 0,
@@ -499,6 +522,7 @@ static struct qcom_cc_desc video_cc_sm8350_desc = {
499522

500523
static int video_cc_sm8350_probe(struct platform_device *pdev)
501524
{
525+
u32 video_cc_xo_clk_cbcr = 0xeec;
502526
struct regmap *regmap;
503527
int ret;
504528

@@ -510,6 +534,21 @@ static int video_cc_sm8350_probe(struct platform_device *pdev)
510534
if (ret)
511535
return ret;
512536

537+
if (of_device_is_compatible(pdev->dev.of_node, "qcom,sc8280xp-videocc")) {
538+
video_cc_sleep_clk_src.cmd_rcgr = 0xf38;
539+
video_cc_sleep_clk.halt_reg = 0xf58;
540+
video_cc_sleep_clk.clkr.enable_reg = 0xf58;
541+
video_cc_xo_clk_src.cmd_rcgr = 0xf14;
542+
video_cc_xo_clk_cbcr = 0xf34;
543+
544+
video_pll0.vco_table = video_pll1.vco_table = lucid_5lpe_vco_8280xp;
545+
/* No change, but assign it for completeness */
546+
video_pll0.num_vco = video_pll1.num_vco = ARRAY_SIZE(lucid_5lpe_vco_8280xp);
547+
548+
video_cc_mvs0_clk_src.freq_tbl = ftbl_video_cc_mvs0_clk_src_8280xp;
549+
video_cc_mvs1_clk_src.freq_tbl = ftbl_video_cc_mvs1_clk_src_8280xp;
550+
}
551+
513552
regmap = qcom_cc_map(pdev, &video_cc_sm8350_desc);
514553
if (IS_ERR(regmap)) {
515554
pm_runtime_put(&pdev->dev);
@@ -525,7 +564,7 @@ static int video_cc_sm8350_probe(struct platform_device *pdev)
525564
* video_cc_xo_clk
526565
*/
527566
regmap_update_bits(regmap, 0xe58, BIT(0), BIT(0));
528-
regmap_update_bits(regmap, 0xeec, BIT(0), BIT(0));
567+
regmap_update_bits(regmap, video_cc_xo_clk_cbcr, BIT(0), BIT(0));
529568

530569
ret = qcom_cc_really_probe(pdev, &video_cc_sm8350_desc, regmap);
531570
pm_runtime_put(&pdev->dev);
@@ -534,6 +573,7 @@ static int video_cc_sm8350_probe(struct platform_device *pdev)
534573
}
535574

536575
static const struct of_device_id video_cc_sm8350_match_table[] = {
576+
{ .compatible = "qcom,sc8280xp-videocc" },
537577
{ .compatible = "qcom,sm8350-videocc" },
538578
{ }
539579
};

0 commit comments

Comments
 (0)