Skip to content

Commit b281039

Browse files
garminchangbebarino
authored andcommitted
clk: mediatek: Add MT8188 imgsys clock support
Add MT8188 imgsys clock controllers which provide clock gate control for image IP blocks. Signed-off-by: Garmin.Chang <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 87d06fa commit b281039

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

drivers/clk/mediatek/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,13 @@ config COMMON_CLK_MT8188_CAMSYS
699699
help
700700
This driver supports MediaTek MT8188 camsys and camsys_raw clocks.
701701

702+
config COMMON_CLK_MT8188_IMGSYS
703+
tristate "Clock driver for MediaTek MT8188 imgsys"
704+
depends on COMMON_CLK_MT8188_VPPSYS
705+
default COMMON_CLK_MT8188_VPPSYS
706+
help
707+
This driver supports MediaTek MT8188 imgsys and imgsys2 clocks.
708+
702709
config COMMON_CLK_MT8192
703710
tristate "Clock driver for MediaTek MT8192"
704711
depends on ARM64 || COMPILE_TEST

drivers/clk/mediatek/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186_WPESYS) += clk-mt8186-wpe.o
103103
obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
104104
clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o
105105
obj-$(CONFIG_COMMON_CLK_MT8188_CAMSYS) += clk-mt8188-cam.o clk-mt8188-ccu.o
106+
obj-$(CONFIG_COMMON_CLK_MT8188_IMGSYS) += clk-mt8188-img.o
106107
obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o
107108
obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
108109
obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o

