xref: /linux/drivers/clk/meson/axg-audio.c (revision 05d3b7c68e6205b2036a7c854e94a62556eeee0f)
11cd50181SJerome Brunet // SPDX-License-Identifier: (GPL-2.0 OR MIT)
21cd50181SJerome Brunet /*
31cd50181SJerome Brunet  * Copyright (c) 2018 BayLibre, SAS.
41cd50181SJerome Brunet  * Author: Jerome Brunet <jbrunet@baylibre.com>
51cd50181SJerome Brunet  */
61cd50181SJerome Brunet 
71cd50181SJerome Brunet #include <linux/clk.h>
81cd50181SJerome Brunet #include <linux/clk-provider.h>
91cd50181SJerome Brunet #include <linux/init.h>
101cd50181SJerome Brunet #include <linux/of_device.h>
111cd50181SJerome Brunet #include <linux/module.h>
121cd50181SJerome Brunet #include <linux/platform_device.h>
131cd50181SJerome Brunet #include <linux/regmap.h>
141cd50181SJerome Brunet #include <linux/reset.h>
157cfefab6SJerome Brunet #include <linux/reset-controller.h>
161cd50181SJerome Brunet #include <linux/slab.h>
171cd50181SJerome Brunet 
18*05d3b7c6SNeil Armstrong #include "meson-clkc-utils.h"
191cd50181SJerome Brunet #include "axg-audio.h"
20889c2b7eSJerome Brunet #include "clk-regmap.h"
21889c2b7eSJerome Brunet #include "clk-phase.h"
22889c2b7eSJerome Brunet #include "sclk-div.h"
231cd50181SJerome Brunet 
248ff93f28SJerome Brunet #define AUD_GATE(_name, _reg, _bit, _pname, _iflags) {			\
251cd50181SJerome Brunet 	.data = &(struct clk_regmap_gate_data){				\
261cd50181SJerome Brunet 		.offset = (_reg),					\
271cd50181SJerome Brunet 		.bit_idx = (_bit),					\
281cd50181SJerome Brunet 	},								\
291cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
30b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
311cd50181SJerome Brunet 		.ops = &clk_regmap_gate_ops,				\
328ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
331cd50181SJerome Brunet 		.num_parents = 1,					\
341cd50181SJerome Brunet 		.flags = CLK_DUTY_CYCLE_PARENT | (_iflags),		\
351cd50181SJerome Brunet 	},								\
361cd50181SJerome Brunet }
371cd50181SJerome Brunet 
388ff93f28SJerome Brunet #define AUD_MUX(_name, _reg, _mask, _shift, _dflags, _pdata, _iflags) {	\
391cd50181SJerome Brunet 	.data = &(struct clk_regmap_mux_data){				\
401cd50181SJerome Brunet 		.offset = (_reg),					\
411cd50181SJerome Brunet 		.mask = (_mask),					\
421cd50181SJerome Brunet 		.shift = (_shift),					\
431cd50181SJerome Brunet 		.flags = (_dflags),					\
441cd50181SJerome Brunet 	},								\
451cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data){				\
46b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
471cd50181SJerome Brunet 		.ops = &clk_regmap_mux_ops,				\
48282420eeSAlexandre Mergnat 		.parent_data = _pdata,					\
49282420eeSAlexandre Mergnat 		.num_parents = ARRAY_SIZE(_pdata),			\
501cd50181SJerome Brunet 		.flags = CLK_DUTY_CYCLE_PARENT | (_iflags),		\
511cd50181SJerome Brunet 	},								\
521cd50181SJerome Brunet }
531cd50181SJerome Brunet 
548ff93f28SJerome Brunet #define AUD_DIV(_name, _reg, _shift, _width, _dflags, _pname, _iflags) { \
551cd50181SJerome Brunet 	.data = &(struct clk_regmap_div_data){				\
561cd50181SJerome Brunet 		.offset = (_reg),					\
571cd50181SJerome Brunet 		.shift = (_shift),					\
581cd50181SJerome Brunet 		.width = (_width),					\
591cd50181SJerome Brunet 		.flags = (_dflags),					\
601cd50181SJerome Brunet 	},								\
611cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data){				\
62b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
631cd50181SJerome Brunet 		.ops = &clk_regmap_divider_ops,				\
648ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
651cd50181SJerome Brunet 		.num_parents = 1,					\
661cd50181SJerome Brunet 		.flags = (_iflags),					\
671cd50181SJerome Brunet 	},								\
681cd50181SJerome Brunet }
691cd50181SJerome Brunet 
70be4fe445SJerome Brunet #define AUD_PCLK_GATE(_name, _reg, _bit) {				\
71282420eeSAlexandre Mergnat 	.data = &(struct clk_regmap_gate_data){				\
72be4fe445SJerome Brunet 		.offset = (_reg),					\
73282420eeSAlexandre Mergnat 		.bit_idx = (_bit),					\
74282420eeSAlexandre Mergnat 	},								\
75282420eeSAlexandre Mergnat 	.hw.init = &(struct clk_init_data) {				\
76282420eeSAlexandre Mergnat 		.name = "aud_"#_name,					\
77282420eeSAlexandre Mergnat 		.ops = &clk_regmap_gate_ops,				\
78cf52db45SJerome Brunet 		.parent_names = (const char *[]){ "aud_top" },		\
79282420eeSAlexandre Mergnat 		.num_parents = 1,					\
80282420eeSAlexandre Mergnat 	},								\
81282420eeSAlexandre Mergnat }
821cd50181SJerome Brunet 
83b18819c4SJerome Brunet #define AUD_SCLK_DIV(_name, _reg, _div_shift, _div_width,		\
848ff93f28SJerome Brunet 		     _hi_shift, _hi_width, _pname, _iflags) {		\
851cd50181SJerome Brunet 	.data = &(struct meson_sclk_div_data) {				\
861cd50181SJerome Brunet 		.div = {						\
871cd50181SJerome Brunet 			.reg_off = (_reg),				\
881cd50181SJerome Brunet 			.shift   = (_div_shift),			\
891cd50181SJerome Brunet 			.width   = (_div_width),			\
901cd50181SJerome Brunet 		},							\
911cd50181SJerome Brunet 		.hi = {							\
921cd50181SJerome Brunet 			.reg_off = (_reg),				\
931cd50181SJerome Brunet 			.shift   = (_hi_shift),				\
941cd50181SJerome Brunet 			.width   = (_hi_width),				\
951cd50181SJerome Brunet 		},							\
961cd50181SJerome Brunet 	},								\
971cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
98b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
991cd50181SJerome Brunet 		.ops = &meson_sclk_div_ops,				\
1008ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1011cd50181SJerome Brunet 		.num_parents = 1,					\
1021cd50181SJerome Brunet 		.flags = (_iflags),					\
1031cd50181SJerome Brunet 	},								\
1041cd50181SJerome Brunet }
1051cd50181SJerome Brunet 
106b18819c4SJerome Brunet #define AUD_TRIPHASE(_name, _reg, _width, _shift0, _shift1, _shift2,	\
1078ff93f28SJerome Brunet 		     _pname, _iflags) {					\
1081cd50181SJerome Brunet 	.data = &(struct meson_clk_triphase_data) {			\
1091cd50181SJerome Brunet 		.ph0 = {						\
1101cd50181SJerome Brunet 			.reg_off = (_reg),				\
1111cd50181SJerome Brunet 			.shift   = (_shift0),				\
1121cd50181SJerome Brunet 			.width   = (_width),				\
1131cd50181SJerome Brunet 		},							\
1141cd50181SJerome Brunet 		.ph1 = {						\
1151cd50181SJerome Brunet 			.reg_off = (_reg),				\
1161cd50181SJerome Brunet 			.shift   = (_shift1),				\
1171cd50181SJerome Brunet 			.width   = (_width),				\
1181cd50181SJerome Brunet 		},							\
1191cd50181SJerome Brunet 		.ph2 = {						\
1201cd50181SJerome Brunet 			.reg_off = (_reg),				\
1211cd50181SJerome Brunet 			.shift   = (_shift2),				\
1221cd50181SJerome Brunet 			.width   = (_width),				\
1231cd50181SJerome Brunet 		},							\
1241cd50181SJerome Brunet 	},								\
1251cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
126b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
1271cd50181SJerome Brunet 		.ops = &meson_clk_triphase_ops,				\
1288ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1291cd50181SJerome Brunet 		.num_parents = 1,					\
1301cd50181SJerome Brunet 		.flags = CLK_DUTY_CYCLE_PARENT | (_iflags),		\
1311cd50181SJerome Brunet 	},								\
1321cd50181SJerome Brunet }
1331cd50181SJerome Brunet 
1348ff93f28SJerome Brunet #define AUD_PHASE(_name, _reg, _width, _shift, _pname, _iflags) {	\
1358ff93f28SJerome Brunet 	.data = &(struct meson_clk_phase_data) {			\
1368ff93f28SJerome Brunet 		.ph = {							\
1378ff93f28SJerome Brunet 			.reg_off = (_reg),				\
1388ff93f28SJerome Brunet 			.shift   = (_shift),				\
1398ff93f28SJerome Brunet 			.width   = (_width),				\
1408ff93f28SJerome Brunet 		},							\
1418ff93f28SJerome Brunet 	},								\
1428ff93f28SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
1438ff93f28SJerome Brunet 		.name = "aud_"#_name,					\
1448ff93f28SJerome Brunet 		.ops = &meson_clk_phase_ops,				\
1458ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1468ff93f28SJerome Brunet 		.num_parents = 1,					\
1478ff93f28SJerome Brunet 		.flags = (_iflags),					\
1488ff93f28SJerome Brunet 	},								\
1498ff93f28SJerome Brunet }
1508ff93f28SJerome Brunet 
1514fd433fdSJerome Brunet #define AUD_SCLK_WS(_name, _reg, _width, _shift_ph, _shift_ws, _pname,	\
1524fd433fdSJerome Brunet 		    _iflags) {						\
1534fd433fdSJerome Brunet 	.data = &(struct meson_sclk_ws_inv_data) {			\
1544fd433fdSJerome Brunet 		.ph = {							\
1554fd433fdSJerome Brunet 			.reg_off = (_reg),				\
1564fd433fdSJerome Brunet 			.shift   = (_shift_ph),				\
1574fd433fdSJerome Brunet 			.width   = (_width),				\
1584fd433fdSJerome Brunet 		},							\
1594fd433fdSJerome Brunet 		.ws = {							\
1604fd433fdSJerome Brunet 			.reg_off = (_reg),				\
1614fd433fdSJerome Brunet 			.shift   = (_shift_ws),				\
1624fd433fdSJerome Brunet 			.width   = (_width),				\
1634fd433fdSJerome Brunet 		},							\
1644fd433fdSJerome Brunet 	},								\
1654fd433fdSJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
1664fd433fdSJerome Brunet 		.name = "aud_"#_name,					\
1674fd433fdSJerome Brunet 		.ops = &meson_clk_phase_ops,				\
1684fd433fdSJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1694fd433fdSJerome Brunet 		.num_parents = 1,					\
1704fd433fdSJerome Brunet 		.flags = (_iflags),					\
1714fd433fdSJerome Brunet 	},								\
1724fd433fdSJerome Brunet }
1734fd433fdSJerome Brunet 
1748ff93f28SJerome Brunet /* Audio Master Clocks */
1758ff93f28SJerome Brunet static const struct clk_parent_data mst_mux_parent_data[] = {
1768ff93f28SJerome Brunet 	{ .fw_name = "mst_in0", },
1778ff93f28SJerome Brunet 	{ .fw_name = "mst_in1", },
1788ff93f28SJerome Brunet 	{ .fw_name = "mst_in2", },
1798ff93f28SJerome Brunet 	{ .fw_name = "mst_in3", },
1808ff93f28SJerome Brunet 	{ .fw_name = "mst_in4", },
1818ff93f28SJerome Brunet 	{ .fw_name = "mst_in5", },
1828ff93f28SJerome Brunet 	{ .fw_name = "mst_in6", },
1838ff93f28SJerome Brunet 	{ .fw_name = "mst_in7", },
1848ff93f28SJerome Brunet };
1858ff93f28SJerome Brunet 
1868ff93f28SJerome Brunet #define AUD_MST_MUX(_name, _reg, _flag)					\
1878ff93f28SJerome Brunet 	AUD_MUX(_name##_sel, _reg, 0x7, 24, _flag,			\
1888ff93f28SJerome Brunet 		mst_mux_parent_data, 0)
1898ff93f28SJerome Brunet #define AUD_MST_DIV(_name, _reg, _flag)					\
1908ff93f28SJerome Brunet 	AUD_DIV(_name##_div, _reg, 0, 16, _flag,			\
1918ff93f28SJerome Brunet 		aud_##_name##_sel, CLK_SET_RATE_PARENT)
1928ff93f28SJerome Brunet #define AUD_MST_MCLK_GATE(_name, _reg)					\
1938ff93f28SJerome Brunet 	AUD_GATE(_name, _reg, 31, aud_##_name##_div,			\
1948ff93f28SJerome Brunet 		 CLK_SET_RATE_PARENT)
1958ff93f28SJerome Brunet 
1968ff93f28SJerome Brunet #define AUD_MST_MCLK_MUX(_name, _reg)					\
1978ff93f28SJerome Brunet 	AUD_MST_MUX(_name, _reg, CLK_MUX_ROUND_CLOSEST)
1988ff93f28SJerome Brunet #define AUD_MST_MCLK_DIV(_name, _reg)					\
1998ff93f28SJerome Brunet 	AUD_MST_DIV(_name, _reg, CLK_DIVIDER_ROUND_CLOSEST)
2008ff93f28SJerome Brunet 
2018ff93f28SJerome Brunet #define AUD_MST_SYS_MUX(_name, _reg)					\
2028ff93f28SJerome Brunet 	AUD_MST_MUX(_name, _reg, 0)
2038ff93f28SJerome Brunet #define AUD_MST_SYS_DIV(_name, _reg)					\
2048ff93f28SJerome Brunet 	AUD_MST_DIV(_name, _reg, 0)
2058ff93f28SJerome Brunet 
2068ff93f28SJerome Brunet /* Sample Clocks */
2078ff93f28SJerome Brunet #define AUD_MST_SCLK_PRE_EN(_name, _reg)				\
2088ff93f28SJerome Brunet 	AUD_GATE(mst_##_name##_sclk_pre_en, _reg, 31,			\
2098ff93f28SJerome Brunet 		 aud_mst_##_name##_mclk, 0)
2108ff93f28SJerome Brunet #define AUD_MST_SCLK_DIV(_name, _reg)					\
2118ff93f28SJerome Brunet 	AUD_SCLK_DIV(mst_##_name##_sclk_div, _reg, 20, 10, 0, 0,	\
2128ff93f28SJerome Brunet 		     aud_mst_##_name##_sclk_pre_en,			\
2138ff93f28SJerome Brunet 		     CLK_SET_RATE_PARENT)
2148ff93f28SJerome Brunet #define AUD_MST_SCLK_POST_EN(_name, _reg)				\
2158ff93f28SJerome Brunet 	AUD_GATE(mst_##_name##_sclk_post_en, _reg, 30,			\
2168ff93f28SJerome Brunet 		 aud_mst_##_name##_sclk_div, CLK_SET_RATE_PARENT)
217b18819c4SJerome Brunet #define AUD_MST_SCLK(_name, _reg)					\
218b18819c4SJerome Brunet 	AUD_TRIPHASE(mst_##_name##_sclk, _reg, 1, 0, 2, 4,		\
219282420eeSAlexandre Mergnat 		     aud_mst_##_name##_sclk_post_en, CLK_SET_RATE_PARENT)
2201cd50181SJerome Brunet 
221b18819c4SJerome Brunet #define AUD_MST_LRCLK_DIV(_name, _reg)					\
222b18819c4SJerome Brunet 	AUD_SCLK_DIV(mst_##_name##_lrclk_div, _reg, 0, 10, 10, 10,	\
2238ff93f28SJerome Brunet 		     aud_mst_##_name##_sclk_post_en, 0)
224b18819c4SJerome Brunet #define AUD_MST_LRCLK(_name, _reg)					\
225b18819c4SJerome Brunet 	AUD_TRIPHASE(mst_##_name##_lrclk, _reg, 1, 1, 3, 5,		\
226282420eeSAlexandre Mergnat 		     aud_mst_##_name##_lrclk_div, CLK_SET_RATE_PARENT)
2271cd50181SJerome Brunet 
2288ff93f28SJerome Brunet /* TDM bit clock sources */
229282420eeSAlexandre Mergnat static const struct clk_parent_data tdm_sclk_parent_data[] = {
2308ff93f28SJerome Brunet 	{ .name = "aud_mst_a_sclk", .index = -1, },
2318ff93f28SJerome Brunet 	{ .name = "aud_mst_b_sclk", .index = -1, },
2328ff93f28SJerome Brunet 	{ .name = "aud_mst_c_sclk", .index = -1, },
2338ff93f28SJerome Brunet 	{ .name = "aud_mst_d_sclk", .index = -1, },
2348ff93f28SJerome Brunet 	{ .name = "aud_mst_e_sclk", .index = -1, },
2358ff93f28SJerome Brunet 	{ .name = "aud_mst_f_sclk", .index = -1, },
236282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk0", },
237282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk1", },
238282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk2", },
239282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk3", },
240282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk4", },
241282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk5", },
242282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk6", },
243282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk7", },
244282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk8", },
245282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk9", },
2461cd50181SJerome Brunet };
2471cd50181SJerome Brunet 
2488ff93f28SJerome Brunet /* TDM sample clock sources */
249282420eeSAlexandre Mergnat static const struct clk_parent_data tdm_lrclk_parent_data[] = {
2508ff93f28SJerome Brunet 	{ .name = "aud_mst_a_lrclk", .index = -1, },
2518ff93f28SJerome Brunet 	{ .name = "aud_mst_b_lrclk", .index = -1, },
2528ff93f28SJerome Brunet 	{ .name = "aud_mst_c_lrclk", .index = -1, },
2538ff93f28SJerome Brunet 	{ .name = "aud_mst_d_lrclk", .index = -1, },
2548ff93f28SJerome Brunet 	{ .name = "aud_mst_e_lrclk", .index = -1, },
2558ff93f28SJerome Brunet 	{ .name = "aud_mst_f_lrclk", .index = -1, },
256282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk0", },
257282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk1", },
258282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk2", },
259282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk3", },
260282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk4", },
261282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk5", },
262282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk6", },
263282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk7", },
264282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk8", },
265282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk9", },
2661cd50181SJerome Brunet };
2671cd50181SJerome Brunet 
2688ff93f28SJerome Brunet #define AUD_TDM_SCLK_MUX(_name, _reg)					\
2698ff93f28SJerome Brunet 	AUD_MUX(tdm##_name##_sclk_sel, _reg, 0xf, 24,			\
2708ff93f28SJerome Brunet 		CLK_MUX_ROUND_CLOSEST, tdm_sclk_parent_data, 0)
2718ff93f28SJerome Brunet #define AUD_TDM_SCLK_PRE_EN(_name, _reg)				\
2728ff93f28SJerome Brunet 	AUD_GATE(tdm##_name##_sclk_pre_en, _reg, 31,			\
2738ff93f28SJerome Brunet 		 aud_tdm##_name##_sclk_sel, CLK_SET_RATE_PARENT)
2748ff93f28SJerome Brunet #define AUD_TDM_SCLK_POST_EN(_name, _reg)				\
2758ff93f28SJerome Brunet 	AUD_GATE(tdm##_name##_sclk_post_en, _reg, 30,			\
2768ff93f28SJerome Brunet 		 aud_tdm##_name##_sclk_pre_en, CLK_SET_RATE_PARENT)
2778ff93f28SJerome Brunet #define AUD_TDM_SCLK(_name, _reg)					\
2788ff93f28SJerome Brunet 	AUD_PHASE(tdm##_name##_sclk, _reg, 1, 29,			\
2798ff93f28SJerome Brunet 		  aud_tdm##_name##_sclk_post_en,			\
2808ff93f28SJerome Brunet 		  CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT)
2814fd433fdSJerome Brunet #define AUD_TDM_SCLK_WS(_name, _reg)					\
2824fd433fdSJerome Brunet 	AUD_SCLK_WS(tdm##_name##_sclk, _reg, 1, 29, 28,			\
2834fd433fdSJerome Brunet 		    aud_tdm##_name##_sclk_post_en,			\
2844fd433fdSJerome Brunet 		    CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT)
2858ff93f28SJerome Brunet 
286b18819c4SJerome Brunet #define AUD_TDM_LRLCK(_name, _reg)					\
287b18819c4SJerome Brunet 	AUD_MUX(tdm##_name##_lrclk, _reg, 0xf, 20,			\
2888ff93f28SJerome Brunet 		CLK_MUX_ROUND_CLOSEST, tdm_lrclk_parent_data, 0)
2891cd50181SJerome Brunet 
2908ff93f28SJerome Brunet /* Pad master clock sources */
2918ff93f28SJerome Brunet static const struct clk_parent_data mclk_pad_ctrl_parent_data[] = {
2928ff93f28SJerome Brunet 	{ .name = "aud_mst_a_mclk", .index = -1,  },
2938ff93f28SJerome Brunet 	{ .name = "aud_mst_b_mclk", .index = -1,  },
2948ff93f28SJerome Brunet 	{ .name = "aud_mst_c_mclk", .index = -1,  },
2958ff93f28SJerome Brunet 	{ .name = "aud_mst_d_mclk", .index = -1,  },
2968ff93f28SJerome Brunet 	{ .name = "aud_mst_e_mclk", .index = -1,  },
2978ff93f28SJerome Brunet 	{ .name = "aud_mst_f_mclk", .index = -1,  },
2988ff93f28SJerome Brunet };
2991cd50181SJerome Brunet 
3008ff93f28SJerome Brunet /* Pad bit clock sources */
3018ff93f28SJerome Brunet static const struct clk_parent_data sclk_pad_ctrl_parent_data[] = {
3028ff93f28SJerome Brunet 	{ .name = "aud_mst_a_sclk", .index = -1, },
3038ff93f28SJerome Brunet 	{ .name = "aud_mst_b_sclk", .index = -1, },
3048ff93f28SJerome Brunet 	{ .name = "aud_mst_c_sclk", .index = -1, },
3058ff93f28SJerome Brunet 	{ .name = "aud_mst_d_sclk", .index = -1, },
3068ff93f28SJerome Brunet 	{ .name = "aud_mst_e_sclk", .index = -1, },
3078ff93f28SJerome Brunet 	{ .name = "aud_mst_f_sclk", .index = -1, },
3088ff93f28SJerome Brunet };
3098ff93f28SJerome Brunet 
3108ff93f28SJerome Brunet /* Pad sample clock sources */
3118ff93f28SJerome Brunet static const struct clk_parent_data lrclk_pad_ctrl_parent_data[] = {
3128ff93f28SJerome Brunet 	{ .name = "aud_mst_a_lrclk", .index = -1, },
3138ff93f28SJerome Brunet 	{ .name = "aud_mst_b_lrclk", .index = -1, },
3148ff93f28SJerome Brunet 	{ .name = "aud_mst_c_lrclk", .index = -1, },
3158ff93f28SJerome Brunet 	{ .name = "aud_mst_d_lrclk", .index = -1, },
3168ff93f28SJerome Brunet 	{ .name = "aud_mst_e_lrclk", .index = -1, },
3178ff93f28SJerome Brunet 	{ .name = "aud_mst_f_lrclk", .index = -1, },
3188ff93f28SJerome Brunet };
3198ff93f28SJerome Brunet 
32007500138SMaxime Jourdan #define AUD_TDM_PAD_CTRL(_name, _reg, _shift, _parents)		\
321be4fe445SJerome Brunet 	AUD_MUX(_name, _reg, 0x7, _shift, 0, _parents,		\
32207500138SMaxime Jourdan 		CLK_SET_RATE_NO_REPARENT)
32307500138SMaxime Jourdan 
3248ff93f28SJerome Brunet /* Common Clocks */
325be4fe445SJerome Brunet static struct clk_regmap ddr_arb =
326be4fe445SJerome Brunet 	AUD_PCLK_GATE(ddr_arb, AUDIO_CLK_GATE_EN, 0);
327be4fe445SJerome Brunet static struct clk_regmap pdm =
328be4fe445SJerome Brunet 	AUD_PCLK_GATE(pdm, AUDIO_CLK_GATE_EN, 1);
329be4fe445SJerome Brunet static struct clk_regmap tdmin_a =
330be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_a, AUDIO_CLK_GATE_EN, 2);
331be4fe445SJerome Brunet static struct clk_regmap tdmin_b =
332be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_b, AUDIO_CLK_GATE_EN, 3);
333be4fe445SJerome Brunet static struct clk_regmap tdmin_c =
334be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_c, AUDIO_CLK_GATE_EN, 4);
335be4fe445SJerome Brunet static struct clk_regmap tdmin_lb =
336be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_lb, AUDIO_CLK_GATE_EN, 5);
337be4fe445SJerome Brunet static struct clk_regmap tdmout_a =
338be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmout_a, AUDIO_CLK_GATE_EN, 6);
339be4fe445SJerome Brunet static struct clk_regmap tdmout_b =
340be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmout_b, AUDIO_CLK_GATE_EN, 7);
341be4fe445SJerome Brunet static struct clk_regmap tdmout_c =
342be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmout_c, AUDIO_CLK_GATE_EN, 8);
343be4fe445SJerome Brunet static struct clk_regmap frddr_a =
344be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_a, AUDIO_CLK_GATE_EN, 9);
345be4fe445SJerome Brunet static struct clk_regmap frddr_b =
346be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_b, AUDIO_CLK_GATE_EN, 10);
347be4fe445SJerome Brunet static struct clk_regmap frddr_c =
348be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_c, AUDIO_CLK_GATE_EN, 11);
349be4fe445SJerome Brunet static struct clk_regmap toddr_a =
350be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_a, AUDIO_CLK_GATE_EN, 12);
351be4fe445SJerome Brunet static struct clk_regmap toddr_b =
352be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_b, AUDIO_CLK_GATE_EN, 13);
353be4fe445SJerome Brunet static struct clk_regmap toddr_c =
354be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_c, AUDIO_CLK_GATE_EN, 14);
355be4fe445SJerome Brunet static struct clk_regmap loopback =
356be4fe445SJerome Brunet 	AUD_PCLK_GATE(loopback, AUDIO_CLK_GATE_EN, 15);
357be4fe445SJerome Brunet static struct clk_regmap spdifin =
358be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifin, AUDIO_CLK_GATE_EN, 16);
359be4fe445SJerome Brunet static struct clk_regmap spdifout =
360be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifout, AUDIO_CLK_GATE_EN, 17);
361be4fe445SJerome Brunet static struct clk_regmap resample =
362be4fe445SJerome Brunet 	AUD_PCLK_GATE(resample, AUDIO_CLK_GATE_EN, 18);
363be4fe445SJerome Brunet static struct clk_regmap power_detect =
364be4fe445SJerome Brunet 	AUD_PCLK_GATE(power_detect, AUDIO_CLK_GATE_EN, 19);
36507500138SMaxime Jourdan 
3668ff93f28SJerome Brunet static struct clk_regmap spdifout_clk_sel =
3678ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL);
3688ff93f28SJerome Brunet static struct clk_regmap pdm_dclk_sel =
3698ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(pdm_dclk, AUDIO_CLK_PDMIN_CTRL0);
3708ff93f28SJerome Brunet static struct clk_regmap spdifin_clk_sel =
3718ff93f28SJerome Brunet 	AUD_MST_SYS_MUX(spdifin_clk, AUDIO_CLK_SPDIFIN_CTRL);
3728ff93f28SJerome Brunet static struct clk_regmap pdm_sysclk_sel =
3738ff93f28SJerome Brunet 	AUD_MST_SYS_MUX(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1);
3748ff93f28SJerome Brunet static struct clk_regmap spdifout_b_clk_sel =
3758ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL);
37607500138SMaxime Jourdan 
3778ff93f28SJerome Brunet static struct clk_regmap spdifout_clk_div =
3788ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL);
3798ff93f28SJerome Brunet static struct clk_regmap pdm_dclk_div =
3808ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(pdm_dclk, AUDIO_CLK_PDMIN_CTRL0);
3818ff93f28SJerome Brunet static struct clk_regmap spdifin_clk_div =
3828ff93f28SJerome Brunet 	AUD_MST_SYS_DIV(spdifin_clk, AUDIO_CLK_SPDIFIN_CTRL);
3838ff93f28SJerome Brunet static struct clk_regmap pdm_sysclk_div =
3848ff93f28SJerome Brunet 	AUD_MST_SYS_DIV(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1);
3858ff93f28SJerome Brunet static struct clk_regmap spdifout_b_clk_div =
3868ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL);
38707500138SMaxime Jourdan 
3888ff93f28SJerome Brunet static struct clk_regmap spdifout_clk =
3898ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL);
3908ff93f28SJerome Brunet static struct clk_regmap spdifin_clk =
3918ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(spdifin_clk, AUDIO_CLK_SPDIFIN_CTRL);
3928ff93f28SJerome Brunet static struct clk_regmap pdm_dclk =
3938ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(pdm_dclk, AUDIO_CLK_PDMIN_CTRL0);
3948ff93f28SJerome Brunet static struct clk_regmap pdm_sysclk =
3958ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1);
3968ff93f28SJerome Brunet static struct clk_regmap spdifout_b_clk =
3978ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL);
39807500138SMaxime Jourdan 
3998ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk_pre_en =
4008ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(a, AUDIO_MST_A_SCLK_CTRL0);
4018ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk_pre_en =
4028ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(b, AUDIO_MST_B_SCLK_CTRL0);
4038ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk_pre_en =
4048ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(c, AUDIO_MST_C_SCLK_CTRL0);
4058ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk_pre_en =
4068ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(d, AUDIO_MST_D_SCLK_CTRL0);
4078ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk_pre_en =
4088ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(e, AUDIO_MST_E_SCLK_CTRL0);
4098ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk_pre_en =
4108ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(f, AUDIO_MST_F_SCLK_CTRL0);
41107500138SMaxime Jourdan 
4128ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk_div =
4138ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(a, AUDIO_MST_A_SCLK_CTRL0);
4148ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk_div =
4158ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(b, AUDIO_MST_B_SCLK_CTRL0);
4168ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk_div =
4178ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(c, AUDIO_MST_C_SCLK_CTRL0);
4188ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk_div =
4198ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(d, AUDIO_MST_D_SCLK_CTRL0);
4208ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk_div =
4218ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(e, AUDIO_MST_E_SCLK_CTRL0);
4228ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk_div =
4238ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(f, AUDIO_MST_F_SCLK_CTRL0);
4248ff93f28SJerome Brunet 
4258ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk_post_en =
4268ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(a, AUDIO_MST_A_SCLK_CTRL0);
4278ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk_post_en =
4288ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(b, AUDIO_MST_B_SCLK_CTRL0);
4298ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk_post_en =
4308ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(c, AUDIO_MST_C_SCLK_CTRL0);
4318ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk_post_en =
4328ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(d, AUDIO_MST_D_SCLK_CTRL0);
4338ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk_post_en =
4348ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(e, AUDIO_MST_E_SCLK_CTRL0);
4358ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk_post_en =
4368ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(f, AUDIO_MST_F_SCLK_CTRL0);
4378ff93f28SJerome Brunet 
4388ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk =
4398ff93f28SJerome Brunet 	AUD_MST_SCLK(a, AUDIO_MST_A_SCLK_CTRL1);
4408ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk =
4418ff93f28SJerome Brunet 	AUD_MST_SCLK(b, AUDIO_MST_B_SCLK_CTRL1);
4428ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk =
4438ff93f28SJerome Brunet 	AUD_MST_SCLK(c, AUDIO_MST_C_SCLK_CTRL1);
4448ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk =
4458ff93f28SJerome Brunet 	AUD_MST_SCLK(d, AUDIO_MST_D_SCLK_CTRL1);
4468ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk =
4478ff93f28SJerome Brunet 	AUD_MST_SCLK(e, AUDIO_MST_E_SCLK_CTRL1);
4488ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk =
4498ff93f28SJerome Brunet 	AUD_MST_SCLK(f, AUDIO_MST_F_SCLK_CTRL1);
4508ff93f28SJerome Brunet 
4518ff93f28SJerome Brunet static struct clk_regmap mst_a_lrclk_div =
4528ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(a, AUDIO_MST_A_SCLK_CTRL0);
4538ff93f28SJerome Brunet static struct clk_regmap mst_b_lrclk_div =
4548ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(b, AUDIO_MST_B_SCLK_CTRL0);
4558ff93f28SJerome Brunet static struct clk_regmap mst_c_lrclk_div =
4568ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(c, AUDIO_MST_C_SCLK_CTRL0);
4578ff93f28SJerome Brunet static struct clk_regmap mst_d_lrclk_div =
4588ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(d, AUDIO_MST_D_SCLK_CTRL0);
4598ff93f28SJerome Brunet static struct clk_regmap mst_e_lrclk_div =
4608ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(e, AUDIO_MST_E_SCLK_CTRL0);
4618ff93f28SJerome Brunet static struct clk_regmap mst_f_lrclk_div =
4628ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(f, AUDIO_MST_F_SCLK_CTRL0);
4638ff93f28SJerome Brunet 
4648ff93f28SJerome Brunet static struct clk_regmap mst_a_lrclk =
4658ff93f28SJerome Brunet 	AUD_MST_LRCLK(a, AUDIO_MST_A_SCLK_CTRL1);
4668ff93f28SJerome Brunet static struct clk_regmap mst_b_lrclk =
4678ff93f28SJerome Brunet 	AUD_MST_LRCLK(b, AUDIO_MST_B_SCLK_CTRL1);
4688ff93f28SJerome Brunet static struct clk_regmap mst_c_lrclk =
4698ff93f28SJerome Brunet 	AUD_MST_LRCLK(c, AUDIO_MST_C_SCLK_CTRL1);
4708ff93f28SJerome Brunet static struct clk_regmap mst_d_lrclk =
4718ff93f28SJerome Brunet 	AUD_MST_LRCLK(d, AUDIO_MST_D_SCLK_CTRL1);
4728ff93f28SJerome Brunet static struct clk_regmap mst_e_lrclk =
4738ff93f28SJerome Brunet 	AUD_MST_LRCLK(e, AUDIO_MST_E_SCLK_CTRL1);
4748ff93f28SJerome Brunet static struct clk_regmap mst_f_lrclk =
4758ff93f28SJerome Brunet 	AUD_MST_LRCLK(f, AUDIO_MST_F_SCLK_CTRL1);
4768ff93f28SJerome Brunet 
4778ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk_sel =
4788ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_a, AUDIO_CLK_TDMIN_A_CTRL);
4798ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk_sel =
4808ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_b, AUDIO_CLK_TDMIN_B_CTRL);
4818ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk_sel =
4828ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_c, AUDIO_CLK_TDMIN_C_CTRL);
4838ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk_sel =
4848ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
4858ff93f28SJerome Brunet static struct clk_regmap tdmout_a_sclk_sel =
4868ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
4878ff93f28SJerome Brunet static struct clk_regmap tdmout_b_sclk_sel =
4888ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
4898ff93f28SJerome Brunet static struct clk_regmap tdmout_c_sclk_sel =
4908ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
4918ff93f28SJerome Brunet 
4928ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk_pre_en =
4938ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_a, AUDIO_CLK_TDMIN_A_CTRL);
4948ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk_pre_en =
4958ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_b, AUDIO_CLK_TDMIN_B_CTRL);
4968ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk_pre_en =
4978ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_c, AUDIO_CLK_TDMIN_C_CTRL);
4988ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk_pre_en =
4998ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5008ff93f28SJerome Brunet static struct clk_regmap tdmout_a_sclk_pre_en =
5018ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5028ff93f28SJerome Brunet static struct clk_regmap tdmout_b_sclk_pre_en =
5038ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5048ff93f28SJerome Brunet static struct clk_regmap tdmout_c_sclk_pre_en =
5058ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5068ff93f28SJerome Brunet 
5078ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk_post_en =
5088ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_a, AUDIO_CLK_TDMIN_A_CTRL);
5098ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk_post_en =
5108ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_b, AUDIO_CLK_TDMIN_B_CTRL);
5118ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk_post_en =
5128ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_c, AUDIO_CLK_TDMIN_C_CTRL);
5138ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk_post_en =
5148ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5158ff93f28SJerome Brunet static struct clk_regmap tdmout_a_sclk_post_en =
5168ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5178ff93f28SJerome Brunet static struct clk_regmap tdmout_b_sclk_post_en =
5188ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5198ff93f28SJerome Brunet static struct clk_regmap tdmout_c_sclk_post_en =
5208ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5218ff93f28SJerome Brunet 
5228ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk =
5238ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_a, AUDIO_CLK_TDMIN_A_CTRL);
5248ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk =
5258ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_b, AUDIO_CLK_TDMIN_B_CTRL);
5268ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk =
5278ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_c, AUDIO_CLK_TDMIN_C_CTRL);
5288ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk =
5298ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5308ff93f28SJerome Brunet 
5318ff93f28SJerome Brunet static struct clk_regmap tdmin_a_lrclk =
5328ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_a, AUDIO_CLK_TDMIN_A_CTRL);
5338ff93f28SJerome Brunet static struct clk_regmap tdmin_b_lrclk =
5348ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_b, AUDIO_CLK_TDMIN_B_CTRL);
5358ff93f28SJerome Brunet static struct clk_regmap tdmin_c_lrclk =
5368ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_c, AUDIO_CLK_TDMIN_C_CTRL);
5378ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_lrclk =
5388ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5398ff93f28SJerome Brunet static struct clk_regmap tdmout_a_lrclk =
5408ff93f28SJerome Brunet 	AUD_TDM_LRLCK(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5418ff93f28SJerome Brunet static struct clk_regmap tdmout_b_lrclk =
5428ff93f28SJerome Brunet 	AUD_TDM_LRLCK(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5438ff93f28SJerome Brunet static struct clk_regmap tdmout_c_lrclk =
5448ff93f28SJerome Brunet 	AUD_TDM_LRLCK(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5458ff93f28SJerome Brunet 
5464fd433fdSJerome Brunet /* AXG Clocks */
5474fd433fdSJerome Brunet static struct clk_regmap axg_tdmout_a_sclk =
5484fd433fdSJerome Brunet 	AUD_TDM_SCLK(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5494fd433fdSJerome Brunet static struct clk_regmap axg_tdmout_b_sclk =
5504fd433fdSJerome Brunet 	AUD_TDM_SCLK(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5514fd433fdSJerome Brunet static struct clk_regmap axg_tdmout_c_sclk =
5524fd433fdSJerome Brunet 	AUD_TDM_SCLK(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5534fd433fdSJerome Brunet 
5548ff93f28SJerome Brunet /* AXG/G12A Clocks */
555cf52db45SJerome Brunet static struct clk_hw axg_aud_top = {
556cf52db45SJerome Brunet 	.init = &(struct clk_init_data) {
557cf52db45SJerome Brunet 		/* Provide aud_top signal name on axg and g12a */
558cf52db45SJerome Brunet 		.name = "aud_top",
559cf52db45SJerome Brunet 		.ops = &(const struct clk_ops) {},
560cf52db45SJerome Brunet 		.parent_data = &(const struct clk_parent_data) {
561cf52db45SJerome Brunet 			.fw_name = "pclk",
562cf52db45SJerome Brunet 		},
563cf52db45SJerome Brunet 		.num_parents = 1,
564cf52db45SJerome Brunet 	},
565cf52db45SJerome Brunet };
566cf52db45SJerome Brunet 
5678ff93f28SJerome Brunet static struct clk_regmap mst_a_mclk_sel =
5688ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_a_mclk, AUDIO_MCLK_A_CTRL);
5698ff93f28SJerome Brunet static struct clk_regmap mst_b_mclk_sel =
5708ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_b_mclk, AUDIO_MCLK_B_CTRL);
5718ff93f28SJerome Brunet static struct clk_regmap mst_c_mclk_sel =
5728ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_c_mclk, AUDIO_MCLK_C_CTRL);
5738ff93f28SJerome Brunet static struct clk_regmap mst_d_mclk_sel =
5748ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_d_mclk, AUDIO_MCLK_D_CTRL);
5758ff93f28SJerome Brunet static struct clk_regmap mst_e_mclk_sel =
5768ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_e_mclk, AUDIO_MCLK_E_CTRL);
5778ff93f28SJerome Brunet static struct clk_regmap mst_f_mclk_sel =
5788ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_f_mclk, AUDIO_MCLK_F_CTRL);
5798ff93f28SJerome Brunet 
5808ff93f28SJerome Brunet static struct clk_regmap mst_a_mclk_div =
5818ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_a_mclk, AUDIO_MCLK_A_CTRL);
5828ff93f28SJerome Brunet static struct clk_regmap mst_b_mclk_div =
5838ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_b_mclk, AUDIO_MCLK_B_CTRL);
5848ff93f28SJerome Brunet static struct clk_regmap mst_c_mclk_div =
5858ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_c_mclk, AUDIO_MCLK_C_CTRL);
5868ff93f28SJerome Brunet static struct clk_regmap mst_d_mclk_div =
5878ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_d_mclk, AUDIO_MCLK_D_CTRL);
5888ff93f28SJerome Brunet static struct clk_regmap mst_e_mclk_div =
5898ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_e_mclk, AUDIO_MCLK_E_CTRL);
5908ff93f28SJerome Brunet static struct clk_regmap mst_f_mclk_div =
5918ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_f_mclk, AUDIO_MCLK_F_CTRL);
5928ff93f28SJerome Brunet 
5938ff93f28SJerome Brunet static struct clk_regmap mst_a_mclk =
5948ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_a_mclk, AUDIO_MCLK_A_CTRL);
5958ff93f28SJerome Brunet static struct clk_regmap mst_b_mclk =
5968ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_b_mclk, AUDIO_MCLK_B_CTRL);
5978ff93f28SJerome Brunet static struct clk_regmap mst_c_mclk =
5988ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_c_mclk, AUDIO_MCLK_C_CTRL);
5998ff93f28SJerome Brunet static struct clk_regmap mst_d_mclk =
6008ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_d_mclk, AUDIO_MCLK_D_CTRL);
6018ff93f28SJerome Brunet static struct clk_regmap mst_e_mclk =
6028ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_e_mclk, AUDIO_MCLK_E_CTRL);
6038ff93f28SJerome Brunet static struct clk_regmap mst_f_mclk =
6048ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_f_mclk, AUDIO_MCLK_F_CTRL);
6058ff93f28SJerome Brunet 
6068ff93f28SJerome Brunet /* G12a clocks */
6078ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_mclk_pad_0 = AUD_TDM_PAD_CTRL(
6088ff93f28SJerome Brunet 	mclk_pad_0, AUDIO_MST_PAD_CTRL0, 0, mclk_pad_ctrl_parent_data);
6098ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_mclk_pad_1 = AUD_TDM_PAD_CTRL(
6108ff93f28SJerome Brunet 	mclk_pad_1, AUDIO_MST_PAD_CTRL0, 4, mclk_pad_ctrl_parent_data);
6118ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_lrclk_pad_0 = AUD_TDM_PAD_CTRL(
6128ff93f28SJerome Brunet 	lrclk_pad_0, AUDIO_MST_PAD_CTRL1, 16, lrclk_pad_ctrl_parent_data);
6138ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_lrclk_pad_1 = AUD_TDM_PAD_CTRL(
6148ff93f28SJerome Brunet 	lrclk_pad_1, AUDIO_MST_PAD_CTRL1, 20, lrclk_pad_ctrl_parent_data);
6158ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_lrclk_pad_2 = AUD_TDM_PAD_CTRL(
6168ff93f28SJerome Brunet 	lrclk_pad_2, AUDIO_MST_PAD_CTRL1, 24, lrclk_pad_ctrl_parent_data);
6178ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_sclk_pad_0 = AUD_TDM_PAD_CTRL(
6188ff93f28SJerome Brunet 	sclk_pad_0, AUDIO_MST_PAD_CTRL1, 0, sclk_pad_ctrl_parent_data);
6198ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_sclk_pad_1 = AUD_TDM_PAD_CTRL(
6208ff93f28SJerome Brunet 	sclk_pad_1, AUDIO_MST_PAD_CTRL1, 4, sclk_pad_ctrl_parent_data);
6218ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_sclk_pad_2 = AUD_TDM_PAD_CTRL(
6228ff93f28SJerome Brunet 	sclk_pad_2, AUDIO_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data);
6238ff93f28SJerome Brunet 
6244fd433fdSJerome Brunet static struct clk_regmap g12a_tdmout_a_sclk =
6254fd433fdSJerome Brunet 	AUD_TDM_SCLK_WS(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
6264fd433fdSJerome Brunet static struct clk_regmap g12a_tdmout_b_sclk =
6274fd433fdSJerome Brunet 	AUD_TDM_SCLK_WS(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
6284fd433fdSJerome Brunet static struct clk_regmap g12a_tdmout_c_sclk =
6294fd433fdSJerome Brunet 	AUD_TDM_SCLK_WS(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
6304fd433fdSJerome Brunet 
631be4fe445SJerome Brunet static struct clk_regmap toram =
632be4fe445SJerome Brunet 	AUD_PCLK_GATE(toram, AUDIO_CLK_GATE_EN, 20);
633be4fe445SJerome Brunet static struct clk_regmap spdifout_b =
634be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifout_b, AUDIO_CLK_GATE_EN, 21);
635be4fe445SJerome Brunet static struct clk_regmap eqdrc =
636be4fe445SJerome Brunet 	AUD_PCLK_GATE(eqdrc, AUDIO_CLK_GATE_EN, 22);
637be4fe445SJerome Brunet 
638be4fe445SJerome Brunet /* SM1 Clocks */
639be4fe445SJerome Brunet static struct clk_regmap sm1_clk81_en = {
640be4fe445SJerome Brunet 	.data = &(struct clk_regmap_gate_data){
641be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_EN,
642be4fe445SJerome Brunet 		.bit_idx = 31,
643be4fe445SJerome Brunet 	},
644be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
645be4fe445SJerome Brunet 		.name = "aud_clk81_en",
646be4fe445SJerome Brunet 		.ops = &clk_regmap_gate_ops,
647be4fe445SJerome Brunet 		.parent_data = &(const struct clk_parent_data) {
648be4fe445SJerome Brunet 			.fw_name = "pclk",
649be4fe445SJerome Brunet 		},
650be4fe445SJerome Brunet 		.num_parents = 1,
651be4fe445SJerome Brunet 	},
652be4fe445SJerome Brunet };
653be4fe445SJerome Brunet 
654be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_a_div = {
655be4fe445SJerome Brunet 	.data = &(struct clk_regmap_div_data){
656be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
657be4fe445SJerome Brunet 		.shift = 0,
658be4fe445SJerome Brunet 		.width = 8,
659be4fe445SJerome Brunet 	},
660be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
661be4fe445SJerome Brunet 		.name = "aud_sysclk_a_div",
662be4fe445SJerome Brunet 		.ops = &clk_regmap_divider_ops,
663be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
664be4fe445SJerome Brunet 			&sm1_clk81_en.hw,
665be4fe445SJerome Brunet 		},
666be4fe445SJerome Brunet 		.num_parents = 1,
667be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
668be4fe445SJerome Brunet 	},
669be4fe445SJerome Brunet };
670be4fe445SJerome Brunet 
671be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_a_en = {
672be4fe445SJerome Brunet 	.data = &(struct clk_regmap_gate_data){
673be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
674be4fe445SJerome Brunet 		.bit_idx = 8,
675be4fe445SJerome Brunet 	},
676be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
677be4fe445SJerome Brunet 		.name = "aud_sysclk_a_en",
678be4fe445SJerome Brunet 		.ops = &clk_regmap_gate_ops,
679be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
680be4fe445SJerome Brunet 			&sm1_sysclk_a_div.hw,
681be4fe445SJerome Brunet 		},
682be4fe445SJerome Brunet 		.num_parents = 1,
683be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
684be4fe445SJerome Brunet 	},
685be4fe445SJerome Brunet };
686be4fe445SJerome Brunet 
687be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_b_div = {
688be4fe445SJerome Brunet 	.data = &(struct clk_regmap_div_data){
689be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
690be4fe445SJerome Brunet 		.shift = 16,
691be4fe445SJerome Brunet 		.width = 8,
692be4fe445SJerome Brunet 	},
693be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
694be4fe445SJerome Brunet 		.name = "aud_sysclk_b_div",
695be4fe445SJerome Brunet 		.ops = &clk_regmap_divider_ops,
696be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
697be4fe445SJerome Brunet 			&sm1_clk81_en.hw,
698be4fe445SJerome Brunet 		},
699be4fe445SJerome Brunet 		.num_parents = 1,
700be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
701be4fe445SJerome Brunet 	},
702be4fe445SJerome Brunet };
703be4fe445SJerome Brunet 
704be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_b_en = {
705be4fe445SJerome Brunet 	.data = &(struct clk_regmap_gate_data){
706be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
707be4fe445SJerome Brunet 		.bit_idx = 24,
708be4fe445SJerome Brunet 	},
709be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
710be4fe445SJerome Brunet 		.name = "aud_sysclk_b_en",
711be4fe445SJerome Brunet 		.ops = &clk_regmap_gate_ops,
712be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
713be4fe445SJerome Brunet 			&sm1_sysclk_b_div.hw,
714be4fe445SJerome Brunet 		},
715be4fe445SJerome Brunet 		.num_parents = 1,
716be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
717be4fe445SJerome Brunet 	},
718be4fe445SJerome Brunet };
719be4fe445SJerome Brunet 
720be4fe445SJerome Brunet static const struct clk_hw *sm1_aud_top_parents[] = {
721be4fe445SJerome Brunet 	&sm1_sysclk_a_en.hw,
722be4fe445SJerome Brunet 	&sm1_sysclk_b_en.hw,
723be4fe445SJerome Brunet };
724be4fe445SJerome Brunet 
725be4fe445SJerome Brunet static struct clk_regmap sm1_aud_top = {
726be4fe445SJerome Brunet 	.data = &(struct clk_regmap_mux_data){
727be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
728be4fe445SJerome Brunet 		.mask = 0x1,
729be4fe445SJerome Brunet 		.shift = 31,
730be4fe445SJerome Brunet 	},
731be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data){
732be4fe445SJerome Brunet 		.name = "aud_top",
733be4fe445SJerome Brunet 		.ops = &clk_regmap_mux_ops,
734be4fe445SJerome Brunet 		.parent_hws = sm1_aud_top_parents,
735be4fe445SJerome Brunet 		.num_parents = ARRAY_SIZE(sm1_aud_top_parents),
736be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_NO_REPARENT,
737be4fe445SJerome Brunet 	},
738be4fe445SJerome Brunet };
739be4fe445SJerome Brunet 
740be4fe445SJerome Brunet static struct clk_regmap resample_b =
741be4fe445SJerome Brunet 	AUD_PCLK_GATE(resample_b, AUDIO_CLK_GATE_EN, 26);
742be4fe445SJerome Brunet static struct clk_regmap tovad =
743be4fe445SJerome Brunet 	AUD_PCLK_GATE(tovad, AUDIO_CLK_GATE_EN, 27);
744be4fe445SJerome Brunet static struct clk_regmap locker =
745be4fe445SJerome Brunet 	AUD_PCLK_GATE(locker, AUDIO_CLK_GATE_EN, 28);
746be4fe445SJerome Brunet static struct clk_regmap spdifin_lb =
747be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifin_lb, AUDIO_CLK_GATE_EN, 29);
748be4fe445SJerome Brunet static struct clk_regmap frddr_d =
749be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_d, AUDIO_CLK_GATE_EN1, 0);
750be4fe445SJerome Brunet static struct clk_regmap toddr_d =
751be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_d, AUDIO_CLK_GATE_EN1, 1);
752be4fe445SJerome Brunet static struct clk_regmap loopback_b =
753be4fe445SJerome Brunet 	AUD_PCLK_GATE(loopback_b, AUDIO_CLK_GATE_EN1, 2);
754be4fe445SJerome Brunet 
755be4fe445SJerome Brunet static struct clk_regmap sm1_mst_a_mclk_sel =
756be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL);
757be4fe445SJerome Brunet static struct clk_regmap sm1_mst_b_mclk_sel =
758be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL);
759be4fe445SJerome Brunet static struct clk_regmap sm1_mst_c_mclk_sel =
760be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL);
761be4fe445SJerome Brunet static struct clk_regmap sm1_mst_d_mclk_sel =
762be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL);
763be4fe445SJerome Brunet static struct clk_regmap sm1_mst_e_mclk_sel =
764be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL);
765be4fe445SJerome Brunet static struct clk_regmap sm1_mst_f_mclk_sel =
766be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL);
767be4fe445SJerome Brunet 
768be4fe445SJerome Brunet static struct clk_regmap sm1_mst_a_mclk_div =
769be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL);
770be4fe445SJerome Brunet static struct clk_regmap sm1_mst_b_mclk_div =
771be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL);
772be4fe445SJerome Brunet static struct clk_regmap sm1_mst_c_mclk_div =
773be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL);
774be4fe445SJerome Brunet static struct clk_regmap sm1_mst_d_mclk_div =
775be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL);
776be4fe445SJerome Brunet static struct clk_regmap sm1_mst_e_mclk_div =
777be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL);
778be4fe445SJerome Brunet static struct clk_regmap sm1_mst_f_mclk_div =
779be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL);
780be4fe445SJerome Brunet 
781be4fe445SJerome Brunet static struct clk_regmap sm1_mst_a_mclk =
782be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL);
783be4fe445SJerome Brunet static struct clk_regmap sm1_mst_b_mclk =
784be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL);
785be4fe445SJerome Brunet static struct clk_regmap sm1_mst_c_mclk =
786be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL);
787be4fe445SJerome Brunet static struct clk_regmap sm1_mst_d_mclk =
788be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL);
789be4fe445SJerome Brunet static struct clk_regmap sm1_mst_e_mclk =
790be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL);
791be4fe445SJerome Brunet static struct clk_regmap sm1_mst_f_mclk =
792be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL);
793be4fe445SJerome Brunet 
794be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_mclk_pad_0 = AUD_TDM_PAD_CTRL(
795be4fe445SJerome Brunet 	tdm_mclk_pad_0, AUDIO_SM1_MST_PAD_CTRL0, 0, mclk_pad_ctrl_parent_data);
796be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_mclk_pad_1 = AUD_TDM_PAD_CTRL(
797be4fe445SJerome Brunet 	tdm_mclk_pad_1, AUDIO_SM1_MST_PAD_CTRL0, 4, mclk_pad_ctrl_parent_data);
798be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_lrclk_pad_0 = AUD_TDM_PAD_CTRL(
799be4fe445SJerome Brunet 	tdm_lrclk_pad_0, AUDIO_SM1_MST_PAD_CTRL1, 16, lrclk_pad_ctrl_parent_data);
800be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_lrclk_pad_1 = AUD_TDM_PAD_CTRL(
801be4fe445SJerome Brunet 	tdm_lrclk_pad_1, AUDIO_SM1_MST_PAD_CTRL1, 20, lrclk_pad_ctrl_parent_data);
802be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_lrclk_pad_2 = AUD_TDM_PAD_CTRL(
803be4fe445SJerome Brunet 	tdm_lrclk_pad_2, AUDIO_SM1_MST_PAD_CTRL1, 24, lrclk_pad_ctrl_parent_data);
804be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_sclk_pad_0 = AUD_TDM_PAD_CTRL(
805be4fe445SJerome Brunet 	tdm_sclk_pad_0, AUDIO_SM1_MST_PAD_CTRL1, 0, sclk_pad_ctrl_parent_data);
806be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_sclk_pad_1 = AUD_TDM_PAD_CTRL(
807be4fe445SJerome Brunet 	tdm_sclk_pad_1, AUDIO_SM1_MST_PAD_CTRL1, 4, sclk_pad_ctrl_parent_data);
808be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_sclk_pad_2 = AUD_TDM_PAD_CTRL(
809be4fe445SJerome Brunet 	tdm_sclk_pad_2, AUDIO_SM1_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data);
81007500138SMaxime Jourdan 
8111cd50181SJerome Brunet /*
8121cd50181SJerome Brunet  * Array of all clocks provided by this provider
8131cd50181SJerome Brunet  * The input clocks of the controller will be populated at runtime
8141cd50181SJerome Brunet  */
815*05d3b7c6SNeil Armstrong static struct clk_hw *axg_audio_hw_clks[] = {
8168ff93f28SJerome Brunet 	[AUD_CLKID_DDR_ARB]		= &ddr_arb.hw,
8178ff93f28SJerome Brunet 	[AUD_CLKID_PDM]			= &pdm.hw,
8188ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A]		= &tdmin_a.hw,
8198ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B]		= &tdmin_b.hw,
8208ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C]		= &tdmin_c.hw,
8218ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB]		= &tdmin_lb.hw,
8228ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A]		= &tdmout_a.hw,
8238ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B]		= &tdmout_b.hw,
8248ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C]		= &tdmout_c.hw,
8258ff93f28SJerome Brunet 	[AUD_CLKID_FRDDR_A]		= &frddr_a.hw,
8268ff93f28SJerome Brunet 	[AUD_CLKID_FRDDR_B]		= &frddr_b.hw,
8278ff93f28SJerome Brunet 	[AUD_CLKID_FRDDR_C]		= &frddr_c.hw,
8288ff93f28SJerome Brunet 	[AUD_CLKID_TODDR_A]		= &toddr_a.hw,
8298ff93f28SJerome Brunet 	[AUD_CLKID_TODDR_B]		= &toddr_b.hw,
8308ff93f28SJerome Brunet 	[AUD_CLKID_TODDR_C]		= &toddr_c.hw,
8318ff93f28SJerome Brunet 	[AUD_CLKID_LOOPBACK]		= &loopback.hw,
8328ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN]		= &spdifin.hw,
8338ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT]		= &spdifout.hw,
8348ff93f28SJerome Brunet 	[AUD_CLKID_RESAMPLE]		= &resample.hw,
8358ff93f28SJerome Brunet 	[AUD_CLKID_POWER_DETECT]	= &power_detect.hw,
8368ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_MCLK_SEL]	= &mst_a_mclk_sel.hw,
8378ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_MCLK_SEL]	= &mst_b_mclk_sel.hw,
8388ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_MCLK_SEL]	= &mst_c_mclk_sel.hw,
8398ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_MCLK_SEL]	= &mst_d_mclk_sel.hw,
8408ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_MCLK_SEL]	= &mst_e_mclk_sel.hw,
8418ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_MCLK_SEL]	= &mst_f_mclk_sel.hw,
8428ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_MCLK_DIV]	= &mst_a_mclk_div.hw,
8438ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_MCLK_DIV]	= &mst_b_mclk_div.hw,
8448ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_MCLK_DIV]	= &mst_c_mclk_div.hw,
8458ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_MCLK_DIV]	= &mst_d_mclk_div.hw,
8468ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_MCLK_DIV]	= &mst_e_mclk_div.hw,
8478ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_MCLK_DIV]	= &mst_f_mclk_div.hw,
8488ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_MCLK]		= &mst_a_mclk.hw,
8498ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_MCLK]		= &mst_b_mclk.hw,
8508ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_MCLK]		= &mst_c_mclk.hw,
8518ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_MCLK]		= &mst_d_mclk.hw,
8528ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_MCLK]		= &mst_e_mclk.hw,
8538ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_MCLK]		= &mst_f_mclk.hw,
8548ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK_SEL]	= &spdifout_clk_sel.hw,
8558ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK_DIV]	= &spdifout_clk_div.hw,
8568ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK]	= &spdifout_clk.hw,
8578ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK_SEL]	= &spdifin_clk_sel.hw,
8588ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK_DIV]	= &spdifin_clk_div.hw,
8598ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK]		= &spdifin_clk.hw,
8608ff93f28SJerome Brunet 	[AUD_CLKID_PDM_DCLK_SEL]	= &pdm_dclk_sel.hw,
8618ff93f28SJerome Brunet 	[AUD_CLKID_PDM_DCLK_DIV]	= &pdm_dclk_div.hw,
8628ff93f28SJerome Brunet 	[AUD_CLKID_PDM_DCLK]		= &pdm_dclk.hw,
8638ff93f28SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK_SEL]	= &pdm_sysclk_sel.hw,
8648ff93f28SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK_DIV]	= &pdm_sysclk_div.hw,
8658ff93f28SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK]		= &pdm_sysclk.hw,
8668ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_PRE_EN]	= &mst_a_sclk_pre_en.hw,
8678ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_PRE_EN]	= &mst_b_sclk_pre_en.hw,
8688ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_PRE_EN]	= &mst_c_sclk_pre_en.hw,
8698ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_PRE_EN]	= &mst_d_sclk_pre_en.hw,
8708ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_PRE_EN]	= &mst_e_sclk_pre_en.hw,
8718ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_PRE_EN]	= &mst_f_sclk_pre_en.hw,
8728ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_DIV]	= &mst_a_sclk_div.hw,
8738ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_DIV]	= &mst_b_sclk_div.hw,
8748ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_DIV]	= &mst_c_sclk_div.hw,
8758ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_DIV]	= &mst_d_sclk_div.hw,
8768ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_DIV]	= &mst_e_sclk_div.hw,
8778ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_DIV]	= &mst_f_sclk_div.hw,
8788ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_POST_EN]	= &mst_a_sclk_post_en.hw,
8798ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_POST_EN]	= &mst_b_sclk_post_en.hw,
8808ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_POST_EN]	= &mst_c_sclk_post_en.hw,
8818ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_POST_EN]	= &mst_d_sclk_post_en.hw,
8828ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_POST_EN]	= &mst_e_sclk_post_en.hw,
8838ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_POST_EN]	= &mst_f_sclk_post_en.hw,
8848ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK]		= &mst_a_sclk.hw,
8858ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK]		= &mst_b_sclk.hw,
8868ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK]		= &mst_c_sclk.hw,
8878ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK]		= &mst_d_sclk.hw,
8888ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK]		= &mst_e_sclk.hw,
8898ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK]		= &mst_f_sclk.hw,
8908ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_LRCLK_DIV]	= &mst_a_lrclk_div.hw,
8918ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_LRCLK_DIV]	= &mst_b_lrclk_div.hw,
8928ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_LRCLK_DIV]	= &mst_c_lrclk_div.hw,
8938ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_LRCLK_DIV]	= &mst_d_lrclk_div.hw,
8948ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_LRCLK_DIV]	= &mst_e_lrclk_div.hw,
8958ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_LRCLK_DIV]	= &mst_f_lrclk_div.hw,
8968ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_LRCLK]		= &mst_a_lrclk.hw,
8978ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_LRCLK]		= &mst_b_lrclk.hw,
8988ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_LRCLK]		= &mst_c_lrclk.hw,
8998ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_LRCLK]		= &mst_d_lrclk.hw,
9008ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_LRCLK]		= &mst_e_lrclk.hw,
9018ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_LRCLK]		= &mst_f_lrclk.hw,
9028ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_SEL]	= &tdmin_a_sclk_sel.hw,
9038ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_SEL]	= &tdmin_b_sclk_sel.hw,
9048ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_SEL]	= &tdmin_c_sclk_sel.hw,
9058ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_SEL]	= &tdmin_lb_sclk_sel.hw,
9068ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_SEL]	= &tdmout_a_sclk_sel.hw,
9078ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_SEL]	= &tdmout_b_sclk_sel.hw,
9088ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_SEL]	= &tdmout_c_sclk_sel.hw,
9098ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_PRE_EN]	= &tdmin_a_sclk_pre_en.hw,
9108ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_PRE_EN]	= &tdmin_b_sclk_pre_en.hw,
9118ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_PRE_EN]	= &tdmin_c_sclk_pre_en.hw,
9128ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_PRE_EN] = &tdmin_lb_sclk_pre_en.hw,
9138ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_PRE_EN] = &tdmout_a_sclk_pre_en.hw,
9148ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_PRE_EN] = &tdmout_b_sclk_pre_en.hw,
9158ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_PRE_EN] = &tdmout_c_sclk_pre_en.hw,
9168ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_POST_EN] = &tdmin_a_sclk_post_en.hw,
9178ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_POST_EN] = &tdmin_b_sclk_post_en.hw,
9188ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_POST_EN] = &tdmin_c_sclk_post_en.hw,
9198ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_POST_EN] = &tdmin_lb_sclk_post_en.hw,
9208ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_POST_EN] = &tdmout_a_sclk_post_en.hw,
9218ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_POST_EN] = &tdmout_b_sclk_post_en.hw,
9228ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_POST_EN] = &tdmout_c_sclk_post_en.hw,
9238ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK]	= &tdmin_a_sclk.hw,
9248ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK]	= &tdmin_b_sclk.hw,
9258ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK]	= &tdmin_c_sclk.hw,
9268ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK]	= &tdmin_lb_sclk.hw,
9274fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK]	= &axg_tdmout_a_sclk.hw,
9284fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK]	= &axg_tdmout_b_sclk.hw,
9294fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK]	= &axg_tdmout_c_sclk.hw,
9308ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_LRCLK]	= &tdmin_a_lrclk.hw,
9318ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_LRCLK]	= &tdmin_b_lrclk.hw,
9328ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_LRCLK]	= &tdmin_c_lrclk.hw,
9338ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_LRCLK]	= &tdmin_lb_lrclk.hw,
9348ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_LRCLK]	= &tdmout_a_lrclk.hw,
9358ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_LRCLK]	= &tdmout_b_lrclk.hw,
9368ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_LRCLK]	= &tdmout_c_lrclk.hw,
937cf52db45SJerome Brunet 	[AUD_CLKID_TOP]			= &axg_aud_top,
9381cd50181SJerome Brunet };
9391cd50181SJerome Brunet 
94007500138SMaxime Jourdan /*
94107500138SMaxime Jourdan  * Array of all G12A clocks provided by this provider
94207500138SMaxime Jourdan  * The input clocks of the controller will be populated at runtime
94307500138SMaxime Jourdan  */
944*05d3b7c6SNeil Armstrong static struct clk_hw *g12a_audio_hw_clks[] = {
9458ff93f28SJerome Brunet 	[AUD_CLKID_DDR_ARB]		= &ddr_arb.hw,
9468ff93f28SJerome Brunet 	[AUD_CLKID_PDM]			= &pdm.hw,
9478ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A]		= &tdmin_a.hw,
9488ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B]		= &tdmin_b.hw,
9498ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C]		= &tdmin_c.hw,
9508ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB]		= &tdmin_lb.hw,
9518ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A]		= &tdmout_a.hw,
9528ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B]		= &tdmout_b.hw,
9538ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C]		= &tdmout_c.hw,
9548ff93f28SJerome Brunet 	[AUD_CLKID_FRDDR_A]		= &frddr_a.hw,
9558ff93f28SJerome Brunet 	[AUD_CLKID_FRDDR_B]		= &frddr_b.hw,
9568ff93f28SJerome Brunet 	[AUD_CLKID_FRDDR_C]		= &frddr_c.hw,
9578ff93f28SJerome Brunet 	[AUD_CLKID_TODDR_A]		= &toddr_a.hw,
9588ff93f28SJerome Brunet 	[AUD_CLKID_TODDR_B]		= &toddr_b.hw,
9598ff93f28SJerome Brunet 	[AUD_CLKID_TODDR_C]		= &toddr_c.hw,
9608ff93f28SJerome Brunet 	[AUD_CLKID_LOOPBACK]		= &loopback.hw,
9618ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN]		= &spdifin.hw,
9628ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT]		= &spdifout.hw,
9638ff93f28SJerome Brunet 	[AUD_CLKID_RESAMPLE]		= &resample.hw,
9648ff93f28SJerome Brunet 	[AUD_CLKID_POWER_DETECT]	= &power_detect.hw,
9658ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B]		= &spdifout_b.hw,
9668ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_MCLK_SEL]	= &mst_a_mclk_sel.hw,
9678ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_MCLK_SEL]	= &mst_b_mclk_sel.hw,
9688ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_MCLK_SEL]	= &mst_c_mclk_sel.hw,
9698ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_MCLK_SEL]	= &mst_d_mclk_sel.hw,
9708ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_MCLK_SEL]	= &mst_e_mclk_sel.hw,
9718ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_MCLK_SEL]	= &mst_f_mclk_sel.hw,
9728ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_MCLK_DIV]	= &mst_a_mclk_div.hw,
9738ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_MCLK_DIV]	= &mst_b_mclk_div.hw,
9748ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_MCLK_DIV]	= &mst_c_mclk_div.hw,
9758ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_MCLK_DIV]	= &mst_d_mclk_div.hw,
9768ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_MCLK_DIV]	= &mst_e_mclk_div.hw,
9778ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_MCLK_DIV]	= &mst_f_mclk_div.hw,
9788ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_MCLK]		= &mst_a_mclk.hw,
9798ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_MCLK]		= &mst_b_mclk.hw,
9808ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_MCLK]		= &mst_c_mclk.hw,
9818ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_MCLK]		= &mst_d_mclk.hw,
9828ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_MCLK]		= &mst_e_mclk.hw,
9838ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_MCLK]		= &mst_f_mclk.hw,
9848ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK_SEL]	= &spdifout_clk_sel.hw,
9858ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK_DIV]	= &spdifout_clk_div.hw,
9868ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK]	= &spdifout_clk.hw,
9878ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B_CLK_SEL]	= &spdifout_b_clk_sel.hw,
9888ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B_CLK_DIV]	= &spdifout_b_clk_div.hw,
9898ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B_CLK]	= &spdifout_b_clk.hw,
9908ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK_SEL]	= &spdifin_clk_sel.hw,
9918ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK_DIV]	= &spdifin_clk_div.hw,
9928ff93f28SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK]		= &spdifin_clk.hw,
9938ff93f28SJerome Brunet 	[AUD_CLKID_PDM_DCLK_SEL]	= &pdm_dclk_sel.hw,
9948ff93f28SJerome Brunet 	[AUD_CLKID_PDM_DCLK_DIV]	= &pdm_dclk_div.hw,
9958ff93f28SJerome Brunet 	[AUD_CLKID_PDM_DCLK]		= &pdm_dclk.hw,
9968ff93f28SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK_SEL]	= &pdm_sysclk_sel.hw,
9978ff93f28SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK_DIV]	= &pdm_sysclk_div.hw,
9988ff93f28SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK]		= &pdm_sysclk.hw,
9998ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_PRE_EN]	= &mst_a_sclk_pre_en.hw,
10008ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_PRE_EN]	= &mst_b_sclk_pre_en.hw,
10018ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_PRE_EN]	= &mst_c_sclk_pre_en.hw,
10028ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_PRE_EN]	= &mst_d_sclk_pre_en.hw,
10038ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_PRE_EN]	= &mst_e_sclk_pre_en.hw,
10048ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_PRE_EN]	= &mst_f_sclk_pre_en.hw,
10058ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_DIV]	= &mst_a_sclk_div.hw,
10068ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_DIV]	= &mst_b_sclk_div.hw,
10078ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_DIV]	= &mst_c_sclk_div.hw,
10088ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_DIV]	= &mst_d_sclk_div.hw,
10098ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_DIV]	= &mst_e_sclk_div.hw,
10108ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_DIV]	= &mst_f_sclk_div.hw,
10118ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_POST_EN]	= &mst_a_sclk_post_en.hw,
10128ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_POST_EN]	= &mst_b_sclk_post_en.hw,
10138ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_POST_EN]	= &mst_c_sclk_post_en.hw,
10148ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_POST_EN]	= &mst_d_sclk_post_en.hw,
10158ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_POST_EN]	= &mst_e_sclk_post_en.hw,
10168ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_POST_EN]	= &mst_f_sclk_post_en.hw,
10178ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_SCLK]		= &mst_a_sclk.hw,
10188ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_SCLK]		= &mst_b_sclk.hw,
10198ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_SCLK]		= &mst_c_sclk.hw,
10208ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_SCLK]		= &mst_d_sclk.hw,
10218ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_SCLK]		= &mst_e_sclk.hw,
10228ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_SCLK]		= &mst_f_sclk.hw,
10238ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_LRCLK_DIV]	= &mst_a_lrclk_div.hw,
10248ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_LRCLK_DIV]	= &mst_b_lrclk_div.hw,
10258ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_LRCLK_DIV]	= &mst_c_lrclk_div.hw,
10268ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_LRCLK_DIV]	= &mst_d_lrclk_div.hw,
10278ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_LRCLK_DIV]	= &mst_e_lrclk_div.hw,
10288ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_LRCLK_DIV]	= &mst_f_lrclk_div.hw,
10298ff93f28SJerome Brunet 	[AUD_CLKID_MST_A_LRCLK]		= &mst_a_lrclk.hw,
10308ff93f28SJerome Brunet 	[AUD_CLKID_MST_B_LRCLK]		= &mst_b_lrclk.hw,
10318ff93f28SJerome Brunet 	[AUD_CLKID_MST_C_LRCLK]		= &mst_c_lrclk.hw,
10328ff93f28SJerome Brunet 	[AUD_CLKID_MST_D_LRCLK]		= &mst_d_lrclk.hw,
10338ff93f28SJerome Brunet 	[AUD_CLKID_MST_E_LRCLK]		= &mst_e_lrclk.hw,
10348ff93f28SJerome Brunet 	[AUD_CLKID_MST_F_LRCLK]		= &mst_f_lrclk.hw,
10358ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_SEL]	= &tdmin_a_sclk_sel.hw,
10368ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_SEL]	= &tdmin_b_sclk_sel.hw,
10378ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_SEL]	= &tdmin_c_sclk_sel.hw,
10388ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_SEL]	= &tdmin_lb_sclk_sel.hw,
10398ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_SEL]	= &tdmout_a_sclk_sel.hw,
10408ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_SEL]	= &tdmout_b_sclk_sel.hw,
10418ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_SEL]	= &tdmout_c_sclk_sel.hw,
10428ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_PRE_EN]	= &tdmin_a_sclk_pre_en.hw,
10438ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_PRE_EN]	= &tdmin_b_sclk_pre_en.hw,
10448ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_PRE_EN]	= &tdmin_c_sclk_pre_en.hw,
10458ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_PRE_EN] = &tdmin_lb_sclk_pre_en.hw,
10468ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_PRE_EN] = &tdmout_a_sclk_pre_en.hw,
10478ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_PRE_EN] = &tdmout_b_sclk_pre_en.hw,
10488ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_PRE_EN] = &tdmout_c_sclk_pre_en.hw,
10498ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_POST_EN] = &tdmin_a_sclk_post_en.hw,
10508ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_POST_EN] = &tdmin_b_sclk_post_en.hw,
10518ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_POST_EN] = &tdmin_c_sclk_post_en.hw,
10528ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_POST_EN] = &tdmin_lb_sclk_post_en.hw,
10538ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_POST_EN] = &tdmout_a_sclk_post_en.hw,
10548ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_POST_EN] = &tdmout_b_sclk_post_en.hw,
10558ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_POST_EN] = &tdmout_c_sclk_post_en.hw,
10568ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK]	= &tdmin_a_sclk.hw,
10578ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK]	= &tdmin_b_sclk.hw,
10588ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK]	= &tdmin_c_sclk.hw,
10598ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK]	= &tdmin_lb_sclk.hw,
10604fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK]	= &g12a_tdmout_a_sclk.hw,
10614fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK]	= &g12a_tdmout_b_sclk.hw,
10624fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK]	= &g12a_tdmout_c_sclk.hw,
10638ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_A_LRCLK]	= &tdmin_a_lrclk.hw,
10648ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_B_LRCLK]	= &tdmin_b_lrclk.hw,
10658ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_C_LRCLK]	= &tdmin_c_lrclk.hw,
10668ff93f28SJerome Brunet 	[AUD_CLKID_TDMIN_LB_LRCLK]	= &tdmin_lb_lrclk.hw,
10678ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_A_LRCLK]	= &tdmout_a_lrclk.hw,
10688ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_B_LRCLK]	= &tdmout_b_lrclk.hw,
10698ff93f28SJerome Brunet 	[AUD_CLKID_TDMOUT_C_LRCLK]	= &tdmout_c_lrclk.hw,
10708ff93f28SJerome Brunet 	[AUD_CLKID_TDM_MCLK_PAD0]	= &g12a_tdm_mclk_pad_0.hw,
10718ff93f28SJerome Brunet 	[AUD_CLKID_TDM_MCLK_PAD1]	= &g12a_tdm_mclk_pad_1.hw,
10728ff93f28SJerome Brunet 	[AUD_CLKID_TDM_LRCLK_PAD0]	= &g12a_tdm_lrclk_pad_0.hw,
10738ff93f28SJerome Brunet 	[AUD_CLKID_TDM_LRCLK_PAD1]	= &g12a_tdm_lrclk_pad_1.hw,
10748ff93f28SJerome Brunet 	[AUD_CLKID_TDM_LRCLK_PAD2]	= &g12a_tdm_lrclk_pad_2.hw,
10758ff93f28SJerome Brunet 	[AUD_CLKID_TDM_SCLK_PAD0]	= &g12a_tdm_sclk_pad_0.hw,
10768ff93f28SJerome Brunet 	[AUD_CLKID_TDM_SCLK_PAD1]	= &g12a_tdm_sclk_pad_1.hw,
10778ff93f28SJerome Brunet 	[AUD_CLKID_TDM_SCLK_PAD2]	= &g12a_tdm_sclk_pad_2.hw,
1078cf52db45SJerome Brunet 	[AUD_CLKID_TOP]			= &axg_aud_top,
107907500138SMaxime Jourdan };
108007500138SMaxime Jourdan 
1081be4fe445SJerome Brunet /*
1082be4fe445SJerome Brunet  * Array of all SM1 clocks provided by this provider
1083be4fe445SJerome Brunet  * The input clocks of the controller will be populated at runtime
1084be4fe445SJerome Brunet  */
1085*05d3b7c6SNeil Armstrong static struct clk_hw *sm1_audio_hw_clks[] = {
1086be4fe445SJerome Brunet 	[AUD_CLKID_DDR_ARB]		= &ddr_arb.hw,
1087be4fe445SJerome Brunet 	[AUD_CLKID_PDM]			= &pdm.hw,
1088be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_A]		= &tdmin_a.hw,
1089be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_B]		= &tdmin_b.hw,
1090be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_C]		= &tdmin_c.hw,
1091be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_LB]		= &tdmin_lb.hw,
1092be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_A]		= &tdmout_a.hw,
1093be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_B]		= &tdmout_b.hw,
1094be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_C]		= &tdmout_c.hw,
1095be4fe445SJerome Brunet 	[AUD_CLKID_FRDDR_A]		= &frddr_a.hw,
1096be4fe445SJerome Brunet 	[AUD_CLKID_FRDDR_B]		= &frddr_b.hw,
1097be4fe445SJerome Brunet 	[AUD_CLKID_FRDDR_C]		= &frddr_c.hw,
1098be4fe445SJerome Brunet 	[AUD_CLKID_TODDR_A]		= &toddr_a.hw,
1099be4fe445SJerome Brunet 	[AUD_CLKID_TODDR_B]		= &toddr_b.hw,
1100be4fe445SJerome Brunet 	[AUD_CLKID_TODDR_C]		= &toddr_c.hw,
1101be4fe445SJerome Brunet 	[AUD_CLKID_LOOPBACK]		= &loopback.hw,
1102be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFIN]		= &spdifin.hw,
1103be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT]		= &spdifout.hw,
1104be4fe445SJerome Brunet 	[AUD_CLKID_RESAMPLE]		= &resample.hw,
1105be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B]		= &spdifout_b.hw,
1106be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_MCLK_SEL]	= &sm1_mst_a_mclk_sel.hw,
1107be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_MCLK_SEL]	= &sm1_mst_b_mclk_sel.hw,
1108be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_MCLK_SEL]	= &sm1_mst_c_mclk_sel.hw,
1109be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_MCLK_SEL]	= &sm1_mst_d_mclk_sel.hw,
1110be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_MCLK_SEL]	= &sm1_mst_e_mclk_sel.hw,
1111be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_MCLK_SEL]	= &sm1_mst_f_mclk_sel.hw,
1112be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_MCLK_DIV]	= &sm1_mst_a_mclk_div.hw,
1113be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_MCLK_DIV]	= &sm1_mst_b_mclk_div.hw,
1114be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_MCLK_DIV]	= &sm1_mst_c_mclk_div.hw,
1115be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_MCLK_DIV]	= &sm1_mst_d_mclk_div.hw,
1116be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_MCLK_DIV]	= &sm1_mst_e_mclk_div.hw,
1117be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_MCLK_DIV]	= &sm1_mst_f_mclk_div.hw,
1118be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_MCLK]		= &sm1_mst_a_mclk.hw,
1119be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_MCLK]		= &sm1_mst_b_mclk.hw,
1120be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_MCLK]		= &sm1_mst_c_mclk.hw,
1121be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_MCLK]		= &sm1_mst_d_mclk.hw,
1122be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_MCLK]		= &sm1_mst_e_mclk.hw,
1123be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_MCLK]		= &sm1_mst_f_mclk.hw,
1124be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK_SEL]	= &spdifout_clk_sel.hw,
1125be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK_DIV]	= &spdifout_clk_div.hw,
1126be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_CLK]	= &spdifout_clk.hw,
1127be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B_CLK_SEL]	= &spdifout_b_clk_sel.hw,
1128be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B_CLK_DIV]	= &spdifout_b_clk_div.hw,
1129be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFOUT_B_CLK]	= &spdifout_b_clk.hw,
1130be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK_SEL]	= &spdifin_clk_sel.hw,
1131be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK_DIV]	= &spdifin_clk_div.hw,
1132be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFIN_CLK]		= &spdifin_clk.hw,
1133be4fe445SJerome Brunet 	[AUD_CLKID_PDM_DCLK_SEL]	= &pdm_dclk_sel.hw,
1134be4fe445SJerome Brunet 	[AUD_CLKID_PDM_DCLK_DIV]	= &pdm_dclk_div.hw,
1135be4fe445SJerome Brunet 	[AUD_CLKID_PDM_DCLK]		= &pdm_dclk.hw,
1136be4fe445SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK_SEL]	= &pdm_sysclk_sel.hw,
1137be4fe445SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK_DIV]	= &pdm_sysclk_div.hw,
1138be4fe445SJerome Brunet 	[AUD_CLKID_PDM_SYSCLK]		= &pdm_sysclk.hw,
1139be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_PRE_EN]	= &mst_a_sclk_pre_en.hw,
1140be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_PRE_EN]	= &mst_b_sclk_pre_en.hw,
1141be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_PRE_EN]	= &mst_c_sclk_pre_en.hw,
1142be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_PRE_EN]	= &mst_d_sclk_pre_en.hw,
1143be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_PRE_EN]	= &mst_e_sclk_pre_en.hw,
1144be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_PRE_EN]	= &mst_f_sclk_pre_en.hw,
1145be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_DIV]	= &mst_a_sclk_div.hw,
1146be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_DIV]	= &mst_b_sclk_div.hw,
1147be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_DIV]	= &mst_c_sclk_div.hw,
1148be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_DIV]	= &mst_d_sclk_div.hw,
1149be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_DIV]	= &mst_e_sclk_div.hw,
1150be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_DIV]	= &mst_f_sclk_div.hw,
1151be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_SCLK_POST_EN]	= &mst_a_sclk_post_en.hw,
1152be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_SCLK_POST_EN]	= &mst_b_sclk_post_en.hw,
1153be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_SCLK_POST_EN]	= &mst_c_sclk_post_en.hw,
1154be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_SCLK_POST_EN]	= &mst_d_sclk_post_en.hw,
1155be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_SCLK_POST_EN]	= &mst_e_sclk_post_en.hw,
1156be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_SCLK_POST_EN]	= &mst_f_sclk_post_en.hw,
1157be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_SCLK]		= &mst_a_sclk.hw,
1158be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_SCLK]		= &mst_b_sclk.hw,
1159be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_SCLK]		= &mst_c_sclk.hw,
1160be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_SCLK]		= &mst_d_sclk.hw,
1161be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_SCLK]		= &mst_e_sclk.hw,
1162be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_SCLK]		= &mst_f_sclk.hw,
1163be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_LRCLK_DIV]	= &mst_a_lrclk_div.hw,
1164be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_LRCLK_DIV]	= &mst_b_lrclk_div.hw,
1165be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_LRCLK_DIV]	= &mst_c_lrclk_div.hw,
1166be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_LRCLK_DIV]	= &mst_d_lrclk_div.hw,
1167be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_LRCLK_DIV]	= &mst_e_lrclk_div.hw,
1168be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_LRCLK_DIV]	= &mst_f_lrclk_div.hw,
1169be4fe445SJerome Brunet 	[AUD_CLKID_MST_A_LRCLK]		= &mst_a_lrclk.hw,
1170be4fe445SJerome Brunet 	[AUD_CLKID_MST_B_LRCLK]		= &mst_b_lrclk.hw,
1171be4fe445SJerome Brunet 	[AUD_CLKID_MST_C_LRCLK]		= &mst_c_lrclk.hw,
1172be4fe445SJerome Brunet 	[AUD_CLKID_MST_D_LRCLK]		= &mst_d_lrclk.hw,
1173be4fe445SJerome Brunet 	[AUD_CLKID_MST_E_LRCLK]		= &mst_e_lrclk.hw,
1174be4fe445SJerome Brunet 	[AUD_CLKID_MST_F_LRCLK]		= &mst_f_lrclk.hw,
1175be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_SEL]	= &tdmin_a_sclk_sel.hw,
1176be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_SEL]	= &tdmin_b_sclk_sel.hw,
1177be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_SEL]	= &tdmin_c_sclk_sel.hw,
1178be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_SEL]	= &tdmin_lb_sclk_sel.hw,
1179be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_SEL]	= &tdmout_a_sclk_sel.hw,
1180be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_SEL]	= &tdmout_b_sclk_sel.hw,
1181be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_SEL]	= &tdmout_c_sclk_sel.hw,
1182be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_PRE_EN]	= &tdmin_a_sclk_pre_en.hw,
1183be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_PRE_EN]	= &tdmin_b_sclk_pre_en.hw,
1184be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_PRE_EN]	= &tdmin_c_sclk_pre_en.hw,
1185be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_PRE_EN] = &tdmin_lb_sclk_pre_en.hw,
1186be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_PRE_EN] = &tdmout_a_sclk_pre_en.hw,
1187be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_PRE_EN] = &tdmout_b_sclk_pre_en.hw,
1188be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_PRE_EN] = &tdmout_c_sclk_pre_en.hw,
1189be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK_POST_EN] = &tdmin_a_sclk_post_en.hw,
1190be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK_POST_EN] = &tdmin_b_sclk_post_en.hw,
1191be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK_POST_EN] = &tdmin_c_sclk_post_en.hw,
1192be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK_POST_EN] = &tdmin_lb_sclk_post_en.hw,
1193be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK_POST_EN] = &tdmout_a_sclk_post_en.hw,
1194be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK_POST_EN] = &tdmout_b_sclk_post_en.hw,
1195be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK_POST_EN] = &tdmout_c_sclk_post_en.hw,
1196be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_A_SCLK]	= &tdmin_a_sclk.hw,
1197be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_B_SCLK]	= &tdmin_b_sclk.hw,
1198be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_C_SCLK]	= &tdmin_c_sclk.hw,
1199be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_LB_SCLK]	= &tdmin_lb_sclk.hw,
12004fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_A_SCLK]	= &g12a_tdmout_a_sclk.hw,
12014fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_B_SCLK]	= &g12a_tdmout_b_sclk.hw,
12024fd433fdSJerome Brunet 	[AUD_CLKID_TDMOUT_C_SCLK]	= &g12a_tdmout_c_sclk.hw,
1203be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_A_LRCLK]	= &tdmin_a_lrclk.hw,
1204be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_B_LRCLK]	= &tdmin_b_lrclk.hw,
1205be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_C_LRCLK]	= &tdmin_c_lrclk.hw,
1206be4fe445SJerome Brunet 	[AUD_CLKID_TDMIN_LB_LRCLK]	= &tdmin_lb_lrclk.hw,
1207be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_A_LRCLK]	= &tdmout_a_lrclk.hw,
1208be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_B_LRCLK]	= &tdmout_b_lrclk.hw,
1209be4fe445SJerome Brunet 	[AUD_CLKID_TDMOUT_C_LRCLK]	= &tdmout_c_lrclk.hw,
1210be4fe445SJerome Brunet 	[AUD_CLKID_TDM_MCLK_PAD0]	= &sm1_tdm_mclk_pad_0.hw,
1211be4fe445SJerome Brunet 	[AUD_CLKID_TDM_MCLK_PAD1]	= &sm1_tdm_mclk_pad_1.hw,
1212be4fe445SJerome Brunet 	[AUD_CLKID_TDM_LRCLK_PAD0]	= &sm1_tdm_lrclk_pad_0.hw,
1213be4fe445SJerome Brunet 	[AUD_CLKID_TDM_LRCLK_PAD1]	= &sm1_tdm_lrclk_pad_1.hw,
1214be4fe445SJerome Brunet 	[AUD_CLKID_TDM_LRCLK_PAD2]	= &sm1_tdm_lrclk_pad_2.hw,
1215be4fe445SJerome Brunet 	[AUD_CLKID_TDM_SCLK_PAD0]	= &sm1_tdm_sclk_pad_0.hw,
1216be4fe445SJerome Brunet 	[AUD_CLKID_TDM_SCLK_PAD1]	= &sm1_tdm_sclk_pad_1.hw,
1217be4fe445SJerome Brunet 	[AUD_CLKID_TDM_SCLK_PAD2]	= &sm1_tdm_sclk_pad_2.hw,
1218be4fe445SJerome Brunet 	[AUD_CLKID_TOP]			= &sm1_aud_top.hw,
1219be4fe445SJerome Brunet 	[AUD_CLKID_TORAM]		= &toram.hw,
1220be4fe445SJerome Brunet 	[AUD_CLKID_EQDRC]		= &eqdrc.hw,
1221be4fe445SJerome Brunet 	[AUD_CLKID_RESAMPLE_B]		= &resample_b.hw,
1222be4fe445SJerome Brunet 	[AUD_CLKID_TOVAD]		= &tovad.hw,
1223be4fe445SJerome Brunet 	[AUD_CLKID_LOCKER]		= &locker.hw,
1224be4fe445SJerome Brunet 	[AUD_CLKID_SPDIFIN_LB]		= &spdifin_lb.hw,
1225be4fe445SJerome Brunet 	[AUD_CLKID_FRDDR_D]		= &frddr_d.hw,
1226be4fe445SJerome Brunet 	[AUD_CLKID_TODDR_D]		= &toddr_d.hw,
1227be4fe445SJerome Brunet 	[AUD_CLKID_LOOPBACK_B]		= &loopback_b.hw,
1228be4fe445SJerome Brunet 	[AUD_CLKID_CLK81_EN]		= &sm1_clk81_en.hw,
1229be4fe445SJerome Brunet 	[AUD_CLKID_SYSCLK_A_DIV]	= &sm1_sysclk_a_div.hw,
1230be4fe445SJerome Brunet 	[AUD_CLKID_SYSCLK_A_EN]		= &sm1_sysclk_a_en.hw,
1231be4fe445SJerome Brunet 	[AUD_CLKID_SYSCLK_B_DIV]	= &sm1_sysclk_b_div.hw,
1232be4fe445SJerome Brunet 	[AUD_CLKID_SYSCLK_B_EN]		= &sm1_sysclk_b_en.hw,
1233be4fe445SJerome Brunet };
1234be4fe445SJerome Brunet 
1235be4fe445SJerome Brunet 
1236cdabb1ffSJerome Brunet /* Convenience table to populate regmap in .probe(). */
1237be4fe445SJerome Brunet static struct clk_regmap *const axg_clk_regmaps[] = {
12388ff93f28SJerome Brunet 	&ddr_arb,
12398ff93f28SJerome Brunet 	&pdm,
12408ff93f28SJerome Brunet 	&tdmin_a,
12418ff93f28SJerome Brunet 	&tdmin_b,
12428ff93f28SJerome Brunet 	&tdmin_c,
12438ff93f28SJerome Brunet 	&tdmin_lb,
12448ff93f28SJerome Brunet 	&tdmout_a,
12458ff93f28SJerome Brunet 	&tdmout_b,
12468ff93f28SJerome Brunet 	&tdmout_c,
12478ff93f28SJerome Brunet 	&frddr_a,
12488ff93f28SJerome Brunet 	&frddr_b,
12498ff93f28SJerome Brunet 	&frddr_c,
12508ff93f28SJerome Brunet 	&toddr_a,
12518ff93f28SJerome Brunet 	&toddr_b,
12528ff93f28SJerome Brunet 	&toddr_c,
12538ff93f28SJerome Brunet 	&loopback,
12548ff93f28SJerome Brunet 	&spdifin,
12558ff93f28SJerome Brunet 	&spdifout,
12568ff93f28SJerome Brunet 	&resample,
12578ff93f28SJerome Brunet 	&power_detect,
1258cdabb1ffSJerome Brunet 	&mst_a_mclk_sel,
1259cdabb1ffSJerome Brunet 	&mst_b_mclk_sel,
1260cdabb1ffSJerome Brunet 	&mst_c_mclk_sel,
1261cdabb1ffSJerome Brunet 	&mst_d_mclk_sel,
1262cdabb1ffSJerome Brunet 	&mst_e_mclk_sel,
1263cdabb1ffSJerome Brunet 	&mst_f_mclk_sel,
1264cdabb1ffSJerome Brunet 	&mst_a_mclk_div,
1265cdabb1ffSJerome Brunet 	&mst_b_mclk_div,
1266cdabb1ffSJerome Brunet 	&mst_c_mclk_div,
1267cdabb1ffSJerome Brunet 	&mst_d_mclk_div,
1268cdabb1ffSJerome Brunet 	&mst_e_mclk_div,
1269cdabb1ffSJerome Brunet 	&mst_f_mclk_div,
1270cdabb1ffSJerome Brunet 	&mst_a_mclk,
1271cdabb1ffSJerome Brunet 	&mst_b_mclk,
1272cdabb1ffSJerome Brunet 	&mst_c_mclk,
1273cdabb1ffSJerome Brunet 	&mst_d_mclk,
1274cdabb1ffSJerome Brunet 	&mst_e_mclk,
1275cdabb1ffSJerome Brunet 	&mst_f_mclk,
1276cdabb1ffSJerome Brunet 	&spdifout_clk_sel,
1277cdabb1ffSJerome Brunet 	&spdifout_clk_div,
1278cdabb1ffSJerome Brunet 	&spdifout_clk,
1279cdabb1ffSJerome Brunet 	&spdifin_clk_sel,
1280cdabb1ffSJerome Brunet 	&spdifin_clk_div,
1281cdabb1ffSJerome Brunet 	&spdifin_clk,
1282cdabb1ffSJerome Brunet 	&pdm_dclk_sel,
1283cdabb1ffSJerome Brunet 	&pdm_dclk_div,
1284cdabb1ffSJerome Brunet 	&pdm_dclk,
1285cdabb1ffSJerome Brunet 	&pdm_sysclk_sel,
1286cdabb1ffSJerome Brunet 	&pdm_sysclk_div,
1287cdabb1ffSJerome Brunet 	&pdm_sysclk,
1288cdabb1ffSJerome Brunet 	&mst_a_sclk_pre_en,
1289cdabb1ffSJerome Brunet 	&mst_b_sclk_pre_en,
1290cdabb1ffSJerome Brunet 	&mst_c_sclk_pre_en,
1291cdabb1ffSJerome Brunet 	&mst_d_sclk_pre_en,
1292cdabb1ffSJerome Brunet 	&mst_e_sclk_pre_en,
1293cdabb1ffSJerome Brunet 	&mst_f_sclk_pre_en,
1294cdabb1ffSJerome Brunet 	&mst_a_sclk_div,
1295cdabb1ffSJerome Brunet 	&mst_b_sclk_div,
1296cdabb1ffSJerome Brunet 	&mst_c_sclk_div,
1297cdabb1ffSJerome Brunet 	&mst_d_sclk_div,
1298cdabb1ffSJerome Brunet 	&mst_e_sclk_div,
1299cdabb1ffSJerome Brunet 	&mst_f_sclk_div,
1300cdabb1ffSJerome Brunet 	&mst_a_sclk_post_en,
1301cdabb1ffSJerome Brunet 	&mst_b_sclk_post_en,
1302cdabb1ffSJerome Brunet 	&mst_c_sclk_post_en,
1303cdabb1ffSJerome Brunet 	&mst_d_sclk_post_en,
1304cdabb1ffSJerome Brunet 	&mst_e_sclk_post_en,
1305cdabb1ffSJerome Brunet 	&mst_f_sclk_post_en,
1306cdabb1ffSJerome Brunet 	&mst_a_sclk,
1307cdabb1ffSJerome Brunet 	&mst_b_sclk,
1308cdabb1ffSJerome Brunet 	&mst_c_sclk,
1309cdabb1ffSJerome Brunet 	&mst_d_sclk,
1310cdabb1ffSJerome Brunet 	&mst_e_sclk,
1311cdabb1ffSJerome Brunet 	&mst_f_sclk,
1312cdabb1ffSJerome Brunet 	&mst_a_lrclk_div,
1313cdabb1ffSJerome Brunet 	&mst_b_lrclk_div,
1314cdabb1ffSJerome Brunet 	&mst_c_lrclk_div,
1315cdabb1ffSJerome Brunet 	&mst_d_lrclk_div,
1316cdabb1ffSJerome Brunet 	&mst_e_lrclk_div,
1317cdabb1ffSJerome Brunet 	&mst_f_lrclk_div,
1318cdabb1ffSJerome Brunet 	&mst_a_lrclk,
1319cdabb1ffSJerome Brunet 	&mst_b_lrclk,
1320cdabb1ffSJerome Brunet 	&mst_c_lrclk,
1321cdabb1ffSJerome Brunet 	&mst_d_lrclk,
1322cdabb1ffSJerome Brunet 	&mst_e_lrclk,
1323cdabb1ffSJerome Brunet 	&mst_f_lrclk,
1324cdabb1ffSJerome Brunet 	&tdmin_a_sclk_sel,
1325cdabb1ffSJerome Brunet 	&tdmin_b_sclk_sel,
1326cdabb1ffSJerome Brunet 	&tdmin_c_sclk_sel,
1327cdabb1ffSJerome Brunet 	&tdmin_lb_sclk_sel,
1328cdabb1ffSJerome Brunet 	&tdmout_a_sclk_sel,
1329cdabb1ffSJerome Brunet 	&tdmout_b_sclk_sel,
1330cdabb1ffSJerome Brunet 	&tdmout_c_sclk_sel,
1331cdabb1ffSJerome Brunet 	&tdmin_a_sclk_pre_en,
1332cdabb1ffSJerome Brunet 	&tdmin_b_sclk_pre_en,
1333cdabb1ffSJerome Brunet 	&tdmin_c_sclk_pre_en,
1334cdabb1ffSJerome Brunet 	&tdmin_lb_sclk_pre_en,
1335cdabb1ffSJerome Brunet 	&tdmout_a_sclk_pre_en,
1336cdabb1ffSJerome Brunet 	&tdmout_b_sclk_pre_en,
1337cdabb1ffSJerome Brunet 	&tdmout_c_sclk_pre_en,
1338cdabb1ffSJerome Brunet 	&tdmin_a_sclk_post_en,
1339cdabb1ffSJerome Brunet 	&tdmin_b_sclk_post_en,
1340cdabb1ffSJerome Brunet 	&tdmin_c_sclk_post_en,
1341cdabb1ffSJerome Brunet 	&tdmin_lb_sclk_post_en,
1342cdabb1ffSJerome Brunet 	&tdmout_a_sclk_post_en,
1343cdabb1ffSJerome Brunet 	&tdmout_b_sclk_post_en,
1344cdabb1ffSJerome Brunet 	&tdmout_c_sclk_post_en,
1345cdabb1ffSJerome Brunet 	&tdmin_a_sclk,
1346cdabb1ffSJerome Brunet 	&tdmin_b_sclk,
1347cdabb1ffSJerome Brunet 	&tdmin_c_sclk,
1348cdabb1ffSJerome Brunet 	&tdmin_lb_sclk,
13494fd433fdSJerome Brunet 	&axg_tdmout_a_sclk,
13504fd433fdSJerome Brunet 	&axg_tdmout_b_sclk,
13514fd433fdSJerome Brunet 	&axg_tdmout_c_sclk,
1352cdabb1ffSJerome Brunet 	&tdmin_a_lrclk,
1353cdabb1ffSJerome Brunet 	&tdmin_b_lrclk,
1354cdabb1ffSJerome Brunet 	&tdmin_c_lrclk,
1355cdabb1ffSJerome Brunet 	&tdmin_lb_lrclk,
1356cdabb1ffSJerome Brunet 	&tdmout_a_lrclk,
1357cdabb1ffSJerome Brunet 	&tdmout_b_lrclk,
1358cdabb1ffSJerome Brunet 	&tdmout_c_lrclk,
1359cdabb1ffSJerome Brunet };
1360cdabb1ffSJerome Brunet 
1361cdabb1ffSJerome Brunet static struct clk_regmap *const g12a_clk_regmaps[] = {
1362cdabb1ffSJerome Brunet 	&ddr_arb,
1363cdabb1ffSJerome Brunet 	&pdm,
1364cdabb1ffSJerome Brunet 	&tdmin_a,
1365cdabb1ffSJerome Brunet 	&tdmin_b,
1366cdabb1ffSJerome Brunet 	&tdmin_c,
1367cdabb1ffSJerome Brunet 	&tdmin_lb,
1368cdabb1ffSJerome Brunet 	&tdmout_a,
1369cdabb1ffSJerome Brunet 	&tdmout_b,
1370cdabb1ffSJerome Brunet 	&tdmout_c,
1371cdabb1ffSJerome Brunet 	&frddr_a,
1372cdabb1ffSJerome Brunet 	&frddr_b,
1373cdabb1ffSJerome Brunet 	&frddr_c,
1374cdabb1ffSJerome Brunet 	&toddr_a,
1375cdabb1ffSJerome Brunet 	&toddr_b,
1376cdabb1ffSJerome Brunet 	&toddr_c,
1377cdabb1ffSJerome Brunet 	&loopback,
1378cdabb1ffSJerome Brunet 	&spdifin,
1379cdabb1ffSJerome Brunet 	&spdifout,
1380cdabb1ffSJerome Brunet 	&resample,
1381cdabb1ffSJerome Brunet 	&power_detect,
13828ff93f28SJerome Brunet 	&spdifout_b,
13838ff93f28SJerome Brunet 	&mst_a_mclk_sel,
13848ff93f28SJerome Brunet 	&mst_b_mclk_sel,
13858ff93f28SJerome Brunet 	&mst_c_mclk_sel,
13868ff93f28SJerome Brunet 	&mst_d_mclk_sel,
13878ff93f28SJerome Brunet 	&mst_e_mclk_sel,
13888ff93f28SJerome Brunet 	&mst_f_mclk_sel,
13898ff93f28SJerome Brunet 	&mst_a_mclk_div,
13908ff93f28SJerome Brunet 	&mst_b_mclk_div,
13918ff93f28SJerome Brunet 	&mst_c_mclk_div,
13928ff93f28SJerome Brunet 	&mst_d_mclk_div,
13938ff93f28SJerome Brunet 	&mst_e_mclk_div,
13948ff93f28SJerome Brunet 	&mst_f_mclk_div,
13958ff93f28SJerome Brunet 	&mst_a_mclk,
13968ff93f28SJerome Brunet 	&mst_b_mclk,
13978ff93f28SJerome Brunet 	&mst_c_mclk,
13988ff93f28SJerome Brunet 	&mst_d_mclk,
13998ff93f28SJerome Brunet 	&mst_e_mclk,
14008ff93f28SJerome Brunet 	&mst_f_mclk,
14018ff93f28SJerome Brunet 	&spdifout_clk_sel,
14028ff93f28SJerome Brunet 	&spdifout_clk_div,
14038ff93f28SJerome Brunet 	&spdifout_clk,
14048ff93f28SJerome Brunet 	&spdifin_clk_sel,
14058ff93f28SJerome Brunet 	&spdifin_clk_div,
14068ff93f28SJerome Brunet 	&spdifin_clk,
14078ff93f28SJerome Brunet 	&pdm_dclk_sel,
14088ff93f28SJerome Brunet 	&pdm_dclk_div,
14098ff93f28SJerome Brunet 	&pdm_dclk,
14108ff93f28SJerome Brunet 	&pdm_sysclk_sel,
14118ff93f28SJerome Brunet 	&pdm_sysclk_div,
14128ff93f28SJerome Brunet 	&pdm_sysclk,
14138ff93f28SJerome Brunet 	&mst_a_sclk_pre_en,
14148ff93f28SJerome Brunet 	&mst_b_sclk_pre_en,
14158ff93f28SJerome Brunet 	&mst_c_sclk_pre_en,
14168ff93f28SJerome Brunet 	&mst_d_sclk_pre_en,
14178ff93f28SJerome Brunet 	&mst_e_sclk_pre_en,
14188ff93f28SJerome Brunet 	&mst_f_sclk_pre_en,
14198ff93f28SJerome Brunet 	&mst_a_sclk_div,
14208ff93f28SJerome Brunet 	&mst_b_sclk_div,
14218ff93f28SJerome Brunet 	&mst_c_sclk_div,
14228ff93f28SJerome Brunet 	&mst_d_sclk_div,
14238ff93f28SJerome Brunet 	&mst_e_sclk_div,
14248ff93f28SJerome Brunet 	&mst_f_sclk_div,
14258ff93f28SJerome Brunet 	&mst_a_sclk_post_en,
14268ff93f28SJerome Brunet 	&mst_b_sclk_post_en,
14278ff93f28SJerome Brunet 	&mst_c_sclk_post_en,
14288ff93f28SJerome Brunet 	&mst_d_sclk_post_en,
14298ff93f28SJerome Brunet 	&mst_e_sclk_post_en,
14308ff93f28SJerome Brunet 	&mst_f_sclk_post_en,
14318ff93f28SJerome Brunet 	&mst_a_sclk,
14328ff93f28SJerome Brunet 	&mst_b_sclk,
14338ff93f28SJerome Brunet 	&mst_c_sclk,
14348ff93f28SJerome Brunet 	&mst_d_sclk,
14358ff93f28SJerome Brunet 	&mst_e_sclk,
14368ff93f28SJerome Brunet 	&mst_f_sclk,
14378ff93f28SJerome Brunet 	&mst_a_lrclk_div,
14388ff93f28SJerome Brunet 	&mst_b_lrclk_div,
14398ff93f28SJerome Brunet 	&mst_c_lrclk_div,
14408ff93f28SJerome Brunet 	&mst_d_lrclk_div,
14418ff93f28SJerome Brunet 	&mst_e_lrclk_div,
14428ff93f28SJerome Brunet 	&mst_f_lrclk_div,
14438ff93f28SJerome Brunet 	&mst_a_lrclk,
14448ff93f28SJerome Brunet 	&mst_b_lrclk,
14458ff93f28SJerome Brunet 	&mst_c_lrclk,
14468ff93f28SJerome Brunet 	&mst_d_lrclk,
14478ff93f28SJerome Brunet 	&mst_e_lrclk,
14488ff93f28SJerome Brunet 	&mst_f_lrclk,
14498ff93f28SJerome Brunet 	&tdmin_a_sclk_sel,
14508ff93f28SJerome Brunet 	&tdmin_b_sclk_sel,
14518ff93f28SJerome Brunet 	&tdmin_c_sclk_sel,
14528ff93f28SJerome Brunet 	&tdmin_lb_sclk_sel,
14538ff93f28SJerome Brunet 	&tdmout_a_sclk_sel,
14548ff93f28SJerome Brunet 	&tdmout_b_sclk_sel,
14558ff93f28SJerome Brunet 	&tdmout_c_sclk_sel,
14568ff93f28SJerome Brunet 	&tdmin_a_sclk_pre_en,
14578ff93f28SJerome Brunet 	&tdmin_b_sclk_pre_en,
14588ff93f28SJerome Brunet 	&tdmin_c_sclk_pre_en,
14598ff93f28SJerome Brunet 	&tdmin_lb_sclk_pre_en,
14608ff93f28SJerome Brunet 	&tdmout_a_sclk_pre_en,
14618ff93f28SJerome Brunet 	&tdmout_b_sclk_pre_en,
14628ff93f28SJerome Brunet 	&tdmout_c_sclk_pre_en,
14638ff93f28SJerome Brunet 	&tdmin_a_sclk_post_en,
14648ff93f28SJerome Brunet 	&tdmin_b_sclk_post_en,
14658ff93f28SJerome Brunet 	&tdmin_c_sclk_post_en,
14668ff93f28SJerome Brunet 	&tdmin_lb_sclk_post_en,
14678ff93f28SJerome Brunet 	&tdmout_a_sclk_post_en,
14688ff93f28SJerome Brunet 	&tdmout_b_sclk_post_en,
14698ff93f28SJerome Brunet 	&tdmout_c_sclk_post_en,
14708ff93f28SJerome Brunet 	&tdmin_a_sclk,
14718ff93f28SJerome Brunet 	&tdmin_b_sclk,
14728ff93f28SJerome Brunet 	&tdmin_c_sclk,
14738ff93f28SJerome Brunet 	&tdmin_lb_sclk,
14744fd433fdSJerome Brunet 	&g12a_tdmout_a_sclk,
14754fd433fdSJerome Brunet 	&g12a_tdmout_b_sclk,
14764fd433fdSJerome Brunet 	&g12a_tdmout_c_sclk,
14778ff93f28SJerome Brunet 	&tdmin_a_lrclk,
14788ff93f28SJerome Brunet 	&tdmin_b_lrclk,
14798ff93f28SJerome Brunet 	&tdmin_c_lrclk,
14808ff93f28SJerome Brunet 	&tdmin_lb_lrclk,
14818ff93f28SJerome Brunet 	&tdmout_a_lrclk,
14828ff93f28SJerome Brunet 	&tdmout_b_lrclk,
14838ff93f28SJerome Brunet 	&tdmout_c_lrclk,
14848ff93f28SJerome Brunet 	&spdifout_b_clk_sel,
14858ff93f28SJerome Brunet 	&spdifout_b_clk_div,
14868ff93f28SJerome Brunet 	&spdifout_b_clk,
14878ff93f28SJerome Brunet 	&g12a_tdm_mclk_pad_0,
14888ff93f28SJerome Brunet 	&g12a_tdm_mclk_pad_1,
14898ff93f28SJerome Brunet 	&g12a_tdm_lrclk_pad_0,
14908ff93f28SJerome Brunet 	&g12a_tdm_lrclk_pad_1,
14918ff93f28SJerome Brunet 	&g12a_tdm_lrclk_pad_2,
14928ff93f28SJerome Brunet 	&g12a_tdm_sclk_pad_0,
14938ff93f28SJerome Brunet 	&g12a_tdm_sclk_pad_1,
14948ff93f28SJerome Brunet 	&g12a_tdm_sclk_pad_2,
1495be4fe445SJerome Brunet 	&toram,
1496be4fe445SJerome Brunet 	&eqdrc,
1497be4fe445SJerome Brunet };
1498be4fe445SJerome Brunet 
1499be4fe445SJerome Brunet static struct clk_regmap *const sm1_clk_regmaps[] = {
1500be4fe445SJerome Brunet 	&ddr_arb,
1501be4fe445SJerome Brunet 	&pdm,
1502be4fe445SJerome Brunet 	&tdmin_a,
1503be4fe445SJerome Brunet 	&tdmin_b,
1504be4fe445SJerome Brunet 	&tdmin_c,
1505be4fe445SJerome Brunet 	&tdmin_lb,
1506be4fe445SJerome Brunet 	&tdmout_a,
1507be4fe445SJerome Brunet 	&tdmout_b,
1508be4fe445SJerome Brunet 	&tdmout_c,
1509be4fe445SJerome Brunet 	&frddr_a,
1510be4fe445SJerome Brunet 	&frddr_b,
1511be4fe445SJerome Brunet 	&frddr_c,
1512be4fe445SJerome Brunet 	&toddr_a,
1513be4fe445SJerome Brunet 	&toddr_b,
1514be4fe445SJerome Brunet 	&toddr_c,
1515be4fe445SJerome Brunet 	&loopback,
1516be4fe445SJerome Brunet 	&spdifin,
1517be4fe445SJerome Brunet 	&spdifout,
1518be4fe445SJerome Brunet 	&resample,
1519be4fe445SJerome Brunet 	&spdifout_b,
1520be4fe445SJerome Brunet 	&sm1_mst_a_mclk_sel,
1521be4fe445SJerome Brunet 	&sm1_mst_b_mclk_sel,
1522be4fe445SJerome Brunet 	&sm1_mst_c_mclk_sel,
1523be4fe445SJerome Brunet 	&sm1_mst_d_mclk_sel,
1524be4fe445SJerome Brunet 	&sm1_mst_e_mclk_sel,
1525be4fe445SJerome Brunet 	&sm1_mst_f_mclk_sel,
1526be4fe445SJerome Brunet 	&sm1_mst_a_mclk_div,
1527be4fe445SJerome Brunet 	&sm1_mst_b_mclk_div,
1528be4fe445SJerome Brunet 	&sm1_mst_c_mclk_div,
1529be4fe445SJerome Brunet 	&sm1_mst_d_mclk_div,
1530be4fe445SJerome Brunet 	&sm1_mst_e_mclk_div,
1531be4fe445SJerome Brunet 	&sm1_mst_f_mclk_div,
1532be4fe445SJerome Brunet 	&sm1_mst_a_mclk,
1533be4fe445SJerome Brunet 	&sm1_mst_b_mclk,
1534be4fe445SJerome Brunet 	&sm1_mst_c_mclk,
1535be4fe445SJerome Brunet 	&sm1_mst_d_mclk,
1536be4fe445SJerome Brunet 	&sm1_mst_e_mclk,
1537be4fe445SJerome Brunet 	&sm1_mst_f_mclk,
1538be4fe445SJerome Brunet 	&spdifout_clk_sel,
1539be4fe445SJerome Brunet 	&spdifout_clk_div,
1540be4fe445SJerome Brunet 	&spdifout_clk,
1541be4fe445SJerome Brunet 	&spdifin_clk_sel,
1542be4fe445SJerome Brunet 	&spdifin_clk_div,
1543be4fe445SJerome Brunet 	&spdifin_clk,
1544be4fe445SJerome Brunet 	&pdm_dclk_sel,
1545be4fe445SJerome Brunet 	&pdm_dclk_div,
1546be4fe445SJerome Brunet 	&pdm_dclk,
1547be4fe445SJerome Brunet 	&pdm_sysclk_sel,
1548be4fe445SJerome Brunet 	&pdm_sysclk_div,
1549be4fe445SJerome Brunet 	&pdm_sysclk,
1550be4fe445SJerome Brunet 	&mst_a_sclk_pre_en,
1551be4fe445SJerome Brunet 	&mst_b_sclk_pre_en,
1552be4fe445SJerome Brunet 	&mst_c_sclk_pre_en,
1553be4fe445SJerome Brunet 	&mst_d_sclk_pre_en,
1554be4fe445SJerome Brunet 	&mst_e_sclk_pre_en,
1555be4fe445SJerome Brunet 	&mst_f_sclk_pre_en,
1556be4fe445SJerome Brunet 	&mst_a_sclk_div,
1557be4fe445SJerome Brunet 	&mst_b_sclk_div,
1558be4fe445SJerome Brunet 	&mst_c_sclk_div,
1559be4fe445SJerome Brunet 	&mst_d_sclk_div,
1560be4fe445SJerome Brunet 	&mst_e_sclk_div,
1561be4fe445SJerome Brunet 	&mst_f_sclk_div,
1562be4fe445SJerome Brunet 	&mst_a_sclk_post_en,
1563be4fe445SJerome Brunet 	&mst_b_sclk_post_en,
1564be4fe445SJerome Brunet 	&mst_c_sclk_post_en,
1565be4fe445SJerome Brunet 	&mst_d_sclk_post_en,
1566be4fe445SJerome Brunet 	&mst_e_sclk_post_en,
1567be4fe445SJerome Brunet 	&mst_f_sclk_post_en,
1568be4fe445SJerome Brunet 	&mst_a_sclk,
1569be4fe445SJerome Brunet 	&mst_b_sclk,
1570be4fe445SJerome Brunet 	&mst_c_sclk,
1571be4fe445SJerome Brunet 	&mst_d_sclk,
1572be4fe445SJerome Brunet 	&mst_e_sclk,
1573be4fe445SJerome Brunet 	&mst_f_sclk,
1574be4fe445SJerome Brunet 	&mst_a_lrclk_div,
1575be4fe445SJerome Brunet 	&mst_b_lrclk_div,
1576be4fe445SJerome Brunet 	&mst_c_lrclk_div,
1577be4fe445SJerome Brunet 	&mst_d_lrclk_div,
1578be4fe445SJerome Brunet 	&mst_e_lrclk_div,
1579be4fe445SJerome Brunet 	&mst_f_lrclk_div,
1580be4fe445SJerome Brunet 	&mst_a_lrclk,
1581be4fe445SJerome Brunet 	&mst_b_lrclk,
1582be4fe445SJerome Brunet 	&mst_c_lrclk,
1583be4fe445SJerome Brunet 	&mst_d_lrclk,
1584be4fe445SJerome Brunet 	&mst_e_lrclk,
1585be4fe445SJerome Brunet 	&mst_f_lrclk,
1586be4fe445SJerome Brunet 	&tdmin_a_sclk_sel,
1587be4fe445SJerome Brunet 	&tdmin_b_sclk_sel,
1588be4fe445SJerome Brunet 	&tdmin_c_sclk_sel,
1589be4fe445SJerome Brunet 	&tdmin_lb_sclk_sel,
1590be4fe445SJerome Brunet 	&tdmout_a_sclk_sel,
1591be4fe445SJerome Brunet 	&tdmout_b_sclk_sel,
1592be4fe445SJerome Brunet 	&tdmout_c_sclk_sel,
1593be4fe445SJerome Brunet 	&tdmin_a_sclk_pre_en,
1594be4fe445SJerome Brunet 	&tdmin_b_sclk_pre_en,
1595be4fe445SJerome Brunet 	&tdmin_c_sclk_pre_en,
1596be4fe445SJerome Brunet 	&tdmin_lb_sclk_pre_en,
1597be4fe445SJerome Brunet 	&tdmout_a_sclk_pre_en,
1598be4fe445SJerome Brunet 	&tdmout_b_sclk_pre_en,
1599be4fe445SJerome Brunet 	&tdmout_c_sclk_pre_en,
1600be4fe445SJerome Brunet 	&tdmin_a_sclk_post_en,
1601be4fe445SJerome Brunet 	&tdmin_b_sclk_post_en,
1602be4fe445SJerome Brunet 	&tdmin_c_sclk_post_en,
1603be4fe445SJerome Brunet 	&tdmin_lb_sclk_post_en,
1604be4fe445SJerome Brunet 	&tdmout_a_sclk_post_en,
1605be4fe445SJerome Brunet 	&tdmout_b_sclk_post_en,
1606be4fe445SJerome Brunet 	&tdmout_c_sclk_post_en,
1607be4fe445SJerome Brunet 	&tdmin_a_sclk,
1608be4fe445SJerome Brunet 	&tdmin_b_sclk,
1609be4fe445SJerome Brunet 	&tdmin_c_sclk,
1610be4fe445SJerome Brunet 	&tdmin_lb_sclk,
16114fd433fdSJerome Brunet 	&g12a_tdmout_a_sclk,
16124fd433fdSJerome Brunet 	&g12a_tdmout_b_sclk,
16134fd433fdSJerome Brunet 	&g12a_tdmout_c_sclk,
1614be4fe445SJerome Brunet 	&tdmin_a_lrclk,
1615be4fe445SJerome Brunet 	&tdmin_b_lrclk,
1616be4fe445SJerome Brunet 	&tdmin_c_lrclk,
1617be4fe445SJerome Brunet 	&tdmin_lb_lrclk,
1618be4fe445SJerome Brunet 	&tdmout_a_lrclk,
1619be4fe445SJerome Brunet 	&tdmout_b_lrclk,
1620be4fe445SJerome Brunet 	&tdmout_c_lrclk,
1621be4fe445SJerome Brunet 	&spdifout_b_clk_sel,
1622be4fe445SJerome Brunet 	&spdifout_b_clk_div,
1623be4fe445SJerome Brunet 	&spdifout_b_clk,
1624be4fe445SJerome Brunet 	&sm1_tdm_mclk_pad_0,
1625be4fe445SJerome Brunet 	&sm1_tdm_mclk_pad_1,
1626be4fe445SJerome Brunet 	&sm1_tdm_lrclk_pad_0,
1627be4fe445SJerome Brunet 	&sm1_tdm_lrclk_pad_1,
1628be4fe445SJerome Brunet 	&sm1_tdm_lrclk_pad_2,
1629be4fe445SJerome Brunet 	&sm1_tdm_sclk_pad_0,
1630be4fe445SJerome Brunet 	&sm1_tdm_sclk_pad_1,
1631be4fe445SJerome Brunet 	&sm1_tdm_sclk_pad_2,
1632be4fe445SJerome Brunet 	&sm1_aud_top,
1633be4fe445SJerome Brunet 	&toram,
1634be4fe445SJerome Brunet 	&eqdrc,
1635be4fe445SJerome Brunet 	&resample_b,
1636be4fe445SJerome Brunet 	&tovad,
1637be4fe445SJerome Brunet 	&locker,
1638be4fe445SJerome Brunet 	&spdifin_lb,
1639be4fe445SJerome Brunet 	&frddr_d,
1640be4fe445SJerome Brunet 	&toddr_d,
1641be4fe445SJerome Brunet 	&loopback_b,
1642be4fe445SJerome Brunet 	&sm1_clk81_en,
1643be4fe445SJerome Brunet 	&sm1_sysclk_a_div,
1644be4fe445SJerome Brunet 	&sm1_sysclk_a_en,
1645be4fe445SJerome Brunet 	&sm1_sysclk_b_div,
1646be4fe445SJerome Brunet 	&sm1_sysclk_b_en,
16471cd50181SJerome Brunet };
16481cd50181SJerome Brunet 
16497cfefab6SJerome Brunet struct axg_audio_reset_data {
16507cfefab6SJerome Brunet 	struct reset_controller_dev rstc;
16517cfefab6SJerome Brunet 	struct regmap *map;
16527cfefab6SJerome Brunet 	unsigned int offset;
16537cfefab6SJerome Brunet };
16547cfefab6SJerome Brunet 
16557cfefab6SJerome Brunet static void axg_audio_reset_reg_and_bit(struct axg_audio_reset_data *rst,
16567cfefab6SJerome Brunet 					unsigned long id,
16577cfefab6SJerome Brunet 					unsigned int *reg,
16587cfefab6SJerome Brunet 					unsigned int *bit)
16597cfefab6SJerome Brunet {
16607cfefab6SJerome Brunet 	unsigned int stride = regmap_get_reg_stride(rst->map);
16617cfefab6SJerome Brunet 
16627cfefab6SJerome Brunet 	*reg = (id / (stride * BITS_PER_BYTE)) * stride;
16637cfefab6SJerome Brunet 	*reg += rst->offset;
16647cfefab6SJerome Brunet 	*bit = id % (stride * BITS_PER_BYTE);
16657cfefab6SJerome Brunet }
16667cfefab6SJerome Brunet 
16677cfefab6SJerome Brunet static int axg_audio_reset_update(struct reset_controller_dev *rcdev,
16687cfefab6SJerome Brunet 				unsigned long id, bool assert)
16697cfefab6SJerome Brunet {
16707cfefab6SJerome Brunet 	struct axg_audio_reset_data *rst =
16717cfefab6SJerome Brunet 		container_of(rcdev, struct axg_audio_reset_data, rstc);
16727cfefab6SJerome Brunet 	unsigned int offset, bit;
16737cfefab6SJerome Brunet 
16747cfefab6SJerome Brunet 	axg_audio_reset_reg_and_bit(rst, id, &offset, &bit);
16757cfefab6SJerome Brunet 
16767cfefab6SJerome Brunet 	regmap_update_bits(rst->map, offset, BIT(bit),
16777cfefab6SJerome Brunet 			assert ? BIT(bit) : 0);
16787cfefab6SJerome Brunet 
16797cfefab6SJerome Brunet 	return 0;
16807cfefab6SJerome Brunet }
16817cfefab6SJerome Brunet 
16827cfefab6SJerome Brunet static int axg_audio_reset_status(struct reset_controller_dev *rcdev,
16837cfefab6SJerome Brunet 				unsigned long id)
16847cfefab6SJerome Brunet {
16857cfefab6SJerome Brunet 	struct axg_audio_reset_data *rst =
16867cfefab6SJerome Brunet 		container_of(rcdev, struct axg_audio_reset_data, rstc);
16877cfefab6SJerome Brunet 	unsigned int val, offset, bit;
16887cfefab6SJerome Brunet 
16897cfefab6SJerome Brunet 	axg_audio_reset_reg_and_bit(rst, id, &offset, &bit);
16907cfefab6SJerome Brunet 
16917cfefab6SJerome Brunet 	regmap_read(rst->map, offset, &val);
16927cfefab6SJerome Brunet 
16937cfefab6SJerome Brunet 	return !!(val & BIT(bit));
16947cfefab6SJerome Brunet }
16957cfefab6SJerome Brunet 
16967cfefab6SJerome Brunet static int axg_audio_reset_assert(struct reset_controller_dev *rcdev,
16977cfefab6SJerome Brunet 				unsigned long id)
16987cfefab6SJerome Brunet {
16997cfefab6SJerome Brunet 	return axg_audio_reset_update(rcdev, id, true);
17007cfefab6SJerome Brunet }
17017cfefab6SJerome Brunet 
17027cfefab6SJerome Brunet static int axg_audio_reset_deassert(struct reset_controller_dev *rcdev,
17037cfefab6SJerome Brunet 				unsigned long id)
17047cfefab6SJerome Brunet {
17057cfefab6SJerome Brunet 	return axg_audio_reset_update(rcdev, id, false);
17067cfefab6SJerome Brunet }
17077cfefab6SJerome Brunet 
17087cfefab6SJerome Brunet static int axg_audio_reset_toggle(struct reset_controller_dev *rcdev,
17097cfefab6SJerome Brunet 				unsigned long id)
17107cfefab6SJerome Brunet {
17117cfefab6SJerome Brunet 	int ret;
17127cfefab6SJerome Brunet 
17137cfefab6SJerome Brunet 	ret = axg_audio_reset_assert(rcdev, id);
17147cfefab6SJerome Brunet 	if (ret)
17157cfefab6SJerome Brunet 		return ret;
17167cfefab6SJerome Brunet 
17177cfefab6SJerome Brunet 	return axg_audio_reset_deassert(rcdev, id);
17187cfefab6SJerome Brunet }
17197cfefab6SJerome Brunet 
17207cfefab6SJerome Brunet static const struct reset_control_ops axg_audio_rstc_ops = {
17217cfefab6SJerome Brunet 	.assert = axg_audio_reset_assert,
17227cfefab6SJerome Brunet 	.deassert = axg_audio_reset_deassert,
17237cfefab6SJerome Brunet 	.reset = axg_audio_reset_toggle,
17247cfefab6SJerome Brunet 	.status = axg_audio_reset_status,
17257cfefab6SJerome Brunet };
17267cfefab6SJerome Brunet 
17271cd50181SJerome Brunet static const struct regmap_config axg_audio_regmap_cfg = {
17281cd50181SJerome Brunet 	.reg_bits	= 32,
17291cd50181SJerome Brunet 	.val_bits	= 32,
17301cd50181SJerome Brunet 	.reg_stride	= 4,
1731255cab9dSJerome Brunet 	.max_register	= AUDIO_CLK_SPDIFOUT_B_CTRL,
17321cd50181SJerome Brunet };
17331cd50181SJerome Brunet 
173407500138SMaxime Jourdan struct audioclk_data {
1735be4fe445SJerome Brunet 	struct clk_regmap *const *regmap_clks;
1736be4fe445SJerome Brunet 	unsigned int regmap_clk_num;
1737*05d3b7c6SNeil Armstrong 	struct meson_clk_hw_data hw_clks;
17387cfefab6SJerome Brunet 	unsigned int reset_offset;
17397cfefab6SJerome Brunet 	unsigned int reset_num;
174007500138SMaxime Jourdan };
174107500138SMaxime Jourdan 
17421cd50181SJerome Brunet static int axg_audio_clkc_probe(struct platform_device *pdev)
17431cd50181SJerome Brunet {
17441cd50181SJerome Brunet 	struct device *dev = &pdev->dev;
174507500138SMaxime Jourdan 	const struct audioclk_data *data;
17467cfefab6SJerome Brunet 	struct axg_audio_reset_data *rst;
17471cd50181SJerome Brunet 	struct regmap *map;
17481cd50181SJerome Brunet 	void __iomem *regs;
17491cd50181SJerome Brunet 	struct clk_hw *hw;
175068bde8b2SUwe Kleine-König 	struct clk *clk;
17511cd50181SJerome Brunet 	int ret, i;
17521cd50181SJerome Brunet 
175307500138SMaxime Jourdan 	data = of_device_get_match_data(dev);
175407500138SMaxime Jourdan 	if (!data)
175507500138SMaxime Jourdan 		return -EINVAL;
175607500138SMaxime Jourdan 
175750bf025bSYueHaibing 	regs = devm_platform_ioremap_resource(pdev, 0);
17581cd50181SJerome Brunet 	if (IS_ERR(regs))
17591cd50181SJerome Brunet 		return PTR_ERR(regs);
17601cd50181SJerome Brunet 
17611cd50181SJerome Brunet 	map = devm_regmap_init_mmio(dev, regs, &axg_audio_regmap_cfg);
17621cd50181SJerome Brunet 	if (IS_ERR(map)) {
17631cd50181SJerome Brunet 		dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(map));
17641cd50181SJerome Brunet 		return PTR_ERR(map);
17651cd50181SJerome Brunet 	}
17661cd50181SJerome Brunet 
17671cd50181SJerome Brunet 	/* Get the mandatory peripheral clock */
176868bde8b2SUwe Kleine-König 	clk = devm_clk_get_enabled(dev, "pclk");
176968bde8b2SUwe Kleine-König 	if (IS_ERR(clk))
177068bde8b2SUwe Kleine-König 		return PTR_ERR(clk);
17711cd50181SJerome Brunet 
17721cd50181SJerome Brunet 	ret = device_reset(dev);
17731cd50181SJerome Brunet 	if (ret) {
177450cb321fSJerome Brunet 		dev_err_probe(dev, ret, "failed to reset device\n");
17751cd50181SJerome Brunet 		return ret;
17761cd50181SJerome Brunet 	}
17771cd50181SJerome Brunet 
17781cd50181SJerome Brunet 	/* Populate regmap for the regmap backed clocks */
1779be4fe445SJerome Brunet 	for (i = 0; i < data->regmap_clk_num; i++)
1780be4fe445SJerome Brunet 		data->regmap_clks[i]->map = map;
17811cd50181SJerome Brunet 
17821cd50181SJerome Brunet 	/* Take care to skip the registered input clocks */
1783*05d3b7c6SNeil Armstrong 	for (i = AUD_CLKID_DDR_ARB; i < data->hw_clks.num; i++) {
17841610dd79SStephen Boyd 		const char *name;
17851610dd79SStephen Boyd 
1786*05d3b7c6SNeil Armstrong 		hw = data->hw_clks.hws[i];
17871cd50181SJerome Brunet 		/* array might be sparse */
17881cd50181SJerome Brunet 		if (!hw)
17891cd50181SJerome Brunet 			continue;
17901cd50181SJerome Brunet 
17911610dd79SStephen Boyd 		name = hw->init->name;
17921610dd79SStephen Boyd 
17931cd50181SJerome Brunet 		ret = devm_clk_hw_register(dev, hw);
17941cd50181SJerome Brunet 		if (ret) {
17951610dd79SStephen Boyd 			dev_err(dev, "failed to register clock %s\n", name);
17961cd50181SJerome Brunet 			return ret;
17971cd50181SJerome Brunet 		}
17981cd50181SJerome Brunet 	}
17991cd50181SJerome Brunet 
1800*05d3b7c6SNeil Armstrong 	ret = devm_of_clk_add_hw_provider(dev, meson_clk_hw_get, (void *)&data->hw_clks);
18017cfefab6SJerome Brunet 	if (ret)
18027cfefab6SJerome Brunet 		return ret;
18037cfefab6SJerome Brunet 
18047cfefab6SJerome Brunet 	/* Stop here if there is no reset */
18057cfefab6SJerome Brunet 	if (!data->reset_num)
18067cfefab6SJerome Brunet 		return 0;
18077cfefab6SJerome Brunet 
18087cfefab6SJerome Brunet 	rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL);
18097cfefab6SJerome Brunet 	if (!rst)
18107cfefab6SJerome Brunet 		return -ENOMEM;
18117cfefab6SJerome Brunet 
18127cfefab6SJerome Brunet 	rst->map = map;
18137cfefab6SJerome Brunet 	rst->offset = data->reset_offset;
18147cfefab6SJerome Brunet 	rst->rstc.nr_resets = data->reset_num;
18157cfefab6SJerome Brunet 	rst->rstc.ops = &axg_audio_rstc_ops;
18167cfefab6SJerome Brunet 	rst->rstc.of_node = dev->of_node;
18177cfefab6SJerome Brunet 	rst->rstc.owner = THIS_MODULE;
18187cfefab6SJerome Brunet 
18197cfefab6SJerome Brunet 	return devm_reset_controller_register(dev, &rst->rstc);
18201cd50181SJerome Brunet }
18211cd50181SJerome Brunet 
182207500138SMaxime Jourdan static const struct audioclk_data axg_audioclk_data = {
1823be4fe445SJerome Brunet 	.regmap_clks = axg_clk_regmaps,
1824be4fe445SJerome Brunet 	.regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps),
1825*05d3b7c6SNeil Armstrong 	.hw_clks = {
1826*05d3b7c6SNeil Armstrong 		.hws = axg_audio_hw_clks,
1827*05d3b7c6SNeil Armstrong 		.num = ARRAY_SIZE(axg_audio_hw_clks),
1828*05d3b7c6SNeil Armstrong 	},
182907500138SMaxime Jourdan };
183007500138SMaxime Jourdan 
183107500138SMaxime Jourdan static const struct audioclk_data g12a_audioclk_data = {
1832cdabb1ffSJerome Brunet 	.regmap_clks = g12a_clk_regmaps,
1833cdabb1ffSJerome Brunet 	.regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
1834*05d3b7c6SNeil Armstrong 	.hw_clks = {
1835*05d3b7c6SNeil Armstrong 		.hws = g12a_audio_hw_clks,
1836*05d3b7c6SNeil Armstrong 		.num = ARRAY_SIZE(g12a_audio_hw_clks),
1837*05d3b7c6SNeil Armstrong 	},
18387cfefab6SJerome Brunet 	.reset_offset = AUDIO_SW_RESET,
18397cfefab6SJerome Brunet 	.reset_num = 26,
184007500138SMaxime Jourdan };
184107500138SMaxime Jourdan 
1842be4fe445SJerome Brunet static const struct audioclk_data sm1_audioclk_data = {
1843be4fe445SJerome Brunet 	.regmap_clks = sm1_clk_regmaps,
1844be4fe445SJerome Brunet 	.regmap_clk_num = ARRAY_SIZE(sm1_clk_regmaps),
1845*05d3b7c6SNeil Armstrong 	.hw_clks = {
1846*05d3b7c6SNeil Armstrong 		.hws = sm1_audio_hw_clks,
1847*05d3b7c6SNeil Armstrong 		.num = ARRAY_SIZE(sm1_audio_hw_clks),
1848*05d3b7c6SNeil Armstrong 	},
1849be4fe445SJerome Brunet 	.reset_offset = AUDIO_SM1_SW_RESET0,
1850be4fe445SJerome Brunet 	.reset_num = 39,
1851be4fe445SJerome Brunet };
1852be4fe445SJerome Brunet 
18531cd50181SJerome Brunet static const struct of_device_id clkc_match_table[] = {
185407500138SMaxime Jourdan 	{
185507500138SMaxime Jourdan 		.compatible = "amlogic,axg-audio-clkc",
185607500138SMaxime Jourdan 		.data = &axg_audioclk_data
185707500138SMaxime Jourdan 	}, {
185807500138SMaxime Jourdan 		.compatible = "amlogic,g12a-audio-clkc",
185907500138SMaxime Jourdan 		.data = &g12a_audioclk_data
1860be4fe445SJerome Brunet 	}, {
1861be4fe445SJerome Brunet 		.compatible = "amlogic,sm1-audio-clkc",
1862be4fe445SJerome Brunet 		.data = &sm1_audioclk_data
186307500138SMaxime Jourdan 	}, {}
18641cd50181SJerome Brunet };
18651cd50181SJerome Brunet MODULE_DEVICE_TABLE(of, clkc_match_table);
18661cd50181SJerome Brunet 
18671cd50181SJerome Brunet static struct platform_driver axg_audio_driver = {
18681cd50181SJerome Brunet 	.probe		= axg_audio_clkc_probe,
18691cd50181SJerome Brunet 	.driver		= {
18701cd50181SJerome Brunet 		.name	= "axg-audio-clkc",
18711cd50181SJerome Brunet 		.of_match_table = clkc_match_table,
18721cd50181SJerome Brunet 	},
18731cd50181SJerome Brunet };
18741cd50181SJerome Brunet module_platform_driver(axg_audio_driver);
18751cd50181SJerome Brunet 
1876be4fe445SJerome Brunet MODULE_DESCRIPTION("Amlogic AXG/G12A/SM1 Audio Clock driver");
18771cd50181SJerome Brunet MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
18781cd50181SJerome Brunet MODULE_LICENSE("GPL v2");
1879