|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
| 2 | +/* |
| 3 | + * Copyright (c) 2022 MediaTek Inc. |
| 4 | + * Author: Garmin Chang <garmin.chang@mediatek.com> |
| 5 | + */ |
| 6 | + |
| 7 | +#include <dt-bindings/clock/mediatek,mt8188-clk.h> |
| 8 | +#include <linux/clk-provider.h> |
| 9 | +#include <linux/platform_device.h> |
| 10 | + |
| 11 | +#include "clk-gate.h" |
| 12 | +#include "clk-mtk.h" |
| 13 | + |
| 14 | +static const struct mtk_gate_regs venc1_cg_regs = { |
| 15 | + .set_ofs = 0x4, |
| 16 | + .clr_ofs = 0x8, |
| 17 | + .sta_ofs = 0x0, |
| 18 | +}; |
| 19 | + |
| 20 | +#define GATE_VENC1(_id, _name, _parent, _shift) \ |
| 21 | + GATE_MTK(_id, _name, _parent, &venc1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv) |
| 22 | + |
| 23 | +static const struct mtk_gate venc1_clks[] = { |
| 24 | + GATE_VENC1(CLK_VENC1_LARB, "venc1_larb", "top_venc", 0), |
| 25 | + GATE_VENC1(CLK_VENC1_VENC, "venc1_venc", "top_venc", 4), |
| 26 | + GATE_VENC1(CLK_VENC1_JPGENC, "venc1_jpgenc", "top_venc", 8), |
| 27 | + GATE_VENC1(CLK_VENC1_JPGDEC, "venc1_jpgdec", "top_venc", 12), |
| 28 | + GATE_VENC1(CLK_VENC1_JPGDEC_C1, "venc1_jpgdec_c1", "top_venc", 16), |
| 29 | + GATE_VENC1(CLK_VENC1_GALS, "venc1_gals", "top_venc", 28), |
| 30 | + GATE_VENC1(CLK_VENC1_GALS_SRAM, "venc1_gals_sram", "top_venc", 31), |
| 31 | +}; |
| 32 | + |
| 33 | +static const struct mtk_clk_desc venc1_desc = { |
| 34 | + .clks = venc1_clks, |
| 35 | + .num_clks = ARRAY_SIZE(venc1_clks), |
| 36 | +}; |
| 37 | + |
| 38 | +static const struct of_device_id of_match_clk_mt8188_venc1[] = { |
| 39 | + { .compatible = "mediatek,mt8188-vencsys", .data = &venc1_desc }, |
| 40 | + { /* sentinel */ } |
| 41 | +}; |
| 42 | +MODULE_DEVICE_TABLE(platform, of_match_clk_mt8188_venc1); |
| 43 | + |
| 44 | +static struct platform_driver clk_mt8188_venc1_drv = { |
| 45 | + .probe = mtk_clk_simple_probe, |
| 46 | + .remove = mtk_clk_simple_remove, |
| 47 | + .driver = { |
| 48 | + .name = "clk-mt8188-venc1", |
| 49 | + .of_match_table = of_match_clk_mt8188_venc1, |
| 50 | + }, |
| 51 | +}; |
| 52 | + |
| 53 | +module_platform_driver(clk_mt8188_venc1_drv); |
| 54 | +MODULE_LICENSE("GPL"); |
0 commit comments