Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: mediatek: Add MT8195 vdecsys clock support

Add MT8195 vdec clock controllers which provide clock gate
control for video decoder.

Signed-off-by: Chun-Jie Chen <chun-jie.chen@mediatek.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20210914021633.26377-17-chun-jie.chen@mediatek.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Chun-Jie Chen and committed by
Stephen Boyd
d7338d06 24da2c24

+106 -1
+2 -1
drivers/clk/mediatek/Makefile
··· 83 83 obj-$(CONFIG_COMMON_CLK_MT8195) += clk-mt8195-apmixedsys.o clk-mt8195-topckgen.o \ 84 84 clk-mt8195-peri_ao.o clk-mt8195-infra_ao.o \ 85 85 clk-mt8195-cam.o clk-mt8195-ccu.o clk-mt8195-img.o \ 86 - clk-mt8195-ipe.o clk-mt8195-mfg.o clk-mt8195-scp_adsp.o 86 + clk-mt8195-ipe.o clk-mt8195-mfg.o clk-mt8195-scp_adsp.o \ 87 + clk-mt8195-vdec.o 87 88 obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o 88 89 obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o
+104
drivers/clk/mediatek/clk-mt8195-vdec.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + // 3 + // Copyright (c) 2021 MediaTek Inc. 4 + // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com> 5 + 6 + #include "clk-gate.h" 7 + #include "clk-mtk.h" 8 + 9 + #include <dt-bindings/clock/mt8195-clk.h> 10 + #include <linux/clk-provider.h> 11 + #include <linux/platform_device.h> 12 + 13 + static const struct mtk_gate_regs vdec0_cg_regs = { 14 + .set_ofs = 0x0, 15 + .clr_ofs = 0x4, 16 + .sta_ofs = 0x0, 17 + }; 18 + 19 + static const struct mtk_gate_regs vdec1_cg_regs = { 20 + .set_ofs = 0x200, 21 + .clr_ofs = 0x204, 22 + .sta_ofs = 0x200, 23 + }; 24 + 25 + static const struct mtk_gate_regs vdec2_cg_regs = { 26 + .set_ofs = 0x8, 27 + .clr_ofs = 0xc, 28 + .sta_ofs = 0x8, 29 + }; 30 + 31 + #define GATE_VDEC0(_id, _name, _parent, _shift) \ 32 + GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv) 33 + 34 + #define GATE_VDEC1(_id, _name, _parent, _shift) \ 35 + GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv) 36 + 37 + #define GATE_VDEC2(_id, _name, _parent, _shift) \ 38 + GATE_MTK(_id, _name, _parent, &vdec2_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv) 39 + 40 + static const struct mtk_gate vdec_clks[] = { 41 + /* VDEC0 */ 42 + GATE_VDEC0(CLK_VDEC_VDEC, "vdec_vdec", "top_vdec", 0), 43 + /* VDEC1 */ 44 + GATE_VDEC1(CLK_VDEC_LAT, "vdec_lat", "top_vdec", 0), 45 + /* VDEC2 */ 46 + GATE_VDEC2(CLK_VDEC_LARB1, "vdec_larb1", "top_vdec", 0), 47 + }; 48 + 49 + static const struct mtk_gate vdec_core1_clks[] = { 50 + /* VDEC0 */ 51 + GATE_VDEC0(CLK_VDEC_CORE1_VDEC, "vdec_core1_vdec", "top_vdec", 0), 52 + /* VDEC1 */ 53 + GATE_VDEC1(CLK_VDEC_CORE1_LAT, "vdec_core1_lat", "top_vdec", 0), 54 + /* VDEC2 */ 55 + GATE_VDEC2(CLK_VDEC_CORE1_LARB1, "vdec_core1_larb1", "top_vdec", 0), 56 + }; 57 + 58 + static const struct mtk_gate vdec_soc_clks[] = { 59 + /* VDEC0 */ 60 + GATE_VDEC0(CLK_VDEC_SOC_VDEC, "vdec_soc_vdec", "top_vdec", 0), 61 + /* VDEC1 */ 62 + GATE_VDEC1(CLK_VDEC_SOC_LAT, "vdec_soc_lat", "top_vdec", 0), 63 + /* VDEC2 */ 64 + GATE_VDEC2(CLK_VDEC_SOC_LARB1, "vdec_soc_larb1", "top_vdec", 0), 65 + }; 66 + 67 + static const struct mtk_clk_desc vdec_desc = { 68 + .clks = vdec_clks, 69 + .num_clks = ARRAY_SIZE(vdec_clks), 70 + }; 71 + 72 + static const struct mtk_clk_desc vdec_core1_desc = { 73 + .clks = vdec_core1_clks, 74 + .num_clks = ARRAY_SIZE(vdec_core1_clks), 75 + }; 76 + 77 + static const struct mtk_clk_desc vdec_soc_desc = { 78 + .clks = vdec_soc_clks, 79 + .num_clks = ARRAY_SIZE(vdec_soc_clks), 80 + }; 81 + 82 + static const struct of_device_id of_match_clk_mt8195_vdec[] = { 83 + { 84 + .compatible = "mediatek,mt8195-vdecsys", 85 + .data = &vdec_desc, 86 + }, { 87 + .compatible = "mediatek,mt8195-vdecsys_core1", 88 + .data = &vdec_core1_desc, 89 + }, { 90 + .compatible = "mediatek,mt8195-vdecsys_soc", 91 + .data = &vdec_soc_desc, 92 + }, { 93 + /* sentinel */ 94 + } 95 + }; 96 + 97 + static struct platform_driver clk_mt8195_vdec_drv = { 98 + .probe = mtk_clk_simple_probe, 99 + .driver = { 100 + .name = "clk-mt8195-vdec", 101 + .of_match_table = of_match_clk_mt8195_vdec, 102 + }, 103 + }; 104 + builtin_platform_driver(clk_mt8195_vdec_drv);