drivers/clk/mediatek/clk-mt8188-img.c

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Copyright (c) 2022 MediaTek Inc.
4+
* Author: Garmin Chang <[email protected]>
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 imgsys_cg_regs = {
15+
.set_ofs = 0x4,
16+
.clr_ofs = 0x8,
17+
.sta_ofs = 0x0,
18+
};
19+
20+
#define GATE_IMGSYS(_id, _name, _parent, _shift) \
21+
GATE_MTK(_id, _name, _parent, &imgsys_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
22+
23+
static const struct mtk_gate imgsys_main_clks[] = {
24+
GATE_IMGSYS(CLK_IMGSYS_MAIN_LARB9, "imgsys_main_larb9", "top_img", 0),
25+
GATE_IMGSYS(CLK_IMGSYS_MAIN_TRAW0, "imgsys_main_traw0", "top_img", 1),
26+
GATE_IMGSYS(CLK_IMGSYS_MAIN_TRAW1, "imgsys_main_traw1", "top_img", 2),
27+
GATE_IMGSYS(CLK_IMGSYS_MAIN_VCORE_GALS, "imgsys_main_vcore_gals", "top_img", 3),
28+
GATE_IMGSYS(CLK_IMGSYS_MAIN_DIP0, "imgsys_main_dip0", "top_img", 8),
29+
GATE_IMGSYS(CLK_IMGSYS_MAIN_WPE0, "imgsys_main_wpe0", "top_img", 9),
30+
GATE_IMGSYS(CLK_IMGSYS_MAIN_IPE, "imgsys_main_ipe", "top_img", 10),
31+
GATE_IMGSYS(CLK_IMGSYS_MAIN_WPE1, "imgsys_main_wpe1", "top_img", 12),
32+
GATE_IMGSYS(CLK_IMGSYS_MAIN_WPE2, "imgsys_main_wpe2", "top_img", 13),
33+
GATE_IMGSYS(CLK_IMGSYS_MAIN_GALS, "imgsys_main_gals", "top_img", 31),
34+
};
35+
36+
static const struct mtk_gate imgsys_wpe1_clks[] = {
37+
GATE_IMGSYS(CLK_IMGSYS_WPE1_LARB11, "imgsys_wpe1_larb11", "top_img", 0),
38+
GATE_IMGSYS(CLK_IMGSYS_WPE1, "imgsys_wpe1", "top_img", 1),
39+
};
40+
41+
static const struct mtk_gate imgsys_wpe2_clks[] = {
42+
GATE_IMGSYS(CLK_IMGSYS_WPE2_LARB11, "imgsys_wpe2_larb11", "top_img", 0),
43+
GATE_IMGSYS(CLK_IMGSYS_WPE2, "imgsys_wpe2", "top_img", 1),
44+
};
45+
46+
static const struct mtk_gate imgsys_wpe3_clks[] = {
47+
GATE_IMGSYS(CLK_IMGSYS_WPE3_LARB11, "imgsys_wpe3_larb11", "top_img", 0),
48+
GATE_IMGSYS(CLK_IMGSYS_WPE3, "imgsys_wpe3", "top_img", 1),
49+
};
50+
51+
static const struct mtk_gate imgsys1_dip_top_clks[] = {
52+
GATE_IMGSYS(CLK_IMGSYS1_DIP_TOP_LARB10, "imgsys1_dip_larb10", "top_img", 0),
53+
GATE_IMGSYS(CLK_IMGSYS1_DIP_TOP_DIP_TOP, "imgsys1_dip_dip_top", "top_img", 1),
54+
};
55+
56+
static const struct mtk_gate imgsys1_dip_nr_clks[] = {
57+
GATE_IMGSYS(CLK_IMGSYS1_DIP_NR_LARB15, "imgsys1_dip_nr_larb15", "top_img", 0),
58+
GATE_IMGSYS(CLK_IMGSYS1_DIP_NR_DIP_NR, "imgsys1_dip_nr_dip_nr", "top_img", 1),
59+
};
60+
61+
static const struct mtk_clk_desc imgsys_main_desc = {
62+
.clks = imgsys_main_clks,
63+
.num_clks = ARRAY_SIZE(imgsys_main_clks),
64+
};
65+
66+
static const struct mtk_clk_desc imgsys_wpe1_desc = {
67+
.clks = imgsys_wpe1_clks,
68+
.num_clks = ARRAY_SIZE(imgsys_wpe1_clks),
69+
};
70+
71+
static const struct mtk_clk_desc imgsys_wpe2_desc = {
72+
.clks = imgsys_wpe2_clks,
73+
.num_clks = ARRAY_SIZE(imgsys_wpe2_clks),
74+
};
75+
76+
static const struct mtk_clk_desc imgsys_wpe3_desc = {
77+
.clks = imgsys_wpe3_clks,
78+
.num_clks = ARRAY_SIZE(imgsys_wpe3_clks),
79+
};
80+
81+
static const struct mtk_clk_desc imgsys1_dip_top_desc = {
82+
.clks = imgsys1_dip_top_clks,
83+
.num_clks = ARRAY_SIZE(imgsys1_dip_top_clks),
84+
};
85+
86+
static const struct mtk_clk_desc imgsys1_dip_nr_desc = {
87+
.clks = imgsys1_dip_nr_clks,
88+
.num_clks = ARRAY_SIZE(imgsys1_dip_nr_clks),
89+
};
90+
91+
static const struct of_device_id of_match_clk_mt8188_imgsys_main[] = {
92+
{ .compatible = "mediatek,mt8188-imgsys", .data = &imgsys_main_desc },
93+
{ .compatible = "mediatek,mt8188-imgsys-wpe1", .data = &imgsys_wpe1_desc },
94+
{ .compatible = "mediatek,mt8188-imgsys-wpe2", .data = &imgsys_wpe2_desc },
95+
{ .compatible = "mediatek,mt8188-imgsys-wpe3", .data = &imgsys_wpe3_desc },
96+
{ .compatible = "mediatek,mt8188-imgsys1-dip-top", .data = &imgsys1_dip_top_desc },
97+
{ .compatible = "mediatek,mt8188-imgsys1-dip-nr", .data = &imgsys1_dip_nr_desc },
98+
{ /* sentinel */ }
99+
};
100+
MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_imgsys_main);
101+
102+
static struct platform_driver clk_mt8188_imgsys_main_drv = {
103+
.probe = mtk_clk_simple_probe,
104+
.remove = mtk_clk_simple_remove,
105+
.driver = {
106+
.name = "clk-mt8188-imgsys_main",
107+
.of_match_table = of_match_clk_mt8188_imgsys_main,
108+
},
109+
};
110+
111+
module_platform_driver(clk_mt8188_imgsys_main_drv);
112+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)