xref: /linux/drivers/clk/mediatek/clk-mt8188-adsp_audio26m.c (revision c771600c6af14749609b49565ffb4cac2959710d)
10d2f2cefSGarmin.Chang // SPDX-License-Identifier: GPL-2.0-only
20d2f2cefSGarmin.Chang /*
30d2f2cefSGarmin.Chang  * Copyright (c) 2022 MediaTek Inc.
40d2f2cefSGarmin.Chang  * Author: Garmin Chang <garmin.chang@mediatek.com>
50d2f2cefSGarmin.Chang  */
60d2f2cefSGarmin.Chang 
70d2f2cefSGarmin.Chang #include <linux/clk-provider.h>
8e0e3aca9SStephen Boyd #include <linux/mod_devicetable.h>
90d2f2cefSGarmin.Chang #include <linux/platform_device.h>
100d2f2cefSGarmin.Chang 
11e0e3aca9SStephen Boyd #include <dt-bindings/clock/mediatek,mt8188-clk.h>
12e0e3aca9SStephen Boyd 
130d2f2cefSGarmin.Chang #include "clk-gate.h"
140d2f2cefSGarmin.Chang #include "clk-mtk.h"
150d2f2cefSGarmin.Chang 
160d2f2cefSGarmin.Chang static const struct mtk_gate_regs adsp_audio26m_cg_regs = {
170d2f2cefSGarmin.Chang 	.set_ofs = 0x80,
180d2f2cefSGarmin.Chang 	.clr_ofs = 0x80,
190d2f2cefSGarmin.Chang 	.sta_ofs = 0x80,
200d2f2cefSGarmin.Chang };
210d2f2cefSGarmin.Chang 
220d2f2cefSGarmin.Chang #define GATE_ADSP_FLAGS(_id, _name, _parent, _shift)		\
230d2f2cefSGarmin.Chang 	GATE_MTK(_id, _name, _parent, &adsp_audio26m_cg_regs, _shift,		\
240d2f2cefSGarmin.Chang 		&mtk_clk_gate_ops_no_setclr)
250d2f2cefSGarmin.Chang 
260d2f2cefSGarmin.Chang static const struct mtk_gate adsp_audio26m_clks[] = {
270d2f2cefSGarmin.Chang 	GATE_ADSP_FLAGS(CLK_AUDIODSP_AUDIO26M, "audiodsp_audio26m", "clk26m", 3),
280d2f2cefSGarmin.Chang };
290d2f2cefSGarmin.Chang 
300d2f2cefSGarmin.Chang static const struct mtk_clk_desc adsp_audio26m_desc = {
310d2f2cefSGarmin.Chang 	.clks = adsp_audio26m_clks,
320d2f2cefSGarmin.Chang 	.num_clks = ARRAY_SIZE(adsp_audio26m_clks),
330d2f2cefSGarmin.Chang };
340d2f2cefSGarmin.Chang 
350d2f2cefSGarmin.Chang static const struct of_device_id of_match_clk_mt8188_adsp_audio26m[] = {
360d2f2cefSGarmin.Chang 	{ .compatible = "mediatek,mt8188-adsp-audio26m", .data = &adsp_audio26m_desc },
370d2f2cefSGarmin.Chang 	{ /* sentinel */ }
380d2f2cefSGarmin.Chang };
39e0e3aca9SStephen Boyd MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_adsp_audio26m);
400d2f2cefSGarmin.Chang 
410d2f2cefSGarmin.Chang static struct platform_driver clk_mt8188_adsp_audio26m_drv = {
420d2f2cefSGarmin.Chang 	.probe = mtk_clk_simple_probe,
43f00b45dbSUwe Kleine-König 	.remove = mtk_clk_simple_remove,
440d2f2cefSGarmin.Chang 	.driver = {
450d2f2cefSGarmin.Chang 		.name = "clk-mt8188-adsp_audio26m",
460d2f2cefSGarmin.Chang 		.of_match_table = of_match_clk_mt8188_adsp_audio26m,
470d2f2cefSGarmin.Chang 	},
480d2f2cefSGarmin.Chang };
490d2f2cefSGarmin.Chang module_platform_driver(clk_mt8188_adsp_audio26m_drv);
50f5100c41SAngeloGioacchino Del Regno 
51f5100c41SAngeloGioacchino Del Regno MODULE_DESCRIPTION("MediaTek MT8188 AudioDSP clocks driver");
520d2f2cefSGarmin.Chang MODULE_LICENSE("GPL");
53