1 // SPDX-License-Identifier: GPL-2.0-only 2 // 3 // Copyright (c) 2021 MediaTek Inc. 4 // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com> 5 6 #include <linux/clk-provider.h> 7 #include <linux/platform_device.h> 8 9 #include "clk-mtk.h" 10 #include "clk-gate.h" 11 12 #include <dt-bindings/clock/mt8192-clk.h> 13 14 static const struct mtk_gate_regs ipe_cg_regs = { 15 .set_ofs = 0x4, 16 .clr_ofs = 0x8, 17 .sta_ofs = 0x0, 18 }; 19 20 #define GATE_IPE(_id, _name, _parent, _shift) \ 21 GATE_MTK(_id, _name, _parent, &ipe_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 22 23 static const struct mtk_gate ipe_clks[] = { 24 GATE_IPE(CLK_IPE_LARB19, "ipe_larb19", "ipe_sel", 0), 25 GATE_IPE(CLK_IPE_LARB20, "ipe_larb20", "ipe_sel", 1), 26 GATE_IPE(CLK_IPE_SMI_SUBCOM, "ipe_smi_subcom", "ipe_sel", 2), 27 GATE_IPE(CLK_IPE_FD, "ipe_fd", "ipe_sel", 3), 28 GATE_IPE(CLK_IPE_FE, "ipe_fe", "ipe_sel", 4), 29 GATE_IPE(CLK_IPE_RSC, "ipe_rsc", "ipe_sel", 5), 30 GATE_IPE(CLK_IPE_DPE, "ipe_dpe", "ipe_sel", 6), 31 GATE_IPE(CLK_IPE_GALS, "ipe_gals", "ipe_sel", 8), 32 }; 33 34 static const struct mtk_clk_desc ipe_desc = { 35 .clks = ipe_clks, 36 .num_clks = ARRAY_SIZE(ipe_clks), 37 }; 38 39 static const struct of_device_id of_match_clk_mt8192_ipe[] = { 40 { 41 .compatible = "mediatek,mt8192-ipesys", 42 .data = &ipe_desc, 43 }, { 44 /* sentinel */ 45 } 46 }; 47 MODULE_DEVICE_TABLE(of, of_match_clk_mt8192_ipe); 48 49 static struct platform_driver clk_mt8192_ipe_drv = { 50 .probe = mtk_clk_simple_probe, 51 .remove = mtk_clk_simple_remove, 52 .driver = { 53 .name = "clk-mt8192-ipe", 54 .of_match_table = of_match_clk_mt8192_ipe, 55 }, 56 }; 57 module_platform_driver(clk_mt8192_ipe_drv); 58 59 MODULE_DESCRIPTION("MediaTek MT8192 Image Processing Engine clocks driver"); 60 MODULE_LICENSE("GPL"); 61