0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/clk-provider.h>
0009 #include <linux/of.h>
0010 #include <linux/of_address.h>
0011 #include <linux/of_device.h>
0012 #include <linux/platform_device.h>
0013
0014 #include "clk-mtk.h"
0015 #include "clk-gate.h"
0016
0017 #include <dt-bindings/clock/mt8516-clk.h>
0018
0019 static const struct mtk_gate_regs aud_cg_regs = {
0020 .set_ofs = 0x0,
0021 .clr_ofs = 0x0,
0022 .sta_ofs = 0x0,
0023 };
0024
0025 #define GATE_AUD(_id, _name, _parent, _shift) { \
0026 .id = _id, \
0027 .name = _name, \
0028 .parent_name = _parent, \
0029 .regs = &aud_cg_regs, \
0030 .shift = _shift, \
0031 .ops = &mtk_clk_gate_ops_no_setclr, \
0032 }
0033
0034 static const struct mtk_gate aud_clks[] __initconst = {
0035 GATE_AUD(CLK_AUD_AFE, "aud_afe", "clk26m_ck", 2),
0036 GATE_AUD(CLK_AUD_I2S, "aud_i2s", "i2s_infra_bck", 6),
0037 GATE_AUD(CLK_AUD_22M, "aud_22m", "rg_aud_engen1", 8),
0038 GATE_AUD(CLK_AUD_24M, "aud_24m", "rg_aud_engen2", 9),
0039 GATE_AUD(CLK_AUD_INTDIR, "aud_intdir", "rg_aud_spdif_in", 15),
0040 GATE_AUD(CLK_AUD_APLL2_TUNER, "aud_apll2_tuner", "rg_aud_engen2", 18),
0041 GATE_AUD(CLK_AUD_APLL_TUNER, "aud_apll_tuner", "rg_aud_engen1", 19),
0042 GATE_AUD(CLK_AUD_HDMI, "aud_hdmi", "apll12_div4", 20),
0043 GATE_AUD(CLK_AUD_SPDF, "aud_spdf", "apll12_div6", 21),
0044 GATE_AUD(CLK_AUD_ADC, "aud_adc", "aud_afe", 24),
0045 GATE_AUD(CLK_AUD_DAC, "aud_dac", "aud_afe", 25),
0046 GATE_AUD(CLK_AUD_DAC_PREDIS, "aud_dac_predis", "aud_afe", 26),
0047 GATE_AUD(CLK_AUD_TML, "aud_tml", "aud_afe", 27),
0048 };
0049
0050 static void __init mtk_audsys_init(struct device_node *node)
0051 {
0052 struct clk_hw_onecell_data *clk_data;
0053 int r;
0054
0055 clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK);
0056
0057 mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
0058
0059 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
0060 if (r)
0061 pr_err("%s(): could not register clock provider: %d\n",
0062 __func__, r);
0063
0064 }
0065 CLK_OF_DECLARE(mtk_audsys, "mediatek,mt8516-audsys", mtk_audsys_init);