Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / clk / mediatek / clk-mt6797-vdec.c
blobd832f48123f58ebb788cc8a0e796834f6900e409
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2017 MediaTek Inc.
4 * Author: Kevin-CW Chen <kevin-cw.chen@mediatek.com>
5 */
7 #include <linux/clk-provider.h>
8 #include <linux/platform_device.h>
10 #include "clk-mtk.h"
11 #include "clk-gate.h"
13 #include <dt-bindings/clock/mt6797-clk.h>
15 static const struct mtk_gate_regs vdec0_cg_regs = {
16 .set_ofs = 0x0000,
17 .clr_ofs = 0x0004,
18 .sta_ofs = 0x0000,
21 static const struct mtk_gate_regs vdec1_cg_regs = {
22 .set_ofs = 0x0008,
23 .clr_ofs = 0x000c,
24 .sta_ofs = 0x0008,
27 #define GATE_VDEC0(_id, _name, _parent, _shift) \
28 GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
30 #define GATE_VDEC1(_id, _name, _parent, _shift) \
31 GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
33 static const struct mtk_gate vdec_clks[] = {
34 GATE_VDEC0(CLK_VDEC_CKEN_ENG, "vdec_cken_eng", "vdec_sel", 8),
35 GATE_VDEC0(CLK_VDEC_ACTIVE, "vdec_active", "vdec_sel", 4),
36 GATE_VDEC0(CLK_VDEC_CKEN, "vdec_cken", "vdec_sel", 0),
37 GATE_VDEC1(CLK_VDEC_LARB1_CKEN, "vdec_larb1_cken", "mm_sel", 0),
40 static const struct mtk_clk_desc vdec_desc = {
41 .clks = vdec_clks,
42 .num_clks = ARRAY_SIZE(vdec_clks),
45 static const struct of_device_id of_match_clk_mt6797_vdec[] = {
47 .compatible = "mediatek,mt6797-vdecsys",
48 .data = &vdec_desc,
49 }, {
50 /* sentinel */
53 MODULE_DEVICE_TABLE(of, of_match_clk_mt6797_vdec);
55 static struct platform_driver clk_mt6797_vdec_drv = {
56 .probe = mtk_clk_simple_probe,
57 .remove = mtk_clk_simple_remove,
58 .driver = {
59 .name = "clk-mt6797-vdec",
60 .of_match_table = of_match_clk_mt6797_vdec,
63 module_platform_driver(clk_mt6797_vdec_drv);
65 MODULE_DESCRIPTION("MediaTek MT6797 Video Decoders clocks driver");
66 MODULE_LICENSE("GPL");