11802d0beSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 2e2f744a8Sweiyi.lu@mediatek.com /* 3e2f744a8Sweiyi.lu@mediatek.com * Copyright (c) 2017 MediaTek Inc. 4e2f744a8Sweiyi.lu@mediatek.com * Author: Weiyi Lu <weiyi.lu@mediatek.com> 5e2f744a8Sweiyi.lu@mediatek.com */ 6e2f744a8Sweiyi.lu@mediatek.com 7e2f744a8Sweiyi.lu@mediatek.com #include <linux/clk-provider.h> 8e2f744a8Sweiyi.lu@mediatek.com #include <linux/platform_device.h> 9e2f744a8Sweiyi.lu@mediatek.com 10e2f744a8Sweiyi.lu@mediatek.com #include "clk-mtk.h" 11e2f744a8Sweiyi.lu@mediatek.com #include "clk-gate.h" 12e2f744a8Sweiyi.lu@mediatek.com 13e2f744a8Sweiyi.lu@mediatek.com #include <dt-bindings/clock/mt2712-clk.h> 14e2f744a8Sweiyi.lu@mediatek.com 15e2f744a8Sweiyi.lu@mediatek.com static const struct mtk_gate_regs venc_cg_regs = { 16e2f744a8Sweiyi.lu@mediatek.com .set_ofs = 0x4, 17e2f744a8Sweiyi.lu@mediatek.com .clr_ofs = 0x8, 18e2f744a8Sweiyi.lu@mediatek.com .sta_ofs = 0x0, 19e2f744a8Sweiyi.lu@mediatek.com }; 20e2f744a8Sweiyi.lu@mediatek.com 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) 23e2f744a8Sweiyi.lu@mediatek.com 24e2f744a8Sweiyi.lu@mediatek.com static const struct mtk_gate venc_clks[] = { 25e2f744a8Sweiyi.lu@mediatek.com GATE_VENC(CLK_VENC_SMI_COMMON_CON, "venc_smi", "mm_sel", 0), 26e2f744a8Sweiyi.lu@mediatek.com GATE_VENC(CLK_VENC_VENC, "venc_venc", "venc_sel", 4), 27e2f744a8Sweiyi.lu@mediatek.com GATE_VENC(CLK_VENC_SMI_LARB6, "venc_smi_larb6", "jpgdec_sel", 12), 28e2f744a8Sweiyi.lu@mediatek.com }; 29e2f744a8Sweiyi.lu@mediatek.com 30f3e4e735SMiles Chen static const struct mtk_clk_desc venc_desc = { 31f3e4e735SMiles Chen .clks = venc_clks, 32f3e4e735SMiles Chen .num_clks = ARRAY_SIZE(venc_clks), 33f3e4e735SMiles Chen }; 34e2f744a8Sweiyi.lu@mediatek.com 35e2f744a8Sweiyi.lu@mediatek.com static const struct of_device_id of_match_clk_mt2712_venc[] = { 36f3e4e735SMiles Chen { 37f3e4e735SMiles Chen .compatible = "mediatek,mt2712-vencsys", 38f3e4e735SMiles Chen .data = &venc_desc, 39f3e4e735SMiles Chen }, { 40f3e4e735SMiles Chen /* sentinel */ 41f3e4e735SMiles Chen } 42e2f744a8Sweiyi.lu@mediatek.com }; 43*65c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_venc); 44e2f744a8Sweiyi.lu@mediatek.com 45e2f744a8Sweiyi.lu@mediatek.com static struct platform_driver clk_mt2712_venc_drv = { 46f3e4e735SMiles Chen .probe = mtk_clk_simple_probe, 47f3e4e735SMiles Chen .remove_new = mtk_clk_simple_remove, 48e2f744a8Sweiyi.lu@mediatek.com .driver = { 49e2f744a8Sweiyi.lu@mediatek.com .name = "clk-mt2712-venc", 50e2f744a8Sweiyi.lu@mediatek.com .of_match_table = of_match_clk_mt2712_venc, 51e2f744a8Sweiyi.lu@mediatek.com }, 52e2f744a8Sweiyi.lu@mediatek.com }; 53164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt2712_venc_drv); 54a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL"); 55