1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
6 #include <linux/clk-provider.h>
8 #include <linux/module.h>
10 #include <linux/platform_device.h>
11 #include <linux/pm_clock.h>
12 #include <linux/pm_runtime.h>
13 #include <linux/regmap.h>
15 #include <dt-bindings/clock/qcom,camcc-sc7180.h>
17 #include "clk-alpha-pll.h"
18 #include "clk-branch.h"
20 #include "clk-regmap.h"
27 P_CAM_CC_PLL0_OUT_EVEN
,
28 P_CAM_CC_PLL1_OUT_EVEN
,
29 P_CAM_CC_PLL2_OUT_AUX
,
30 P_CAM_CC_PLL2_OUT_EARLY
,
31 P_CAM_CC_PLL3_OUT_MAIN
,
34 static const struct pll_vco agera_vco
[] = {
35 { 600000000, 3300000000UL, 0 },
38 static const struct pll_vco fabia_vco
[] = {
39 { 249600000, 2000000000UL, 0 },
42 /* 600MHz configuration */
43 static const struct alpha_pll_config cam_cc_pll0_config
= {
46 .config_ctl_val
= 0x20485699,
47 .config_ctl_hi_val
= 0x00002067,
48 .test_ctl_val
= 0x40000000,
49 .user_ctl_hi_val
= 0x00004805,
50 .user_ctl_val
= 0x00000001,
53 static struct clk_alpha_pll cam_cc_pll0
= {
55 .vco_table
= fabia_vco
,
56 .num_vco
= ARRAY_SIZE(fabia_vco
),
57 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
59 .hw
.init
= &(struct clk_init_data
){
60 .name
= "cam_cc_pll0",
61 .parent_data
= &(const struct clk_parent_data
){
65 .ops
= &clk_alpha_pll_fabia_ops
,
70 /* 860MHz configuration */
71 static const struct alpha_pll_config cam_cc_pll1_config
= {
74 .config_ctl_val
= 0x20485699,
75 .config_ctl_hi_val
= 0x00002067,
76 .test_ctl_val
= 0x40000000,
77 .user_ctl_hi_val
= 0x00004805,
80 static struct clk_alpha_pll cam_cc_pll1
= {
82 .vco_table
= fabia_vco
,
83 .num_vco
= ARRAY_SIZE(fabia_vco
),
84 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
86 .hw
.init
= &(struct clk_init_data
){
87 .name
= "cam_cc_pll1",
88 .parent_data
= &(const struct clk_parent_data
){
92 .ops
= &clk_alpha_pll_fabia_ops
,
97 /* 1920MHz configuration */
98 static const struct alpha_pll_config cam_cc_pll2_config
= {
100 .config_ctl_val
= 0x20000800,
101 .config_ctl_hi_val
= 0x400003D2,
102 .test_ctl_val
= 0x04000400,
103 .test_ctl_hi_val
= 0x00004000,
104 .user_ctl_val
= 0x0000030F,
107 static struct clk_alpha_pll cam_cc_pll2
= {
109 .vco_table
= agera_vco
,
110 .num_vco
= ARRAY_SIZE(agera_vco
),
111 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_AGERA
],
113 .hw
.init
= &(struct clk_init_data
){
114 .name
= "cam_cc_pll2",
115 .parent_data
= &(const struct clk_parent_data
){
116 .fw_name
= "bi_tcxo",
119 .ops
= &clk_alpha_pll_agera_ops
,
124 static struct clk_fixed_factor cam_cc_pll2_out_early
= {
127 .hw
.init
= &(struct clk_init_data
){
128 .name
= "cam_cc_pll2_out_early",
129 .parent_hws
= (const struct clk_hw
*[]){
130 &cam_cc_pll2
.clkr
.hw
,
133 .ops
= &clk_fixed_factor_ops
,
137 static const struct clk_div_table post_div_table_cam_cc_pll2_out_aux
[] = {
142 static struct clk_alpha_pll_postdiv cam_cc_pll2_out_aux
= {
145 .post_div_table
= post_div_table_cam_cc_pll2_out_aux
,
146 .num_post_div
= ARRAY_SIZE(post_div_table_cam_cc_pll2_out_aux
),
148 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_AGERA
],
149 .clkr
.hw
.init
= &(struct clk_init_data
){
150 .name
= "cam_cc_pll2_out_aux",
151 .parent_hws
= (const struct clk_hw
*[]){
152 &cam_cc_pll2
.clkr
.hw
,
155 .flags
= CLK_SET_RATE_PARENT
,
156 .ops
= &clk_alpha_pll_postdiv_ops
,
160 /* 1080MHz configuration */
161 static const struct alpha_pll_config cam_cc_pll3_config
= {
164 .config_ctl_val
= 0x20485699,
165 .config_ctl_hi_val
= 0x00002067,
166 .test_ctl_val
= 0x40000000,
167 .user_ctl_hi_val
= 0x00004805,
170 static struct clk_alpha_pll cam_cc_pll3
= {
172 .vco_table
= fabia_vco
,
173 .num_vco
= ARRAY_SIZE(fabia_vco
),
174 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
176 .hw
.init
= &(struct clk_init_data
){
177 .name
= "cam_cc_pll3",
178 .parent_data
= &(const struct clk_parent_data
){
179 .fw_name
= "bi_tcxo",
182 .ops
= &clk_alpha_pll_fabia_ops
,
187 static const struct parent_map cam_cc_parent_map_0
[] = {
189 { P_CAM_CC_PLL1_OUT_EVEN
, 2 },
190 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
193 static const struct clk_parent_data cam_cc_parent_data_0
[] = {
194 { .fw_name
= "bi_tcxo" },
195 { .hw
= &cam_cc_pll1
.clkr
.hw
},
196 { .hw
= &cam_cc_pll0
.clkr
.hw
},
199 static const struct parent_map cam_cc_parent_map_1
[] = {
201 { P_CAM_CC_PLL2_OUT_AUX
, 1 },
204 static const struct clk_parent_data cam_cc_parent_data_1
[] = {
205 { .fw_name
= "bi_tcxo" },
206 { .hw
= &cam_cc_pll2_out_aux
.clkr
.hw
},
209 static const struct parent_map cam_cc_parent_map_2
[] = {
211 { P_CAM_CC_PLL2_OUT_EARLY
, 4 },
212 { P_CAM_CC_PLL3_OUT_MAIN
, 5 },
213 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
216 static const struct clk_parent_data cam_cc_parent_data_2
[] = {
217 { .fw_name
= "bi_tcxo" },
218 { .hw
= &cam_cc_pll2_out_early
.hw
},
219 { .hw
= &cam_cc_pll3
.clkr
.hw
},
220 { .hw
= &cam_cc_pll0
.clkr
.hw
},
223 static const struct parent_map cam_cc_parent_map_3
[] = {
225 { P_CAM_CC_PLL1_OUT_EVEN
, 2 },
226 { P_CAM_CC_PLL2_OUT_EARLY
, 4 },
227 { P_CAM_CC_PLL3_OUT_MAIN
, 5 },
228 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
231 static const struct clk_parent_data cam_cc_parent_data_3
[] = {
232 { .fw_name
= "bi_tcxo" },
233 { .hw
= &cam_cc_pll1
.clkr
.hw
},
234 { .hw
= &cam_cc_pll2_out_early
.hw
},
235 { .hw
= &cam_cc_pll3
.clkr
.hw
},
236 { .hw
= &cam_cc_pll0
.clkr
.hw
},
239 static const struct parent_map cam_cc_parent_map_4
[] = {
241 { P_CAM_CC_PLL3_OUT_MAIN
, 5 },
242 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
245 static const struct clk_parent_data cam_cc_parent_data_4
[] = {
246 { .fw_name
= "bi_tcxo" },
247 { .hw
= &cam_cc_pll3
.clkr
.hw
},
248 { .hw
= &cam_cc_pll0
.clkr
.hw
},
251 static const struct parent_map cam_cc_parent_map_5
[] = {
253 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
256 static const struct clk_parent_data cam_cc_parent_data_5
[] = {
257 { .fw_name
= "bi_tcxo" },
258 { .hw
= &cam_cc_pll0
.clkr
.hw
},
261 static const struct parent_map cam_cc_parent_map_6
[] = {
263 { P_CAM_CC_PLL1_OUT_EVEN
, 2 },
264 { P_CAM_CC_PLL3_OUT_MAIN
, 5 },
265 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
268 static const struct clk_parent_data cam_cc_parent_data_6
[] = {
269 { .fw_name
= "bi_tcxo" },
270 { .hw
= &cam_cc_pll1
.clkr
.hw
},
271 { .hw
= &cam_cc_pll3
.clkr
.hw
},
272 { .hw
= &cam_cc_pll0
.clkr
.hw
},
275 static const struct freq_tbl ftbl_cam_cc_bps_clk_src
[] = {
276 F(200000000, P_CAM_CC_PLL0_OUT_EVEN
, 3, 0, 0),
277 F(360000000, P_CAM_CC_PLL3_OUT_MAIN
, 3, 0, 0),
278 F(432000000, P_CAM_CC_PLL3_OUT_MAIN
, 2.5, 0, 0),
279 F(480000000, P_CAM_CC_PLL2_OUT_EARLY
, 2, 0, 0),
280 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
284 static struct clk_rcg2 cam_cc_bps_clk_src
= {
288 .parent_map
= cam_cc_parent_map_2
,
289 .freq_tbl
= ftbl_cam_cc_bps_clk_src
,
290 .clkr
.hw
.init
= &(struct clk_init_data
){
291 .name
= "cam_cc_bps_clk_src",
292 .parent_data
= cam_cc_parent_data_2
,
293 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_2
),
294 .ops
= &clk_rcg2_shared_ops
,
298 static const struct freq_tbl ftbl_cam_cc_cci_0_clk_src
[] = {
299 F(37500000, P_CAM_CC_PLL0_OUT_EVEN
, 16, 0, 0),
300 F(50000000, P_CAM_CC_PLL0_OUT_EVEN
, 12, 0, 0),
301 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
305 static struct clk_rcg2 cam_cc_cci_0_clk_src
= {
309 .parent_map
= cam_cc_parent_map_5
,
310 .freq_tbl
= ftbl_cam_cc_cci_0_clk_src
,
311 .clkr
.hw
.init
= &(struct clk_init_data
){
312 .name
= "cam_cc_cci_0_clk_src",
313 .parent_data
= cam_cc_parent_data_5
,
314 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_5
),
315 .ops
= &clk_rcg2_shared_ops
,
319 static struct clk_rcg2 cam_cc_cci_1_clk_src
= {
323 .parent_map
= cam_cc_parent_map_5
,
324 .freq_tbl
= ftbl_cam_cc_cci_0_clk_src
,
325 .clkr
.hw
.init
= &(struct clk_init_data
){
326 .name
= "cam_cc_cci_1_clk_src",
327 .parent_data
= cam_cc_parent_data_5
,
328 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_5
),
329 .ops
= &clk_rcg2_shared_ops
,
333 static const struct freq_tbl ftbl_cam_cc_cphy_rx_clk_src
[] = {
334 F(150000000, P_CAM_CC_PLL0_OUT_EVEN
, 4, 0, 0),
335 F(270000000, P_CAM_CC_PLL3_OUT_MAIN
, 4, 0, 0),
336 F(360000000, P_CAM_CC_PLL3_OUT_MAIN
, 3, 0, 0),
340 static struct clk_rcg2 cam_cc_cphy_rx_clk_src
= {
344 .parent_map
= cam_cc_parent_map_3
,
345 .freq_tbl
= ftbl_cam_cc_cphy_rx_clk_src
,
346 .clkr
.hw
.init
= &(struct clk_init_data
){
347 .name
= "cam_cc_cphy_rx_clk_src",
348 .parent_data
= cam_cc_parent_data_3
,
349 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_3
),
350 .ops
= &clk_rcg2_shared_ops
,
354 static const struct freq_tbl ftbl_cam_cc_csi0phytimer_clk_src
[] = {
355 F(300000000, P_CAM_CC_PLL0_OUT_EVEN
, 2, 0, 0),
359 static struct clk_rcg2 cam_cc_csi0phytimer_clk_src
= {
363 .parent_map
= cam_cc_parent_map_0
,
364 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
365 .clkr
.hw
.init
= &(struct clk_init_data
){
366 .name
= "cam_cc_csi0phytimer_clk_src",
367 .parent_data
= cam_cc_parent_data_0
,
368 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_0
),
369 .ops
= &clk_rcg2_shared_ops
,
373 static struct clk_rcg2 cam_cc_csi1phytimer_clk_src
= {
377 .parent_map
= cam_cc_parent_map_0
,
378 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
379 .clkr
.hw
.init
= &(struct clk_init_data
){
380 .name
= "cam_cc_csi1phytimer_clk_src",
381 .parent_data
= cam_cc_parent_data_0
,
382 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_0
),
383 .ops
= &clk_rcg2_shared_ops
,
387 static struct clk_rcg2 cam_cc_csi2phytimer_clk_src
= {
391 .parent_map
= cam_cc_parent_map_0
,
392 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
393 .clkr
.hw
.init
= &(struct clk_init_data
){
394 .name
= "cam_cc_csi2phytimer_clk_src",
395 .parent_data
= cam_cc_parent_data_0
,
396 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_0
),
397 .ops
= &clk_rcg2_shared_ops
,
401 static struct clk_rcg2 cam_cc_csi3phytimer_clk_src
= {
405 .parent_map
= cam_cc_parent_map_0
,
406 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
407 .clkr
.hw
.init
= &(struct clk_init_data
){
408 .name
= "cam_cc_csi3phytimer_clk_src",
409 .parent_data
= cam_cc_parent_data_0
,
410 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_0
),
411 .ops
= &clk_rcg2_shared_ops
,
415 static const struct freq_tbl ftbl_cam_cc_fast_ahb_clk_src
[] = {
416 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
417 F(200000000, P_CAM_CC_PLL0_OUT_EVEN
, 3, 0, 0),
418 F(300000000, P_CAM_CC_PLL0_OUT_EVEN
, 2, 0, 0),
419 F(404000000, P_CAM_CC_PLL1_OUT_EVEN
, 2, 0, 0),
423 static struct clk_rcg2 cam_cc_fast_ahb_clk_src
= {
427 .parent_map
= cam_cc_parent_map_0
,
428 .freq_tbl
= ftbl_cam_cc_fast_ahb_clk_src
,
429 .clkr
.hw
.init
= &(struct clk_init_data
){
430 .name
= "cam_cc_fast_ahb_clk_src",
431 .parent_data
= cam_cc_parent_data_0
,
432 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_0
),
433 .ops
= &clk_rcg2_shared_ops
,
437 static const struct freq_tbl ftbl_cam_cc_icp_clk_src
[] = {
438 F(240000000, P_CAM_CC_PLL0_OUT_EVEN
, 2.5, 0, 0),
439 F(360000000, P_CAM_CC_PLL3_OUT_MAIN
, 3, 0, 0),
440 F(432000000, P_CAM_CC_PLL3_OUT_MAIN
, 2.5, 0, 0),
441 F(480000000, P_CAM_CC_PLL2_OUT_EARLY
, 2, 0, 0),
442 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
446 static struct clk_rcg2 cam_cc_icp_clk_src
= {
450 .parent_map
= cam_cc_parent_map_2
,
451 .freq_tbl
= ftbl_cam_cc_icp_clk_src
,
452 .clkr
.hw
.init
= &(struct clk_init_data
){
453 .name
= "cam_cc_icp_clk_src",
454 .parent_data
= cam_cc_parent_data_2
,
455 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_2
),
456 .ops
= &clk_rcg2_shared_ops
,
460 static const struct freq_tbl ftbl_cam_cc_ife_0_clk_src
[] = {
461 F(240000000, P_CAM_CC_PLL0_OUT_EVEN
, 2.5, 0, 0),
462 F(360000000, P_CAM_CC_PLL3_OUT_MAIN
, 3, 0, 0),
463 F(432000000, P_CAM_CC_PLL3_OUT_MAIN
, 2.5, 0, 0),
464 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
468 static struct clk_rcg2 cam_cc_ife_0_clk_src
= {
472 .parent_map
= cam_cc_parent_map_4
,
473 .freq_tbl
= ftbl_cam_cc_ife_0_clk_src
,
474 .clkr
.hw
.init
= &(struct clk_init_data
){
475 .name
= "cam_cc_ife_0_clk_src",
476 .parent_data
= cam_cc_parent_data_4
,
477 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_4
),
478 .ops
= &clk_rcg2_shared_ops
,
482 static const struct freq_tbl ftbl_cam_cc_ife_0_csid_clk_src
[] = {
483 F(150000000, P_CAM_CC_PLL0_OUT_EVEN
, 4, 0, 0),
484 F(270000000, P_CAM_CC_PLL3_OUT_MAIN
, 4, 0, 0),
485 F(360000000, P_CAM_CC_PLL3_OUT_MAIN
, 3, 0, 0),
486 F(480000000, P_CAM_CC_PLL2_OUT_EARLY
, 2, 0, 0),
490 static struct clk_rcg2 cam_cc_ife_0_csid_clk_src
= {
494 .parent_map
= cam_cc_parent_map_3
,
495 .freq_tbl
= ftbl_cam_cc_ife_0_csid_clk_src
,
496 .clkr
.hw
.init
= &(struct clk_init_data
){
497 .name
= "cam_cc_ife_0_csid_clk_src",
498 .parent_data
= cam_cc_parent_data_3
,
499 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_3
),
500 .ops
= &clk_rcg2_shared_ops
,
504 static struct clk_rcg2 cam_cc_ife_1_clk_src
= {
508 .parent_map
= cam_cc_parent_map_4
,
509 .freq_tbl
= ftbl_cam_cc_ife_0_clk_src
,
510 .clkr
.hw
.init
= &(struct clk_init_data
){
511 .name
= "cam_cc_ife_1_clk_src",
512 .parent_data
= cam_cc_parent_data_4
,
513 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_4
),
514 .ops
= &clk_rcg2_shared_ops
,
518 static struct clk_rcg2 cam_cc_ife_1_csid_clk_src
= {
522 .parent_map
= cam_cc_parent_map_3
,
523 .freq_tbl
= ftbl_cam_cc_ife_0_csid_clk_src
,
524 .clkr
.hw
.init
= &(struct clk_init_data
){
525 .name
= "cam_cc_ife_1_csid_clk_src",
526 .parent_data
= cam_cc_parent_data_3
,
527 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_3
),
528 .ops
= &clk_rcg2_shared_ops
,
532 static struct clk_rcg2 cam_cc_ife_lite_clk_src
= {
536 .parent_map
= cam_cc_parent_map_4
,
537 .freq_tbl
= ftbl_cam_cc_ife_0_clk_src
,
538 .clkr
.hw
.init
= &(struct clk_init_data
){
539 .name
= "cam_cc_ife_lite_clk_src",
540 .parent_data
= cam_cc_parent_data_4
,
541 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_4
),
542 .flags
= CLK_SET_RATE_PARENT
,
543 .ops
= &clk_rcg2_shared_ops
,
547 static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src
= {
551 .parent_map
= cam_cc_parent_map_3
,
552 .freq_tbl
= ftbl_cam_cc_ife_0_csid_clk_src
,
553 .clkr
.hw
.init
= &(struct clk_init_data
){
554 .name
= "cam_cc_ife_lite_csid_clk_src",
555 .parent_data
= cam_cc_parent_data_3
,
556 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_3
),
557 .ops
= &clk_rcg2_shared_ops
,
561 static const struct freq_tbl ftbl_cam_cc_ipe_0_clk_src
[] = {
562 F(240000000, P_CAM_CC_PLL0_OUT_EVEN
, 2.5, 0, 0),
563 F(360000000, P_CAM_CC_PLL3_OUT_MAIN
, 3, 0, 0),
564 F(432000000, P_CAM_CC_PLL3_OUT_MAIN
, 2.5, 0, 0),
565 F(540000000, P_CAM_CC_PLL3_OUT_MAIN
, 2, 0, 0),
566 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
570 static struct clk_rcg2 cam_cc_ipe_0_clk_src
= {
574 .parent_map
= cam_cc_parent_map_2
,
575 .freq_tbl
= ftbl_cam_cc_ipe_0_clk_src
,
576 .clkr
.hw
.init
= &(struct clk_init_data
){
577 .name
= "cam_cc_ipe_0_clk_src",
578 .parent_data
= cam_cc_parent_data_2
,
579 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_2
),
580 .ops
= &clk_rcg2_shared_ops
,
584 static const struct freq_tbl ftbl_cam_cc_jpeg_clk_src
[] = {
585 F(66666667, P_CAM_CC_PLL0_OUT_EVEN
, 9, 0, 0),
586 F(133333333, P_CAM_CC_PLL0_OUT_EVEN
, 4.5, 0, 0),
587 F(216000000, P_CAM_CC_PLL3_OUT_MAIN
, 5, 0, 0),
588 F(320000000, P_CAM_CC_PLL2_OUT_EARLY
, 3, 0, 0),
589 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
593 static struct clk_rcg2 cam_cc_jpeg_clk_src
= {
597 .parent_map
= cam_cc_parent_map_2
,
598 .freq_tbl
= ftbl_cam_cc_jpeg_clk_src
,
599 .clkr
.hw
.init
= &(struct clk_init_data
){
600 .name
= "cam_cc_jpeg_clk_src",
601 .parent_data
= cam_cc_parent_data_2
,
602 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_2
),
603 .ops
= &clk_rcg2_shared_ops
,
607 static const struct freq_tbl ftbl_cam_cc_lrme_clk_src
[] = {
608 F(200000000, P_CAM_CC_PLL0_OUT_EVEN
, 3, 0, 0),
609 F(216000000, P_CAM_CC_PLL3_OUT_MAIN
, 5, 0, 0),
610 F(300000000, P_CAM_CC_PLL0_OUT_EVEN
, 2, 0, 0),
611 F(404000000, P_CAM_CC_PLL1_OUT_EVEN
, 2, 0, 0),
615 static struct clk_rcg2 cam_cc_lrme_clk_src
= {
619 .parent_map
= cam_cc_parent_map_6
,
620 .freq_tbl
= ftbl_cam_cc_lrme_clk_src
,
621 .clkr
.hw
.init
= &(struct clk_init_data
){
622 .name
= "cam_cc_lrme_clk_src",
623 .parent_data
= cam_cc_parent_data_6
,
624 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_6
),
625 .ops
= &clk_rcg2_shared_ops
,
629 static const struct freq_tbl ftbl_cam_cc_mclk0_clk_src
[] = {
630 F(19200000, P_BI_TCXO
, 1, 0, 0),
631 F(24000000, P_CAM_CC_PLL2_OUT_AUX
, 10, 1, 2),
632 F(64000000, P_CAM_CC_PLL2_OUT_AUX
, 7.5, 0, 0),
636 static struct clk_rcg2 cam_cc_mclk0_clk_src
= {
640 .parent_map
= cam_cc_parent_map_1
,
641 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
642 .clkr
.hw
.init
= &(struct clk_init_data
){
643 .name
= "cam_cc_mclk0_clk_src",
644 .parent_data
= cam_cc_parent_data_1
,
645 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_1
),
646 .ops
= &clk_rcg2_shared_ops
,
650 static struct clk_rcg2 cam_cc_mclk1_clk_src
= {
654 .parent_map
= cam_cc_parent_map_1
,
655 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
656 .clkr
.hw
.init
= &(struct clk_init_data
){
657 .name
= "cam_cc_mclk1_clk_src",
658 .parent_data
= cam_cc_parent_data_1
,
659 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_1
),
660 .ops
= &clk_rcg2_shared_ops
,
664 static struct clk_rcg2 cam_cc_mclk2_clk_src
= {
668 .parent_map
= cam_cc_parent_map_1
,
669 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
670 .clkr
.hw
.init
= &(struct clk_init_data
){
671 .name
= "cam_cc_mclk2_clk_src",
672 .parent_data
= cam_cc_parent_data_1
,
673 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_1
),
674 .ops
= &clk_rcg2_shared_ops
,
678 static struct clk_rcg2 cam_cc_mclk3_clk_src
= {
682 .parent_map
= cam_cc_parent_map_1
,
683 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
684 .clkr
.hw
.init
= &(struct clk_init_data
){
685 .name
= "cam_cc_mclk3_clk_src",
686 .parent_data
= cam_cc_parent_data_1
,
687 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_1
),
688 .ops
= &clk_rcg2_shared_ops
,
692 static struct clk_rcg2 cam_cc_mclk4_clk_src
= {
696 .parent_map
= cam_cc_parent_map_1
,
697 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
698 .clkr
.hw
.init
= &(struct clk_init_data
){
699 .name
= "cam_cc_mclk4_clk_src",
700 .parent_data
= cam_cc_parent_data_1
,
701 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_1
),
702 .ops
= &clk_rcg2_shared_ops
,
706 static const struct freq_tbl ftbl_cam_cc_slow_ahb_clk_src
[] = {
707 F(80000000, P_CAM_CC_PLL0_OUT_EVEN
, 7.5, 0, 0),
711 static struct clk_rcg2 cam_cc_slow_ahb_clk_src
= {
715 .parent_map
= cam_cc_parent_map_0
,
716 .freq_tbl
= ftbl_cam_cc_slow_ahb_clk_src
,
717 .clkr
.hw
.init
= &(struct clk_init_data
){
718 .name
= "cam_cc_slow_ahb_clk_src",
719 .parent_data
= cam_cc_parent_data_0
,
720 .num_parents
= ARRAY_SIZE(cam_cc_parent_data_0
),
721 .flags
= CLK_SET_RATE_PARENT
| CLK_OPS_PARENT_ENABLE
,
722 .ops
= &clk_rcg2_shared_ops
,
726 static struct clk_branch cam_cc_bps_ahb_clk
= {
728 .halt_check
= BRANCH_HALT
,
730 .enable_reg
= 0x6070,
731 .enable_mask
= BIT(0),
732 .hw
.init
= &(struct clk_init_data
){
733 .name
= "cam_cc_bps_ahb_clk",
734 .parent_hws
= (const struct clk_hw
*[]){
735 &cam_cc_slow_ahb_clk_src
.clkr
.hw
,
738 .flags
= CLK_SET_RATE_PARENT
,
739 .ops
= &clk_branch2_ops
,
744 static struct clk_branch cam_cc_bps_areg_clk
= {
746 .halt_check
= BRANCH_HALT
,
748 .enable_reg
= 0x6054,
749 .enable_mask
= BIT(0),
750 .hw
.init
= &(struct clk_init_data
){
751 .name
= "cam_cc_bps_areg_clk",
752 .parent_hws
= (const struct clk_hw
*[]){
753 &cam_cc_fast_ahb_clk_src
.clkr
.hw
,
756 .flags
= CLK_SET_RATE_PARENT
,
757 .ops
= &clk_branch2_ops
,
762 static struct clk_branch cam_cc_bps_axi_clk
= {
764 .halt_check
= BRANCH_HALT
,
766 .enable_reg
= 0x6038,
767 .enable_mask
= BIT(0),
768 .hw
.init
= &(struct clk_init_data
){
769 .name
= "cam_cc_bps_axi_clk",
770 .ops
= &clk_branch2_ops
,
775 static struct clk_branch cam_cc_bps_clk
= {
777 .halt_check
= BRANCH_HALT
,
779 .enable_reg
= 0x6028,
780 .enable_mask
= BIT(0),
781 .hw
.init
= &(struct clk_init_data
){
782 .name
= "cam_cc_bps_clk",
783 .parent_hws
= (const struct clk_hw
*[]){
784 &cam_cc_bps_clk_src
.clkr
.hw
,
787 .flags
= CLK_SET_RATE_PARENT
,
788 .ops
= &clk_branch2_ops
,
793 static struct clk_branch cam_cc_camnoc_axi_clk
= {
795 .halt_check
= BRANCH_HALT
,
797 .enable_reg
= 0xb124,
798 .enable_mask
= BIT(0),
799 .hw
.init
= &(struct clk_init_data
){
800 .name
= "cam_cc_camnoc_axi_clk",
801 .ops
= &clk_branch2_ops
,
806 static struct clk_branch cam_cc_cci_0_clk
= {
808 .halt_check
= BRANCH_HALT
,
810 .enable_reg
= 0xb0f0,
811 .enable_mask
= BIT(0),
812 .hw
.init
= &(struct clk_init_data
){
813 .name
= "cam_cc_cci_0_clk",
814 .parent_hws
= (const struct clk_hw
*[]){
815 &cam_cc_cci_0_clk_src
.clkr
.hw
,
818 .flags
= CLK_SET_RATE_PARENT
,
819 .ops
= &clk_branch2_ops
,
824 static struct clk_branch cam_cc_cci_1_clk
= {
826 .halt_check
= BRANCH_HALT
,
828 .enable_reg
= 0xb164,
829 .enable_mask
= BIT(0),
830 .hw
.init
= &(struct clk_init_data
){
831 .name
= "cam_cc_cci_1_clk",
832 .parent_hws
= (const struct clk_hw
*[]){
833 &cam_cc_cci_1_clk_src
.clkr
.hw
,
836 .flags
= CLK_SET_RATE_PARENT
,
837 .ops
= &clk_branch2_ops
,
842 static struct clk_branch cam_cc_core_ahb_clk
= {
844 .halt_check
= BRANCH_HALT_DELAY
,
846 .enable_reg
= 0xb144,
847 .enable_mask
= BIT(0),
848 .hw
.init
= &(struct clk_init_data
){
849 .name
= "cam_cc_core_ahb_clk",
850 .parent_hws
= (const struct clk_hw
*[]){
851 &cam_cc_slow_ahb_clk_src
.clkr
.hw
,
854 .flags
= CLK_SET_RATE_PARENT
,
855 .ops
= &clk_branch2_ops
,
860 static struct clk_branch cam_cc_cpas_ahb_clk
= {
862 .halt_check
= BRANCH_HALT
,
864 .enable_reg
= 0xb11c,
865 .enable_mask
= BIT(0),
866 .hw
.init
= &(struct clk_init_data
){
867 .name
= "cam_cc_cpas_ahb_clk",
868 .parent_hws
= (const struct clk_hw
*[]){
869 &cam_cc_slow_ahb_clk_src
.clkr
.hw
,
872 .flags
= CLK_SET_RATE_PARENT
,
873 .ops
= &clk_branch2_ops
,
878 static struct clk_branch cam_cc_csi0phytimer_clk
= {
880 .halt_check
= BRANCH_HALT
,
882 .enable_reg
= 0x501c,
883 .enable_mask
= BIT(0),
884 .hw
.init
= &(struct clk_init_data
){
885 .name
= "cam_cc_csi0phytimer_clk",
886 .parent_hws
= (const struct clk_hw
*[]){
887 &cam_cc_csi0phytimer_clk_src
.clkr
.hw
,
890 .flags
= CLK_SET_RATE_PARENT
,
891 .ops
= &clk_branch2_ops
,
896 static struct clk_branch cam_cc_csi1phytimer_clk
= {
898 .halt_check
= BRANCH_HALT
,
900 .enable_reg
= 0x5040,
901 .enable_mask
= BIT(0),
902 .hw
.init
= &(struct clk_init_data
){
903 .name
= "cam_cc_csi1phytimer_clk",
904 .parent_hws
= (const struct clk_hw
*[]){
905 &cam_cc_csi1phytimer_clk_src
.clkr
.hw
,
908 .flags
= CLK_SET_RATE_PARENT
,
909 .ops
= &clk_branch2_ops
,
914 static struct clk_branch cam_cc_csi2phytimer_clk
= {
916 .halt_check
= BRANCH_HALT
,
918 .enable_reg
= 0x5064,
919 .enable_mask
= BIT(0),
920 .hw
.init
= &(struct clk_init_data
){
921 .name
= "cam_cc_csi2phytimer_clk",
922 .parent_hws
= (const struct clk_hw
*[]){
923 &cam_cc_csi2phytimer_clk_src
.clkr
.hw
,
926 .flags
= CLK_SET_RATE_PARENT
,
927 .ops
= &clk_branch2_ops
,
932 static struct clk_branch cam_cc_csi3phytimer_clk
= {
934 .halt_check
= BRANCH_HALT
,
936 .enable_reg
= 0x5088,
937 .enable_mask
= BIT(0),
938 .hw
.init
= &(struct clk_init_data
){
939 .name
= "cam_cc_csi3phytimer_clk",
940 .parent_hws
= (const struct clk_hw
*[]){
941 &cam_cc_csi3phytimer_clk_src
.clkr
.hw
,
944 .flags
= CLK_SET_RATE_PARENT
,
945 .ops
= &clk_branch2_ops
,
950 static struct clk_branch cam_cc_csiphy0_clk
= {
952 .halt_check
= BRANCH_HALT
,
954 .enable_reg
= 0x5020,
955 .enable_mask
= BIT(0),
956 .hw
.init
= &(struct clk_init_data
){
957 .name
= "cam_cc_csiphy0_clk",
958 .parent_hws
= (const struct clk_hw
*[]){
959 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
962 .flags
= CLK_SET_RATE_PARENT
,
963 .ops
= &clk_branch2_ops
,
968 static struct clk_branch cam_cc_csiphy1_clk
= {
970 .halt_check
= BRANCH_HALT
,
972 .enable_reg
= 0x5044,
973 .enable_mask
= BIT(0),
974 .hw
.init
= &(struct clk_init_data
){
975 .name
= "cam_cc_csiphy1_clk",
976 .parent_hws
= (const struct clk_hw
*[]){
977 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
980 .flags
= CLK_SET_RATE_PARENT
,
981 .ops
= &clk_branch2_ops
,
986 static struct clk_branch cam_cc_csiphy2_clk
= {
988 .halt_check
= BRANCH_HALT
,
990 .enable_reg
= 0x5068,
991 .enable_mask
= BIT(0),
992 .hw
.init
= &(struct clk_init_data
){
993 .name
= "cam_cc_csiphy2_clk",
994 .parent_hws
= (const struct clk_hw
*[]){
995 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
998 .flags
= CLK_SET_RATE_PARENT
,
999 .ops
= &clk_branch2_ops
,
1004 static struct clk_branch cam_cc_csiphy3_clk
= {
1006 .halt_check
= BRANCH_HALT
,
1008 .enable_reg
= 0x508c,
1009 .enable_mask
= BIT(0),
1010 .hw
.init
= &(struct clk_init_data
){
1011 .name
= "cam_cc_csiphy3_clk",
1012 .parent_hws
= (const struct clk_hw
*[]){
1013 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
1016 .flags
= CLK_SET_RATE_PARENT
,
1017 .ops
= &clk_branch2_ops
,
1022 static struct clk_branch cam_cc_icp_clk
= {
1024 .halt_check
= BRANCH_HALT
,
1026 .enable_reg
= 0xb0a0,
1027 .enable_mask
= BIT(0),
1028 .hw
.init
= &(struct clk_init_data
){
1029 .name
= "cam_cc_icp_clk",
1030 .parent_hws
= (const struct clk_hw
*[]){
1031 &cam_cc_icp_clk_src
.clkr
.hw
,
1034 .flags
= CLK_SET_RATE_PARENT
,
1035 .ops
= &clk_branch2_ops
,
1040 static struct clk_branch cam_cc_ife_0_axi_clk
= {
1042 .halt_check
= BRANCH_HALT
,
1044 .enable_reg
= 0x9080,
1045 .enable_mask
= BIT(0),
1046 .hw
.init
= &(struct clk_init_data
){
1047 .name
= "cam_cc_ife_0_axi_clk",
1048 .ops
= &clk_branch2_ops
,
1053 static struct clk_branch cam_cc_ife_0_clk
= {
1055 .halt_check
= BRANCH_HALT
,
1057 .enable_reg
= 0x9028,
1058 .enable_mask
= BIT(0),
1059 .hw
.init
= &(struct clk_init_data
){
1060 .name
= "cam_cc_ife_0_clk",
1061 .parent_hws
= (const struct clk_hw
*[]){
1062 &cam_cc_ife_0_clk_src
.clkr
.hw
,
1065 .flags
= CLK_SET_RATE_PARENT
,
1066 .ops
= &clk_branch2_ops
,
1071 static struct clk_branch cam_cc_ife_0_cphy_rx_clk
= {
1073 .halt_check
= BRANCH_HALT
,
1075 .enable_reg
= 0x907c,
1076 .enable_mask
= BIT(0),
1077 .hw
.init
= &(struct clk_init_data
){
1078 .name
= "cam_cc_ife_0_cphy_rx_clk",
1079 .parent_hws
= (const struct clk_hw
*[]){
1080 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
1083 .flags
= CLK_SET_RATE_PARENT
,
1084 .ops
= &clk_branch2_ops
,
1089 static struct clk_branch cam_cc_ife_0_csid_clk
= {
1091 .halt_check
= BRANCH_HALT
,
1093 .enable_reg
= 0x9054,
1094 .enable_mask
= BIT(0),
1095 .hw
.init
= &(struct clk_init_data
){
1096 .name
= "cam_cc_ife_0_csid_clk",
1097 .parent_hws
= (const struct clk_hw
*[]){
1098 &cam_cc_ife_0_csid_clk_src
.clkr
.hw
,
1101 .flags
= CLK_SET_RATE_PARENT
,
1102 .ops
= &clk_branch2_ops
,
1107 static struct clk_branch cam_cc_ife_0_dsp_clk
= {
1109 .halt_check
= BRANCH_HALT
,
1111 .enable_reg
= 0x9038,
1112 .enable_mask
= BIT(0),
1113 .hw
.init
= &(struct clk_init_data
){
1114 .name
= "cam_cc_ife_0_dsp_clk",
1115 .parent_hws
= (const struct clk_hw
*[]){
1116 &cam_cc_ife_0_clk_src
.clkr
.hw
,
1119 .flags
= CLK_SET_RATE_PARENT
,
1120 .ops
= &clk_branch2_ops
,
1125 static struct clk_branch cam_cc_ife_1_axi_clk
= {
1127 .halt_check
= BRANCH_HALT
,
1129 .enable_reg
= 0xa058,
1130 .enable_mask
= BIT(0),
1131 .hw
.init
= &(struct clk_init_data
){
1132 .name
= "cam_cc_ife_1_axi_clk",
1133 .ops
= &clk_branch2_ops
,
1138 static struct clk_branch cam_cc_ife_1_clk
= {
1140 .halt_check
= BRANCH_HALT
,
1142 .enable_reg
= 0xa028,
1143 .enable_mask
= BIT(0),
1144 .hw
.init
= &(struct clk_init_data
){
1145 .name
= "cam_cc_ife_1_clk",
1146 .parent_hws
= (const struct clk_hw
*[]){
1147 &cam_cc_ife_1_clk_src
.clkr
.hw
,
1150 .flags
= CLK_SET_RATE_PARENT
,
1151 .ops
= &clk_branch2_ops
,
1156 static struct clk_branch cam_cc_ife_1_cphy_rx_clk
= {
1158 .halt_check
= BRANCH_HALT
,
1160 .enable_reg
= 0xa054,
1161 .enable_mask
= BIT(0),
1162 .hw
.init
= &(struct clk_init_data
){
1163 .name
= "cam_cc_ife_1_cphy_rx_clk",
1164 .parent_hws
= (const struct clk_hw
*[]){
1165 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
1168 .flags
= CLK_SET_RATE_PARENT
,
1169 .ops
= &clk_branch2_ops
,
1174 static struct clk_branch cam_cc_ife_1_csid_clk
= {
1176 .halt_check
= BRANCH_HALT
,
1178 .enable_reg
= 0xa04c,
1179 .enable_mask
= BIT(0),
1180 .hw
.init
= &(struct clk_init_data
){
1181 .name
= "cam_cc_ife_1_csid_clk",
1182 .parent_hws
= (const struct clk_hw
*[]){
1183 &cam_cc_ife_1_csid_clk_src
.clkr
.hw
,
1186 .flags
= CLK_SET_RATE_PARENT
,
1187 .ops
= &clk_branch2_ops
,
1192 static struct clk_branch cam_cc_ife_1_dsp_clk
= {
1194 .halt_check
= BRANCH_HALT
,
1196 .enable_reg
= 0xa030,
1197 .enable_mask
= BIT(0),
1198 .hw
.init
= &(struct clk_init_data
){
1199 .name
= "cam_cc_ife_1_dsp_clk",
1200 .parent_hws
= (const struct clk_hw
*[]){
1201 &cam_cc_ife_1_clk_src
.clkr
.hw
,
1204 .flags
= CLK_SET_RATE_PARENT
,
1205 .ops
= &clk_branch2_ops
,
1210 static struct clk_branch cam_cc_ife_lite_clk
= {
1212 .halt_check
= BRANCH_HALT
,
1214 .enable_reg
= 0xb01c,
1215 .enable_mask
= BIT(0),
1216 .hw
.init
= &(struct clk_init_data
){
1217 .name
= "cam_cc_ife_lite_clk",
1218 .parent_hws
= (const struct clk_hw
*[]){
1219 &cam_cc_ife_lite_clk_src
.clkr
.hw
,
1222 .flags
= CLK_SET_RATE_PARENT
,
1223 .ops
= &clk_branch2_ops
,
1228 static struct clk_branch cam_cc_ife_lite_cphy_rx_clk
= {
1230 .halt_check
= BRANCH_HALT
,
1232 .enable_reg
= 0xb044,
1233 .enable_mask
= BIT(0),
1234 .hw
.init
= &(struct clk_init_data
){
1235 .name
= "cam_cc_ife_lite_cphy_rx_clk",
1236 .parent_hws
= (const struct clk_hw
*[]){
1237 &cam_cc_cphy_rx_clk_src
.clkr
.hw
,
1240 .flags
= CLK_SET_RATE_PARENT
,
1241 .ops
= &clk_branch2_ops
,
1246 static struct clk_branch cam_cc_ife_lite_csid_clk
= {
1248 .halt_check
= BRANCH_HALT
,
1250 .enable_reg
= 0xb03c,
1251 .enable_mask
= BIT(0),
1252 .hw
.init
= &(struct clk_init_data
){
1253 .name
= "cam_cc_ife_lite_csid_clk",
1254 .parent_hws
= (const struct clk_hw
*[]){
1255 &cam_cc_ife_lite_csid_clk_src
.clkr
.hw
,
1258 .flags
= CLK_SET_RATE_PARENT
,
1259 .ops
= &clk_branch2_ops
,
1264 static struct clk_branch cam_cc_ipe_0_ahb_clk
= {
1266 .halt_check
= BRANCH_HALT
,
1268 .enable_reg
= 0x7040,
1269 .enable_mask
= BIT(0),
1270 .hw
.init
= &(struct clk_init_data
){
1271 .name
= "cam_cc_ipe_0_ahb_clk",
1272 .parent_hws
= (const struct clk_hw
*[]){
1273 &cam_cc_slow_ahb_clk_src
.clkr
.hw
,
1276 .flags
= CLK_SET_RATE_PARENT
,
1277 .ops
= &clk_branch2_ops
,
1282 static struct clk_branch cam_cc_ipe_0_areg_clk
= {
1284 .halt_check
= BRANCH_HALT
,
1286 .enable_reg
= 0x703c,
1287 .enable_mask
= BIT(0),
1288 .hw
.init
= &(struct clk_init_data
){
1289 .name
= "cam_cc_ipe_0_areg_clk",
1290 .parent_hws
= (const struct clk_hw
*[]){
1291 &cam_cc_fast_ahb_clk_src
.clkr
.hw
,
1294 .flags
= CLK_SET_RATE_PARENT
,
1295 .ops
= &clk_branch2_ops
,
1300 static struct clk_branch cam_cc_ipe_0_axi_clk
= {
1302 .halt_check
= BRANCH_HALT
,
1304 .enable_reg
= 0x7038,
1305 .enable_mask
= BIT(0),
1306 .hw
.init
= &(struct clk_init_data
){
1307 .name
= "cam_cc_ipe_0_axi_clk",
1308 .ops
= &clk_branch2_ops
,
1313 static struct clk_branch cam_cc_ipe_0_clk
= {
1315 .halt_check
= BRANCH_HALT
,
1317 .enable_reg
= 0x7028,
1318 .enable_mask
= BIT(0),
1319 .hw
.init
= &(struct clk_init_data
){
1320 .name
= "cam_cc_ipe_0_clk",
1321 .parent_hws
= (const struct clk_hw
*[]){
1322 &cam_cc_ipe_0_clk_src
.clkr
.hw
,
1325 .flags
= CLK_SET_RATE_PARENT
,
1326 .ops
= &clk_branch2_ops
,
1331 static struct clk_branch cam_cc_jpeg_clk
= {
1333 .halt_check
= BRANCH_HALT
,
1335 .enable_reg
= 0xb064,
1336 .enable_mask
= BIT(0),
1337 .hw
.init
= &(struct clk_init_data
){
1338 .name
= "cam_cc_jpeg_clk",
1339 .parent_hws
= (const struct clk_hw
*[]){
1340 &cam_cc_jpeg_clk_src
.clkr
.hw
,
1343 .flags
= CLK_SET_RATE_PARENT
,
1344 .ops
= &clk_branch2_ops
,
1349 static struct clk_branch cam_cc_lrme_clk
= {
1351 .halt_check
= BRANCH_HALT
,
1353 .enable_reg
= 0xb110,
1354 .enable_mask
= BIT(0),
1355 .hw
.init
= &(struct clk_init_data
){
1356 .name
= "cam_cc_lrme_clk",
1357 .parent_hws
= (const struct clk_hw
*[]){
1358 &cam_cc_lrme_clk_src
.clkr
.hw
,
1361 .flags
= CLK_SET_RATE_PARENT
,
1362 .ops
= &clk_branch2_ops
,
1367 static struct clk_branch cam_cc_mclk0_clk
= {
1369 .halt_check
= BRANCH_HALT
,
1371 .enable_reg
= 0x401c,
1372 .enable_mask
= BIT(0),
1373 .hw
.init
= &(struct clk_init_data
){
1374 .name
= "cam_cc_mclk0_clk",
1375 .parent_hws
= (const struct clk_hw
*[]){
1376 &cam_cc_mclk0_clk_src
.clkr
.hw
,
1379 .flags
= CLK_SET_RATE_PARENT
,
1380 .ops
= &clk_branch2_ops
,
1385 static struct clk_branch cam_cc_mclk1_clk
= {
1387 .halt_check
= BRANCH_HALT
,
1389 .enable_reg
= 0x403c,
1390 .enable_mask
= BIT(0),
1391 .hw
.init
= &(struct clk_init_data
){
1392 .name
= "cam_cc_mclk1_clk",
1393 .parent_hws
= (const struct clk_hw
*[]){
1394 &cam_cc_mclk1_clk_src
.clkr
.hw
,
1397 .flags
= CLK_SET_RATE_PARENT
,
1398 .ops
= &clk_branch2_ops
,
1403 static struct clk_branch cam_cc_mclk2_clk
= {
1405 .halt_check
= BRANCH_HALT
,
1407 .enable_reg
= 0x405c,
1408 .enable_mask
= BIT(0),
1409 .hw
.init
= &(struct clk_init_data
){
1410 .name
= "cam_cc_mclk2_clk",
1411 .parent_hws
= (const struct clk_hw
*[]){
1412 &cam_cc_mclk2_clk_src
.clkr
.hw
,
1415 .flags
= CLK_SET_RATE_PARENT
,
1416 .ops
= &clk_branch2_ops
,
1421 static struct clk_branch cam_cc_mclk3_clk
= {
1423 .halt_check
= BRANCH_HALT
,
1425 .enable_reg
= 0x407c,
1426 .enable_mask
= BIT(0),
1427 .hw
.init
= &(struct clk_init_data
){
1428 .name
= "cam_cc_mclk3_clk",
1429 .parent_hws
= (const struct clk_hw
*[]){
1430 &cam_cc_mclk3_clk_src
.clkr
.hw
,
1433 .flags
= CLK_SET_RATE_PARENT
,
1434 .ops
= &clk_branch2_ops
,
1439 static struct clk_branch cam_cc_mclk4_clk
= {
1441 .halt_check
= BRANCH_HALT
,
1443 .enable_reg
= 0x409c,
1444 .enable_mask
= BIT(0),
1445 .hw
.init
= &(struct clk_init_data
){
1446 .name
= "cam_cc_mclk4_clk",
1447 .parent_hws
= (const struct clk_hw
*[]){
1448 &cam_cc_mclk4_clk_src
.clkr
.hw
,
1451 .flags
= CLK_SET_RATE_PARENT
,
1452 .ops
= &clk_branch2_ops
,
1457 static struct clk_branch cam_cc_soc_ahb_clk
= {
1459 .halt_check
= BRANCH_HALT
,
1461 .enable_reg
= 0xb140,
1462 .enable_mask
= BIT(0),
1463 .hw
.init
= &(struct clk_init_data
){
1464 .name
= "cam_cc_soc_ahb_clk",
1465 .ops
= &clk_branch2_ops
,
1470 static struct clk_branch cam_cc_sys_tmr_clk
= {
1472 .halt_check
= BRANCH_HALT
,
1474 .enable_reg
= 0xb0a8,
1475 .enable_mask
= BIT(0),
1476 .hw
.init
= &(struct clk_init_data
){
1477 .name
= "cam_cc_sys_tmr_clk",
1478 .ops
= &clk_branch2_ops
,
1483 static struct gdsc titan_top_gdsc
= {
1486 .name
= "titan_top_gdsc",
1488 .pwrsts
= PWRSTS_OFF_ON
,
1491 static struct gdsc bps_gdsc
= {
1496 .pwrsts
= PWRSTS_OFF_ON
,
1497 .parent
= &titan_top_gdsc
.pd
,
1501 static struct gdsc ife_0_gdsc
= {
1504 .name
= "ife_0_gdsc",
1506 .pwrsts
= PWRSTS_OFF_ON
,
1507 .parent
= &titan_top_gdsc
.pd
,
1510 static struct gdsc ife_1_gdsc
= {
1513 .name
= "ife_1_gdsc",
1515 .pwrsts
= PWRSTS_OFF_ON
,
1516 .parent
= &titan_top_gdsc
.pd
,
1519 static struct gdsc ipe_0_gdsc
= {
1522 .name
= "ipe_0_gdsc",
1524 .pwrsts
= PWRSTS_OFF_ON
,
1526 .parent
= &titan_top_gdsc
.pd
,
1530 static struct clk_hw
*cam_cc_sc7180_hws
[] = {
1531 [CAM_CC_PLL2_OUT_EARLY
] = &cam_cc_pll2_out_early
.hw
,
1534 static struct clk_regmap
*cam_cc_sc7180_clocks
[] = {
1535 [CAM_CC_BPS_AHB_CLK
] = &cam_cc_bps_ahb_clk
.clkr
,
1536 [CAM_CC_BPS_AREG_CLK
] = &cam_cc_bps_areg_clk
.clkr
,
1537 [CAM_CC_BPS_AXI_CLK
] = &cam_cc_bps_axi_clk
.clkr
,
1538 [CAM_CC_BPS_CLK
] = &cam_cc_bps_clk
.clkr
,
1539 [CAM_CC_BPS_CLK_SRC
] = &cam_cc_bps_clk_src
.clkr
,
1540 [CAM_CC_CAMNOC_AXI_CLK
] = &cam_cc_camnoc_axi_clk
.clkr
,
1541 [CAM_CC_CCI_0_CLK
] = &cam_cc_cci_0_clk
.clkr
,
1542 [CAM_CC_CCI_0_CLK_SRC
] = &cam_cc_cci_0_clk_src
.clkr
,
1543 [CAM_CC_CCI_1_CLK
] = &cam_cc_cci_1_clk
.clkr
,
1544 [CAM_CC_CCI_1_CLK_SRC
] = &cam_cc_cci_1_clk_src
.clkr
,
1545 [CAM_CC_CORE_AHB_CLK
] = &cam_cc_core_ahb_clk
.clkr
,
1546 [CAM_CC_CPAS_AHB_CLK
] = &cam_cc_cpas_ahb_clk
.clkr
,
1547 [CAM_CC_CPHY_RX_CLK_SRC
] = &cam_cc_cphy_rx_clk_src
.clkr
,
1548 [CAM_CC_CSI0PHYTIMER_CLK
] = &cam_cc_csi0phytimer_clk
.clkr
,
1549 [CAM_CC_CSI0PHYTIMER_CLK_SRC
] = &cam_cc_csi0phytimer_clk_src
.clkr
,
1550 [CAM_CC_CSI1PHYTIMER_CLK
] = &cam_cc_csi1phytimer_clk
.clkr
,
1551 [CAM_CC_CSI1PHYTIMER_CLK_SRC
] = &cam_cc_csi1phytimer_clk_src
.clkr
,
1552 [CAM_CC_CSI2PHYTIMER_CLK
] = &cam_cc_csi2phytimer_clk
.clkr
,
1553 [CAM_CC_CSI2PHYTIMER_CLK_SRC
] = &cam_cc_csi2phytimer_clk_src
.clkr
,
1554 [CAM_CC_CSI3PHYTIMER_CLK
] = &cam_cc_csi3phytimer_clk
.clkr
,
1555 [CAM_CC_CSI3PHYTIMER_CLK_SRC
] = &cam_cc_csi3phytimer_clk_src
.clkr
,
1556 [CAM_CC_CSIPHY0_CLK
] = &cam_cc_csiphy0_clk
.clkr
,
1557 [CAM_CC_CSIPHY1_CLK
] = &cam_cc_csiphy1_clk
.clkr
,
1558 [CAM_CC_CSIPHY2_CLK
] = &cam_cc_csiphy2_clk
.clkr
,
1559 [CAM_CC_CSIPHY3_CLK
] = &cam_cc_csiphy3_clk
.clkr
,
1560 [CAM_CC_FAST_AHB_CLK_SRC
] = &cam_cc_fast_ahb_clk_src
.clkr
,
1561 [CAM_CC_ICP_CLK
] = &cam_cc_icp_clk
.clkr
,
1562 [CAM_CC_ICP_CLK_SRC
] = &cam_cc_icp_clk_src
.clkr
,
1563 [CAM_CC_IFE_0_AXI_CLK
] = &cam_cc_ife_0_axi_clk
.clkr
,
1564 [CAM_CC_IFE_0_CLK
] = &cam_cc_ife_0_clk
.clkr
,
1565 [CAM_CC_IFE_0_CLK_SRC
] = &cam_cc_ife_0_clk_src
.clkr
,
1566 [CAM_CC_IFE_0_CPHY_RX_CLK
] = &cam_cc_ife_0_cphy_rx_clk
.clkr
,
1567 [CAM_CC_IFE_0_CSID_CLK
] = &cam_cc_ife_0_csid_clk
.clkr
,
1568 [CAM_CC_IFE_0_CSID_CLK_SRC
] = &cam_cc_ife_0_csid_clk_src
.clkr
,
1569 [CAM_CC_IFE_0_DSP_CLK
] = &cam_cc_ife_0_dsp_clk
.clkr
,
1570 [CAM_CC_IFE_1_AXI_CLK
] = &cam_cc_ife_1_axi_clk
.clkr
,
1571 [CAM_CC_IFE_1_CLK
] = &cam_cc_ife_1_clk
.clkr
,
1572 [CAM_CC_IFE_1_CLK_SRC
] = &cam_cc_ife_1_clk_src
.clkr
,
1573 [CAM_CC_IFE_1_CPHY_RX_CLK
] = &cam_cc_ife_1_cphy_rx_clk
.clkr
,
1574 [CAM_CC_IFE_1_CSID_CLK
] = &cam_cc_ife_1_csid_clk
.clkr
,
1575 [CAM_CC_IFE_1_CSID_CLK_SRC
] = &cam_cc_ife_1_csid_clk_src
.clkr
,
1576 [CAM_CC_IFE_1_DSP_CLK
] = &cam_cc_ife_1_dsp_clk
.clkr
,
1577 [CAM_CC_IFE_LITE_CLK
] = &cam_cc_ife_lite_clk
.clkr
,
1578 [CAM_CC_IFE_LITE_CLK_SRC
] = &cam_cc_ife_lite_clk_src
.clkr
,
1579 [CAM_CC_IFE_LITE_CPHY_RX_CLK
] = &cam_cc_ife_lite_cphy_rx_clk
.clkr
,
1580 [CAM_CC_IFE_LITE_CSID_CLK
] = &cam_cc_ife_lite_csid_clk
.clkr
,
1581 [CAM_CC_IFE_LITE_CSID_CLK_SRC
] = &cam_cc_ife_lite_csid_clk_src
.clkr
,
1582 [CAM_CC_IPE_0_AHB_CLK
] = &cam_cc_ipe_0_ahb_clk
.clkr
,
1583 [CAM_CC_IPE_0_AREG_CLK
] = &cam_cc_ipe_0_areg_clk
.clkr
,
1584 [CAM_CC_IPE_0_AXI_CLK
] = &cam_cc_ipe_0_axi_clk
.clkr
,
1585 [CAM_CC_IPE_0_CLK
] = &cam_cc_ipe_0_clk
.clkr
,
1586 [CAM_CC_IPE_0_CLK_SRC
] = &cam_cc_ipe_0_clk_src
.clkr
,
1587 [CAM_CC_JPEG_CLK
] = &cam_cc_jpeg_clk
.clkr
,
1588 [CAM_CC_JPEG_CLK_SRC
] = &cam_cc_jpeg_clk_src
.clkr
,
1589 [CAM_CC_LRME_CLK
] = &cam_cc_lrme_clk
.clkr
,
1590 [CAM_CC_LRME_CLK_SRC
] = &cam_cc_lrme_clk_src
.clkr
,
1591 [CAM_CC_MCLK0_CLK
] = &cam_cc_mclk0_clk
.clkr
,
1592 [CAM_CC_MCLK0_CLK_SRC
] = &cam_cc_mclk0_clk_src
.clkr
,
1593 [CAM_CC_MCLK1_CLK
] = &cam_cc_mclk1_clk
.clkr
,
1594 [CAM_CC_MCLK1_CLK_SRC
] = &cam_cc_mclk1_clk_src
.clkr
,
1595 [CAM_CC_MCLK2_CLK
] = &cam_cc_mclk2_clk
.clkr
,
1596 [CAM_CC_MCLK2_CLK_SRC
] = &cam_cc_mclk2_clk_src
.clkr
,
1597 [CAM_CC_MCLK3_CLK
] = &cam_cc_mclk3_clk
.clkr
,
1598 [CAM_CC_MCLK3_CLK_SRC
] = &cam_cc_mclk3_clk_src
.clkr
,
1599 [CAM_CC_MCLK4_CLK
] = &cam_cc_mclk4_clk
.clkr
,
1600 [CAM_CC_MCLK4_CLK_SRC
] = &cam_cc_mclk4_clk_src
.clkr
,
1601 [CAM_CC_PLL0
] = &cam_cc_pll0
.clkr
,
1602 [CAM_CC_PLL1
] = &cam_cc_pll1
.clkr
,
1603 [CAM_CC_PLL2
] = &cam_cc_pll2
.clkr
,
1604 [CAM_CC_PLL2_OUT_AUX
] = &cam_cc_pll2_out_aux
.clkr
,
1605 [CAM_CC_PLL3
] = &cam_cc_pll3
.clkr
,
1606 [CAM_CC_SLOW_AHB_CLK_SRC
] = &cam_cc_slow_ahb_clk_src
.clkr
,
1607 [CAM_CC_SOC_AHB_CLK
] = &cam_cc_soc_ahb_clk
.clkr
,
1608 [CAM_CC_SYS_TMR_CLK
] = &cam_cc_sys_tmr_clk
.clkr
,
1610 static struct gdsc
*cam_cc_sc7180_gdscs
[] = {
1611 [BPS_GDSC
] = &bps_gdsc
,
1612 [IFE_0_GDSC
] = &ife_0_gdsc
,
1613 [IFE_1_GDSC
] = &ife_1_gdsc
,
1614 [IPE_0_GDSC
] = &ipe_0_gdsc
,
1615 [TITAN_TOP_GDSC
] = &titan_top_gdsc
,
1618 static const struct regmap_config cam_cc_sc7180_regmap_config
= {
1622 .max_register
= 0xd028,
1626 static const struct qcom_cc_desc cam_cc_sc7180_desc
= {
1627 .config
= &cam_cc_sc7180_regmap_config
,
1628 .clk_hws
= cam_cc_sc7180_hws
,
1629 .num_clk_hws
= ARRAY_SIZE(cam_cc_sc7180_hws
),
1630 .clks
= cam_cc_sc7180_clocks
,
1631 .num_clks
= ARRAY_SIZE(cam_cc_sc7180_clocks
),
1632 .gdscs
= cam_cc_sc7180_gdscs
,
1633 .num_gdscs
= ARRAY_SIZE(cam_cc_sc7180_gdscs
),
1636 static const struct of_device_id cam_cc_sc7180_match_table
[] = {
1637 { .compatible
= "qcom,sc7180-camcc" },
1640 MODULE_DEVICE_TABLE(of
, cam_cc_sc7180_match_table
);
1642 static int cam_cc_sc7180_probe(struct platform_device
*pdev
)
1644 struct regmap
*regmap
;
1647 ret
= devm_pm_runtime_enable(&pdev
->dev
);
1651 ret
= devm_pm_clk_create(&pdev
->dev
);
1655 ret
= pm_clk_add(&pdev
->dev
, "xo");
1657 dev_err(&pdev
->dev
, "Failed to acquire XO clock\n");
1661 ret
= pm_clk_add(&pdev
->dev
, "iface");
1663 dev_err(&pdev
->dev
, "Failed to acquire iface clock\n");
1667 ret
= pm_runtime_resume_and_get(&pdev
->dev
);
1671 regmap
= qcom_cc_map(pdev
, &cam_cc_sc7180_desc
);
1672 if (IS_ERR(regmap
)) {
1673 ret
= PTR_ERR(regmap
);
1674 pm_runtime_put(&pdev
->dev
);
1678 clk_fabia_pll_configure(&cam_cc_pll0
, regmap
, &cam_cc_pll0_config
);
1679 clk_fabia_pll_configure(&cam_cc_pll1
, regmap
, &cam_cc_pll1_config
);
1680 clk_agera_pll_configure(&cam_cc_pll2
, regmap
, &cam_cc_pll2_config
);
1681 clk_fabia_pll_configure(&cam_cc_pll3
, regmap
, &cam_cc_pll3_config
);
1683 ret
= qcom_cc_really_probe(&pdev
->dev
, &cam_cc_sc7180_desc
, regmap
);
1684 pm_runtime_put(&pdev
->dev
);
1686 dev_err(&pdev
->dev
, "Failed to register CAM CC clocks\n");
1693 static const struct dev_pm_ops cam_cc_pm_ops
= {
1694 SET_RUNTIME_PM_OPS(pm_clk_suspend
, pm_clk_resume
, NULL
)
1697 static struct platform_driver cam_cc_sc7180_driver
= {
1698 .probe
= cam_cc_sc7180_probe
,
1700 .name
= "cam_cc-sc7180",
1701 .of_match_table
= cam_cc_sc7180_match_table
,
1702 .pm
= &cam_cc_pm_ops
,
1706 module_platform_driver(cam_cc_sc7180_driver
);
1708 MODULE_DESCRIPTION("QTI CAM_CC SC7180 Driver");
1709 MODULE_LICENSE("GPL v2");