11802d0beSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 296596aa0SKevin-CW Chen /* 396596aa0SKevin-CW Chen * Copyright (c) 2017 MediaTek Inc. 496596aa0SKevin-CW Chen * Author: Kevin Chen <kevin-cw.chen@mediatek.com> 596596aa0SKevin-CW Chen */ 696596aa0SKevin-CW Chen 796596aa0SKevin-CW Chen #include <linux/clk-provider.h> 896596aa0SKevin-CW Chen #include <linux/platform_device.h> 996596aa0SKevin-CW Chen 1096596aa0SKevin-CW Chen #include "clk-mtk.h" 1196596aa0SKevin-CW Chen #include "clk-gate.h" 1296596aa0SKevin-CW Chen 1396596aa0SKevin-CW Chen #include <dt-bindings/clock/mt6797-clk.h> 1496596aa0SKevin-CW Chen 1596596aa0SKevin-CW Chen static const struct mtk_gate_regs venc_cg_regs = { 1696596aa0SKevin-CW Chen .set_ofs = 0x0004, 1796596aa0SKevin-CW Chen .clr_ofs = 0x0008, 1896596aa0SKevin-CW Chen .sta_ofs = 0x0000, 1996596aa0SKevin-CW Chen }; 2096596aa0SKevin-CW 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) 2396596aa0SKevin-CW Chen 2496596aa0SKevin-CW Chen static const struct mtk_gate venc_clks[] = { 2596596aa0SKevin-CW Chen GATE_VENC(CLK_VENC_0, "venc_0", "mm_sel", 0), 2696596aa0SKevin-CW Chen GATE_VENC(CLK_VENC_1, "venc_1", "venc_sel", 4), 2796596aa0SKevin-CW Chen GATE_VENC(CLK_VENC_2, "venc_2", "venc_sel", 8), 2896596aa0SKevin-CW Chen GATE_VENC(CLK_VENC_3, "venc_3", "venc_sel", 12), 2996596aa0SKevin-CW Chen }; 3096596aa0SKevin-CW Chen 31a481c6c7SMiles Chen static const struct mtk_clk_desc venc_desc = { 32a481c6c7SMiles Chen .clks = venc_clks, 33a481c6c7SMiles Chen .num_clks = ARRAY_SIZE(venc_clks), 3496596aa0SKevin-CW Chen }; 3596596aa0SKevin-CW Chen 36a481c6c7SMiles Chen static const struct of_device_id of_match_clk_mt6797_venc[] = { 3796596aa0SKevin-CW Chen { 38a481c6c7SMiles Chen .compatible = "mediatek,mt6797-vencsys", 39a481c6c7SMiles Chen .data = &venc_desc, 40a481c6c7SMiles Chen }, { 41a481c6c7SMiles Chen /* sentinel */ 4296596aa0SKevin-CW Chen } 43a481c6c7SMiles Chen }; 4465c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt6797_venc); 4596596aa0SKevin-CW Chen 4696596aa0SKevin-CW Chen static struct platform_driver clk_mt6797_venc_drv = { 47a481c6c7SMiles Chen .probe = mtk_clk_simple_probe, 48*61ca6ee7SUwe Kleine-König .remove_new = mtk_clk_simple_remove, 4996596aa0SKevin-CW Chen .driver = { 5096596aa0SKevin-CW Chen .name = "clk-mt6797-venc", 5196596aa0SKevin-CW Chen .of_match_table = of_match_clk_mt6797_venc, 5296596aa0SKevin-CW Chen }, 5396596aa0SKevin-CW Chen }; 54164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt6797_venc_drv); 55a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL"); 56