1
1
// SPDX-License-Identifier: GPL-2.0-only
2
2
/*
3
- * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
3
+ * Copyright (c) 2023-2024 , Qualcomm Innovation Center, Inc. All rights reserved.
4
4
*/
5
5
6
6
#include <linux/clk-provider.h>
@@ -35,7 +35,7 @@ static const struct pll_vco lucid_ole_vco[] = {
35
35
{ 249600000 , 2300000000 , 0 },
36
36
};
37
37
38
- static const struct alpha_pll_config video_cc_pll0_config = {
38
+ static struct alpha_pll_config video_cc_pll0_config = {
39
39
.l = 0x25 ,
40
40
.alpha = 0x8000 ,
41
41
.config_ctl_val = 0x20485699 ,
@@ -66,7 +66,7 @@ static struct clk_alpha_pll video_cc_pll0 = {
66
66
},
67
67
};
68
68
69
- static const struct alpha_pll_config video_cc_pll1_config = {
69
+ static struct alpha_pll_config video_cc_pll1_config = {
70
70
.l = 0x36 ,
71
71
.alpha = 0xb000 ,
72
72
.config_ctl_val = 0x20485699 ,
@@ -117,6 +117,14 @@ static const struct clk_parent_data video_cc_parent_data_1[] = {
117
117
{ .hw = & video_cc_pll1 .clkr .hw },
118
118
};
119
119
120
+ static const struct parent_map video_cc_parent_map_2 [] = {
121
+ { P_BI_TCXO , 0 },
122
+ };
123
+
124
+ static const struct clk_parent_data video_cc_parent_data_2 [] = {
125
+ { .index = DT_BI_TCXO },
126
+ };
127
+
120
128
static const struct freq_tbl ftbl_video_cc_mvs0_clk_src [] = {
121
129
F (720000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
122
130
F (1014000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
@@ -126,6 +134,16 @@ static const struct freq_tbl ftbl_video_cc_mvs0_clk_src[] = {
126
134
{ }
127
135
};
128
136
137
+ static const struct freq_tbl ftbl_video_cc_mvs0_clk_src_sm8650 [] = {
138
+ F (588000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
139
+ F (900000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
140
+ F (1140000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
141
+ F (1305000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
142
+ F (1440000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
143
+ F (1600000000 , P_VIDEO_CC_PLL0_OUT_MAIN , 1 , 0 , 0 ),
144
+ { }
145
+ };
146
+
129
147
static struct clk_rcg2 video_cc_mvs0_clk_src = {
130
148
.cmd_rcgr = 0x8000 ,
131
149
.mnd_width = 0 ,
@@ -149,6 +167,15 @@ static const struct freq_tbl ftbl_video_cc_mvs1_clk_src[] = {
149
167
{ }
150
168
};
151
169
170
+ static const struct freq_tbl ftbl_video_cc_mvs1_clk_src_sm8650 [] = {
171
+ F (840000000 , P_VIDEO_CC_PLL1_OUT_MAIN , 1 , 0 , 0 ),
172
+ F (1110000000 , P_VIDEO_CC_PLL1_OUT_MAIN , 1 , 0 , 0 ),
173
+ F (1350000000 , P_VIDEO_CC_PLL1_OUT_MAIN , 1 , 0 , 0 ),
174
+ F (1500000000 , P_VIDEO_CC_PLL1_OUT_MAIN , 1 , 0 , 0 ),
175
+ F (1650000000 , P_VIDEO_CC_PLL1_OUT_MAIN , 1 , 0 , 0 ),
176
+ { }
177
+ };
178
+
152
179
static struct clk_rcg2 video_cc_mvs1_clk_src = {
153
180
.cmd_rcgr = 0x8018 ,
154
181
.mnd_width = 0 ,
@@ -164,6 +191,26 @@ static struct clk_rcg2 video_cc_mvs1_clk_src = {
164
191
},
165
192
};
166
193
194
+ static const struct freq_tbl ftbl_video_cc_xo_clk_src [] = {
195
+ F (19200000 , P_BI_TCXO , 1 , 0 , 0 ),
196
+ { }
197
+ };
198
+
199
+ static struct clk_rcg2 video_cc_xo_clk_src = {
200
+ .cmd_rcgr = 0x810c ,
201
+ .mnd_width = 0 ,
202
+ .hid_width = 5 ,
203
+ .parent_map = video_cc_parent_map_2 ,
204
+ .freq_tbl = ftbl_video_cc_xo_clk_src ,
205
+ .clkr .hw .init = & (const struct clk_init_data ) {
206
+ .name = "video_cc_xo_clk_src" ,
207
+ .parent_data = video_cc_parent_data_2 ,
208
+ .num_parents = ARRAY_SIZE (video_cc_parent_data_2 ),
209
+ .flags = CLK_SET_RATE_PARENT ,
210
+ .ops = & clk_rcg2_shared_ops ,
211
+ },
212
+ };
213
+
167
214
static struct clk_regmap_div video_cc_mvs0_div_clk_src = {
168
215
.reg = 0x80c4 ,
169
216
.shift = 0 ,
@@ -244,6 +291,26 @@ static struct clk_branch video_cc_mvs0_clk = {
244
291
},
245
292
};
246
293
294
+ static struct clk_branch video_cc_mvs0_shift_clk = {
295
+ .halt_reg = 0x8128 ,
296
+ .halt_check = BRANCH_HALT_VOTED ,
297
+ .hwcg_reg = 0x8128 ,
298
+ .hwcg_bit = 1 ,
299
+ .clkr = {
300
+ .enable_reg = 0x8128 ,
301
+ .enable_mask = BIT (0 ),
302
+ .hw .init = & (const struct clk_init_data ) {
303
+ .name = "video_cc_mvs0_shift_clk" ,
304
+ .parent_hws = (const struct clk_hw * []) {
305
+ & video_cc_xo_clk_src .clkr .hw ,
306
+ },
307
+ .num_parents = 1 ,
308
+ .flags = CLK_SET_RATE_PARENT ,
309
+ .ops = & clk_branch2_ops ,
310
+ },
311
+ },
312
+ };
313
+
247
314
static struct clk_branch video_cc_mvs0c_clk = {
248
315
.halt_reg = 0x8064 ,
249
316
.halt_check = BRANCH_HALT ,
@@ -262,6 +329,26 @@ static struct clk_branch video_cc_mvs0c_clk = {
262
329
},
263
330
};
264
331
332
+ static struct clk_branch video_cc_mvs0c_shift_clk = {
333
+ .halt_reg = 0x812c ,
334
+ .halt_check = BRANCH_HALT_VOTED ,
335
+ .hwcg_reg = 0x812c ,
336
+ .hwcg_bit = 1 ,
337
+ .clkr = {
338
+ .enable_reg = 0x812c ,
339
+ .enable_mask = BIT (0 ),
340
+ .hw .init = & (const struct clk_init_data ) {
341
+ .name = "video_cc_mvs0c_shift_clk" ,
342
+ .parent_hws = (const struct clk_hw * []) {
343
+ & video_cc_xo_clk_src .clkr .hw ,
344
+ },
345
+ .num_parents = 1 ,
346
+ .flags = CLK_SET_RATE_PARENT ,
347
+ .ops = & clk_branch2_ops ,
348
+ },
349
+ },
350
+ };
351
+
265
352
static struct clk_branch video_cc_mvs1_clk = {
266
353
.halt_reg = 0x80e0 ,
267
354
.halt_check = BRANCH_HALT_SKIP ,
@@ -282,6 +369,26 @@ static struct clk_branch video_cc_mvs1_clk = {
282
369
},
283
370
};
284
371
372
+ static struct clk_branch video_cc_mvs1_shift_clk = {
373
+ .halt_reg = 0x8130 ,
374
+ .halt_check = BRANCH_HALT_VOTED ,
375
+ .hwcg_reg = 0x8130 ,
376
+ .hwcg_bit = 1 ,
377
+ .clkr = {
378
+ .enable_reg = 0x8130 ,
379
+ .enable_mask = BIT (0 ),
380
+ .hw .init = & (const struct clk_init_data ) {
381
+ .name = "video_cc_mvs1_shift_clk" ,
382
+ .parent_hws = (const struct clk_hw * []) {
383
+ & video_cc_xo_clk_src .clkr .hw ,
384
+ },
385
+ .num_parents = 1 ,
386
+ .flags = CLK_SET_RATE_PARENT ,
387
+ .ops = & clk_branch2_ops ,
388
+ },
389
+ },
390
+ };
391
+
285
392
static struct clk_branch video_cc_mvs1c_clk = {
286
393
.halt_reg = 0x8090 ,
287
394
.halt_check = BRANCH_HALT ,
@@ -300,6 +407,26 @@ static struct clk_branch video_cc_mvs1c_clk = {
300
407
},
301
408
};
302
409
410
+ static struct clk_branch video_cc_mvs1c_shift_clk = {
411
+ .halt_reg = 0x8134 ,
412
+ .halt_check = BRANCH_HALT_VOTED ,
413
+ .hwcg_reg = 0x8134 ,
414
+ .hwcg_bit = 1 ,
415
+ .clkr = {
416
+ .enable_reg = 0x8134 ,
417
+ .enable_mask = BIT (0 ),
418
+ .hw .init = & (const struct clk_init_data ) {
419
+ .name = "video_cc_mvs1c_shift_clk" ,
420
+ .parent_hws = (const struct clk_hw * []) {
421
+ & video_cc_xo_clk_src .clkr .hw ,
422
+ },
423
+ .num_parents = 1 ,
424
+ .flags = CLK_SET_RATE_PARENT ,
425
+ .ops = & clk_branch2_ops ,
426
+ },
427
+ },
428
+ };
429
+
303
430
static struct gdsc video_cc_mvs0c_gdsc = {
304
431
.gdscr = 0x804c ,
305
432
.en_rest_wait_val = 0x2 ,
@@ -363,6 +490,7 @@ static struct clk_regmap *video_cc_sm8550_clocks[] = {
363
490
[VIDEO_CC_MVS1C_DIV2_DIV_CLK_SRC ] = & video_cc_mvs1c_div2_div_clk_src .clkr ,
364
491
[VIDEO_CC_PLL0 ] = & video_cc_pll0 .clkr ,
365
492
[VIDEO_CC_PLL1 ] = & video_cc_pll1 .clkr ,
493
+ [VIDEO_CC_XO_CLK_SRC ] = NULL ,
366
494
};
367
495
368
496
static struct gdsc * video_cc_sm8550_gdscs [] = {
@@ -403,6 +531,7 @@ static struct qcom_cc_desc video_cc_sm8550_desc = {
403
531
404
532
static const struct of_device_id video_cc_sm8550_match_table [] = {
405
533
{ .compatible = "qcom,sm8550-videocc" },
534
+ { .compatible = "qcom,sm8650-videocc" },
406
535
{ }
407
536
};
408
537
MODULE_DEVICE_TABLE (of , video_cc_sm8550_match_table );
@@ -411,6 +540,7 @@ static int video_cc_sm8550_probe(struct platform_device *pdev)
411
540
{
412
541
struct regmap * regmap ;
413
542
int ret ;
543
+ u32 sleep_clk_offset = 0x8140 ;
414
544
415
545
ret = devm_pm_runtime_enable (& pdev -> dev );
416
546
if (ret )
@@ -426,12 +556,27 @@ static int video_cc_sm8550_probe(struct platform_device *pdev)
426
556
return PTR_ERR (regmap );
427
557
}
428
558
559
+ if (of_device_is_compatible (pdev -> dev .of_node , "qcom,sm8650-videocc" )) {
560
+ sleep_clk_offset = 0x8150 ;
561
+ video_cc_pll0_config .l = 0x1e ;
562
+ video_cc_pll0_config .alpha = 0xa000 ;
563
+ video_cc_pll1_config .l = 0x2b ;
564
+ video_cc_pll1_config .alpha = 0xc000 ;
565
+ video_cc_mvs0_clk_src .freq_tbl = ftbl_video_cc_mvs0_clk_src_sm8650 ;
566
+ video_cc_mvs1_clk_src .freq_tbl = ftbl_video_cc_mvs1_clk_src_sm8650 ;
567
+ video_cc_sm8550_clocks [VIDEO_CC_MVS0_SHIFT_CLK ] = & video_cc_mvs0_shift_clk .clkr ;
568
+ video_cc_sm8550_clocks [VIDEO_CC_MVS0C_SHIFT_CLK ] = & video_cc_mvs0c_shift_clk .clkr ;
569
+ video_cc_sm8550_clocks [VIDEO_CC_MVS1_SHIFT_CLK ] = & video_cc_mvs1_shift_clk .clkr ;
570
+ video_cc_sm8550_clocks [VIDEO_CC_MVS1C_SHIFT_CLK ] = & video_cc_mvs1c_shift_clk .clkr ;
571
+ video_cc_sm8550_clocks [VIDEO_CC_XO_CLK_SRC ] = & video_cc_xo_clk_src .clkr ;
572
+ }
573
+
429
574
clk_lucid_ole_pll_configure (& video_cc_pll0 , regmap , & video_cc_pll0_config );
430
575
clk_lucid_ole_pll_configure (& video_cc_pll1 , regmap , & video_cc_pll1_config );
431
576
432
577
/* Keep some clocks always-on */
433
578
qcom_branch_set_clk_en (regmap , 0x80f4 ); /* VIDEO_CC_AHB_CLK */
434
- qcom_branch_set_clk_en (regmap , 0x8140 ); /* VIDEO_CC_SLEEP_CLK */
579
+ qcom_branch_set_clk_en (regmap , sleep_clk_offset ); /* VIDEO_CC_SLEEP_CLK */
435
580
qcom_branch_set_clk_en (regmap , 0x8124 ); /* VIDEO_CC_XO_CLK */
436
581
437
582
ret = qcom_cc_really_probe (pdev , & video_cc_sm8550_desc , regmap );
0 commit comments