11aca9939SOwen Chen // SPDX-License-Identifier: GPL-2.0 21aca9939SOwen Chen /* 31aca9939SOwen Chen * Copyright (c) 2018 MediaTek Inc. 41aca9939SOwen Chen * Author: Owen Chen <owen.chen@mediatek.com> 51aca9939SOwen Chen */ 61aca9939SOwen Chen 71aca9939SOwen Chen #include <linux/clk-provider.h> 81aca9939SOwen Chen #include <linux/platform_device.h> 91aca9939SOwen Chen 101aca9939SOwen Chen #include "clk-mtk.h" 111aca9939SOwen Chen #include "clk-gate.h" 121aca9939SOwen Chen 131aca9939SOwen Chen #include <dt-bindings/clock/mt6765-clk.h> 141aca9939SOwen Chen 151aca9939SOwen Chen static const struct mtk_gate_regs venc_cg_regs = { 161aca9939SOwen Chen .set_ofs = 0x4, 171aca9939SOwen Chen .clr_ofs = 0x8, 181aca9939SOwen Chen .sta_ofs = 0x0, 191aca9939SOwen Chen }; 201aca9939SOwen Chen 214c85e20bSAngeloGioacchino Del Regno #define GATE_VENC(_id, _name, _parent, _shift) \ 224c85e20bSAngeloGioacchino Del Regno GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv) 231aca9939SOwen Chen 241aca9939SOwen Chen static const struct mtk_gate venc_clks[] = { 251aca9939SOwen Chen GATE_VENC(CLK_VENC_SET0_LARB, "venc_set0_larb", "mm_ck", 0), 261aca9939SOwen Chen GATE_VENC(CLK_VENC_SET1_VENC, "venc_set1_venc", "mm_ck", 4), 271aca9939SOwen Chen GATE_VENC(CLK_VENC_SET2_JPGENC, "jpgenc", "mm_ck", 8), 281aca9939SOwen Chen GATE_VENC(CLK_VENC_SET3_VDEC, "venc_set3_vdec", "mm_ck", 12), 291aca9939SOwen Chen }; 301aca9939SOwen Chen 312b74c1f6SMiles Chen static const struct mtk_clk_desc venc_desc = { 322b74c1f6SMiles Chen .clks = venc_clks, 332b74c1f6SMiles Chen .num_clks = ARRAY_SIZE(venc_clks), 342b74c1f6SMiles Chen }; 351aca9939SOwen Chen 361aca9939SOwen Chen static const struct of_device_id of_match_clk_mt6765_vcodec[] = { 372b74c1f6SMiles Chen { 382b74c1f6SMiles Chen .compatible = "mediatek,mt6765-vcodecsys", 392b74c1f6SMiles Chen .data = &venc_desc, 402b74c1f6SMiles Chen }, { 412b74c1f6SMiles Chen /* sentinel */ 422b74c1f6SMiles Chen } 431aca9939SOwen Chen }; 44*65c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_vcodec); 451aca9939SOwen Chen 461aca9939SOwen Chen static struct platform_driver clk_mt6765_vcodec_drv = { 472b74c1f6SMiles Chen .probe = mtk_clk_simple_probe, 482b74c1f6SMiles Chen .remove = mtk_clk_simple_remove, 491aca9939SOwen Chen .driver = { 501aca9939SOwen Chen .name = "clk-mt6765-vcodec", 511aca9939SOwen Chen .of_match_table = of_match_clk_mt6765_vcodec, 521aca9939SOwen Chen }, 531aca9939SOwen Chen }; 54164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt6765_vcodec_drv); 55a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL"); 56