Skip to content

Commit 0d2f2ce

Browse files
garminchangbebarino
authored andcommitted
clk: mediatek: Add MT8188 adsp clock support
Add MT8188 adsp clock controller which provides clock gate control for Audio DSP. Signed-off-by: Garmin.Chang <Garmin.Chang@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230331123621.16167-20-Garmin.Chang@mediatek.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 1b5e529 commit 0d2f2ce

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

drivers/clk/mediatek/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,13 @@ config COMMON_CLK_MT8188
692692
help
693693
This driver supports MediaTek MT8188 clocks.
694694

695+
config COMMON_CLK_MT8188_ADSP_AUDIO26M
696+
tristate "Clock driver for MediaTek MT8188 adsp audio26m"
697+
depends on COMMON_CLK_MT8188
698+
default COMMON_CLK_MT8188
699+
help
700+
This driver supports MediaTek MT8188 adsp audio26m clocks.
701+
695702
config COMMON_CLK_MT8188_CAMSYS
696703
tristate "Clock driver for MediaTek MT8188 camsys"
697704
depends on COMMON_CLK_MT8188_VPPSYS

drivers/clk/mediatek/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186_VENCSYS) += clk-mt8186-venc.o
102102
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
105+
obj-$(CONFIG_COMMON_CLK_MT8188_ADSP_AUDIO26M) += clk-mt8188-adsp_audio26m.o
105106
obj-$(CONFIG_COMMON_CLK_MT8188_CAMSYS) += clk-mt8188-cam.o clk-mt8188-ccu.o
106107
obj-$(CONFIG_COMMON_CLK_MT8188_IMGSYS) += clk-mt8188-img.o
107108
obj-$(CONFIG_COMMON_CLK_MT8188_IMP_IIC_WRAP) += clk-mt8188-imp_iic_wrap.o
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 adsp_audio26m_cg_regs = {
15+
.set_ofs = 0x80,
16+
.clr_ofs = 0x80,
17+
.sta_ofs = 0x80,
18+
};
19+
20+
#define GATE_ADSP_FLAGS(_id, _name, _parent, _shift) \
21+
GATE_MTK(_id, _name, _parent, &adsp_audio26m_cg_regs, _shift, \
22+
&mtk_clk_gate_ops_no_setclr)
23+
24+
static const struct mtk_gate adsp_audio26m_clks[] = {
25+
GATE_ADSP_FLAGS(CLK_AUDIODSP_AUDIO26M, "audiodsp_audio26m", "clk26m", 3),
26+
};
27+
28+
static const struct mtk_clk_desc adsp_audio26m_desc = {
29+
.clks = adsp_audio26m_clks,
30+
.num_clks = ARRAY_SIZE(adsp_audio26m_clks),
31+
};
32+
33+
static const struct of_device_id of_match_clk_mt8188_adsp_audio26m[] = {
34+
{ .compatible = "mediatek,mt8188-adsp-audio26m", .data = &adsp_audio26m_desc },
35+
{ /* sentinel */ }
36+
};
37+
MODULE_DEVICE_TABLE(platform, of_match_clk_mt8188_adsp_audio26m);
38+
39+
static struct platform_driver clk_mt8188_adsp_audio26m_drv = {
40+
.probe = mtk_clk_simple_probe,
41+
.remove = mtk_clk_simple_remove,
42+
.driver = {
43+
.name = "clk-mt8188-adsp_audio26m",
44+
.of_match_table = of_match_clk_mt8188_adsp_audio26m,
45+
},
46+
};
47+
module_platform_driver(clk_mt8188_adsp_audio26m_drv);
48+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)