GNU Linux-libre 6.8.9-gnu
[releases.git] / drivers / clk / mediatek / clk-mt8188-adsp_audio26m.c
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 <linux/clk-provider.h>
8 #include <linux/mod_devicetable.h>
9 #include <linux/platform_device.h>
10
11 #include <dt-bindings/clock/mediatek,mt8188-clk.h>
12
13 #include "clk-gate.h"
14 #include "clk-mtk.h"
15
16 static const struct mtk_gate_regs adsp_audio26m_cg_regs = {
17         .set_ofs = 0x80,
18         .clr_ofs = 0x80,
19         .sta_ofs = 0x80,
20 };
21
22 #define GATE_ADSP_FLAGS(_id, _name, _parent, _shift)            \
23         GATE_MTK(_id, _name, _parent, &adsp_audio26m_cg_regs, _shift,           \
24                 &mtk_clk_gate_ops_no_setclr)
25
26 static const struct mtk_gate adsp_audio26m_clks[] = {
27         GATE_ADSP_FLAGS(CLK_AUDIODSP_AUDIO26M, "audiodsp_audio26m", "clk26m", 3),
28 };
29
30 static const struct mtk_clk_desc adsp_audio26m_desc = {
31         .clks = adsp_audio26m_clks,
32         .num_clks = ARRAY_SIZE(adsp_audio26m_clks),
33 };
34
35 static const struct of_device_id of_match_clk_mt8188_adsp_audio26m[] = {
36         { .compatible = "mediatek,mt8188-adsp-audio26m", .data = &adsp_audio26m_desc },
37         { /* sentinel */ }
38 };
39 MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_adsp_audio26m);
40
41 static struct platform_driver clk_mt8188_adsp_audio26m_drv = {
42         .probe = mtk_clk_simple_probe,
43         .remove_new = mtk_clk_simple_remove,
44         .driver = {
45                 .name = "clk-mt8188-adsp_audio26m",
46                 .of_match_table = of_match_clk_mt8188_adsp_audio26m,
47         },
48 };
49 module_platform_driver(clk_mt8188_adsp_audio26m_drv);
50 MODULE_LICENSE("GPL");