Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 //
0003 // Copyright (c) 2022 MediaTek Inc.
0004 // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com>
0005 
0006 #include <linux/clk-provider.h>
0007 #include <linux/platform_device.h>
0008 #include <dt-bindings/clock/mt8186-clk.h>
0009 
0010 #include "clk-gate.h"
0011 #include "clk-mtk.h"
0012 
0013 static const struct mtk_gate_regs venc_cg_regs = {
0014     .set_ofs = 0x4,
0015     .clr_ofs = 0x8,
0016     .sta_ofs = 0x0,
0017 };
0018 
0019 #define GATE_VENC(_id, _name, _parent, _shift)          \
0020     GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
0021 
0022 static const struct mtk_gate venc_clks[] = {
0023     GATE_VENC(CLK_VENC_CKE0_LARB, "venc_cke0_larb", "top_venc", 0),
0024     GATE_VENC(CLK_VENC_CKE1_VENC, "venc_cke1_venc", "top_venc", 4),
0025     GATE_VENC(CLK_VENC_CKE2_JPGENC, "venc_cke2_jpgenc", "top_venc", 8),
0026     GATE_VENC(CLK_VENC_CKE5_GALS, "venc_cke5_gals", "top_venc", 28),
0027 };
0028 
0029 static const struct mtk_clk_desc venc_desc = {
0030     .clks = venc_clks,
0031     .num_clks = ARRAY_SIZE(venc_clks),
0032 };
0033 
0034 static const struct of_device_id of_match_clk_mt8186_venc[] = {
0035     {
0036         .compatible = "mediatek,mt8186-vencsys",
0037         .data = &venc_desc,
0038     }, {
0039         /* sentinel */
0040     }
0041 };
0042 
0043 static struct platform_driver clk_mt8186_venc_drv = {
0044     .probe = mtk_clk_simple_probe,
0045     .remove = mtk_clk_simple_remove,
0046     .driver = {
0047         .name = "clk-mt8186-venc",
0048         .of_match_table = of_match_clk_mt8186_venc,
0049     },
0050 };
0051 builtin_platform_driver(clk_mt8186_venc_drv);