Skip to content

Commit 014a488

Browse files
Chun-Jie Chenbebarino
authored andcommitted
clk: mediatek: Add MT8192 imgsys clock support
Add MT8192 imgsys and imgsys2 clock providers Signed-off-by: Weiyi Lu <[email protected]> Signed-off-by: Chun-Jie Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ikjoon Jang <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent cebef18 commit 014a488

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

drivers/clk/mediatek/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ config COMMON_CLK_MT8192_CAMSYS
520520
help
521521
This driver supports MediaTek MT8192 camsys and camsys_raw clocks.
522522

523+
config COMMON_CLK_MT8192_IMGSYS
524+
bool "Clock driver for MediaTek MT8192 imgsys"
525+
depends on COMMON_CLK_MT8192
526+
help
527+
This driver supports MediaTek MT8192 imgsys and imgsys2 clocks.
528+
523529
config COMMON_CLK_MT8516
524530
bool "Clock driver for MediaTek MT8516"
525531
depends on ARCH_MEDIATEK || COMPILE_TEST

drivers/clk/mediatek/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@ obj-$(CONFIG_COMMON_CLK_MT8183_VENCSYS) += clk-mt8183-venc.o
7070
obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
7171
obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
7272
obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
73+
obj-$(CONFIG_COMMON_CLK_MT8192_IMGSYS) += clk-mt8192-img.o
7374
obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o
7475
obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o

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

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
//
3+
// Copyright (c) 2021 MediaTek Inc.
4+
// Author: Chun-Jie Chen <[email protected]>
5+
6+
#include <linux/clk-provider.h>
7+
#include <linux/of_device.h>
8+
#include <linux/platform_device.h>
9+
10+
#include "clk-mtk.h"
11+
#include "clk-gate.h"
12+
13+
#include <dt-bindings/clock/mt8192-clk.h>
14+
15+
static const struct mtk_gate_regs img_cg_regs = {
16+
.set_ofs = 0x4,
17+
.clr_ofs = 0x8,
18+
.sta_ofs = 0x0,
19+
};
20+
21+
#define GATE_IMG(_id, _name, _parent, _shift) \
22+
GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
23+
24+
static const struct mtk_gate img_clks[] = {
25+
GATE_IMG(CLK_IMG_LARB9, "img_larb9", "img1_sel", 0),
26+
GATE_IMG(CLK_IMG_LARB10, "img_larb10", "img1_sel", 1),
27+
GATE_IMG(CLK_IMG_DIP, "img_dip", "img1_sel", 2),
28+
GATE_IMG(CLK_IMG_GALS, "img_gals", "img1_sel", 12),
29+
};
30+
31+
static const struct mtk_gate img2_clks[] = {
32+
GATE_IMG(CLK_IMG2_LARB11, "img2_larb11", "img1_sel", 0),
33+
GATE_IMG(CLK_IMG2_LARB12, "img2_larb12", "img1_sel", 1),
34+
GATE_IMG(CLK_IMG2_MFB, "img2_mfb", "img1_sel", 6),
35+
GATE_IMG(CLK_IMG2_WPE, "img2_wpe", "img1_sel", 7),
36+
GATE_IMG(CLK_IMG2_MSS, "img2_mss", "img1_sel", 8),
37+
GATE_IMG(CLK_IMG2_GALS, "img2_gals", "img1_sel", 12),
38+
};
39+
40+
static const struct mtk_clk_desc img_desc = {
41+
.clks = img_clks,
42+
.num_clks = ARRAY_SIZE(img_clks),
43+
};
44+
45+
static const struct mtk_clk_desc img2_desc = {
46+
.clks = img2_clks,
47+
.num_clks = ARRAY_SIZE(img2_clks),
48+
};
49+
50+
static const struct of_device_id of_match_clk_mt8192_img[] = {
51+
{
52+
.compatible = "mediatek,mt8192-imgsys",
53+
.data = &img_desc,
54+
}, {
55+
.compatible = "mediatek,mt8192-imgsys2",
56+
.data = &img2_desc,
57+
}, {
58+
/* sentinel */
59+
}
60+
};
61+
62+
static struct platform_driver clk_mt8192_img_drv = {
63+
.probe = mtk_clk_simple_probe,
64+
.driver = {
65+
.name = "clk-mt8192-img",
66+
.of_match_table = of_match_clk_mt8192_img,
67+
},
68+
};
69+
70+
builtin_platform_driver(clk_mt8192_img_drv);

0 commit comments

Comments
 (0)