1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2020 MediaTek Inc.
4 * Copyright (c) 2020 BayLibre, SAS
5 * Author: James Liao <jamesjj.liao@mediatek.com>
6 * Fabien Parent <fparent@baylibre.com>
9 #include <linux/clk-provider.h>
11 #include <linux/of_address.h>
12 #include <linux/of_device.h>
13 #include <linux/platform_device.h>
18 #include <dt-bindings/clock/mt8167-clk.h>
20 static const struct mtk_gate_regs vdec0_cg_regs
= {
26 static const struct mtk_gate_regs vdec1_cg_regs
= {
32 #define GATE_VDEC0_I(_id, _name, _parent, _shift) { \
35 .parent_name = _parent, \
36 .regs = &vdec0_cg_regs, \
38 .ops = &mtk_clk_gate_ops_setclr_inv, \
41 #define GATE_VDEC1_I(_id, _name, _parent, _shift) { \
44 .parent_name = _parent, \
45 .regs = &vdec1_cg_regs, \
47 .ops = &mtk_clk_gate_ops_setclr_inv, \
50 static const struct mtk_gate vdec_clks
[] __initconst
= {
52 GATE_VDEC0_I(CLK_VDEC_CKEN
, "vdec_cken", "rg_vdec", 0),
54 GATE_VDEC1_I(CLK_VDEC_LARB1_CKEN
, "vdec_larb1_cken", "smi_mm", 0),
57 static void __init
mtk_vdecsys_init(struct device_node
*node
)
59 struct clk_onecell_data
*clk_data
;
62 clk_data
= mtk_alloc_clk_data(CLK_VDEC_NR_CLK
);
64 mtk_clk_register_gates(node
, vdec_clks
, ARRAY_SIZE(vdec_clks
), clk_data
);
66 r
= of_clk_add_provider(node
, of_clk_src_onecell_get
, clk_data
);
69 pr_err("%s(): could not register clock provider: %d\n",
73 CLK_OF_DECLARE(mtk_vdecsys
, "mediatek,mt8167-vdecsys", mtk_vdecsys_init
);