1*50df7722SChun-Jie Chen // SPDX-License-Identifier: GPL-2.0-only 2*50df7722SChun-Jie Chen // 3*50df7722SChun-Jie Chen // Copyright (c) 2021 MediaTek Inc. 4*50df7722SChun-Jie Chen // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com> 5*50df7722SChun-Jie Chen 6*50df7722SChun-Jie Chen #include "clk-gate.h" 7*50df7722SChun-Jie Chen #include "clk-mtk.h" 8*50df7722SChun-Jie Chen 9*50df7722SChun-Jie Chen #include <dt-bindings/clock/mt8195-clk.h> 10*50df7722SChun-Jie Chen #include <linux/clk-provider.h> 11*50df7722SChun-Jie Chen #include <linux/platform_device.h> 12*50df7722SChun-Jie Chen 13*50df7722SChun-Jie Chen static const struct mtk_gate_regs vpp1_0_cg_regs = { 14*50df7722SChun-Jie Chen .set_ofs = 0x104, 15*50df7722SChun-Jie Chen .clr_ofs = 0x108, 16*50df7722SChun-Jie Chen .sta_ofs = 0x100, 17*50df7722SChun-Jie Chen }; 18*50df7722SChun-Jie Chen 19*50df7722SChun-Jie Chen static const struct mtk_gate_regs vpp1_1_cg_regs = { 20*50df7722SChun-Jie Chen .set_ofs = 0x114, 21*50df7722SChun-Jie Chen .clr_ofs = 0x118, 22*50df7722SChun-Jie Chen .sta_ofs = 0x110, 23*50df7722SChun-Jie Chen }; 24*50df7722SChun-Jie Chen 25*50df7722SChun-Jie Chen #define GATE_VPP1_0(_id, _name, _parent, _shift) \ 26*50df7722SChun-Jie Chen GATE_MTK(_id, _name, _parent, &vpp1_0_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 27*50df7722SChun-Jie Chen 28*50df7722SChun-Jie Chen #define GATE_VPP1_1(_id, _name, _parent, _shift) \ 29*50df7722SChun-Jie Chen GATE_MTK(_id, _name, _parent, &vpp1_1_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 30*50df7722SChun-Jie Chen 31*50df7722SChun-Jie Chen static const struct mtk_gate vpp1_clks[] = { 32*50df7722SChun-Jie Chen /* VPP1_0 */ 33*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_OVL, "vpp1_svpp1_mdp_ovl", "top_vpp", 0), 34*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_TCC, "vpp1_svpp1_mdp_tcc", "top_vpp", 1), 35*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_WROT, "vpp1_svpp1_mdp_wrot", "top_vpp", 2), 36*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_VPP_PAD, "vpp1_svpp1_vpp_pad", "top_vpp", 3), 37*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_MDP_WROT, "vpp1_svpp2_mdp_wrot", "top_vpp", 4), 38*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_VPP_PAD, "vpp1_svpp2_vpp_pad", "top_vpp", 5), 39*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_MDP_WROT, "vpp1_svpp3_mdp_wrot", "top_vpp", 6), 40*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_VPP_PAD, "vpp1_svpp3_vpp_pad", "top_vpp", 7), 41*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_RDMA, "vpp1_svpp1_mdp_rdma", "top_vpp", 8), 42*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_FG, "vpp1_svpp1_mdp_fg", "top_vpp", 9), 43*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_MDP_RDMA, "vpp1_svpp2_mdp_rdma", "top_vpp", 10), 44*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_MDP_FG, "vpp1_svpp2_mdp_fg", "top_vpp", 11), 45*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_MDP_RDMA, "vpp1_svpp3_mdp_rdma", "top_vpp", 12), 46*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_MDP_FG, "vpp1_svpp3_mdp_fg", "top_vpp", 13), 47*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_VPP_SPLIT, "vpp1_vpp_split", "top_vpp", 14), 48*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_VDO0_DL_RELAY, "vpp1_svpp2_vdo0_dl_relay", "top_vpp", 15), 49*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_TDSHP, "vpp1_svpp1_mdp_tdshp", "top_vpp", 16), 50*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_COLOR, "vpp1_svpp1_mdp_color", "top_vpp", 17), 51*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_VDO1_DL_RELAY, "vpp1_svpp3_vdo1_dl_relay", "top_vpp", 18), 52*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_VPP_MERGE, "vpp1_svpp2_vpp_merge", "top_vpp", 19), 53*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_MDP_COLOR, "vpp1_svpp2_mdp_color", "top_vpp", 20), 54*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_VPPSYS1_GALS, "vpp1_vppsys1_gals", "top_vpp", 21), 55*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_VPP_MERGE, "vpp1_svpp3_vpp_merge", "top_vpp", 22), 56*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP3_MDP_COLOR, "vpp1_svpp3_mdp_color", "top_vpp", 23), 57*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_VPPSYS1_LARB, "vpp1_vppsys1_larb", "top_vpp", 24), 58*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_RSZ, "vpp1_svpp1_mdp_rsz", "top_vpp", 25), 59*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_HDR, "vpp1_svpp1_mdp_hdr", "top_vpp", 26), 60*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP1_MDP_AAL, "vpp1_svpp1_mdp_aal", "top_vpp", 27), 61*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_MDP_HDR, "vpp1_svpp2_mdp_hdr", "top_vpp", 28), 62*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_SVPP2_MDP_AAL, "vpp1_svpp2_mdp_aal", "top_vpp", 29), 63*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_DL_ASYNC, "vpp1_dl_async", "top_vpp", 30), 64*50df7722SChun-Jie Chen GATE_VPP1_0(CLK_VPP1_LARB5_FAKE_ENG, "vpp1_larb5_fake_eng", "top_vpp", 31), 65*50df7722SChun-Jie Chen /* VPP1_1 */ 66*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP3_MDP_HDR, "vpp1_svpp3_mdp_hdr", "top_vpp", 0), 67*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP3_MDP_AAL, "vpp1_svpp3_mdp_aal", "top_vpp", 1), 68*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP2_VDO1_DL_RELAY, "vpp1_svpp2_vdo1_dl_relay", "top_vpp", 2), 69*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_LARB6_FAKE_ENG, "vpp1_larb6_fake_eng", "top_vpp", 3), 70*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP2_MDP_RSZ, "vpp1_svpp2_mdp_rsz", "top_vpp", 4), 71*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP3_MDP_RSZ, "vpp1_svpp3_mdp_rsz", "top_vpp", 5), 72*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP3_VDO0_DL_RELAY, "vpp1_svpp3_vdo0_dl_relay", "top_vpp", 6), 73*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_DISP_MUTEX, "vpp1_disp_mutex", "top_vpp", 7), 74*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP2_MDP_TDSHP, "vpp1_svpp2_mdp_tdshp", "top_vpp", 8), 75*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_SVPP3_MDP_TDSHP, "vpp1_svpp3_mdp_tdshp", "top_vpp", 9), 76*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_VPP0_DL1_RELAY, "vpp1_vpp0_dl1_relay", "top_vpp", 10), 77*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_HDMI_META, "vpp1_hdmi_meta", "hdmirx_p", 11), 78*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_VPP_SPLIT_HDMI, "vpp1_vpp_split_hdmi", "hdmirx_p", 12), 79*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_DGI_IN, "vpp1_dgi_in", "in_dgi", 13), 80*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_DGI_OUT, "vpp1_dgi_out", "top_dgi_out", 14), 81*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_VPP_SPLIT_DGI, "vpp1_vpp_split_dgi", "top_dgi_out", 15), 82*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_VPP0_DL_ASYNC, "vpp1_vpp0_dl_async", "top_vpp", 16), 83*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_VPP0_DL_RELAY, "vpp1_vpp0_dl_relay", "top_vpp", 17), 84*50df7722SChun-Jie Chen GATE_VPP1_1(CLK_VPP1_VPP_SPLIT_26M, "vpp1_vpp_split_26m", "clk26m", 26), 85*50df7722SChun-Jie Chen }; 86*50df7722SChun-Jie Chen 87*50df7722SChun-Jie Chen static const struct mtk_clk_desc vpp1_desc = { 88*50df7722SChun-Jie Chen .clks = vpp1_clks, 89*50df7722SChun-Jie Chen .num_clks = ARRAY_SIZE(vpp1_clks), 90*50df7722SChun-Jie Chen }; 91*50df7722SChun-Jie Chen 92*50df7722SChun-Jie Chen static const struct of_device_id of_match_clk_mt8195_vpp1[] = { 93*50df7722SChun-Jie Chen { 94*50df7722SChun-Jie Chen .compatible = "mediatek,mt8195-vppsys1", 95*50df7722SChun-Jie Chen .data = &vpp1_desc, 96*50df7722SChun-Jie Chen }, { 97*50df7722SChun-Jie Chen /* sentinel */ 98*50df7722SChun-Jie Chen } 99*50df7722SChun-Jie Chen }; 100*50df7722SChun-Jie Chen 101*50df7722SChun-Jie Chen static struct platform_driver clk_mt8195_vpp1_drv = { 102*50df7722SChun-Jie Chen .probe = mtk_clk_simple_probe, 103*50df7722SChun-Jie Chen .driver = { 104*50df7722SChun-Jie Chen .name = "clk-mt8195-vpp1", 105*50df7722SChun-Jie Chen .of_match_table = of_match_clk_mt8195_vpp1, 106*50df7722SChun-Jie Chen }, 107*50df7722SChun-Jie Chen }; 108*50df7722SChun-Jie Chen builtin_platform_driver(clk_mt8195_vpp1_drv); 109