18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2018, The Linux Foundation. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
78c2ecf20Sopenharmony_ci#include <linux/module.h>
88c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
98c2ecf20Sopenharmony_ci#include <linux/regmap.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <dt-bindings/clock/qcom,videocc-sdm845.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include "common.h"
148c2ecf20Sopenharmony_ci#include "clk-alpha-pll.h"
158c2ecf20Sopenharmony_ci#include "clk-branch.h"
168c2ecf20Sopenharmony_ci#include "clk-rcg.h"
178c2ecf20Sopenharmony_ci#include "clk-regmap.h"
188c2ecf20Sopenharmony_ci#include "clk-pll.h"
198c2ecf20Sopenharmony_ci#include "gdsc.h"
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cienum {
228c2ecf20Sopenharmony_ci	P_BI_TCXO,
238c2ecf20Sopenharmony_ci	P_CORE_BI_PLL_TEST_SE,
248c2ecf20Sopenharmony_ci	P_VIDEO_PLL0_OUT_EVEN,
258c2ecf20Sopenharmony_ci	P_VIDEO_PLL0_OUT_MAIN,
268c2ecf20Sopenharmony_ci	P_VIDEO_PLL0_OUT_ODD,
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic const struct parent_map video_cc_parent_map_0[] = {
308c2ecf20Sopenharmony_ci	{ P_BI_TCXO, 0 },
318c2ecf20Sopenharmony_ci	{ P_VIDEO_PLL0_OUT_MAIN, 1 },
328c2ecf20Sopenharmony_ci	{ P_VIDEO_PLL0_OUT_EVEN, 2 },
338c2ecf20Sopenharmony_ci	{ P_VIDEO_PLL0_OUT_ODD, 3 },
348c2ecf20Sopenharmony_ci	{ P_CORE_BI_PLL_TEST_SE, 4 },
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistatic const char * const video_cc_parent_names_0[] = {
388c2ecf20Sopenharmony_ci	"bi_tcxo",
398c2ecf20Sopenharmony_ci	"video_pll0",
408c2ecf20Sopenharmony_ci	"video_pll0_out_even",
418c2ecf20Sopenharmony_ci	"video_pll0_out_odd",
428c2ecf20Sopenharmony_ci	"core_bi_pll_test_se",
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic const struct alpha_pll_config video_pll0_config = {
468c2ecf20Sopenharmony_ci	.l = 0x10,
478c2ecf20Sopenharmony_ci	.alpha = 0xaaab,
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistatic struct clk_alpha_pll video_pll0 = {
518c2ecf20Sopenharmony_ci	.offset = 0x42c,
528c2ecf20Sopenharmony_ci	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
538c2ecf20Sopenharmony_ci	.clkr = {
548c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
558c2ecf20Sopenharmony_ci			.name = "video_pll0",
568c2ecf20Sopenharmony_ci			.parent_names = (const char *[]){ "bi_tcxo" },
578c2ecf20Sopenharmony_ci			.num_parents = 1,
588c2ecf20Sopenharmony_ci			.ops = &clk_alpha_pll_fabia_ops,
598c2ecf20Sopenharmony_ci		},
608c2ecf20Sopenharmony_ci	},
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_video_cc_venus_clk_src[] = {
648c2ecf20Sopenharmony_ci	F(100000000, P_VIDEO_PLL0_OUT_MAIN, 4, 0, 0),
658c2ecf20Sopenharmony_ci	F(200000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0),
668c2ecf20Sopenharmony_ci	F(330000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
678c2ecf20Sopenharmony_ci	F(404000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
688c2ecf20Sopenharmony_ci	F(444000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
698c2ecf20Sopenharmony_ci	F(533000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0),
708c2ecf20Sopenharmony_ci	{ }
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistatic struct clk_rcg2 video_cc_venus_clk_src = {
748c2ecf20Sopenharmony_ci	.cmd_rcgr = 0x7f0,
758c2ecf20Sopenharmony_ci	.mnd_width = 0,
768c2ecf20Sopenharmony_ci	.hid_width = 5,
778c2ecf20Sopenharmony_ci	.parent_map = video_cc_parent_map_0,
788c2ecf20Sopenharmony_ci	.freq_tbl = ftbl_video_cc_venus_clk_src,
798c2ecf20Sopenharmony_ci	.clkr.hw.init = &(struct clk_init_data){
808c2ecf20Sopenharmony_ci		.name = "video_cc_venus_clk_src",
818c2ecf20Sopenharmony_ci		.parent_names = video_cc_parent_names_0,
828c2ecf20Sopenharmony_ci		.num_parents = 5,
838c2ecf20Sopenharmony_ci		.flags = CLK_SET_RATE_PARENT,
848c2ecf20Sopenharmony_ci		.ops = &clk_rcg2_shared_ops,
858c2ecf20Sopenharmony_ci	},
868c2ecf20Sopenharmony_ci};
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_apb_clk = {
898c2ecf20Sopenharmony_ci	.halt_reg = 0x990,
908c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
918c2ecf20Sopenharmony_ci	.clkr = {
928c2ecf20Sopenharmony_ci		.enable_reg = 0x990,
938c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
948c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
958c2ecf20Sopenharmony_ci			.name = "video_cc_apb_clk",
968c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
978c2ecf20Sopenharmony_ci		},
988c2ecf20Sopenharmony_ci	},
998c2ecf20Sopenharmony_ci};
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_at_clk = {
1028c2ecf20Sopenharmony_ci	.halt_reg = 0x9f0,
1038c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
1048c2ecf20Sopenharmony_ci	.clkr = {
1058c2ecf20Sopenharmony_ci		.enable_reg = 0x9f0,
1068c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1078c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1088c2ecf20Sopenharmony_ci			.name = "video_cc_at_clk",
1098c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1108c2ecf20Sopenharmony_ci		},
1118c2ecf20Sopenharmony_ci	},
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_qdss_trig_clk = {
1158c2ecf20Sopenharmony_ci	.halt_reg = 0x970,
1168c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
1178c2ecf20Sopenharmony_ci	.clkr = {
1188c2ecf20Sopenharmony_ci		.enable_reg = 0x970,
1198c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1208c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1218c2ecf20Sopenharmony_ci			.name = "video_cc_qdss_trig_clk",
1228c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1238c2ecf20Sopenharmony_ci		},
1248c2ecf20Sopenharmony_ci	},
1258c2ecf20Sopenharmony_ci};
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_qdss_tsctr_div8_clk = {
1288c2ecf20Sopenharmony_ci	.halt_reg = 0x9d0,
1298c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
1308c2ecf20Sopenharmony_ci	.clkr = {
1318c2ecf20Sopenharmony_ci		.enable_reg = 0x9d0,
1328c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1338c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1348c2ecf20Sopenharmony_ci			.name = "video_cc_qdss_tsctr_div8_clk",
1358c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1368c2ecf20Sopenharmony_ci		},
1378c2ecf20Sopenharmony_ci	},
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_vcodec0_axi_clk = {
1418c2ecf20Sopenharmony_ci	.halt_reg = 0x930,
1428c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
1438c2ecf20Sopenharmony_ci	.clkr = {
1448c2ecf20Sopenharmony_ci		.enable_reg = 0x930,
1458c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1468c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1478c2ecf20Sopenharmony_ci			.name = "video_cc_vcodec0_axi_clk",
1488c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1498c2ecf20Sopenharmony_ci		},
1508c2ecf20Sopenharmony_ci	},
1518c2ecf20Sopenharmony_ci};
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_vcodec0_core_clk = {
1548c2ecf20Sopenharmony_ci	.halt_reg = 0x890,
1558c2ecf20Sopenharmony_ci	.halt_check = BRANCH_VOTED,
1568c2ecf20Sopenharmony_ci	.clkr = {
1578c2ecf20Sopenharmony_ci		.enable_reg = 0x890,
1588c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1598c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1608c2ecf20Sopenharmony_ci			.name = "video_cc_vcodec0_core_clk",
1618c2ecf20Sopenharmony_ci			.parent_names = (const char *[]){
1628c2ecf20Sopenharmony_ci				"video_cc_venus_clk_src",
1638c2ecf20Sopenharmony_ci			},
1648c2ecf20Sopenharmony_ci			.num_parents = 1,
1658c2ecf20Sopenharmony_ci			.flags = CLK_SET_RATE_PARENT,
1668c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1678c2ecf20Sopenharmony_ci		},
1688c2ecf20Sopenharmony_ci	},
1698c2ecf20Sopenharmony_ci};
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_vcodec1_axi_clk = {
1728c2ecf20Sopenharmony_ci	.halt_reg = 0x950,
1738c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
1748c2ecf20Sopenharmony_ci	.clkr = {
1758c2ecf20Sopenharmony_ci		.enable_reg = 0x950,
1768c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1778c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1788c2ecf20Sopenharmony_ci			.name = "video_cc_vcodec1_axi_clk",
1798c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1808c2ecf20Sopenharmony_ci		},
1818c2ecf20Sopenharmony_ci	},
1828c2ecf20Sopenharmony_ci};
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_vcodec1_core_clk = {
1858c2ecf20Sopenharmony_ci	.halt_reg = 0x8d0,
1868c2ecf20Sopenharmony_ci	.halt_check = BRANCH_VOTED,
1878c2ecf20Sopenharmony_ci	.clkr = {
1888c2ecf20Sopenharmony_ci		.enable_reg = 0x8d0,
1898c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
1908c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
1918c2ecf20Sopenharmony_ci			.name = "video_cc_vcodec1_core_clk",
1928c2ecf20Sopenharmony_ci			.parent_names = (const char *[]){
1938c2ecf20Sopenharmony_ci				"video_cc_venus_clk_src",
1948c2ecf20Sopenharmony_ci			},
1958c2ecf20Sopenharmony_ci			.num_parents = 1,
1968c2ecf20Sopenharmony_ci			.flags = CLK_SET_RATE_PARENT,
1978c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
1988c2ecf20Sopenharmony_ci		},
1998c2ecf20Sopenharmony_ci	},
2008c2ecf20Sopenharmony_ci};
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_venus_ahb_clk = {
2038c2ecf20Sopenharmony_ci	.halt_reg = 0x9b0,
2048c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
2058c2ecf20Sopenharmony_ci	.clkr = {
2068c2ecf20Sopenharmony_ci		.enable_reg = 0x9b0,
2078c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
2088c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
2098c2ecf20Sopenharmony_ci			.name = "video_cc_venus_ahb_clk",
2108c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
2118c2ecf20Sopenharmony_ci		},
2128c2ecf20Sopenharmony_ci	},
2138c2ecf20Sopenharmony_ci};
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_venus_ctl_axi_clk = {
2168c2ecf20Sopenharmony_ci	.halt_reg = 0x910,
2178c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
2188c2ecf20Sopenharmony_ci	.clkr = {
2198c2ecf20Sopenharmony_ci		.enable_reg = 0x910,
2208c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
2218c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
2228c2ecf20Sopenharmony_ci			.name = "video_cc_venus_ctl_axi_clk",
2238c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
2248c2ecf20Sopenharmony_ci		},
2258c2ecf20Sopenharmony_ci	},
2268c2ecf20Sopenharmony_ci};
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_cistatic struct clk_branch video_cc_venus_ctl_core_clk = {
2298c2ecf20Sopenharmony_ci	.halt_reg = 0x850,
2308c2ecf20Sopenharmony_ci	.halt_check = BRANCH_HALT,
2318c2ecf20Sopenharmony_ci	.clkr = {
2328c2ecf20Sopenharmony_ci		.enable_reg = 0x850,
2338c2ecf20Sopenharmony_ci		.enable_mask = BIT(0),
2348c2ecf20Sopenharmony_ci		.hw.init = &(struct clk_init_data){
2358c2ecf20Sopenharmony_ci			.name = "video_cc_venus_ctl_core_clk",
2368c2ecf20Sopenharmony_ci			.parent_names = (const char *[]){
2378c2ecf20Sopenharmony_ci				"video_cc_venus_clk_src",
2388c2ecf20Sopenharmony_ci			},
2398c2ecf20Sopenharmony_ci			.num_parents = 1,
2408c2ecf20Sopenharmony_ci			.flags = CLK_SET_RATE_PARENT,
2418c2ecf20Sopenharmony_ci			.ops = &clk_branch2_ops,
2428c2ecf20Sopenharmony_ci		},
2438c2ecf20Sopenharmony_ci	},
2448c2ecf20Sopenharmony_ci};
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_cistatic struct gdsc venus_gdsc = {
2478c2ecf20Sopenharmony_ci	.gdscr = 0x814,
2488c2ecf20Sopenharmony_ci	.pd = {
2498c2ecf20Sopenharmony_ci		.name = "venus_gdsc",
2508c2ecf20Sopenharmony_ci	},
2518c2ecf20Sopenharmony_ci	.cxcs = (unsigned int []){ 0x850, 0x910 },
2528c2ecf20Sopenharmony_ci	.cxc_count = 2,
2538c2ecf20Sopenharmony_ci	.pwrsts = PWRSTS_OFF_ON,
2548c2ecf20Sopenharmony_ci	.flags = POLL_CFG_GDSCR,
2558c2ecf20Sopenharmony_ci};
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_cistatic struct gdsc vcodec0_gdsc = {
2588c2ecf20Sopenharmony_ci	.gdscr = 0x874,
2598c2ecf20Sopenharmony_ci	.pd = {
2608c2ecf20Sopenharmony_ci		.name = "vcodec0_gdsc",
2618c2ecf20Sopenharmony_ci	},
2628c2ecf20Sopenharmony_ci	.cxcs = (unsigned int []){ 0x890, 0x930 },
2638c2ecf20Sopenharmony_ci	.cxc_count = 2,
2648c2ecf20Sopenharmony_ci	.flags = HW_CTRL | POLL_CFG_GDSCR,
2658c2ecf20Sopenharmony_ci	.pwrsts = PWRSTS_OFF_ON,
2668c2ecf20Sopenharmony_ci};
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_cistatic struct gdsc vcodec1_gdsc = {
2698c2ecf20Sopenharmony_ci	.gdscr = 0x8b4,
2708c2ecf20Sopenharmony_ci	.pd = {
2718c2ecf20Sopenharmony_ci		.name = "vcodec1_gdsc",
2728c2ecf20Sopenharmony_ci	},
2738c2ecf20Sopenharmony_ci	.cxcs = (unsigned int []){ 0x8d0, 0x950 },
2748c2ecf20Sopenharmony_ci	.cxc_count = 2,
2758c2ecf20Sopenharmony_ci	.flags = HW_CTRL | POLL_CFG_GDSCR,
2768c2ecf20Sopenharmony_ci	.pwrsts = PWRSTS_OFF_ON,
2778c2ecf20Sopenharmony_ci};
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_cistatic struct clk_regmap *video_cc_sdm845_clocks[] = {
2808c2ecf20Sopenharmony_ci	[VIDEO_CC_APB_CLK] = &video_cc_apb_clk.clkr,
2818c2ecf20Sopenharmony_ci	[VIDEO_CC_AT_CLK] = &video_cc_at_clk.clkr,
2828c2ecf20Sopenharmony_ci	[VIDEO_CC_QDSS_TRIG_CLK] = &video_cc_qdss_trig_clk.clkr,
2838c2ecf20Sopenharmony_ci	[VIDEO_CC_QDSS_TSCTR_DIV8_CLK] = &video_cc_qdss_tsctr_div8_clk.clkr,
2848c2ecf20Sopenharmony_ci	[VIDEO_CC_VCODEC0_AXI_CLK] = &video_cc_vcodec0_axi_clk.clkr,
2858c2ecf20Sopenharmony_ci	[VIDEO_CC_VCODEC0_CORE_CLK] = &video_cc_vcodec0_core_clk.clkr,
2868c2ecf20Sopenharmony_ci	[VIDEO_CC_VCODEC1_AXI_CLK] = &video_cc_vcodec1_axi_clk.clkr,
2878c2ecf20Sopenharmony_ci	[VIDEO_CC_VCODEC1_CORE_CLK] = &video_cc_vcodec1_core_clk.clkr,
2888c2ecf20Sopenharmony_ci	[VIDEO_CC_VENUS_AHB_CLK] = &video_cc_venus_ahb_clk.clkr,
2898c2ecf20Sopenharmony_ci	[VIDEO_CC_VENUS_CLK_SRC] = &video_cc_venus_clk_src.clkr,
2908c2ecf20Sopenharmony_ci	[VIDEO_CC_VENUS_CTL_AXI_CLK] = &video_cc_venus_ctl_axi_clk.clkr,
2918c2ecf20Sopenharmony_ci	[VIDEO_CC_VENUS_CTL_CORE_CLK] = &video_cc_venus_ctl_core_clk.clkr,
2928c2ecf20Sopenharmony_ci	[VIDEO_PLL0] = &video_pll0.clkr,
2938c2ecf20Sopenharmony_ci};
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_cistatic struct gdsc *video_cc_sdm845_gdscs[] = {
2968c2ecf20Sopenharmony_ci	[VENUS_GDSC] = &venus_gdsc,
2978c2ecf20Sopenharmony_ci	[VCODEC0_GDSC] = &vcodec0_gdsc,
2988c2ecf20Sopenharmony_ci	[VCODEC1_GDSC] = &vcodec1_gdsc,
2998c2ecf20Sopenharmony_ci};
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_cistatic const struct regmap_config video_cc_sdm845_regmap_config = {
3028c2ecf20Sopenharmony_ci	.reg_bits	= 32,
3038c2ecf20Sopenharmony_ci	.reg_stride	= 4,
3048c2ecf20Sopenharmony_ci	.val_bits	= 32,
3058c2ecf20Sopenharmony_ci	.max_register	= 0xb90,
3068c2ecf20Sopenharmony_ci	.fast_io	= true,
3078c2ecf20Sopenharmony_ci};
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_cistatic const struct qcom_cc_desc video_cc_sdm845_desc = {
3108c2ecf20Sopenharmony_ci	.config = &video_cc_sdm845_regmap_config,
3118c2ecf20Sopenharmony_ci	.clks = video_cc_sdm845_clocks,
3128c2ecf20Sopenharmony_ci	.num_clks = ARRAY_SIZE(video_cc_sdm845_clocks),
3138c2ecf20Sopenharmony_ci	.gdscs = video_cc_sdm845_gdscs,
3148c2ecf20Sopenharmony_ci	.num_gdscs = ARRAY_SIZE(video_cc_sdm845_gdscs),
3158c2ecf20Sopenharmony_ci};
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cistatic const struct of_device_id video_cc_sdm845_match_table[] = {
3188c2ecf20Sopenharmony_ci	{ .compatible = "qcom,sdm845-videocc" },
3198c2ecf20Sopenharmony_ci	{ }
3208c2ecf20Sopenharmony_ci};
3218c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, video_cc_sdm845_match_table);
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_cistatic int video_cc_sdm845_probe(struct platform_device *pdev)
3248c2ecf20Sopenharmony_ci{
3258c2ecf20Sopenharmony_ci	struct regmap *regmap;
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	regmap = qcom_cc_map(pdev, &video_cc_sdm845_desc);
3288c2ecf20Sopenharmony_ci	if (IS_ERR(regmap))
3298c2ecf20Sopenharmony_ci		return PTR_ERR(regmap);
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci	clk_fabia_pll_configure(&video_pll0, regmap, &video_pll0_config);
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci	return qcom_cc_really_probe(pdev, &video_cc_sdm845_desc, regmap);
3348c2ecf20Sopenharmony_ci}
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_cistatic struct platform_driver video_cc_sdm845_driver = {
3378c2ecf20Sopenharmony_ci	.probe		= video_cc_sdm845_probe,
3388c2ecf20Sopenharmony_ci	.driver		= {
3398c2ecf20Sopenharmony_ci		.name	= "sdm845-videocc",
3408c2ecf20Sopenharmony_ci		.of_match_table = video_cc_sdm845_match_table,
3418c2ecf20Sopenharmony_ci	},
3428c2ecf20Sopenharmony_ci};
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_cistatic int __init video_cc_sdm845_init(void)
3458c2ecf20Sopenharmony_ci{
3468c2ecf20Sopenharmony_ci	return platform_driver_register(&video_cc_sdm845_driver);
3478c2ecf20Sopenharmony_ci}
3488c2ecf20Sopenharmony_cisubsys_initcall(video_cc_sdm845_init);
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_cistatic void __exit video_cc_sdm845_exit(void)
3518c2ecf20Sopenharmony_ci{
3528c2ecf20Sopenharmony_ci	platform_driver_unregister(&video_cc_sdm845_driver);
3538c2ecf20Sopenharmony_ci}
3548c2ecf20Sopenharmony_cimodule_exit(video_cc_sdm845_exit);
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
357