xref: /linux/drivers/clk/meson/axg-audio.c (revision 50cb321f16f6665873071792d89ab8563be1658d)
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 
181cd50181SJerome Brunet #include "axg-audio.h"
19889c2b7eSJerome Brunet #include "clk-regmap.h"
20889c2b7eSJerome Brunet #include "clk-phase.h"
21889c2b7eSJerome Brunet #include "sclk-div.h"
221cd50181SJerome Brunet 
238ff93f28SJerome Brunet #define AUD_GATE(_name, _reg, _bit, _pname, _iflags) {			\
241cd50181SJerome Brunet 	.data = &(struct clk_regmap_gate_data){				\
251cd50181SJerome Brunet 		.offset = (_reg),					\
261cd50181SJerome Brunet 		.bit_idx = (_bit),					\
271cd50181SJerome Brunet 	},								\
281cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
29b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
301cd50181SJerome Brunet 		.ops = &clk_regmap_gate_ops,				\
318ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
321cd50181SJerome Brunet 		.num_parents = 1,					\
331cd50181SJerome Brunet 		.flags = CLK_DUTY_CYCLE_PARENT | (_iflags),		\
341cd50181SJerome Brunet 	},								\
351cd50181SJerome Brunet }
361cd50181SJerome Brunet 
378ff93f28SJerome Brunet #define AUD_MUX(_name, _reg, _mask, _shift, _dflags, _pdata, _iflags) {	\
381cd50181SJerome Brunet 	.data = &(struct clk_regmap_mux_data){				\
391cd50181SJerome Brunet 		.offset = (_reg),					\
401cd50181SJerome Brunet 		.mask = (_mask),					\
411cd50181SJerome Brunet 		.shift = (_shift),					\
421cd50181SJerome Brunet 		.flags = (_dflags),					\
431cd50181SJerome Brunet 	},								\
441cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data){				\
45b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
461cd50181SJerome Brunet 		.ops = &clk_regmap_mux_ops,				\
47282420eeSAlexandre Mergnat 		.parent_data = _pdata,					\
48282420eeSAlexandre Mergnat 		.num_parents = ARRAY_SIZE(_pdata),			\
491cd50181SJerome Brunet 		.flags = CLK_DUTY_CYCLE_PARENT | (_iflags),		\
501cd50181SJerome Brunet 	},								\
511cd50181SJerome Brunet }
521cd50181SJerome Brunet 
538ff93f28SJerome Brunet #define AUD_DIV(_name, _reg, _shift, _width, _dflags, _pname, _iflags) { \
541cd50181SJerome Brunet 	.data = &(struct clk_regmap_div_data){				\
551cd50181SJerome Brunet 		.offset = (_reg),					\
561cd50181SJerome Brunet 		.shift = (_shift),					\
571cd50181SJerome Brunet 		.width = (_width),					\
581cd50181SJerome Brunet 		.flags = (_dflags),					\
591cd50181SJerome Brunet 	},								\
601cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data){				\
61b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
621cd50181SJerome Brunet 		.ops = &clk_regmap_divider_ops,				\
638ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
641cd50181SJerome Brunet 		.num_parents = 1,					\
651cd50181SJerome Brunet 		.flags = (_iflags),					\
661cd50181SJerome Brunet 	},								\
671cd50181SJerome Brunet }
681cd50181SJerome Brunet 
69be4fe445SJerome Brunet #define AUD_PCLK_GATE(_name, _reg, _bit) {				\
70282420eeSAlexandre Mergnat 	.data = &(struct clk_regmap_gate_data){				\
71be4fe445SJerome Brunet 		.offset = (_reg),					\
72282420eeSAlexandre Mergnat 		.bit_idx = (_bit),					\
73282420eeSAlexandre Mergnat 	},								\
74282420eeSAlexandre Mergnat 	.hw.init = &(struct clk_init_data) {				\
75282420eeSAlexandre Mergnat 		.name = "aud_"#_name,					\
76282420eeSAlexandre Mergnat 		.ops = &clk_regmap_gate_ops,				\
77cf52db45SJerome Brunet 		.parent_names = (const char *[]){ "aud_top" },		\
78282420eeSAlexandre Mergnat 		.num_parents = 1,					\
79282420eeSAlexandre Mergnat 	},								\
80282420eeSAlexandre Mergnat }
811cd50181SJerome Brunet 
82b18819c4SJerome Brunet #define AUD_SCLK_DIV(_name, _reg, _div_shift, _div_width,		\
838ff93f28SJerome Brunet 		     _hi_shift, _hi_width, _pname, _iflags) {		\
841cd50181SJerome Brunet 	.data = &(struct meson_sclk_div_data) {				\
851cd50181SJerome Brunet 		.div = {						\
861cd50181SJerome Brunet 			.reg_off = (_reg),				\
871cd50181SJerome Brunet 			.shift   = (_div_shift),			\
881cd50181SJerome Brunet 			.width   = (_div_width),			\
891cd50181SJerome Brunet 		},							\
901cd50181SJerome Brunet 		.hi = {							\
911cd50181SJerome Brunet 			.reg_off = (_reg),				\
921cd50181SJerome Brunet 			.shift   = (_hi_shift),				\
931cd50181SJerome Brunet 			.width   = (_hi_width),				\
941cd50181SJerome Brunet 		},							\
951cd50181SJerome Brunet 	},								\
961cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
97b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
981cd50181SJerome Brunet 		.ops = &meson_sclk_div_ops,				\
998ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1001cd50181SJerome Brunet 		.num_parents = 1,					\
1011cd50181SJerome Brunet 		.flags = (_iflags),					\
1021cd50181SJerome Brunet 	},								\
1031cd50181SJerome Brunet }
1041cd50181SJerome Brunet 
105b18819c4SJerome Brunet #define AUD_TRIPHASE(_name, _reg, _width, _shift0, _shift1, _shift2,	\
1068ff93f28SJerome Brunet 		     _pname, _iflags) {					\
1071cd50181SJerome Brunet 	.data = &(struct meson_clk_triphase_data) {			\
1081cd50181SJerome Brunet 		.ph0 = {						\
1091cd50181SJerome Brunet 			.reg_off = (_reg),				\
1101cd50181SJerome Brunet 			.shift   = (_shift0),				\
1111cd50181SJerome Brunet 			.width   = (_width),				\
1121cd50181SJerome Brunet 		},							\
1131cd50181SJerome Brunet 		.ph1 = {						\
1141cd50181SJerome Brunet 			.reg_off = (_reg),				\
1151cd50181SJerome Brunet 			.shift   = (_shift1),				\
1161cd50181SJerome Brunet 			.width   = (_width),				\
1171cd50181SJerome Brunet 		},							\
1181cd50181SJerome Brunet 		.ph2 = {						\
1191cd50181SJerome Brunet 			.reg_off = (_reg),				\
1201cd50181SJerome Brunet 			.shift   = (_shift2),				\
1211cd50181SJerome Brunet 			.width   = (_width),				\
1221cd50181SJerome Brunet 		},							\
1231cd50181SJerome Brunet 	},								\
1241cd50181SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
125b18819c4SJerome Brunet 		.name = "aud_"#_name,					\
1261cd50181SJerome Brunet 		.ops = &meson_clk_triphase_ops,				\
1278ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1281cd50181SJerome Brunet 		.num_parents = 1,					\
1291cd50181SJerome Brunet 		.flags = CLK_DUTY_CYCLE_PARENT | (_iflags),		\
1301cd50181SJerome Brunet 	},								\
1311cd50181SJerome Brunet }
1321cd50181SJerome Brunet 
1338ff93f28SJerome Brunet #define AUD_PHASE(_name, _reg, _width, _shift, _pname, _iflags) {	\
1348ff93f28SJerome Brunet 	.data = &(struct meson_clk_phase_data) {			\
1358ff93f28SJerome Brunet 		.ph = {							\
1368ff93f28SJerome Brunet 			.reg_off = (_reg),				\
1378ff93f28SJerome Brunet 			.shift   = (_shift),				\
1388ff93f28SJerome Brunet 			.width   = (_width),				\
1398ff93f28SJerome Brunet 		},							\
1408ff93f28SJerome Brunet 	},								\
1418ff93f28SJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
1428ff93f28SJerome Brunet 		.name = "aud_"#_name,					\
1438ff93f28SJerome Brunet 		.ops = &meson_clk_phase_ops,				\
1448ff93f28SJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1458ff93f28SJerome Brunet 		.num_parents = 1,					\
1468ff93f28SJerome Brunet 		.flags = (_iflags),					\
1478ff93f28SJerome Brunet 	},								\
1488ff93f28SJerome Brunet }
1498ff93f28SJerome Brunet 
1504fd433fdSJerome Brunet #define AUD_SCLK_WS(_name, _reg, _width, _shift_ph, _shift_ws, _pname,	\
1514fd433fdSJerome Brunet 		    _iflags) {						\
1524fd433fdSJerome Brunet 	.data = &(struct meson_sclk_ws_inv_data) {			\
1534fd433fdSJerome Brunet 		.ph = {							\
1544fd433fdSJerome Brunet 			.reg_off = (_reg),				\
1554fd433fdSJerome Brunet 			.shift   = (_shift_ph),				\
1564fd433fdSJerome Brunet 			.width   = (_width),				\
1574fd433fdSJerome Brunet 		},							\
1584fd433fdSJerome Brunet 		.ws = {							\
1594fd433fdSJerome Brunet 			.reg_off = (_reg),				\
1604fd433fdSJerome Brunet 			.shift   = (_shift_ws),				\
1614fd433fdSJerome Brunet 			.width   = (_width),				\
1624fd433fdSJerome Brunet 		},							\
1634fd433fdSJerome Brunet 	},								\
1644fd433fdSJerome Brunet 	.hw.init = &(struct clk_init_data) {				\
1654fd433fdSJerome Brunet 		.name = "aud_"#_name,					\
1664fd433fdSJerome Brunet 		.ops = &meson_clk_phase_ops,				\
1674fd433fdSJerome Brunet 		.parent_names = (const char *[]){ #_pname },		\
1684fd433fdSJerome Brunet 		.num_parents = 1,					\
1694fd433fdSJerome Brunet 		.flags = (_iflags),					\
1704fd433fdSJerome Brunet 	},								\
1714fd433fdSJerome Brunet }
1724fd433fdSJerome Brunet 
1738ff93f28SJerome Brunet /* Audio Master Clocks */
1748ff93f28SJerome Brunet static const struct clk_parent_data mst_mux_parent_data[] = {
1758ff93f28SJerome Brunet 	{ .fw_name = "mst_in0", },
1768ff93f28SJerome Brunet 	{ .fw_name = "mst_in1", },
1778ff93f28SJerome Brunet 	{ .fw_name = "mst_in2", },
1788ff93f28SJerome Brunet 	{ .fw_name = "mst_in3", },
1798ff93f28SJerome Brunet 	{ .fw_name = "mst_in4", },
1808ff93f28SJerome Brunet 	{ .fw_name = "mst_in5", },
1818ff93f28SJerome Brunet 	{ .fw_name = "mst_in6", },
1828ff93f28SJerome Brunet 	{ .fw_name = "mst_in7", },
1838ff93f28SJerome Brunet };
1848ff93f28SJerome Brunet 
1858ff93f28SJerome Brunet #define AUD_MST_MUX(_name, _reg, _flag)					\
1868ff93f28SJerome Brunet 	AUD_MUX(_name##_sel, _reg, 0x7, 24, _flag,			\
1878ff93f28SJerome Brunet 		mst_mux_parent_data, 0)
1888ff93f28SJerome Brunet #define AUD_MST_DIV(_name, _reg, _flag)					\
1898ff93f28SJerome Brunet 	AUD_DIV(_name##_div, _reg, 0, 16, _flag,			\
1908ff93f28SJerome Brunet 		aud_##_name##_sel, CLK_SET_RATE_PARENT)
1918ff93f28SJerome Brunet #define AUD_MST_MCLK_GATE(_name, _reg)					\
1928ff93f28SJerome Brunet 	AUD_GATE(_name, _reg, 31, aud_##_name##_div,			\
1938ff93f28SJerome Brunet 		 CLK_SET_RATE_PARENT)
1948ff93f28SJerome Brunet 
1958ff93f28SJerome Brunet #define AUD_MST_MCLK_MUX(_name, _reg)					\
1968ff93f28SJerome Brunet 	AUD_MST_MUX(_name, _reg, CLK_MUX_ROUND_CLOSEST)
1978ff93f28SJerome Brunet #define AUD_MST_MCLK_DIV(_name, _reg)					\
1988ff93f28SJerome Brunet 	AUD_MST_DIV(_name, _reg, CLK_DIVIDER_ROUND_CLOSEST)
1998ff93f28SJerome Brunet 
2008ff93f28SJerome Brunet #define AUD_MST_SYS_MUX(_name, _reg)					\
2018ff93f28SJerome Brunet 	AUD_MST_MUX(_name, _reg, 0)
2028ff93f28SJerome Brunet #define AUD_MST_SYS_DIV(_name, _reg)					\
2038ff93f28SJerome Brunet 	AUD_MST_DIV(_name, _reg, 0)
2048ff93f28SJerome Brunet 
2058ff93f28SJerome Brunet /* Sample Clocks */
2068ff93f28SJerome Brunet #define AUD_MST_SCLK_PRE_EN(_name, _reg)				\
2078ff93f28SJerome Brunet 	AUD_GATE(mst_##_name##_sclk_pre_en, _reg, 31,			\
2088ff93f28SJerome Brunet 		 aud_mst_##_name##_mclk, 0)
2098ff93f28SJerome Brunet #define AUD_MST_SCLK_DIV(_name, _reg)					\
2108ff93f28SJerome Brunet 	AUD_SCLK_DIV(mst_##_name##_sclk_div, _reg, 20, 10, 0, 0,	\
2118ff93f28SJerome Brunet 		     aud_mst_##_name##_sclk_pre_en,			\
2128ff93f28SJerome Brunet 		     CLK_SET_RATE_PARENT)
2138ff93f28SJerome Brunet #define AUD_MST_SCLK_POST_EN(_name, _reg)				\
2148ff93f28SJerome Brunet 	AUD_GATE(mst_##_name##_sclk_post_en, _reg, 30,			\
2158ff93f28SJerome Brunet 		 aud_mst_##_name##_sclk_div, CLK_SET_RATE_PARENT)
216b18819c4SJerome Brunet #define AUD_MST_SCLK(_name, _reg)					\
217b18819c4SJerome Brunet 	AUD_TRIPHASE(mst_##_name##_sclk, _reg, 1, 0, 2, 4,		\
218282420eeSAlexandre Mergnat 		     aud_mst_##_name##_sclk_post_en, CLK_SET_RATE_PARENT)
2191cd50181SJerome Brunet 
220b18819c4SJerome Brunet #define AUD_MST_LRCLK_DIV(_name, _reg)					\
221b18819c4SJerome Brunet 	AUD_SCLK_DIV(mst_##_name##_lrclk_div, _reg, 0, 10, 10, 10,	\
2228ff93f28SJerome Brunet 		     aud_mst_##_name##_sclk_post_en, 0)
223b18819c4SJerome Brunet #define AUD_MST_LRCLK(_name, _reg)					\
224b18819c4SJerome Brunet 	AUD_TRIPHASE(mst_##_name##_lrclk, _reg, 1, 1, 3, 5,		\
225282420eeSAlexandre Mergnat 		     aud_mst_##_name##_lrclk_div, CLK_SET_RATE_PARENT)
2261cd50181SJerome Brunet 
2278ff93f28SJerome Brunet /* TDM bit clock sources */
228282420eeSAlexandre Mergnat static const struct clk_parent_data tdm_sclk_parent_data[] = {
2298ff93f28SJerome Brunet 	{ .name = "aud_mst_a_sclk", .index = -1, },
2308ff93f28SJerome Brunet 	{ .name = "aud_mst_b_sclk", .index = -1, },
2318ff93f28SJerome Brunet 	{ .name = "aud_mst_c_sclk", .index = -1, },
2328ff93f28SJerome Brunet 	{ .name = "aud_mst_d_sclk", .index = -1, },
2338ff93f28SJerome Brunet 	{ .name = "aud_mst_e_sclk", .index = -1, },
2348ff93f28SJerome Brunet 	{ .name = "aud_mst_f_sclk", .index = -1, },
235282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk0", },
236282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk1", },
237282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk2", },
238282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk3", },
239282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk4", },
240282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk5", },
241282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk6", },
242282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk7", },
243282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk8", },
244282420eeSAlexandre Mergnat 	{ .fw_name = "slv_sclk9", },
2451cd50181SJerome Brunet };
2461cd50181SJerome Brunet 
2478ff93f28SJerome Brunet /* TDM sample clock sources */
248282420eeSAlexandre Mergnat static const struct clk_parent_data tdm_lrclk_parent_data[] = {
2498ff93f28SJerome Brunet 	{ .name = "aud_mst_a_lrclk", .index = -1, },
2508ff93f28SJerome Brunet 	{ .name = "aud_mst_b_lrclk", .index = -1, },
2518ff93f28SJerome Brunet 	{ .name = "aud_mst_c_lrclk", .index = -1, },
2528ff93f28SJerome Brunet 	{ .name = "aud_mst_d_lrclk", .index = -1, },
2538ff93f28SJerome Brunet 	{ .name = "aud_mst_e_lrclk", .index = -1, },
2548ff93f28SJerome Brunet 	{ .name = "aud_mst_f_lrclk", .index = -1, },
255282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk0", },
256282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk1", },
257282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk2", },
258282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk3", },
259282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk4", },
260282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk5", },
261282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk6", },
262282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk7", },
263282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk8", },
264282420eeSAlexandre Mergnat 	{ .fw_name = "slv_lrclk9", },
2651cd50181SJerome Brunet };
2661cd50181SJerome Brunet 
2678ff93f28SJerome Brunet #define AUD_TDM_SCLK_MUX(_name, _reg)					\
2688ff93f28SJerome Brunet 	AUD_MUX(tdm##_name##_sclk_sel, _reg, 0xf, 24,			\
2698ff93f28SJerome Brunet 		CLK_MUX_ROUND_CLOSEST, tdm_sclk_parent_data, 0)
2708ff93f28SJerome Brunet #define AUD_TDM_SCLK_PRE_EN(_name, _reg)				\
2718ff93f28SJerome Brunet 	AUD_GATE(tdm##_name##_sclk_pre_en, _reg, 31,			\
2728ff93f28SJerome Brunet 		 aud_tdm##_name##_sclk_sel, CLK_SET_RATE_PARENT)
2738ff93f28SJerome Brunet #define AUD_TDM_SCLK_POST_EN(_name, _reg)				\
2748ff93f28SJerome Brunet 	AUD_GATE(tdm##_name##_sclk_post_en, _reg, 30,			\
2758ff93f28SJerome Brunet 		 aud_tdm##_name##_sclk_pre_en, CLK_SET_RATE_PARENT)
2768ff93f28SJerome Brunet #define AUD_TDM_SCLK(_name, _reg)					\
2778ff93f28SJerome Brunet 	AUD_PHASE(tdm##_name##_sclk, _reg, 1, 29,			\
2788ff93f28SJerome Brunet 		  aud_tdm##_name##_sclk_post_en,			\
2798ff93f28SJerome Brunet 		  CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT)
2804fd433fdSJerome Brunet #define AUD_TDM_SCLK_WS(_name, _reg)					\
2814fd433fdSJerome Brunet 	AUD_SCLK_WS(tdm##_name##_sclk, _reg, 1, 29, 28,			\
2824fd433fdSJerome Brunet 		    aud_tdm##_name##_sclk_post_en,			\
2834fd433fdSJerome Brunet 		    CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT)
2848ff93f28SJerome Brunet 
285b18819c4SJerome Brunet #define AUD_TDM_LRLCK(_name, _reg)					\
286b18819c4SJerome Brunet 	AUD_MUX(tdm##_name##_lrclk, _reg, 0xf, 20,			\
2878ff93f28SJerome Brunet 		CLK_MUX_ROUND_CLOSEST, tdm_lrclk_parent_data, 0)
2881cd50181SJerome Brunet 
2898ff93f28SJerome Brunet /* Pad master clock sources */
2908ff93f28SJerome Brunet static const struct clk_parent_data mclk_pad_ctrl_parent_data[] = {
2918ff93f28SJerome Brunet 	{ .name = "aud_mst_a_mclk", .index = -1,  },
2928ff93f28SJerome Brunet 	{ .name = "aud_mst_b_mclk", .index = -1,  },
2938ff93f28SJerome Brunet 	{ .name = "aud_mst_c_mclk", .index = -1,  },
2948ff93f28SJerome Brunet 	{ .name = "aud_mst_d_mclk", .index = -1,  },
2958ff93f28SJerome Brunet 	{ .name = "aud_mst_e_mclk", .index = -1,  },
2968ff93f28SJerome Brunet 	{ .name = "aud_mst_f_mclk", .index = -1,  },
2978ff93f28SJerome Brunet };
2981cd50181SJerome Brunet 
2998ff93f28SJerome Brunet /* Pad bit clock sources */
3008ff93f28SJerome Brunet static const struct clk_parent_data sclk_pad_ctrl_parent_data[] = {
3018ff93f28SJerome Brunet 	{ .name = "aud_mst_a_sclk", .index = -1, },
3028ff93f28SJerome Brunet 	{ .name = "aud_mst_b_sclk", .index = -1, },
3038ff93f28SJerome Brunet 	{ .name = "aud_mst_c_sclk", .index = -1, },
3048ff93f28SJerome Brunet 	{ .name = "aud_mst_d_sclk", .index = -1, },
3058ff93f28SJerome Brunet 	{ .name = "aud_mst_e_sclk", .index = -1, },
3068ff93f28SJerome Brunet 	{ .name = "aud_mst_f_sclk", .index = -1, },
3078ff93f28SJerome Brunet };
3088ff93f28SJerome Brunet 
3098ff93f28SJerome Brunet /* Pad sample clock sources */
3108ff93f28SJerome Brunet static const struct clk_parent_data lrclk_pad_ctrl_parent_data[] = {
3118ff93f28SJerome Brunet 	{ .name = "aud_mst_a_lrclk", .index = -1, },
3128ff93f28SJerome Brunet 	{ .name = "aud_mst_b_lrclk", .index = -1, },
3138ff93f28SJerome Brunet 	{ .name = "aud_mst_c_lrclk", .index = -1, },
3148ff93f28SJerome Brunet 	{ .name = "aud_mst_d_lrclk", .index = -1, },
3158ff93f28SJerome Brunet 	{ .name = "aud_mst_e_lrclk", .index = -1, },
3168ff93f28SJerome Brunet 	{ .name = "aud_mst_f_lrclk", .index = -1, },
3178ff93f28SJerome Brunet };
3188ff93f28SJerome Brunet 
31907500138SMaxime Jourdan #define AUD_TDM_PAD_CTRL(_name, _reg, _shift, _parents)		\
320be4fe445SJerome Brunet 	AUD_MUX(_name, _reg, 0x7, _shift, 0, _parents,		\
32107500138SMaxime Jourdan 		CLK_SET_RATE_NO_REPARENT)
32207500138SMaxime Jourdan 
3238ff93f28SJerome Brunet /* Common Clocks */
324be4fe445SJerome Brunet static struct clk_regmap ddr_arb =
325be4fe445SJerome Brunet 	AUD_PCLK_GATE(ddr_arb, AUDIO_CLK_GATE_EN, 0);
326be4fe445SJerome Brunet static struct clk_regmap pdm =
327be4fe445SJerome Brunet 	AUD_PCLK_GATE(pdm, AUDIO_CLK_GATE_EN, 1);
328be4fe445SJerome Brunet static struct clk_regmap tdmin_a =
329be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_a, AUDIO_CLK_GATE_EN, 2);
330be4fe445SJerome Brunet static struct clk_regmap tdmin_b =
331be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_b, AUDIO_CLK_GATE_EN, 3);
332be4fe445SJerome Brunet static struct clk_regmap tdmin_c =
333be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_c, AUDIO_CLK_GATE_EN, 4);
334be4fe445SJerome Brunet static struct clk_regmap tdmin_lb =
335be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmin_lb, AUDIO_CLK_GATE_EN, 5);
336be4fe445SJerome Brunet static struct clk_regmap tdmout_a =
337be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmout_a, AUDIO_CLK_GATE_EN, 6);
338be4fe445SJerome Brunet static struct clk_regmap tdmout_b =
339be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmout_b, AUDIO_CLK_GATE_EN, 7);
340be4fe445SJerome Brunet static struct clk_regmap tdmout_c =
341be4fe445SJerome Brunet 	AUD_PCLK_GATE(tdmout_c, AUDIO_CLK_GATE_EN, 8);
342be4fe445SJerome Brunet static struct clk_regmap frddr_a =
343be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_a, AUDIO_CLK_GATE_EN, 9);
344be4fe445SJerome Brunet static struct clk_regmap frddr_b =
345be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_b, AUDIO_CLK_GATE_EN, 10);
346be4fe445SJerome Brunet static struct clk_regmap frddr_c =
347be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_c, AUDIO_CLK_GATE_EN, 11);
348be4fe445SJerome Brunet static struct clk_regmap toddr_a =
349be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_a, AUDIO_CLK_GATE_EN, 12);
350be4fe445SJerome Brunet static struct clk_regmap toddr_b =
351be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_b, AUDIO_CLK_GATE_EN, 13);
352be4fe445SJerome Brunet static struct clk_regmap toddr_c =
353be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_c, AUDIO_CLK_GATE_EN, 14);
354be4fe445SJerome Brunet static struct clk_regmap loopback =
355be4fe445SJerome Brunet 	AUD_PCLK_GATE(loopback, AUDIO_CLK_GATE_EN, 15);
356be4fe445SJerome Brunet static struct clk_regmap spdifin =
357be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifin, AUDIO_CLK_GATE_EN, 16);
358be4fe445SJerome Brunet static struct clk_regmap spdifout =
359be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifout, AUDIO_CLK_GATE_EN, 17);
360be4fe445SJerome Brunet static struct clk_regmap resample =
361be4fe445SJerome Brunet 	AUD_PCLK_GATE(resample, AUDIO_CLK_GATE_EN, 18);
362be4fe445SJerome Brunet static struct clk_regmap power_detect =
363be4fe445SJerome Brunet 	AUD_PCLK_GATE(power_detect, AUDIO_CLK_GATE_EN, 19);
36407500138SMaxime Jourdan 
3658ff93f28SJerome Brunet static struct clk_regmap spdifout_clk_sel =
3668ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL);
3678ff93f28SJerome Brunet static struct clk_regmap pdm_dclk_sel =
3688ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(pdm_dclk, AUDIO_CLK_PDMIN_CTRL0);
3698ff93f28SJerome Brunet static struct clk_regmap spdifin_clk_sel =
3708ff93f28SJerome Brunet 	AUD_MST_SYS_MUX(spdifin_clk, AUDIO_CLK_SPDIFIN_CTRL);
3718ff93f28SJerome Brunet static struct clk_regmap pdm_sysclk_sel =
3728ff93f28SJerome Brunet 	AUD_MST_SYS_MUX(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1);
3738ff93f28SJerome Brunet static struct clk_regmap spdifout_b_clk_sel =
3748ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL);
37507500138SMaxime Jourdan 
3768ff93f28SJerome Brunet static struct clk_regmap spdifout_clk_div =
3778ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL);
3788ff93f28SJerome Brunet static struct clk_regmap pdm_dclk_div =
3798ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(pdm_dclk, AUDIO_CLK_PDMIN_CTRL0);
3808ff93f28SJerome Brunet static struct clk_regmap spdifin_clk_div =
3818ff93f28SJerome Brunet 	AUD_MST_SYS_DIV(spdifin_clk, AUDIO_CLK_SPDIFIN_CTRL);
3828ff93f28SJerome Brunet static struct clk_regmap pdm_sysclk_div =
3838ff93f28SJerome Brunet 	AUD_MST_SYS_DIV(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1);
3848ff93f28SJerome Brunet static struct clk_regmap spdifout_b_clk_div =
3858ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL);
38607500138SMaxime Jourdan 
3878ff93f28SJerome Brunet static struct clk_regmap spdifout_clk =
3888ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL);
3898ff93f28SJerome Brunet static struct clk_regmap spdifin_clk =
3908ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(spdifin_clk, AUDIO_CLK_SPDIFIN_CTRL);
3918ff93f28SJerome Brunet static struct clk_regmap pdm_dclk =
3928ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(pdm_dclk, AUDIO_CLK_PDMIN_CTRL0);
3938ff93f28SJerome Brunet static struct clk_regmap pdm_sysclk =
3948ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1);
3958ff93f28SJerome Brunet static struct clk_regmap spdifout_b_clk =
3968ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL);
39707500138SMaxime Jourdan 
3988ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk_pre_en =
3998ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(a, AUDIO_MST_A_SCLK_CTRL0);
4008ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk_pre_en =
4018ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(b, AUDIO_MST_B_SCLK_CTRL0);
4028ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk_pre_en =
4038ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(c, AUDIO_MST_C_SCLK_CTRL0);
4048ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk_pre_en =
4058ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(d, AUDIO_MST_D_SCLK_CTRL0);
4068ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk_pre_en =
4078ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(e, AUDIO_MST_E_SCLK_CTRL0);
4088ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk_pre_en =
4098ff93f28SJerome Brunet 	AUD_MST_SCLK_PRE_EN(f, AUDIO_MST_F_SCLK_CTRL0);
41007500138SMaxime Jourdan 
4118ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk_div =
4128ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(a, AUDIO_MST_A_SCLK_CTRL0);
4138ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk_div =
4148ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(b, AUDIO_MST_B_SCLK_CTRL0);
4158ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk_div =
4168ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(c, AUDIO_MST_C_SCLK_CTRL0);
4178ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk_div =
4188ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(d, AUDIO_MST_D_SCLK_CTRL0);
4198ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk_div =
4208ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(e, AUDIO_MST_E_SCLK_CTRL0);
4218ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk_div =
4228ff93f28SJerome Brunet 	AUD_MST_SCLK_DIV(f, AUDIO_MST_F_SCLK_CTRL0);
4238ff93f28SJerome Brunet 
4248ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk_post_en =
4258ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(a, AUDIO_MST_A_SCLK_CTRL0);
4268ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk_post_en =
4278ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(b, AUDIO_MST_B_SCLK_CTRL0);
4288ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk_post_en =
4298ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(c, AUDIO_MST_C_SCLK_CTRL0);
4308ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk_post_en =
4318ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(d, AUDIO_MST_D_SCLK_CTRL0);
4328ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk_post_en =
4338ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(e, AUDIO_MST_E_SCLK_CTRL0);
4348ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk_post_en =
4358ff93f28SJerome Brunet 	AUD_MST_SCLK_POST_EN(f, AUDIO_MST_F_SCLK_CTRL0);
4368ff93f28SJerome Brunet 
4378ff93f28SJerome Brunet static struct clk_regmap mst_a_sclk =
4388ff93f28SJerome Brunet 	AUD_MST_SCLK(a, AUDIO_MST_A_SCLK_CTRL1);
4398ff93f28SJerome Brunet static struct clk_regmap mst_b_sclk =
4408ff93f28SJerome Brunet 	AUD_MST_SCLK(b, AUDIO_MST_B_SCLK_CTRL1);
4418ff93f28SJerome Brunet static struct clk_regmap mst_c_sclk =
4428ff93f28SJerome Brunet 	AUD_MST_SCLK(c, AUDIO_MST_C_SCLK_CTRL1);
4438ff93f28SJerome Brunet static struct clk_regmap mst_d_sclk =
4448ff93f28SJerome Brunet 	AUD_MST_SCLK(d, AUDIO_MST_D_SCLK_CTRL1);
4458ff93f28SJerome Brunet static struct clk_regmap mst_e_sclk =
4468ff93f28SJerome Brunet 	AUD_MST_SCLK(e, AUDIO_MST_E_SCLK_CTRL1);
4478ff93f28SJerome Brunet static struct clk_regmap mst_f_sclk =
4488ff93f28SJerome Brunet 	AUD_MST_SCLK(f, AUDIO_MST_F_SCLK_CTRL1);
4498ff93f28SJerome Brunet 
4508ff93f28SJerome Brunet static struct clk_regmap mst_a_lrclk_div =
4518ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(a, AUDIO_MST_A_SCLK_CTRL0);
4528ff93f28SJerome Brunet static struct clk_regmap mst_b_lrclk_div =
4538ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(b, AUDIO_MST_B_SCLK_CTRL0);
4548ff93f28SJerome Brunet static struct clk_regmap mst_c_lrclk_div =
4558ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(c, AUDIO_MST_C_SCLK_CTRL0);
4568ff93f28SJerome Brunet static struct clk_regmap mst_d_lrclk_div =
4578ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(d, AUDIO_MST_D_SCLK_CTRL0);
4588ff93f28SJerome Brunet static struct clk_regmap mst_e_lrclk_div =
4598ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(e, AUDIO_MST_E_SCLK_CTRL0);
4608ff93f28SJerome Brunet static struct clk_regmap mst_f_lrclk_div =
4618ff93f28SJerome Brunet 	AUD_MST_LRCLK_DIV(f, AUDIO_MST_F_SCLK_CTRL0);
4628ff93f28SJerome Brunet 
4638ff93f28SJerome Brunet static struct clk_regmap mst_a_lrclk =
4648ff93f28SJerome Brunet 	AUD_MST_LRCLK(a, AUDIO_MST_A_SCLK_CTRL1);
4658ff93f28SJerome Brunet static struct clk_regmap mst_b_lrclk =
4668ff93f28SJerome Brunet 	AUD_MST_LRCLK(b, AUDIO_MST_B_SCLK_CTRL1);
4678ff93f28SJerome Brunet static struct clk_regmap mst_c_lrclk =
4688ff93f28SJerome Brunet 	AUD_MST_LRCLK(c, AUDIO_MST_C_SCLK_CTRL1);
4698ff93f28SJerome Brunet static struct clk_regmap mst_d_lrclk =
4708ff93f28SJerome Brunet 	AUD_MST_LRCLK(d, AUDIO_MST_D_SCLK_CTRL1);
4718ff93f28SJerome Brunet static struct clk_regmap mst_e_lrclk =
4728ff93f28SJerome Brunet 	AUD_MST_LRCLK(e, AUDIO_MST_E_SCLK_CTRL1);
4738ff93f28SJerome Brunet static struct clk_regmap mst_f_lrclk =
4748ff93f28SJerome Brunet 	AUD_MST_LRCLK(f, AUDIO_MST_F_SCLK_CTRL1);
4758ff93f28SJerome Brunet 
4768ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk_sel =
4778ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_a, AUDIO_CLK_TDMIN_A_CTRL);
4788ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk_sel =
4798ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_b, AUDIO_CLK_TDMIN_B_CTRL);
4808ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk_sel =
4818ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_c, AUDIO_CLK_TDMIN_C_CTRL);
4828ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk_sel =
4838ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
4848ff93f28SJerome Brunet static struct clk_regmap tdmout_a_sclk_sel =
4858ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
4868ff93f28SJerome Brunet static struct clk_regmap tdmout_b_sclk_sel =
4878ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
4888ff93f28SJerome Brunet static struct clk_regmap tdmout_c_sclk_sel =
4898ff93f28SJerome Brunet 	AUD_TDM_SCLK_MUX(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
4908ff93f28SJerome Brunet 
4918ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk_pre_en =
4928ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_a, AUDIO_CLK_TDMIN_A_CTRL);
4938ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk_pre_en =
4948ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_b, AUDIO_CLK_TDMIN_B_CTRL);
4958ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk_pre_en =
4968ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_c, AUDIO_CLK_TDMIN_C_CTRL);
4978ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk_pre_en =
4988ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
4998ff93f28SJerome Brunet static struct clk_regmap tdmout_a_sclk_pre_en =
5008ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5018ff93f28SJerome Brunet static struct clk_regmap tdmout_b_sclk_pre_en =
5028ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5038ff93f28SJerome Brunet static struct clk_regmap tdmout_c_sclk_pre_en =
5048ff93f28SJerome Brunet 	AUD_TDM_SCLK_PRE_EN(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5058ff93f28SJerome Brunet 
5068ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk_post_en =
5078ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_a, AUDIO_CLK_TDMIN_A_CTRL);
5088ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk_post_en =
5098ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_b, AUDIO_CLK_TDMIN_B_CTRL);
5108ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk_post_en =
5118ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_c, AUDIO_CLK_TDMIN_C_CTRL);
5128ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk_post_en =
5138ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5148ff93f28SJerome Brunet static struct clk_regmap tdmout_a_sclk_post_en =
5158ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5168ff93f28SJerome Brunet static struct clk_regmap tdmout_b_sclk_post_en =
5178ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5188ff93f28SJerome Brunet static struct clk_regmap tdmout_c_sclk_post_en =
5198ff93f28SJerome Brunet 	AUD_TDM_SCLK_POST_EN(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5208ff93f28SJerome Brunet 
5218ff93f28SJerome Brunet static struct clk_regmap tdmin_a_sclk =
5228ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_a, AUDIO_CLK_TDMIN_A_CTRL);
5238ff93f28SJerome Brunet static struct clk_regmap tdmin_b_sclk =
5248ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_b, AUDIO_CLK_TDMIN_B_CTRL);
5258ff93f28SJerome Brunet static struct clk_regmap tdmin_c_sclk =
5268ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_c, AUDIO_CLK_TDMIN_C_CTRL);
5278ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_sclk =
5288ff93f28SJerome Brunet 	AUD_TDM_SCLK(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5298ff93f28SJerome Brunet 
5308ff93f28SJerome Brunet static struct clk_regmap tdmin_a_lrclk =
5318ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_a, AUDIO_CLK_TDMIN_A_CTRL);
5328ff93f28SJerome Brunet static struct clk_regmap tdmin_b_lrclk =
5338ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_b, AUDIO_CLK_TDMIN_B_CTRL);
5348ff93f28SJerome Brunet static struct clk_regmap tdmin_c_lrclk =
5358ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_c, AUDIO_CLK_TDMIN_C_CTRL);
5368ff93f28SJerome Brunet static struct clk_regmap tdmin_lb_lrclk =
5378ff93f28SJerome Brunet 	AUD_TDM_LRLCK(in_lb, AUDIO_CLK_TDMIN_LB_CTRL);
5388ff93f28SJerome Brunet static struct clk_regmap tdmout_a_lrclk =
5398ff93f28SJerome Brunet 	AUD_TDM_LRLCK(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5408ff93f28SJerome Brunet static struct clk_regmap tdmout_b_lrclk =
5418ff93f28SJerome Brunet 	AUD_TDM_LRLCK(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5428ff93f28SJerome Brunet static struct clk_regmap tdmout_c_lrclk =
5438ff93f28SJerome Brunet 	AUD_TDM_LRLCK(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5448ff93f28SJerome Brunet 
5454fd433fdSJerome Brunet /* AXG Clocks */
5464fd433fdSJerome Brunet static struct clk_regmap axg_tdmout_a_sclk =
5474fd433fdSJerome Brunet 	AUD_TDM_SCLK(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
5484fd433fdSJerome Brunet static struct clk_regmap axg_tdmout_b_sclk =
5494fd433fdSJerome Brunet 	AUD_TDM_SCLK(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
5504fd433fdSJerome Brunet static struct clk_regmap axg_tdmout_c_sclk =
5514fd433fdSJerome Brunet 	AUD_TDM_SCLK(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
5524fd433fdSJerome Brunet 
5538ff93f28SJerome Brunet /* AXG/G12A Clocks */
554cf52db45SJerome Brunet static struct clk_hw axg_aud_top = {
555cf52db45SJerome Brunet 	.init = &(struct clk_init_data) {
556cf52db45SJerome Brunet 		/* Provide aud_top signal name on axg and g12a */
557cf52db45SJerome Brunet 		.name = "aud_top",
558cf52db45SJerome Brunet 		.ops = &(const struct clk_ops) {},
559cf52db45SJerome Brunet 		.parent_data = &(const struct clk_parent_data) {
560cf52db45SJerome Brunet 			.fw_name = "pclk",
561cf52db45SJerome Brunet 		},
562cf52db45SJerome Brunet 		.num_parents = 1,
563cf52db45SJerome Brunet 	},
564cf52db45SJerome Brunet };
565cf52db45SJerome Brunet 
5668ff93f28SJerome Brunet static struct clk_regmap mst_a_mclk_sel =
5678ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_a_mclk, AUDIO_MCLK_A_CTRL);
5688ff93f28SJerome Brunet static struct clk_regmap mst_b_mclk_sel =
5698ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_b_mclk, AUDIO_MCLK_B_CTRL);
5708ff93f28SJerome Brunet static struct clk_regmap mst_c_mclk_sel =
5718ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_c_mclk, AUDIO_MCLK_C_CTRL);
5728ff93f28SJerome Brunet static struct clk_regmap mst_d_mclk_sel =
5738ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_d_mclk, AUDIO_MCLK_D_CTRL);
5748ff93f28SJerome Brunet static struct clk_regmap mst_e_mclk_sel =
5758ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_e_mclk, AUDIO_MCLK_E_CTRL);
5768ff93f28SJerome Brunet static struct clk_regmap mst_f_mclk_sel =
5778ff93f28SJerome Brunet 	AUD_MST_MCLK_MUX(mst_f_mclk, AUDIO_MCLK_F_CTRL);
5788ff93f28SJerome Brunet 
5798ff93f28SJerome Brunet static struct clk_regmap mst_a_mclk_div =
5808ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_a_mclk, AUDIO_MCLK_A_CTRL);
5818ff93f28SJerome Brunet static struct clk_regmap mst_b_mclk_div =
5828ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_b_mclk, AUDIO_MCLK_B_CTRL);
5838ff93f28SJerome Brunet static struct clk_regmap mst_c_mclk_div =
5848ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_c_mclk, AUDIO_MCLK_C_CTRL);
5858ff93f28SJerome Brunet static struct clk_regmap mst_d_mclk_div =
5868ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_d_mclk, AUDIO_MCLK_D_CTRL);
5878ff93f28SJerome Brunet static struct clk_regmap mst_e_mclk_div =
5888ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_e_mclk, AUDIO_MCLK_E_CTRL);
5898ff93f28SJerome Brunet static struct clk_regmap mst_f_mclk_div =
5908ff93f28SJerome Brunet 	AUD_MST_MCLK_DIV(mst_f_mclk, AUDIO_MCLK_F_CTRL);
5918ff93f28SJerome Brunet 
5928ff93f28SJerome Brunet static struct clk_regmap mst_a_mclk =
5938ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_a_mclk, AUDIO_MCLK_A_CTRL);
5948ff93f28SJerome Brunet static struct clk_regmap mst_b_mclk =
5958ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_b_mclk, AUDIO_MCLK_B_CTRL);
5968ff93f28SJerome Brunet static struct clk_regmap mst_c_mclk =
5978ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_c_mclk, AUDIO_MCLK_C_CTRL);
5988ff93f28SJerome Brunet static struct clk_regmap mst_d_mclk =
5998ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_d_mclk, AUDIO_MCLK_D_CTRL);
6008ff93f28SJerome Brunet static struct clk_regmap mst_e_mclk =
6018ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_e_mclk, AUDIO_MCLK_E_CTRL);
6028ff93f28SJerome Brunet static struct clk_regmap mst_f_mclk =
6038ff93f28SJerome Brunet 	AUD_MST_MCLK_GATE(mst_f_mclk, AUDIO_MCLK_F_CTRL);
6048ff93f28SJerome Brunet 
6058ff93f28SJerome Brunet /* G12a clocks */
6068ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_mclk_pad_0 = AUD_TDM_PAD_CTRL(
6078ff93f28SJerome Brunet 	mclk_pad_0, AUDIO_MST_PAD_CTRL0, 0, mclk_pad_ctrl_parent_data);
6088ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_mclk_pad_1 = AUD_TDM_PAD_CTRL(
6098ff93f28SJerome Brunet 	mclk_pad_1, AUDIO_MST_PAD_CTRL0, 4, mclk_pad_ctrl_parent_data);
6108ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_lrclk_pad_0 = AUD_TDM_PAD_CTRL(
6118ff93f28SJerome Brunet 	lrclk_pad_0, AUDIO_MST_PAD_CTRL1, 16, lrclk_pad_ctrl_parent_data);
6128ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_lrclk_pad_1 = AUD_TDM_PAD_CTRL(
6138ff93f28SJerome Brunet 	lrclk_pad_1, AUDIO_MST_PAD_CTRL1, 20, lrclk_pad_ctrl_parent_data);
6148ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_lrclk_pad_2 = AUD_TDM_PAD_CTRL(
6158ff93f28SJerome Brunet 	lrclk_pad_2, AUDIO_MST_PAD_CTRL1, 24, lrclk_pad_ctrl_parent_data);
6168ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_sclk_pad_0 = AUD_TDM_PAD_CTRL(
6178ff93f28SJerome Brunet 	sclk_pad_0, AUDIO_MST_PAD_CTRL1, 0, sclk_pad_ctrl_parent_data);
6188ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_sclk_pad_1 = AUD_TDM_PAD_CTRL(
6198ff93f28SJerome Brunet 	sclk_pad_1, AUDIO_MST_PAD_CTRL1, 4, sclk_pad_ctrl_parent_data);
6208ff93f28SJerome Brunet static struct clk_regmap g12a_tdm_sclk_pad_2 = AUD_TDM_PAD_CTRL(
6218ff93f28SJerome Brunet 	sclk_pad_2, AUDIO_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data);
6228ff93f28SJerome Brunet 
6234fd433fdSJerome Brunet static struct clk_regmap g12a_tdmout_a_sclk =
6244fd433fdSJerome Brunet 	AUD_TDM_SCLK_WS(out_a, AUDIO_CLK_TDMOUT_A_CTRL);
6254fd433fdSJerome Brunet static struct clk_regmap g12a_tdmout_b_sclk =
6264fd433fdSJerome Brunet 	AUD_TDM_SCLK_WS(out_b, AUDIO_CLK_TDMOUT_B_CTRL);
6274fd433fdSJerome Brunet static struct clk_regmap g12a_tdmout_c_sclk =
6284fd433fdSJerome Brunet 	AUD_TDM_SCLK_WS(out_c, AUDIO_CLK_TDMOUT_C_CTRL);
6294fd433fdSJerome Brunet 
630be4fe445SJerome Brunet static struct clk_regmap toram =
631be4fe445SJerome Brunet 	AUD_PCLK_GATE(toram, AUDIO_CLK_GATE_EN, 20);
632be4fe445SJerome Brunet static struct clk_regmap spdifout_b =
633be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifout_b, AUDIO_CLK_GATE_EN, 21);
634be4fe445SJerome Brunet static struct clk_regmap eqdrc =
635be4fe445SJerome Brunet 	AUD_PCLK_GATE(eqdrc, AUDIO_CLK_GATE_EN, 22);
636be4fe445SJerome Brunet 
637be4fe445SJerome Brunet /* SM1 Clocks */
638be4fe445SJerome Brunet static struct clk_regmap sm1_clk81_en = {
639be4fe445SJerome Brunet 	.data = &(struct clk_regmap_gate_data){
640be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_EN,
641be4fe445SJerome Brunet 		.bit_idx = 31,
642be4fe445SJerome Brunet 	},
643be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
644be4fe445SJerome Brunet 		.name = "aud_clk81_en",
645be4fe445SJerome Brunet 		.ops = &clk_regmap_gate_ops,
646be4fe445SJerome Brunet 		.parent_data = &(const struct clk_parent_data) {
647be4fe445SJerome Brunet 			.fw_name = "pclk",
648be4fe445SJerome Brunet 		},
649be4fe445SJerome Brunet 		.num_parents = 1,
650be4fe445SJerome Brunet 	},
651be4fe445SJerome Brunet };
652be4fe445SJerome Brunet 
653be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_a_div = {
654be4fe445SJerome Brunet 	.data = &(struct clk_regmap_div_data){
655be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
656be4fe445SJerome Brunet 		.shift = 0,
657be4fe445SJerome Brunet 		.width = 8,
658be4fe445SJerome Brunet 	},
659be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
660be4fe445SJerome Brunet 		.name = "aud_sysclk_a_div",
661be4fe445SJerome Brunet 		.ops = &clk_regmap_divider_ops,
662be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
663be4fe445SJerome Brunet 			&sm1_clk81_en.hw,
664be4fe445SJerome Brunet 		},
665be4fe445SJerome Brunet 		.num_parents = 1,
666be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
667be4fe445SJerome Brunet 	},
668be4fe445SJerome Brunet };
669be4fe445SJerome Brunet 
670be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_a_en = {
671be4fe445SJerome Brunet 	.data = &(struct clk_regmap_gate_data){
672be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
673be4fe445SJerome Brunet 		.bit_idx = 8,
674be4fe445SJerome Brunet 	},
675be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
676be4fe445SJerome Brunet 		.name = "aud_sysclk_a_en",
677be4fe445SJerome Brunet 		.ops = &clk_regmap_gate_ops,
678be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
679be4fe445SJerome Brunet 			&sm1_sysclk_a_div.hw,
680be4fe445SJerome Brunet 		},
681be4fe445SJerome Brunet 		.num_parents = 1,
682be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
683be4fe445SJerome Brunet 	},
684be4fe445SJerome Brunet };
685be4fe445SJerome Brunet 
686be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_b_div = {
687be4fe445SJerome Brunet 	.data = &(struct clk_regmap_div_data){
688be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
689be4fe445SJerome Brunet 		.shift = 16,
690be4fe445SJerome Brunet 		.width = 8,
691be4fe445SJerome Brunet 	},
692be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
693be4fe445SJerome Brunet 		.name = "aud_sysclk_b_div",
694be4fe445SJerome Brunet 		.ops = &clk_regmap_divider_ops,
695be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
696be4fe445SJerome Brunet 			&sm1_clk81_en.hw,
697be4fe445SJerome Brunet 		},
698be4fe445SJerome Brunet 		.num_parents = 1,
699be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
700be4fe445SJerome Brunet 	},
701be4fe445SJerome Brunet };
702be4fe445SJerome Brunet 
703be4fe445SJerome Brunet static struct clk_regmap sm1_sysclk_b_en = {
704be4fe445SJerome Brunet 	.data = &(struct clk_regmap_gate_data){
705be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
706be4fe445SJerome Brunet 		.bit_idx = 24,
707be4fe445SJerome Brunet 	},
708be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data) {
709be4fe445SJerome Brunet 		.name = "aud_sysclk_b_en",
710be4fe445SJerome Brunet 		.ops = &clk_regmap_gate_ops,
711be4fe445SJerome Brunet 		.parent_hws = (const struct clk_hw *[]) {
712be4fe445SJerome Brunet 			&sm1_sysclk_b_div.hw,
713be4fe445SJerome Brunet 		},
714be4fe445SJerome Brunet 		.num_parents = 1,
715be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_PARENT,
716be4fe445SJerome Brunet 	},
717be4fe445SJerome Brunet };
718be4fe445SJerome Brunet 
719be4fe445SJerome Brunet static const struct clk_hw *sm1_aud_top_parents[] = {
720be4fe445SJerome Brunet 	&sm1_sysclk_a_en.hw,
721be4fe445SJerome Brunet 	&sm1_sysclk_b_en.hw,
722be4fe445SJerome Brunet };
723be4fe445SJerome Brunet 
724be4fe445SJerome Brunet static struct clk_regmap sm1_aud_top = {
725be4fe445SJerome Brunet 	.data = &(struct clk_regmap_mux_data){
726be4fe445SJerome Brunet 		.offset = AUDIO_CLK81_CTRL,
727be4fe445SJerome Brunet 		.mask = 0x1,
728be4fe445SJerome Brunet 		.shift = 31,
729be4fe445SJerome Brunet 	},
730be4fe445SJerome Brunet 	.hw.init = &(struct clk_init_data){
731be4fe445SJerome Brunet 		.name = "aud_top",
732be4fe445SJerome Brunet 		.ops = &clk_regmap_mux_ops,
733be4fe445SJerome Brunet 		.parent_hws = sm1_aud_top_parents,
734be4fe445SJerome Brunet 		.num_parents = ARRAY_SIZE(sm1_aud_top_parents),
735be4fe445SJerome Brunet 		.flags = CLK_SET_RATE_NO_REPARENT,
736be4fe445SJerome Brunet 	},
737be4fe445SJerome Brunet };
738be4fe445SJerome Brunet 
739be4fe445SJerome Brunet static struct clk_regmap resample_b =
740be4fe445SJerome Brunet 	AUD_PCLK_GATE(resample_b, AUDIO_CLK_GATE_EN, 26);
741be4fe445SJerome Brunet static struct clk_regmap tovad =
742be4fe445SJerome Brunet 	AUD_PCLK_GATE(tovad, AUDIO_CLK_GATE_EN, 27);
743be4fe445SJerome Brunet static struct clk_regmap locker =
744be4fe445SJerome Brunet 	AUD_PCLK_GATE(locker, AUDIO_CLK_GATE_EN, 28);
745be4fe445SJerome Brunet static struct clk_regmap spdifin_lb =
746be4fe445SJerome Brunet 	AUD_PCLK_GATE(spdifin_lb, AUDIO_CLK_GATE_EN, 29);
747be4fe445SJerome Brunet static struct clk_regmap frddr_d =
748be4fe445SJerome Brunet 	AUD_PCLK_GATE(frddr_d, AUDIO_CLK_GATE_EN1, 0);
749be4fe445SJerome Brunet static struct clk_regmap toddr_d =
750be4fe445SJerome Brunet 	AUD_PCLK_GATE(toddr_d, AUDIO_CLK_GATE_EN1, 1);
751be4fe445SJerome Brunet static struct clk_regmap loopback_b =
752be4fe445SJerome Brunet 	AUD_PCLK_GATE(loopback_b, AUDIO_CLK_GATE_EN1, 2);
753be4fe445SJerome Brunet 
754be4fe445SJerome Brunet static struct clk_regmap sm1_mst_a_mclk_sel =
755be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL);
756be4fe445SJerome Brunet static struct clk_regmap sm1_mst_b_mclk_sel =
757be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL);
758be4fe445SJerome Brunet static struct clk_regmap sm1_mst_c_mclk_sel =
759be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL);
760be4fe445SJerome Brunet static struct clk_regmap sm1_mst_d_mclk_sel =
761be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL);
762be4fe445SJerome Brunet static struct clk_regmap sm1_mst_e_mclk_sel =
763be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL);
764be4fe445SJerome Brunet static struct clk_regmap sm1_mst_f_mclk_sel =
765be4fe445SJerome Brunet 	AUD_MST_MCLK_MUX(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL);
766be4fe445SJerome Brunet 
767be4fe445SJerome Brunet static struct clk_regmap sm1_mst_a_mclk_div =
768be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL);
769be4fe445SJerome Brunet static struct clk_regmap sm1_mst_b_mclk_div =
770be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL);
771be4fe445SJerome Brunet static struct clk_regmap sm1_mst_c_mclk_div =
772be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL);
773be4fe445SJerome Brunet static struct clk_regmap sm1_mst_d_mclk_div =
774be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL);
775be4fe445SJerome Brunet static struct clk_regmap sm1_mst_e_mclk_div =
776be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL);
777be4fe445SJerome Brunet static struct clk_regmap sm1_mst_f_mclk_div =
778be4fe445SJerome Brunet 	AUD_MST_MCLK_DIV(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL);
779be4fe445SJerome Brunet 
780be4fe445SJerome Brunet static struct clk_regmap sm1_mst_a_mclk =
781be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL);
782be4fe445SJerome Brunet static struct clk_regmap sm1_mst_b_mclk =
783be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL);
784be4fe445SJerome Brunet static struct clk_regmap sm1_mst_c_mclk =
785be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL);
786be4fe445SJerome Brunet static struct clk_regmap sm1_mst_d_mclk =
787be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL);
788be4fe445SJerome Brunet static struct clk_regmap sm1_mst_e_mclk =
789be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL);
790be4fe445SJerome Brunet static struct clk_regmap sm1_mst_f_mclk =
791be4fe445SJerome Brunet 	AUD_MST_MCLK_GATE(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL);
792be4fe445SJerome Brunet 
793be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_mclk_pad_0 = AUD_TDM_PAD_CTRL(
794be4fe445SJerome Brunet 	tdm_mclk_pad_0, AUDIO_SM1_MST_PAD_CTRL0, 0, mclk_pad_ctrl_parent_data);
795be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_mclk_pad_1 = AUD_TDM_PAD_CTRL(
796be4fe445SJerome Brunet 	tdm_mclk_pad_1, AUDIO_SM1_MST_PAD_CTRL0, 4, mclk_pad_ctrl_parent_data);
797be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_lrclk_pad_0 = AUD_TDM_PAD_CTRL(
798be4fe445SJerome Brunet 	tdm_lrclk_pad_0, AUDIO_SM1_MST_PAD_CTRL1, 16, lrclk_pad_ctrl_parent_data);
799be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_lrclk_pad_1 = AUD_TDM_PAD_CTRL(
800be4fe445SJerome Brunet 	tdm_lrclk_pad_1, AUDIO_SM1_MST_PAD_CTRL1, 20, lrclk_pad_ctrl_parent_data);
801be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_lrclk_pad_2 = AUD_TDM_PAD_CTRL(
802be4fe445SJerome Brunet 	tdm_lrclk_pad_2, AUDIO_SM1_MST_PAD_CTRL1, 24, lrclk_pad_ctrl_parent_data);
803be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_sclk_pad_0 = AUD_TDM_PAD_CTRL(
804be4fe445SJerome Brunet 	tdm_sclk_pad_0, AUDIO_SM1_MST_PAD_CTRL1, 0, sclk_pad_ctrl_parent_data);
805be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_sclk_pad_1 = AUD_TDM_PAD_CTRL(
806be4fe445SJerome Brunet 	tdm_sclk_pad_1, AUDIO_SM1_MST_PAD_CTRL1, 4, sclk_pad_ctrl_parent_data);
807be4fe445SJerome Brunet static struct clk_regmap sm1_tdm_sclk_pad_2 = AUD_TDM_PAD_CTRL(
808be4fe445SJerome Brunet 	tdm_sclk_pad_2, AUDIO_SM1_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data);
80907500138SMaxime Jourdan 
8101cd50181SJerome Brunet /*
8111cd50181SJerome Brunet  * Array of all clocks provided by this provider
8121cd50181SJerome Brunet  * The input clocks of the controller will be populated at runtime
8131cd50181SJerome Brunet  */
8141cd50181SJerome Brunet static struct clk_hw_onecell_data axg_audio_hw_onecell_data = {
8151cd50181SJerome Brunet 	.hws = {
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 		[NR_CLKS] = NULL,
9391cd50181SJerome Brunet 	},
9401cd50181SJerome Brunet 	.num = NR_CLKS,
9411cd50181SJerome Brunet };
9421cd50181SJerome Brunet 
94307500138SMaxime Jourdan /*
94407500138SMaxime Jourdan  * Array of all G12A clocks provided by this provider
94507500138SMaxime Jourdan  * The input clocks of the controller will be populated at runtime
94607500138SMaxime Jourdan  */
94707500138SMaxime Jourdan static struct clk_hw_onecell_data g12a_audio_hw_onecell_data = {
94807500138SMaxime Jourdan 	.hws = {
9498ff93f28SJerome Brunet 		[AUD_CLKID_DDR_ARB]		= &ddr_arb.hw,
9508ff93f28SJerome Brunet 		[AUD_CLKID_PDM]			= &pdm.hw,
9518ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_A]		= &tdmin_a.hw,
9528ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_B]		= &tdmin_b.hw,
9538ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_C]		= &tdmin_c.hw,
9548ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_LB]		= &tdmin_lb.hw,
9558ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_A]		= &tdmout_a.hw,
9568ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_B]		= &tdmout_b.hw,
9578ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_C]		= &tdmout_c.hw,
9588ff93f28SJerome Brunet 		[AUD_CLKID_FRDDR_A]		= &frddr_a.hw,
9598ff93f28SJerome Brunet 		[AUD_CLKID_FRDDR_B]		= &frddr_b.hw,
9608ff93f28SJerome Brunet 		[AUD_CLKID_FRDDR_C]		= &frddr_c.hw,
9618ff93f28SJerome Brunet 		[AUD_CLKID_TODDR_A]		= &toddr_a.hw,
9628ff93f28SJerome Brunet 		[AUD_CLKID_TODDR_B]		= &toddr_b.hw,
9638ff93f28SJerome Brunet 		[AUD_CLKID_TODDR_C]		= &toddr_c.hw,
9648ff93f28SJerome Brunet 		[AUD_CLKID_LOOPBACK]		= &loopback.hw,
9658ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFIN]		= &spdifin.hw,
9668ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT]		= &spdifout.hw,
9678ff93f28SJerome Brunet 		[AUD_CLKID_RESAMPLE]		= &resample.hw,
9688ff93f28SJerome Brunet 		[AUD_CLKID_POWER_DETECT]	= &power_detect.hw,
9698ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B]		= &spdifout_b.hw,
9708ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_MCLK_SEL]	= &mst_a_mclk_sel.hw,
9718ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_MCLK_SEL]	= &mst_b_mclk_sel.hw,
9728ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_MCLK_SEL]	= &mst_c_mclk_sel.hw,
9738ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_MCLK_SEL]	= &mst_d_mclk_sel.hw,
9748ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_MCLK_SEL]	= &mst_e_mclk_sel.hw,
9758ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_MCLK_SEL]	= &mst_f_mclk_sel.hw,
9768ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_MCLK_DIV]	= &mst_a_mclk_div.hw,
9778ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_MCLK_DIV]	= &mst_b_mclk_div.hw,
9788ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_MCLK_DIV]	= &mst_c_mclk_div.hw,
9798ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_MCLK_DIV]	= &mst_d_mclk_div.hw,
9808ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_MCLK_DIV]	= &mst_e_mclk_div.hw,
9818ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_MCLK_DIV]	= &mst_f_mclk_div.hw,
9828ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_MCLK]		= &mst_a_mclk.hw,
9838ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_MCLK]		= &mst_b_mclk.hw,
9848ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_MCLK]		= &mst_c_mclk.hw,
9858ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_MCLK]		= &mst_d_mclk.hw,
9868ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_MCLK]		= &mst_e_mclk.hw,
9878ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_MCLK]		= &mst_f_mclk.hw,
9888ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_CLK_SEL]	= &spdifout_clk_sel.hw,
9898ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_CLK_DIV]	= &spdifout_clk_div.hw,
9908ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_CLK]	= &spdifout_clk.hw,
9918ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B_CLK_SEL]	= &spdifout_b_clk_sel.hw,
9928ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B_CLK_DIV]	= &spdifout_b_clk_div.hw,
9938ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B_CLK]	= &spdifout_b_clk.hw,
9948ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFIN_CLK_SEL]	= &spdifin_clk_sel.hw,
9958ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFIN_CLK_DIV]	= &spdifin_clk_div.hw,
9968ff93f28SJerome Brunet 		[AUD_CLKID_SPDIFIN_CLK]		= &spdifin_clk.hw,
9978ff93f28SJerome Brunet 		[AUD_CLKID_PDM_DCLK_SEL]	= &pdm_dclk_sel.hw,
9988ff93f28SJerome Brunet 		[AUD_CLKID_PDM_DCLK_DIV]	= &pdm_dclk_div.hw,
9998ff93f28SJerome Brunet 		[AUD_CLKID_PDM_DCLK]		= &pdm_dclk.hw,
10008ff93f28SJerome Brunet 		[AUD_CLKID_PDM_SYSCLK_SEL]	= &pdm_sysclk_sel.hw,
10018ff93f28SJerome Brunet 		[AUD_CLKID_PDM_SYSCLK_DIV]	= &pdm_sysclk_div.hw,
10028ff93f28SJerome Brunet 		[AUD_CLKID_PDM_SYSCLK]		= &pdm_sysclk.hw,
10038ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_SCLK_PRE_EN]	= &mst_a_sclk_pre_en.hw,
10048ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_SCLK_PRE_EN]	= &mst_b_sclk_pre_en.hw,
10058ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_SCLK_PRE_EN]	= &mst_c_sclk_pre_en.hw,
10068ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_SCLK_PRE_EN]	= &mst_d_sclk_pre_en.hw,
10078ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_SCLK_PRE_EN]	= &mst_e_sclk_pre_en.hw,
10088ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_SCLK_PRE_EN]	= &mst_f_sclk_pre_en.hw,
10098ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_SCLK_DIV]	= &mst_a_sclk_div.hw,
10108ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_SCLK_DIV]	= &mst_b_sclk_div.hw,
10118ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_SCLK_DIV]	= &mst_c_sclk_div.hw,
10128ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_SCLK_DIV]	= &mst_d_sclk_div.hw,
10138ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_SCLK_DIV]	= &mst_e_sclk_div.hw,
10148ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_SCLK_DIV]	= &mst_f_sclk_div.hw,
10158ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_SCLK_POST_EN]	= &mst_a_sclk_post_en.hw,
10168ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_SCLK_POST_EN]	= &mst_b_sclk_post_en.hw,
10178ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_SCLK_POST_EN]	= &mst_c_sclk_post_en.hw,
10188ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_SCLK_POST_EN]	= &mst_d_sclk_post_en.hw,
10198ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_SCLK_POST_EN]	= &mst_e_sclk_post_en.hw,
10208ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_SCLK_POST_EN]	= &mst_f_sclk_post_en.hw,
10218ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_SCLK]		= &mst_a_sclk.hw,
10228ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_SCLK]		= &mst_b_sclk.hw,
10238ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_SCLK]		= &mst_c_sclk.hw,
10248ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_SCLK]		= &mst_d_sclk.hw,
10258ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_SCLK]		= &mst_e_sclk.hw,
10268ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_SCLK]		= &mst_f_sclk.hw,
10278ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_LRCLK_DIV]	= &mst_a_lrclk_div.hw,
10288ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_LRCLK_DIV]	= &mst_b_lrclk_div.hw,
10298ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_LRCLK_DIV]	= &mst_c_lrclk_div.hw,
10308ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_LRCLK_DIV]	= &mst_d_lrclk_div.hw,
10318ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_LRCLK_DIV]	= &mst_e_lrclk_div.hw,
10328ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_LRCLK_DIV]	= &mst_f_lrclk_div.hw,
10338ff93f28SJerome Brunet 		[AUD_CLKID_MST_A_LRCLK]		= &mst_a_lrclk.hw,
10348ff93f28SJerome Brunet 		[AUD_CLKID_MST_B_LRCLK]		= &mst_b_lrclk.hw,
10358ff93f28SJerome Brunet 		[AUD_CLKID_MST_C_LRCLK]		= &mst_c_lrclk.hw,
10368ff93f28SJerome Brunet 		[AUD_CLKID_MST_D_LRCLK]		= &mst_d_lrclk.hw,
10378ff93f28SJerome Brunet 		[AUD_CLKID_MST_E_LRCLK]		= &mst_e_lrclk.hw,
10388ff93f28SJerome Brunet 		[AUD_CLKID_MST_F_LRCLK]		= &mst_f_lrclk.hw,
10398ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK_SEL]	= &tdmin_a_sclk_sel.hw,
10408ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK_SEL]	= &tdmin_b_sclk_sel.hw,
10418ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK_SEL]	= &tdmin_c_sclk_sel.hw,
10428ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK_SEL]	= &tdmin_lb_sclk_sel.hw,
10438ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK_SEL]	= &tdmout_a_sclk_sel.hw,
10448ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK_SEL]	= &tdmout_b_sclk_sel.hw,
10458ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK_SEL]	= &tdmout_c_sclk_sel.hw,
10468ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK_PRE_EN]	= &tdmin_a_sclk_pre_en.hw,
10478ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK_PRE_EN]	= &tdmin_b_sclk_pre_en.hw,
10488ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK_PRE_EN]	= &tdmin_c_sclk_pre_en.hw,
10498ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK_PRE_EN] = &tdmin_lb_sclk_pre_en.hw,
10508ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK_PRE_EN] = &tdmout_a_sclk_pre_en.hw,
10518ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK_PRE_EN] = &tdmout_b_sclk_pre_en.hw,
10528ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK_PRE_EN] = &tdmout_c_sclk_pre_en.hw,
10538ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK_POST_EN] = &tdmin_a_sclk_post_en.hw,
10548ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK_POST_EN] = &tdmin_b_sclk_post_en.hw,
10558ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK_POST_EN] = &tdmin_c_sclk_post_en.hw,
10568ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK_POST_EN] = &tdmin_lb_sclk_post_en.hw,
10578ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK_POST_EN] = &tdmout_a_sclk_post_en.hw,
10588ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK_POST_EN] = &tdmout_b_sclk_post_en.hw,
10598ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK_POST_EN] = &tdmout_c_sclk_post_en.hw,
10608ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK]	= &tdmin_a_sclk.hw,
10618ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK]	= &tdmin_b_sclk.hw,
10628ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK]	= &tdmin_c_sclk.hw,
10638ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK]	= &tdmin_lb_sclk.hw,
10644fd433fdSJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK]	= &g12a_tdmout_a_sclk.hw,
10654fd433fdSJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK]	= &g12a_tdmout_b_sclk.hw,
10664fd433fdSJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK]	= &g12a_tdmout_c_sclk.hw,
10678ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_A_LRCLK]	= &tdmin_a_lrclk.hw,
10688ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_B_LRCLK]	= &tdmin_b_lrclk.hw,
10698ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_C_LRCLK]	= &tdmin_c_lrclk.hw,
10708ff93f28SJerome Brunet 		[AUD_CLKID_TDMIN_LB_LRCLK]	= &tdmin_lb_lrclk.hw,
10718ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_A_LRCLK]	= &tdmout_a_lrclk.hw,
10728ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_B_LRCLK]	= &tdmout_b_lrclk.hw,
10738ff93f28SJerome Brunet 		[AUD_CLKID_TDMOUT_C_LRCLK]	= &tdmout_c_lrclk.hw,
10748ff93f28SJerome Brunet 		[AUD_CLKID_TDM_MCLK_PAD0]	= &g12a_tdm_mclk_pad_0.hw,
10758ff93f28SJerome Brunet 		[AUD_CLKID_TDM_MCLK_PAD1]	= &g12a_tdm_mclk_pad_1.hw,
10768ff93f28SJerome Brunet 		[AUD_CLKID_TDM_LRCLK_PAD0]	= &g12a_tdm_lrclk_pad_0.hw,
10778ff93f28SJerome Brunet 		[AUD_CLKID_TDM_LRCLK_PAD1]	= &g12a_tdm_lrclk_pad_1.hw,
10788ff93f28SJerome Brunet 		[AUD_CLKID_TDM_LRCLK_PAD2]	= &g12a_tdm_lrclk_pad_2.hw,
10798ff93f28SJerome Brunet 		[AUD_CLKID_TDM_SCLK_PAD0]	= &g12a_tdm_sclk_pad_0.hw,
10808ff93f28SJerome Brunet 		[AUD_CLKID_TDM_SCLK_PAD1]	= &g12a_tdm_sclk_pad_1.hw,
10818ff93f28SJerome Brunet 		[AUD_CLKID_TDM_SCLK_PAD2]	= &g12a_tdm_sclk_pad_2.hw,
1082cf52db45SJerome Brunet 		[AUD_CLKID_TOP]			= &axg_aud_top,
108307500138SMaxime Jourdan 		[NR_CLKS] = NULL,
108407500138SMaxime Jourdan 	},
108507500138SMaxime Jourdan 	.num = NR_CLKS,
108607500138SMaxime Jourdan };
108707500138SMaxime Jourdan 
1088be4fe445SJerome Brunet /*
1089be4fe445SJerome Brunet  * Array of all SM1 clocks provided by this provider
1090be4fe445SJerome Brunet  * The input clocks of the controller will be populated at runtime
1091be4fe445SJerome Brunet  */
1092be4fe445SJerome Brunet static struct clk_hw_onecell_data sm1_audio_hw_onecell_data = {
1093be4fe445SJerome Brunet 	.hws = {
1094be4fe445SJerome Brunet 		[AUD_CLKID_DDR_ARB]		= &ddr_arb.hw,
1095be4fe445SJerome Brunet 		[AUD_CLKID_PDM]			= &pdm.hw,
1096be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_A]		= &tdmin_a.hw,
1097be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_B]		= &tdmin_b.hw,
1098be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_C]		= &tdmin_c.hw,
1099be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_LB]		= &tdmin_lb.hw,
1100be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_A]		= &tdmout_a.hw,
1101be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_B]		= &tdmout_b.hw,
1102be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_C]		= &tdmout_c.hw,
1103be4fe445SJerome Brunet 		[AUD_CLKID_FRDDR_A]		= &frddr_a.hw,
1104be4fe445SJerome Brunet 		[AUD_CLKID_FRDDR_B]		= &frddr_b.hw,
1105be4fe445SJerome Brunet 		[AUD_CLKID_FRDDR_C]		= &frddr_c.hw,
1106be4fe445SJerome Brunet 		[AUD_CLKID_TODDR_A]		= &toddr_a.hw,
1107be4fe445SJerome Brunet 		[AUD_CLKID_TODDR_B]		= &toddr_b.hw,
1108be4fe445SJerome Brunet 		[AUD_CLKID_TODDR_C]		= &toddr_c.hw,
1109be4fe445SJerome Brunet 		[AUD_CLKID_LOOPBACK]		= &loopback.hw,
1110be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFIN]		= &spdifin.hw,
1111be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT]		= &spdifout.hw,
1112be4fe445SJerome Brunet 		[AUD_CLKID_RESAMPLE]		= &resample.hw,
1113be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B]		= &spdifout_b.hw,
1114be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_MCLK_SEL]	= &sm1_mst_a_mclk_sel.hw,
1115be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_MCLK_SEL]	= &sm1_mst_b_mclk_sel.hw,
1116be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_MCLK_SEL]	= &sm1_mst_c_mclk_sel.hw,
1117be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_MCLK_SEL]	= &sm1_mst_d_mclk_sel.hw,
1118be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_MCLK_SEL]	= &sm1_mst_e_mclk_sel.hw,
1119be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_MCLK_SEL]	= &sm1_mst_f_mclk_sel.hw,
1120be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_MCLK_DIV]	= &sm1_mst_a_mclk_div.hw,
1121be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_MCLK_DIV]	= &sm1_mst_b_mclk_div.hw,
1122be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_MCLK_DIV]	= &sm1_mst_c_mclk_div.hw,
1123be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_MCLK_DIV]	= &sm1_mst_d_mclk_div.hw,
1124be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_MCLK_DIV]	= &sm1_mst_e_mclk_div.hw,
1125be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_MCLK_DIV]	= &sm1_mst_f_mclk_div.hw,
1126be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_MCLK]		= &sm1_mst_a_mclk.hw,
1127be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_MCLK]		= &sm1_mst_b_mclk.hw,
1128be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_MCLK]		= &sm1_mst_c_mclk.hw,
1129be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_MCLK]		= &sm1_mst_d_mclk.hw,
1130be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_MCLK]		= &sm1_mst_e_mclk.hw,
1131be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_MCLK]		= &sm1_mst_f_mclk.hw,
1132be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_CLK_SEL]	= &spdifout_clk_sel.hw,
1133be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_CLK_DIV]	= &spdifout_clk_div.hw,
1134be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_CLK]	= &spdifout_clk.hw,
1135be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B_CLK_SEL]	= &spdifout_b_clk_sel.hw,
1136be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B_CLK_DIV]	= &spdifout_b_clk_div.hw,
1137be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFOUT_B_CLK]	= &spdifout_b_clk.hw,
1138be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFIN_CLK_SEL]	= &spdifin_clk_sel.hw,
1139be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFIN_CLK_DIV]	= &spdifin_clk_div.hw,
1140be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFIN_CLK]		= &spdifin_clk.hw,
1141be4fe445SJerome Brunet 		[AUD_CLKID_PDM_DCLK_SEL]	= &pdm_dclk_sel.hw,
1142be4fe445SJerome Brunet 		[AUD_CLKID_PDM_DCLK_DIV]	= &pdm_dclk_div.hw,
1143be4fe445SJerome Brunet 		[AUD_CLKID_PDM_DCLK]		= &pdm_dclk.hw,
1144be4fe445SJerome Brunet 		[AUD_CLKID_PDM_SYSCLK_SEL]	= &pdm_sysclk_sel.hw,
1145be4fe445SJerome Brunet 		[AUD_CLKID_PDM_SYSCLK_DIV]	= &pdm_sysclk_div.hw,
1146be4fe445SJerome Brunet 		[AUD_CLKID_PDM_SYSCLK]		= &pdm_sysclk.hw,
1147be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_SCLK_PRE_EN]	= &mst_a_sclk_pre_en.hw,
1148be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_SCLK_PRE_EN]	= &mst_b_sclk_pre_en.hw,
1149be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_SCLK_PRE_EN]	= &mst_c_sclk_pre_en.hw,
1150be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_SCLK_PRE_EN]	= &mst_d_sclk_pre_en.hw,
1151be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_SCLK_PRE_EN]	= &mst_e_sclk_pre_en.hw,
1152be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_SCLK_PRE_EN]	= &mst_f_sclk_pre_en.hw,
1153be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_SCLK_DIV]	= &mst_a_sclk_div.hw,
1154be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_SCLK_DIV]	= &mst_b_sclk_div.hw,
1155be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_SCLK_DIV]	= &mst_c_sclk_div.hw,
1156be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_SCLK_DIV]	= &mst_d_sclk_div.hw,
1157be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_SCLK_DIV]	= &mst_e_sclk_div.hw,
1158be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_SCLK_DIV]	= &mst_f_sclk_div.hw,
1159be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_SCLK_POST_EN]	= &mst_a_sclk_post_en.hw,
1160be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_SCLK_POST_EN]	= &mst_b_sclk_post_en.hw,
1161be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_SCLK_POST_EN]	= &mst_c_sclk_post_en.hw,
1162be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_SCLK_POST_EN]	= &mst_d_sclk_post_en.hw,
1163be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_SCLK_POST_EN]	= &mst_e_sclk_post_en.hw,
1164be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_SCLK_POST_EN]	= &mst_f_sclk_post_en.hw,
1165be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_SCLK]		= &mst_a_sclk.hw,
1166be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_SCLK]		= &mst_b_sclk.hw,
1167be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_SCLK]		= &mst_c_sclk.hw,
1168be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_SCLK]		= &mst_d_sclk.hw,
1169be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_SCLK]		= &mst_e_sclk.hw,
1170be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_SCLK]		= &mst_f_sclk.hw,
1171be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_LRCLK_DIV]	= &mst_a_lrclk_div.hw,
1172be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_LRCLK_DIV]	= &mst_b_lrclk_div.hw,
1173be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_LRCLK_DIV]	= &mst_c_lrclk_div.hw,
1174be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_LRCLK_DIV]	= &mst_d_lrclk_div.hw,
1175be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_LRCLK_DIV]	= &mst_e_lrclk_div.hw,
1176be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_LRCLK_DIV]	= &mst_f_lrclk_div.hw,
1177be4fe445SJerome Brunet 		[AUD_CLKID_MST_A_LRCLK]		= &mst_a_lrclk.hw,
1178be4fe445SJerome Brunet 		[AUD_CLKID_MST_B_LRCLK]		= &mst_b_lrclk.hw,
1179be4fe445SJerome Brunet 		[AUD_CLKID_MST_C_LRCLK]		= &mst_c_lrclk.hw,
1180be4fe445SJerome Brunet 		[AUD_CLKID_MST_D_LRCLK]		= &mst_d_lrclk.hw,
1181be4fe445SJerome Brunet 		[AUD_CLKID_MST_E_LRCLK]		= &mst_e_lrclk.hw,
1182be4fe445SJerome Brunet 		[AUD_CLKID_MST_F_LRCLK]		= &mst_f_lrclk.hw,
1183be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK_SEL]	= &tdmin_a_sclk_sel.hw,
1184be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK_SEL]	= &tdmin_b_sclk_sel.hw,
1185be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK_SEL]	= &tdmin_c_sclk_sel.hw,
1186be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK_SEL]	= &tdmin_lb_sclk_sel.hw,
1187be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK_SEL]	= &tdmout_a_sclk_sel.hw,
1188be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK_SEL]	= &tdmout_b_sclk_sel.hw,
1189be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK_SEL]	= &tdmout_c_sclk_sel.hw,
1190be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK_PRE_EN]	= &tdmin_a_sclk_pre_en.hw,
1191be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK_PRE_EN]	= &tdmin_b_sclk_pre_en.hw,
1192be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK_PRE_EN]	= &tdmin_c_sclk_pre_en.hw,
1193be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK_PRE_EN] = &tdmin_lb_sclk_pre_en.hw,
1194be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK_PRE_EN] = &tdmout_a_sclk_pre_en.hw,
1195be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK_PRE_EN] = &tdmout_b_sclk_pre_en.hw,
1196be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK_PRE_EN] = &tdmout_c_sclk_pre_en.hw,
1197be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK_POST_EN] = &tdmin_a_sclk_post_en.hw,
1198be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK_POST_EN] = &tdmin_b_sclk_post_en.hw,
1199be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK_POST_EN] = &tdmin_c_sclk_post_en.hw,
1200be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK_POST_EN] = &tdmin_lb_sclk_post_en.hw,
1201be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK_POST_EN] = &tdmout_a_sclk_post_en.hw,
1202be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK_POST_EN] = &tdmout_b_sclk_post_en.hw,
1203be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK_POST_EN] = &tdmout_c_sclk_post_en.hw,
1204be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_A_SCLK]	= &tdmin_a_sclk.hw,
1205be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_B_SCLK]	= &tdmin_b_sclk.hw,
1206be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_C_SCLK]	= &tdmin_c_sclk.hw,
1207be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_LB_SCLK]	= &tdmin_lb_sclk.hw,
12084fd433fdSJerome Brunet 		[AUD_CLKID_TDMOUT_A_SCLK]	= &g12a_tdmout_a_sclk.hw,
12094fd433fdSJerome Brunet 		[AUD_CLKID_TDMOUT_B_SCLK]	= &g12a_tdmout_b_sclk.hw,
12104fd433fdSJerome Brunet 		[AUD_CLKID_TDMOUT_C_SCLK]	= &g12a_tdmout_c_sclk.hw,
1211be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_A_LRCLK]	= &tdmin_a_lrclk.hw,
1212be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_B_LRCLK]	= &tdmin_b_lrclk.hw,
1213be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_C_LRCLK]	= &tdmin_c_lrclk.hw,
1214be4fe445SJerome Brunet 		[AUD_CLKID_TDMIN_LB_LRCLK]	= &tdmin_lb_lrclk.hw,
1215be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_A_LRCLK]	= &tdmout_a_lrclk.hw,
1216be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_B_LRCLK]	= &tdmout_b_lrclk.hw,
1217be4fe445SJerome Brunet 		[AUD_CLKID_TDMOUT_C_LRCLK]	= &tdmout_c_lrclk.hw,
1218be4fe445SJerome Brunet 		[AUD_CLKID_TDM_MCLK_PAD0]	= &sm1_tdm_mclk_pad_0.hw,
1219be4fe445SJerome Brunet 		[AUD_CLKID_TDM_MCLK_PAD1]	= &sm1_tdm_mclk_pad_1.hw,
1220be4fe445SJerome Brunet 		[AUD_CLKID_TDM_LRCLK_PAD0]	= &sm1_tdm_lrclk_pad_0.hw,
1221be4fe445SJerome Brunet 		[AUD_CLKID_TDM_LRCLK_PAD1]	= &sm1_tdm_lrclk_pad_1.hw,
1222be4fe445SJerome Brunet 		[AUD_CLKID_TDM_LRCLK_PAD2]	= &sm1_tdm_lrclk_pad_2.hw,
1223be4fe445SJerome Brunet 		[AUD_CLKID_TDM_SCLK_PAD0]	= &sm1_tdm_sclk_pad_0.hw,
1224be4fe445SJerome Brunet 		[AUD_CLKID_TDM_SCLK_PAD1]	= &sm1_tdm_sclk_pad_1.hw,
1225be4fe445SJerome Brunet 		[AUD_CLKID_TDM_SCLK_PAD2]	= &sm1_tdm_sclk_pad_2.hw,
1226be4fe445SJerome Brunet 		[AUD_CLKID_TOP]			= &sm1_aud_top.hw,
1227be4fe445SJerome Brunet 		[AUD_CLKID_TORAM]		= &toram.hw,
1228be4fe445SJerome Brunet 		[AUD_CLKID_EQDRC]		= &eqdrc.hw,
1229be4fe445SJerome Brunet 		[AUD_CLKID_RESAMPLE_B]		= &resample_b.hw,
1230be4fe445SJerome Brunet 		[AUD_CLKID_TOVAD]		= &tovad.hw,
1231be4fe445SJerome Brunet 		[AUD_CLKID_LOCKER]		= &locker.hw,
1232be4fe445SJerome Brunet 		[AUD_CLKID_SPDIFIN_LB]		= &spdifin_lb.hw,
1233be4fe445SJerome Brunet 		[AUD_CLKID_FRDDR_D]		= &frddr_d.hw,
1234be4fe445SJerome Brunet 		[AUD_CLKID_TODDR_D]		= &toddr_d.hw,
1235be4fe445SJerome Brunet 		[AUD_CLKID_LOOPBACK_B]		= &loopback_b.hw,
1236be4fe445SJerome Brunet 		[AUD_CLKID_CLK81_EN]		= &sm1_clk81_en.hw,
1237be4fe445SJerome Brunet 		[AUD_CLKID_SYSCLK_A_DIV]	= &sm1_sysclk_a_div.hw,
1238be4fe445SJerome Brunet 		[AUD_CLKID_SYSCLK_A_EN]		= &sm1_sysclk_a_en.hw,
1239be4fe445SJerome Brunet 		[AUD_CLKID_SYSCLK_B_DIV]	= &sm1_sysclk_b_div.hw,
1240be4fe445SJerome Brunet 		[AUD_CLKID_SYSCLK_B_EN]		= &sm1_sysclk_b_en.hw,
1241be4fe445SJerome Brunet 		[NR_CLKS] = NULL,
1242be4fe445SJerome Brunet 	},
1243be4fe445SJerome Brunet 	.num = NR_CLKS,
1244be4fe445SJerome Brunet };
1245be4fe445SJerome Brunet 
1246be4fe445SJerome Brunet 
1247cdabb1ffSJerome Brunet /* Convenience table to populate regmap in .probe(). */
1248be4fe445SJerome Brunet static struct clk_regmap *const axg_clk_regmaps[] = {
12498ff93f28SJerome Brunet 	&ddr_arb,
12508ff93f28SJerome Brunet 	&pdm,
12518ff93f28SJerome Brunet 	&tdmin_a,
12528ff93f28SJerome Brunet 	&tdmin_b,
12538ff93f28SJerome Brunet 	&tdmin_c,
12548ff93f28SJerome Brunet 	&tdmin_lb,
12558ff93f28SJerome Brunet 	&tdmout_a,
12568ff93f28SJerome Brunet 	&tdmout_b,
12578ff93f28SJerome Brunet 	&tdmout_c,
12588ff93f28SJerome Brunet 	&frddr_a,
12598ff93f28SJerome Brunet 	&frddr_b,
12608ff93f28SJerome Brunet 	&frddr_c,
12618ff93f28SJerome Brunet 	&toddr_a,
12628ff93f28SJerome Brunet 	&toddr_b,
12638ff93f28SJerome Brunet 	&toddr_c,
12648ff93f28SJerome Brunet 	&loopback,
12658ff93f28SJerome Brunet 	&spdifin,
12668ff93f28SJerome Brunet 	&spdifout,
12678ff93f28SJerome Brunet 	&resample,
12688ff93f28SJerome Brunet 	&power_detect,
1269cdabb1ffSJerome Brunet 	&mst_a_mclk_sel,
1270cdabb1ffSJerome Brunet 	&mst_b_mclk_sel,
1271cdabb1ffSJerome Brunet 	&mst_c_mclk_sel,
1272cdabb1ffSJerome Brunet 	&mst_d_mclk_sel,
1273cdabb1ffSJerome Brunet 	&mst_e_mclk_sel,
1274cdabb1ffSJerome Brunet 	&mst_f_mclk_sel,
1275cdabb1ffSJerome Brunet 	&mst_a_mclk_div,
1276cdabb1ffSJerome Brunet 	&mst_b_mclk_div,
1277cdabb1ffSJerome Brunet 	&mst_c_mclk_div,
1278cdabb1ffSJerome Brunet 	&mst_d_mclk_div,
1279cdabb1ffSJerome Brunet 	&mst_e_mclk_div,
1280cdabb1ffSJerome Brunet 	&mst_f_mclk_div,
1281cdabb1ffSJerome Brunet 	&mst_a_mclk,
1282cdabb1ffSJerome Brunet 	&mst_b_mclk,
1283cdabb1ffSJerome Brunet 	&mst_c_mclk,
1284cdabb1ffSJerome Brunet 	&mst_d_mclk,
1285cdabb1ffSJerome Brunet 	&mst_e_mclk,
1286cdabb1ffSJerome Brunet 	&mst_f_mclk,
1287cdabb1ffSJerome Brunet 	&spdifout_clk_sel,
1288cdabb1ffSJerome Brunet 	&spdifout_clk_div,
1289cdabb1ffSJerome Brunet 	&spdifout_clk,
1290cdabb1ffSJerome Brunet 	&spdifin_clk_sel,
1291cdabb1ffSJerome Brunet 	&spdifin_clk_div,
1292cdabb1ffSJerome Brunet 	&spdifin_clk,
1293cdabb1ffSJerome Brunet 	&pdm_dclk_sel,
1294cdabb1ffSJerome Brunet 	&pdm_dclk_div,
1295cdabb1ffSJerome Brunet 	&pdm_dclk,
1296cdabb1ffSJerome Brunet 	&pdm_sysclk_sel,
1297cdabb1ffSJerome Brunet 	&pdm_sysclk_div,
1298cdabb1ffSJerome Brunet 	&pdm_sysclk,
1299cdabb1ffSJerome Brunet 	&mst_a_sclk_pre_en,
1300cdabb1ffSJerome Brunet 	&mst_b_sclk_pre_en,
1301cdabb1ffSJerome Brunet 	&mst_c_sclk_pre_en,
1302cdabb1ffSJerome Brunet 	&mst_d_sclk_pre_en,
1303cdabb1ffSJerome Brunet 	&mst_e_sclk_pre_en,
1304cdabb1ffSJerome Brunet 	&mst_f_sclk_pre_en,
1305cdabb1ffSJerome Brunet 	&mst_a_sclk_div,
1306cdabb1ffSJerome Brunet 	&mst_b_sclk_div,
1307cdabb1ffSJerome Brunet 	&mst_c_sclk_div,
1308cdabb1ffSJerome Brunet 	&mst_d_sclk_div,
1309cdabb1ffSJerome Brunet 	&mst_e_sclk_div,
1310cdabb1ffSJerome Brunet 	&mst_f_sclk_div,
1311cdabb1ffSJerome Brunet 	&mst_a_sclk_post_en,
1312cdabb1ffSJerome Brunet 	&mst_b_sclk_post_en,
1313cdabb1ffSJerome Brunet 	&mst_c_sclk_post_en,
1314cdabb1ffSJerome Brunet 	&mst_d_sclk_post_en,
1315cdabb1ffSJerome Brunet 	&mst_e_sclk_post_en,
1316cdabb1ffSJerome Brunet 	&mst_f_sclk_post_en,
1317cdabb1ffSJerome Brunet 	&mst_a_sclk,
1318cdabb1ffSJerome Brunet 	&mst_b_sclk,
1319cdabb1ffSJerome Brunet 	&mst_c_sclk,
1320cdabb1ffSJerome Brunet 	&mst_d_sclk,
1321cdabb1ffSJerome Brunet 	&mst_e_sclk,
1322cdabb1ffSJerome Brunet 	&mst_f_sclk,
1323cdabb1ffSJerome Brunet 	&mst_a_lrclk_div,
1324cdabb1ffSJerome Brunet 	&mst_b_lrclk_div,
1325cdabb1ffSJerome Brunet 	&mst_c_lrclk_div,
1326cdabb1ffSJerome Brunet 	&mst_d_lrclk_div,
1327cdabb1ffSJerome Brunet 	&mst_e_lrclk_div,
1328cdabb1ffSJerome Brunet 	&mst_f_lrclk_div,
1329cdabb1ffSJerome Brunet 	&mst_a_lrclk,
1330cdabb1ffSJerome Brunet 	&mst_b_lrclk,
1331cdabb1ffSJerome Brunet 	&mst_c_lrclk,
1332cdabb1ffSJerome Brunet 	&mst_d_lrclk,
1333cdabb1ffSJerome Brunet 	&mst_e_lrclk,
1334cdabb1ffSJerome Brunet 	&mst_f_lrclk,
1335cdabb1ffSJerome Brunet 	&tdmin_a_sclk_sel,
1336cdabb1ffSJerome Brunet 	&tdmin_b_sclk_sel,
1337cdabb1ffSJerome Brunet 	&tdmin_c_sclk_sel,
1338cdabb1ffSJerome Brunet 	&tdmin_lb_sclk_sel,
1339cdabb1ffSJerome Brunet 	&tdmout_a_sclk_sel,
1340cdabb1ffSJerome Brunet 	&tdmout_b_sclk_sel,
1341cdabb1ffSJerome Brunet 	&tdmout_c_sclk_sel,
1342cdabb1ffSJerome Brunet 	&tdmin_a_sclk_pre_en,
1343cdabb1ffSJerome Brunet 	&tdmin_b_sclk_pre_en,
1344cdabb1ffSJerome Brunet 	&tdmin_c_sclk_pre_en,
1345cdabb1ffSJerome Brunet 	&tdmin_lb_sclk_pre_en,
1346cdabb1ffSJerome Brunet 	&tdmout_a_sclk_pre_en,
1347cdabb1ffSJerome Brunet 	&tdmout_b_sclk_pre_en,
1348cdabb1ffSJerome Brunet 	&tdmout_c_sclk_pre_en,
1349cdabb1ffSJerome Brunet 	&tdmin_a_sclk_post_en,
1350cdabb1ffSJerome Brunet 	&tdmin_b_sclk_post_en,
1351cdabb1ffSJerome Brunet 	&tdmin_c_sclk_post_en,
1352cdabb1ffSJerome Brunet 	&tdmin_lb_sclk_post_en,
1353cdabb1ffSJerome Brunet 	&tdmout_a_sclk_post_en,
1354cdabb1ffSJerome Brunet 	&tdmout_b_sclk_post_en,
1355cdabb1ffSJerome Brunet 	&tdmout_c_sclk_post_en,
1356cdabb1ffSJerome Brunet 	&tdmin_a_sclk,
1357cdabb1ffSJerome Brunet 	&tdmin_b_sclk,
1358cdabb1ffSJerome Brunet 	&tdmin_c_sclk,
1359cdabb1ffSJerome Brunet 	&tdmin_lb_sclk,
13604fd433fdSJerome Brunet 	&axg_tdmout_a_sclk,
13614fd433fdSJerome Brunet 	&axg_tdmout_b_sclk,
13624fd433fdSJerome Brunet 	&axg_tdmout_c_sclk,
1363cdabb1ffSJerome Brunet 	&tdmin_a_lrclk,
1364cdabb1ffSJerome Brunet 	&tdmin_b_lrclk,
1365cdabb1ffSJerome Brunet 	&tdmin_c_lrclk,
1366cdabb1ffSJerome Brunet 	&tdmin_lb_lrclk,
1367cdabb1ffSJerome Brunet 	&tdmout_a_lrclk,
1368cdabb1ffSJerome Brunet 	&tdmout_b_lrclk,
1369cdabb1ffSJerome Brunet 	&tdmout_c_lrclk,
1370cdabb1ffSJerome Brunet };
1371cdabb1ffSJerome Brunet 
1372cdabb1ffSJerome Brunet static struct clk_regmap *const g12a_clk_regmaps[] = {
1373cdabb1ffSJerome Brunet 	&ddr_arb,
1374cdabb1ffSJerome Brunet 	&pdm,
1375cdabb1ffSJerome Brunet 	&tdmin_a,
1376cdabb1ffSJerome Brunet 	&tdmin_b,
1377cdabb1ffSJerome Brunet 	&tdmin_c,
1378cdabb1ffSJerome Brunet 	&tdmin_lb,
1379cdabb1ffSJerome Brunet 	&tdmout_a,
1380cdabb1ffSJerome Brunet 	&tdmout_b,
1381cdabb1ffSJerome Brunet 	&tdmout_c,
1382cdabb1ffSJerome Brunet 	&frddr_a,
1383cdabb1ffSJerome Brunet 	&frddr_b,
1384cdabb1ffSJerome Brunet 	&frddr_c,
1385cdabb1ffSJerome Brunet 	&toddr_a,
1386cdabb1ffSJerome Brunet 	&toddr_b,
1387cdabb1ffSJerome Brunet 	&toddr_c,
1388cdabb1ffSJerome Brunet 	&loopback,
1389cdabb1ffSJerome Brunet 	&spdifin,
1390cdabb1ffSJerome Brunet 	&spdifout,
1391cdabb1ffSJerome Brunet 	&resample,
1392cdabb1ffSJerome Brunet 	&power_detect,
13938ff93f28SJerome Brunet 	&spdifout_b,
13948ff93f28SJerome Brunet 	&mst_a_mclk_sel,
13958ff93f28SJerome Brunet 	&mst_b_mclk_sel,
13968ff93f28SJerome Brunet 	&mst_c_mclk_sel,
13978ff93f28SJerome Brunet 	&mst_d_mclk_sel,
13988ff93f28SJerome Brunet 	&mst_e_mclk_sel,
13998ff93f28SJerome Brunet 	&mst_f_mclk_sel,
14008ff93f28SJerome Brunet 	&mst_a_mclk_div,
14018ff93f28SJerome Brunet 	&mst_b_mclk_div,
14028ff93f28SJerome Brunet 	&mst_c_mclk_div,
14038ff93f28SJerome Brunet 	&mst_d_mclk_div,
14048ff93f28SJerome Brunet 	&mst_e_mclk_div,
14058ff93f28SJerome Brunet 	&mst_f_mclk_div,
14068ff93f28SJerome Brunet 	&mst_a_mclk,
14078ff93f28SJerome Brunet 	&mst_b_mclk,
14088ff93f28SJerome Brunet 	&mst_c_mclk,
14098ff93f28SJerome Brunet 	&mst_d_mclk,
14108ff93f28SJerome Brunet 	&mst_e_mclk,
14118ff93f28SJerome Brunet 	&mst_f_mclk,
14128ff93f28SJerome Brunet 	&spdifout_clk_sel,
14138ff93f28SJerome Brunet 	&spdifout_clk_div,
14148ff93f28SJerome Brunet 	&spdifout_clk,
14158ff93f28SJerome Brunet 	&spdifin_clk_sel,
14168ff93f28SJerome Brunet 	&spdifin_clk_div,
14178ff93f28SJerome Brunet 	&spdifin_clk,
14188ff93f28SJerome Brunet 	&pdm_dclk_sel,
14198ff93f28SJerome Brunet 	&pdm_dclk_div,
14208ff93f28SJerome Brunet 	&pdm_dclk,
14218ff93f28SJerome Brunet 	&pdm_sysclk_sel,
14228ff93f28SJerome Brunet 	&pdm_sysclk_div,
14238ff93f28SJerome Brunet 	&pdm_sysclk,
14248ff93f28SJerome Brunet 	&mst_a_sclk_pre_en,
14258ff93f28SJerome Brunet 	&mst_b_sclk_pre_en,
14268ff93f28SJerome Brunet 	&mst_c_sclk_pre_en,
14278ff93f28SJerome Brunet 	&mst_d_sclk_pre_en,
14288ff93f28SJerome Brunet 	&mst_e_sclk_pre_en,
14298ff93f28SJerome Brunet 	&mst_f_sclk_pre_en,
14308ff93f28SJerome Brunet 	&mst_a_sclk_div,
14318ff93f28SJerome Brunet 	&mst_b_sclk_div,
14328ff93f28SJerome Brunet 	&mst_c_sclk_div,
14338ff93f28SJerome Brunet 	&mst_d_sclk_div,
14348ff93f28SJerome Brunet 	&mst_e_sclk_div,
14358ff93f28SJerome Brunet 	&mst_f_sclk_div,
14368ff93f28SJerome Brunet 	&mst_a_sclk_post_en,
14378ff93f28SJerome Brunet 	&mst_b_sclk_post_en,
14388ff93f28SJerome Brunet 	&mst_c_sclk_post_en,
14398ff93f28SJerome Brunet 	&mst_d_sclk_post_en,
14408ff93f28SJerome Brunet 	&mst_e_sclk_post_en,
14418ff93f28SJerome Brunet 	&mst_f_sclk_post_en,
14428ff93f28SJerome Brunet 	&mst_a_sclk,
14438ff93f28SJerome Brunet 	&mst_b_sclk,
14448ff93f28SJerome Brunet 	&mst_c_sclk,
14458ff93f28SJerome Brunet 	&mst_d_sclk,
14468ff93f28SJerome Brunet 	&mst_e_sclk,
14478ff93f28SJerome Brunet 	&mst_f_sclk,
14488ff93f28SJerome Brunet 	&mst_a_lrclk_div,
14498ff93f28SJerome Brunet 	&mst_b_lrclk_div,
14508ff93f28SJerome Brunet 	&mst_c_lrclk_div,
14518ff93f28SJerome Brunet 	&mst_d_lrclk_div,
14528ff93f28SJerome Brunet 	&mst_e_lrclk_div,
14538ff93f28SJerome Brunet 	&mst_f_lrclk_div,
14548ff93f28SJerome Brunet 	&mst_a_lrclk,
14558ff93f28SJerome Brunet 	&mst_b_lrclk,
14568ff93f28SJerome Brunet 	&mst_c_lrclk,
14578ff93f28SJerome Brunet 	&mst_d_lrclk,
14588ff93f28SJerome Brunet 	&mst_e_lrclk,
14598ff93f28SJerome Brunet 	&mst_f_lrclk,
14608ff93f28SJerome Brunet 	&tdmin_a_sclk_sel,
14618ff93f28SJerome Brunet 	&tdmin_b_sclk_sel,
14628ff93f28SJerome Brunet 	&tdmin_c_sclk_sel,
14638ff93f28SJerome Brunet 	&tdmin_lb_sclk_sel,
14648ff93f28SJerome Brunet 	&tdmout_a_sclk_sel,
14658ff93f28SJerome Brunet 	&tdmout_b_sclk_sel,
14668ff93f28SJerome Brunet 	&tdmout_c_sclk_sel,
14678ff93f28SJerome Brunet 	&tdmin_a_sclk_pre_en,
14688ff93f28SJerome Brunet 	&tdmin_b_sclk_pre_en,
14698ff93f28SJerome Brunet 	&tdmin_c_sclk_pre_en,
14708ff93f28SJerome Brunet 	&tdmin_lb_sclk_pre_en,
14718ff93f28SJerome Brunet 	&tdmout_a_sclk_pre_en,
14728ff93f28SJerome Brunet 	&tdmout_b_sclk_pre_en,
14738ff93f28SJerome Brunet 	&tdmout_c_sclk_pre_en,
14748ff93f28SJerome Brunet 	&tdmin_a_sclk_post_en,
14758ff93f28SJerome Brunet 	&tdmin_b_sclk_post_en,
14768ff93f28SJerome Brunet 	&tdmin_c_sclk_post_en,
14778ff93f28SJerome Brunet 	&tdmin_lb_sclk_post_en,
14788ff93f28SJerome Brunet 	&tdmout_a_sclk_post_en,
14798ff93f28SJerome Brunet 	&tdmout_b_sclk_post_en,
14808ff93f28SJerome Brunet 	&tdmout_c_sclk_post_en,
14818ff93f28SJerome Brunet 	&tdmin_a_sclk,
14828ff93f28SJerome Brunet 	&tdmin_b_sclk,
14838ff93f28SJerome Brunet 	&tdmin_c_sclk,
14848ff93f28SJerome Brunet 	&tdmin_lb_sclk,
14854fd433fdSJerome Brunet 	&g12a_tdmout_a_sclk,
14864fd433fdSJerome Brunet 	&g12a_tdmout_b_sclk,
14874fd433fdSJerome Brunet 	&g12a_tdmout_c_sclk,
14888ff93f28SJerome Brunet 	&tdmin_a_lrclk,
14898ff93f28SJerome Brunet 	&tdmin_b_lrclk,
14908ff93f28SJerome Brunet 	&tdmin_c_lrclk,
14918ff93f28SJerome Brunet 	&tdmin_lb_lrclk,
14928ff93f28SJerome Brunet 	&tdmout_a_lrclk,
14938ff93f28SJerome Brunet 	&tdmout_b_lrclk,
14948ff93f28SJerome Brunet 	&tdmout_c_lrclk,
14958ff93f28SJerome Brunet 	&spdifout_b_clk_sel,
14968ff93f28SJerome Brunet 	&spdifout_b_clk_div,
14978ff93f28SJerome Brunet 	&spdifout_b_clk,
14988ff93f28SJerome Brunet 	&g12a_tdm_mclk_pad_0,
14998ff93f28SJerome Brunet 	&g12a_tdm_mclk_pad_1,
15008ff93f28SJerome Brunet 	&g12a_tdm_lrclk_pad_0,
15018ff93f28SJerome Brunet 	&g12a_tdm_lrclk_pad_1,
15028ff93f28SJerome Brunet 	&g12a_tdm_lrclk_pad_2,
15038ff93f28SJerome Brunet 	&g12a_tdm_sclk_pad_0,
15048ff93f28SJerome Brunet 	&g12a_tdm_sclk_pad_1,
15058ff93f28SJerome Brunet 	&g12a_tdm_sclk_pad_2,
1506be4fe445SJerome Brunet 	&toram,
1507be4fe445SJerome Brunet 	&eqdrc,
1508be4fe445SJerome Brunet };
1509be4fe445SJerome Brunet 
1510be4fe445SJerome Brunet static struct clk_regmap *const sm1_clk_regmaps[] = {
1511be4fe445SJerome Brunet 	&ddr_arb,
1512be4fe445SJerome Brunet 	&pdm,
1513be4fe445SJerome Brunet 	&tdmin_a,
1514be4fe445SJerome Brunet 	&tdmin_b,
1515be4fe445SJerome Brunet 	&tdmin_c,
1516be4fe445SJerome Brunet 	&tdmin_lb,
1517be4fe445SJerome Brunet 	&tdmout_a,
1518be4fe445SJerome Brunet 	&tdmout_b,
1519be4fe445SJerome Brunet 	&tdmout_c,
1520be4fe445SJerome Brunet 	&frddr_a,
1521be4fe445SJerome Brunet 	&frddr_b,
1522be4fe445SJerome Brunet 	&frddr_c,
1523be4fe445SJerome Brunet 	&toddr_a,
1524be4fe445SJerome Brunet 	&toddr_b,
1525be4fe445SJerome Brunet 	&toddr_c,
1526be4fe445SJerome Brunet 	&loopback,
1527be4fe445SJerome Brunet 	&spdifin,
1528be4fe445SJerome Brunet 	&spdifout,
1529be4fe445SJerome Brunet 	&resample,
1530be4fe445SJerome Brunet 	&spdifout_b,
1531be4fe445SJerome Brunet 	&sm1_mst_a_mclk_sel,
1532be4fe445SJerome Brunet 	&sm1_mst_b_mclk_sel,
1533be4fe445SJerome Brunet 	&sm1_mst_c_mclk_sel,
1534be4fe445SJerome Brunet 	&sm1_mst_d_mclk_sel,
1535be4fe445SJerome Brunet 	&sm1_mst_e_mclk_sel,
1536be4fe445SJerome Brunet 	&sm1_mst_f_mclk_sel,
1537be4fe445SJerome Brunet 	&sm1_mst_a_mclk_div,
1538be4fe445SJerome Brunet 	&sm1_mst_b_mclk_div,
1539be4fe445SJerome Brunet 	&sm1_mst_c_mclk_div,
1540be4fe445SJerome Brunet 	&sm1_mst_d_mclk_div,
1541be4fe445SJerome Brunet 	&sm1_mst_e_mclk_div,
1542be4fe445SJerome Brunet 	&sm1_mst_f_mclk_div,
1543be4fe445SJerome Brunet 	&sm1_mst_a_mclk,
1544be4fe445SJerome Brunet 	&sm1_mst_b_mclk,
1545be4fe445SJerome Brunet 	&sm1_mst_c_mclk,
1546be4fe445SJerome Brunet 	&sm1_mst_d_mclk,
1547be4fe445SJerome Brunet 	&sm1_mst_e_mclk,
1548be4fe445SJerome Brunet 	&sm1_mst_f_mclk,
1549be4fe445SJerome Brunet 	&spdifout_clk_sel,
1550be4fe445SJerome Brunet 	&spdifout_clk_div,
1551be4fe445SJerome Brunet 	&spdifout_clk,
1552be4fe445SJerome Brunet 	&spdifin_clk_sel,
1553be4fe445SJerome Brunet 	&spdifin_clk_div,
1554be4fe445SJerome Brunet 	&spdifin_clk,
1555be4fe445SJerome Brunet 	&pdm_dclk_sel,
1556be4fe445SJerome Brunet 	&pdm_dclk_div,
1557be4fe445SJerome Brunet 	&pdm_dclk,
1558be4fe445SJerome Brunet 	&pdm_sysclk_sel,
1559be4fe445SJerome Brunet 	&pdm_sysclk_div,
1560be4fe445SJerome Brunet 	&pdm_sysclk,
1561be4fe445SJerome Brunet 	&mst_a_sclk_pre_en,
1562be4fe445SJerome Brunet 	&mst_b_sclk_pre_en,
1563be4fe445SJerome Brunet 	&mst_c_sclk_pre_en,
1564be4fe445SJerome Brunet 	&mst_d_sclk_pre_en,
1565be4fe445SJerome Brunet 	&mst_e_sclk_pre_en,
1566be4fe445SJerome Brunet 	&mst_f_sclk_pre_en,
1567be4fe445SJerome Brunet 	&mst_a_sclk_div,
1568be4fe445SJerome Brunet 	&mst_b_sclk_div,
1569be4fe445SJerome Brunet 	&mst_c_sclk_div,
1570be4fe445SJerome Brunet 	&mst_d_sclk_div,
1571be4fe445SJerome Brunet 	&mst_e_sclk_div,
1572be4fe445SJerome Brunet 	&mst_f_sclk_div,
1573be4fe445SJerome Brunet 	&mst_a_sclk_post_en,
1574be4fe445SJerome Brunet 	&mst_b_sclk_post_en,
1575be4fe445SJerome Brunet 	&mst_c_sclk_post_en,
1576be4fe445SJerome Brunet 	&mst_d_sclk_post_en,
1577be4fe445SJerome Brunet 	&mst_e_sclk_post_en,
1578be4fe445SJerome Brunet 	&mst_f_sclk_post_en,
1579be4fe445SJerome Brunet 	&mst_a_sclk,
1580be4fe445SJerome Brunet 	&mst_b_sclk,
1581be4fe445SJerome Brunet 	&mst_c_sclk,
1582be4fe445SJerome Brunet 	&mst_d_sclk,
1583be4fe445SJerome Brunet 	&mst_e_sclk,
1584be4fe445SJerome Brunet 	&mst_f_sclk,
1585be4fe445SJerome Brunet 	&mst_a_lrclk_div,
1586be4fe445SJerome Brunet 	&mst_b_lrclk_div,
1587be4fe445SJerome Brunet 	&mst_c_lrclk_div,
1588be4fe445SJerome Brunet 	&mst_d_lrclk_div,
1589be4fe445SJerome Brunet 	&mst_e_lrclk_div,
1590be4fe445SJerome Brunet 	&mst_f_lrclk_div,
1591be4fe445SJerome Brunet 	&mst_a_lrclk,
1592be4fe445SJerome Brunet 	&mst_b_lrclk,
1593be4fe445SJerome Brunet 	&mst_c_lrclk,
1594be4fe445SJerome Brunet 	&mst_d_lrclk,
1595be4fe445SJerome Brunet 	&mst_e_lrclk,
1596be4fe445SJerome Brunet 	&mst_f_lrclk,
1597be4fe445SJerome Brunet 	&tdmin_a_sclk_sel,
1598be4fe445SJerome Brunet 	&tdmin_b_sclk_sel,
1599be4fe445SJerome Brunet 	&tdmin_c_sclk_sel,
1600be4fe445SJerome Brunet 	&tdmin_lb_sclk_sel,
1601be4fe445SJerome Brunet 	&tdmout_a_sclk_sel,
1602be4fe445SJerome Brunet 	&tdmout_b_sclk_sel,
1603be4fe445SJerome Brunet 	&tdmout_c_sclk_sel,
1604be4fe445SJerome Brunet 	&tdmin_a_sclk_pre_en,
1605be4fe445SJerome Brunet 	&tdmin_b_sclk_pre_en,
1606be4fe445SJerome Brunet 	&tdmin_c_sclk_pre_en,
1607be4fe445SJerome Brunet 	&tdmin_lb_sclk_pre_en,
1608be4fe445SJerome Brunet 	&tdmout_a_sclk_pre_en,
1609be4fe445SJerome Brunet 	&tdmout_b_sclk_pre_en,
1610be4fe445SJerome Brunet 	&tdmout_c_sclk_pre_en,
1611be4fe445SJerome Brunet 	&tdmin_a_sclk_post_en,
1612be4fe445SJerome Brunet 	&tdmin_b_sclk_post_en,
1613be4fe445SJerome Brunet 	&tdmin_c_sclk_post_en,
1614be4fe445SJerome Brunet 	&tdmin_lb_sclk_post_en,
1615be4fe445SJerome Brunet 	&tdmout_a_sclk_post_en,
1616be4fe445SJerome Brunet 	&tdmout_b_sclk_post_en,
1617be4fe445SJerome Brunet 	&tdmout_c_sclk_post_en,
1618be4fe445SJerome Brunet 	&tdmin_a_sclk,
1619be4fe445SJerome Brunet 	&tdmin_b_sclk,
1620be4fe445SJerome Brunet 	&tdmin_c_sclk,
1621be4fe445SJerome Brunet 	&tdmin_lb_sclk,
16224fd433fdSJerome Brunet 	&g12a_tdmout_a_sclk,
16234fd433fdSJerome Brunet 	&g12a_tdmout_b_sclk,
16244fd433fdSJerome Brunet 	&g12a_tdmout_c_sclk,
1625be4fe445SJerome Brunet 	&tdmin_a_lrclk,
1626be4fe445SJerome Brunet 	&tdmin_b_lrclk,
1627be4fe445SJerome Brunet 	&tdmin_c_lrclk,
1628be4fe445SJerome Brunet 	&tdmin_lb_lrclk,
1629be4fe445SJerome Brunet 	&tdmout_a_lrclk,
1630be4fe445SJerome Brunet 	&tdmout_b_lrclk,
1631be4fe445SJerome Brunet 	&tdmout_c_lrclk,
1632be4fe445SJerome Brunet 	&spdifout_b_clk_sel,
1633be4fe445SJerome Brunet 	&spdifout_b_clk_div,
1634be4fe445SJerome Brunet 	&spdifout_b_clk,
1635be4fe445SJerome Brunet 	&sm1_tdm_mclk_pad_0,
1636be4fe445SJerome Brunet 	&sm1_tdm_mclk_pad_1,
1637be4fe445SJerome Brunet 	&sm1_tdm_lrclk_pad_0,
1638be4fe445SJerome Brunet 	&sm1_tdm_lrclk_pad_1,
1639be4fe445SJerome Brunet 	&sm1_tdm_lrclk_pad_2,
1640be4fe445SJerome Brunet 	&sm1_tdm_sclk_pad_0,
1641be4fe445SJerome Brunet 	&sm1_tdm_sclk_pad_1,
1642be4fe445SJerome Brunet 	&sm1_tdm_sclk_pad_2,
1643be4fe445SJerome Brunet 	&sm1_aud_top,
1644be4fe445SJerome Brunet 	&toram,
1645be4fe445SJerome Brunet 	&eqdrc,
1646be4fe445SJerome Brunet 	&resample_b,
1647be4fe445SJerome Brunet 	&tovad,
1648be4fe445SJerome Brunet 	&locker,
1649be4fe445SJerome Brunet 	&spdifin_lb,
1650be4fe445SJerome Brunet 	&frddr_d,
1651be4fe445SJerome Brunet 	&toddr_d,
1652be4fe445SJerome Brunet 	&loopback_b,
1653be4fe445SJerome Brunet 	&sm1_clk81_en,
1654be4fe445SJerome Brunet 	&sm1_sysclk_a_div,
1655be4fe445SJerome Brunet 	&sm1_sysclk_a_en,
1656be4fe445SJerome Brunet 	&sm1_sysclk_b_div,
1657be4fe445SJerome Brunet 	&sm1_sysclk_b_en,
16581cd50181SJerome Brunet };
16591cd50181SJerome Brunet 
1660f03566d0SJerome Brunet static int devm_clk_get_enable(struct device *dev, char *id)
16611cd50181SJerome Brunet {
16621cd50181SJerome Brunet 	struct clk *clk;
16631cd50181SJerome Brunet 	int ret;
16641cd50181SJerome Brunet 
16651cd50181SJerome Brunet 	clk = devm_clk_get(dev, id);
16661cd50181SJerome Brunet 	if (IS_ERR(clk)) {
1667f03566d0SJerome Brunet 		ret = PTR_ERR(clk);
1668*50cb321fSJerome Brunet 		dev_err_probe(dev, ret, "failed to get %s", id);
1669f03566d0SJerome Brunet 		return ret;
16701cd50181SJerome Brunet 	}
16711cd50181SJerome Brunet 
16721cd50181SJerome Brunet 	ret = clk_prepare_enable(clk);
16731cd50181SJerome Brunet 	if (ret) {
16741cd50181SJerome Brunet 		dev_err(dev, "failed to enable %s", id);
1675f03566d0SJerome Brunet 		return ret;
16761cd50181SJerome Brunet 	}
16771cd50181SJerome Brunet 
16781cd50181SJerome Brunet 	ret = devm_add_action_or_reset(dev,
16791cd50181SJerome Brunet 				       (void(*)(void *))clk_disable_unprepare,
16801cd50181SJerome Brunet 				       clk);
16811cd50181SJerome Brunet 	if (ret) {
16821cd50181SJerome Brunet 		dev_err(dev, "failed to add reset action on %s", id);
1683f03566d0SJerome Brunet 		return ret;
16841cd50181SJerome Brunet 	}
16851cd50181SJerome Brunet 
1686f03566d0SJerome Brunet 	return 0;
16871cd50181SJerome Brunet }
16881cd50181SJerome Brunet 
16897cfefab6SJerome Brunet struct axg_audio_reset_data {
16907cfefab6SJerome Brunet 	struct reset_controller_dev rstc;
16917cfefab6SJerome Brunet 	struct regmap *map;
16927cfefab6SJerome Brunet 	unsigned int offset;
16937cfefab6SJerome Brunet };
16947cfefab6SJerome Brunet 
16957cfefab6SJerome Brunet static void axg_audio_reset_reg_and_bit(struct axg_audio_reset_data *rst,
16967cfefab6SJerome Brunet 					unsigned long id,
16977cfefab6SJerome Brunet 					unsigned int *reg,
16987cfefab6SJerome Brunet 					unsigned int *bit)
16997cfefab6SJerome Brunet {
17007cfefab6SJerome Brunet 	unsigned int stride = regmap_get_reg_stride(rst->map);
17017cfefab6SJerome Brunet 
17027cfefab6SJerome Brunet 	*reg = (id / (stride * BITS_PER_BYTE)) * stride;
17037cfefab6SJerome Brunet 	*reg += rst->offset;
17047cfefab6SJerome Brunet 	*bit = id % (stride * BITS_PER_BYTE);
17057cfefab6SJerome Brunet }
17067cfefab6SJerome Brunet 
17077cfefab6SJerome Brunet static int axg_audio_reset_update(struct reset_controller_dev *rcdev,
17087cfefab6SJerome Brunet 				unsigned long id, bool assert)
17097cfefab6SJerome Brunet {
17107cfefab6SJerome Brunet 	struct axg_audio_reset_data *rst =
17117cfefab6SJerome Brunet 		container_of(rcdev, struct axg_audio_reset_data, rstc);
17127cfefab6SJerome Brunet 	unsigned int offset, bit;
17137cfefab6SJerome Brunet 
17147cfefab6SJerome Brunet 	axg_audio_reset_reg_and_bit(rst, id, &offset, &bit);
17157cfefab6SJerome Brunet 
17167cfefab6SJerome Brunet 	regmap_update_bits(rst->map, offset, BIT(bit),
17177cfefab6SJerome Brunet 			assert ? BIT(bit) : 0);
17187cfefab6SJerome Brunet 
17197cfefab6SJerome Brunet 	return 0;
17207cfefab6SJerome Brunet }
17217cfefab6SJerome Brunet 
17227cfefab6SJerome Brunet static int axg_audio_reset_status(struct reset_controller_dev *rcdev,
17237cfefab6SJerome Brunet 				unsigned long id)
17247cfefab6SJerome Brunet {
17257cfefab6SJerome Brunet 	struct axg_audio_reset_data *rst =
17267cfefab6SJerome Brunet 		container_of(rcdev, struct axg_audio_reset_data, rstc);
17277cfefab6SJerome Brunet 	unsigned int val, offset, bit;
17287cfefab6SJerome Brunet 
17297cfefab6SJerome Brunet 	axg_audio_reset_reg_and_bit(rst, id, &offset, &bit);
17307cfefab6SJerome Brunet 
17317cfefab6SJerome Brunet 	regmap_read(rst->map, offset, &val);
17327cfefab6SJerome Brunet 
17337cfefab6SJerome Brunet 	return !!(val & BIT(bit));
17347cfefab6SJerome Brunet }
17357cfefab6SJerome Brunet 
17367cfefab6SJerome Brunet static int axg_audio_reset_assert(struct reset_controller_dev *rcdev,
17377cfefab6SJerome Brunet 				unsigned long id)
17387cfefab6SJerome Brunet {
17397cfefab6SJerome Brunet 	return axg_audio_reset_update(rcdev, id, true);
17407cfefab6SJerome Brunet }
17417cfefab6SJerome Brunet 
17427cfefab6SJerome Brunet static int axg_audio_reset_deassert(struct reset_controller_dev *rcdev,
17437cfefab6SJerome Brunet 				unsigned long id)
17447cfefab6SJerome Brunet {
17457cfefab6SJerome Brunet 	return axg_audio_reset_update(rcdev, id, false);
17467cfefab6SJerome Brunet }
17477cfefab6SJerome Brunet 
17487cfefab6SJerome Brunet static int axg_audio_reset_toggle(struct reset_controller_dev *rcdev,
17497cfefab6SJerome Brunet 				unsigned long id)
17507cfefab6SJerome Brunet {
17517cfefab6SJerome Brunet 	int ret;
17527cfefab6SJerome Brunet 
17537cfefab6SJerome Brunet 	ret = axg_audio_reset_assert(rcdev, id);
17547cfefab6SJerome Brunet 	if (ret)
17557cfefab6SJerome Brunet 		return ret;
17567cfefab6SJerome Brunet 
17577cfefab6SJerome Brunet 	return axg_audio_reset_deassert(rcdev, id);
17587cfefab6SJerome Brunet }
17597cfefab6SJerome Brunet 
17607cfefab6SJerome Brunet static const struct reset_control_ops axg_audio_rstc_ops = {
17617cfefab6SJerome Brunet 	.assert = axg_audio_reset_assert,
17627cfefab6SJerome Brunet 	.deassert = axg_audio_reset_deassert,
17637cfefab6SJerome Brunet 	.reset = axg_audio_reset_toggle,
17647cfefab6SJerome Brunet 	.status = axg_audio_reset_status,
17657cfefab6SJerome Brunet };
17667cfefab6SJerome Brunet 
17671cd50181SJerome Brunet static const struct regmap_config axg_audio_regmap_cfg = {
17681cd50181SJerome Brunet 	.reg_bits	= 32,
17691cd50181SJerome Brunet 	.val_bits	= 32,
17701cd50181SJerome Brunet 	.reg_stride	= 4,
1771255cab9dSJerome Brunet 	.max_register	= AUDIO_CLK_SPDIFOUT_B_CTRL,
17721cd50181SJerome Brunet };
17731cd50181SJerome Brunet 
177407500138SMaxime Jourdan struct audioclk_data {
1775be4fe445SJerome Brunet 	struct clk_regmap *const *regmap_clks;
1776be4fe445SJerome Brunet 	unsigned int regmap_clk_num;
177707500138SMaxime Jourdan 	struct clk_hw_onecell_data *hw_onecell_data;
17787cfefab6SJerome Brunet 	unsigned int reset_offset;
17797cfefab6SJerome Brunet 	unsigned int reset_num;
178007500138SMaxime Jourdan };
178107500138SMaxime Jourdan 
17821cd50181SJerome Brunet static int axg_audio_clkc_probe(struct platform_device *pdev)
17831cd50181SJerome Brunet {
17841cd50181SJerome Brunet 	struct device *dev = &pdev->dev;
178507500138SMaxime Jourdan 	const struct audioclk_data *data;
17867cfefab6SJerome Brunet 	struct axg_audio_reset_data *rst;
17871cd50181SJerome Brunet 	struct regmap *map;
17881cd50181SJerome Brunet 	void __iomem *regs;
17891cd50181SJerome Brunet 	struct clk_hw *hw;
17901cd50181SJerome Brunet 	int ret, i;
17911cd50181SJerome Brunet 
179207500138SMaxime Jourdan 	data = of_device_get_match_data(dev);
179307500138SMaxime Jourdan 	if (!data)
179407500138SMaxime Jourdan 		return -EINVAL;
179507500138SMaxime Jourdan 
179650bf025bSYueHaibing 	regs = devm_platform_ioremap_resource(pdev, 0);
17971cd50181SJerome Brunet 	if (IS_ERR(regs))
17981cd50181SJerome Brunet 		return PTR_ERR(regs);
17991cd50181SJerome Brunet 
18001cd50181SJerome Brunet 	map = devm_regmap_init_mmio(dev, regs, &axg_audio_regmap_cfg);
18011cd50181SJerome Brunet 	if (IS_ERR(map)) {
18021cd50181SJerome Brunet 		dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(map));
18031cd50181SJerome Brunet 		return PTR_ERR(map);
18041cd50181SJerome Brunet 	}
18051cd50181SJerome Brunet 
18061cd50181SJerome Brunet 	/* Get the mandatory peripheral clock */
1807f03566d0SJerome Brunet 	ret = devm_clk_get_enable(dev, "pclk");
1808f03566d0SJerome Brunet 	if (ret)
1809f03566d0SJerome Brunet 		return ret;
18101cd50181SJerome Brunet 
18111cd50181SJerome Brunet 	ret = device_reset(dev);
18121cd50181SJerome Brunet 	if (ret) {
1813*50cb321fSJerome Brunet 		dev_err_probe(dev, ret, "failed to reset device\n");
18141cd50181SJerome Brunet 		return ret;
18151cd50181SJerome Brunet 	}
18161cd50181SJerome Brunet 
18171cd50181SJerome Brunet 	/* Populate regmap for the regmap backed clocks */
1818be4fe445SJerome Brunet 	for (i = 0; i < data->regmap_clk_num; i++)
1819be4fe445SJerome Brunet 		data->regmap_clks[i]->map = map;
18201cd50181SJerome Brunet 
18211cd50181SJerome Brunet 	/* Take care to skip the registered input clocks */
182207500138SMaxime Jourdan 	for (i = AUD_CLKID_DDR_ARB; i < data->hw_onecell_data->num; i++) {
18231610dd79SStephen Boyd 		const char *name;
18241610dd79SStephen Boyd 
182507500138SMaxime Jourdan 		hw = data->hw_onecell_data->hws[i];
18261cd50181SJerome Brunet 		/* array might be sparse */
18271cd50181SJerome Brunet 		if (!hw)
18281cd50181SJerome Brunet 			continue;
18291cd50181SJerome Brunet 
18301610dd79SStephen Boyd 		name = hw->init->name;
18311610dd79SStephen Boyd 
18321cd50181SJerome Brunet 		ret = devm_clk_hw_register(dev, hw);
18331cd50181SJerome Brunet 		if (ret) {
18341610dd79SStephen Boyd 			dev_err(dev, "failed to register clock %s\n", name);
18351cd50181SJerome Brunet 			return ret;
18361cd50181SJerome Brunet 		}
18371cd50181SJerome Brunet 	}
18381cd50181SJerome Brunet 
18397cfefab6SJerome Brunet 	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
184007500138SMaxime Jourdan 					data->hw_onecell_data);
18417cfefab6SJerome Brunet 	if (ret)
18427cfefab6SJerome Brunet 		return ret;
18437cfefab6SJerome Brunet 
18447cfefab6SJerome Brunet 	/* Stop here if there is no reset */
18457cfefab6SJerome Brunet 	if (!data->reset_num)
18467cfefab6SJerome Brunet 		return 0;
18477cfefab6SJerome Brunet 
18487cfefab6SJerome Brunet 	rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL);
18497cfefab6SJerome Brunet 	if (!rst)
18507cfefab6SJerome Brunet 		return -ENOMEM;
18517cfefab6SJerome Brunet 
18527cfefab6SJerome Brunet 	rst->map = map;
18537cfefab6SJerome Brunet 	rst->offset = data->reset_offset;
18547cfefab6SJerome Brunet 	rst->rstc.nr_resets = data->reset_num;
18557cfefab6SJerome Brunet 	rst->rstc.ops = &axg_audio_rstc_ops;
18567cfefab6SJerome Brunet 	rst->rstc.of_node = dev->of_node;
18577cfefab6SJerome Brunet 	rst->rstc.owner = THIS_MODULE;
18587cfefab6SJerome Brunet 
18597cfefab6SJerome Brunet 	return devm_reset_controller_register(dev, &rst->rstc);
18601cd50181SJerome Brunet }
18611cd50181SJerome Brunet 
186207500138SMaxime Jourdan static const struct audioclk_data axg_audioclk_data = {
1863be4fe445SJerome Brunet 	.regmap_clks = axg_clk_regmaps,
1864be4fe445SJerome Brunet 	.regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps),
186507500138SMaxime Jourdan 	.hw_onecell_data = &axg_audio_hw_onecell_data,
186607500138SMaxime Jourdan };
186707500138SMaxime Jourdan 
186807500138SMaxime Jourdan static const struct audioclk_data g12a_audioclk_data = {
1869cdabb1ffSJerome Brunet 	.regmap_clks = g12a_clk_regmaps,
1870cdabb1ffSJerome Brunet 	.regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
187107500138SMaxime Jourdan 	.hw_onecell_data = &g12a_audio_hw_onecell_data,
18727cfefab6SJerome Brunet 	.reset_offset = AUDIO_SW_RESET,
18737cfefab6SJerome Brunet 	.reset_num = 26,
187407500138SMaxime Jourdan };
187507500138SMaxime Jourdan 
1876be4fe445SJerome Brunet static const struct audioclk_data sm1_audioclk_data = {
1877be4fe445SJerome Brunet 	.regmap_clks = sm1_clk_regmaps,
1878be4fe445SJerome Brunet 	.regmap_clk_num = ARRAY_SIZE(sm1_clk_regmaps),
1879be4fe445SJerome Brunet 	.hw_onecell_data = &sm1_audio_hw_onecell_data,
1880be4fe445SJerome Brunet 	.reset_offset = AUDIO_SM1_SW_RESET0,
1881be4fe445SJerome Brunet 	.reset_num = 39,
1882be4fe445SJerome Brunet };
1883be4fe445SJerome Brunet 
18841cd50181SJerome Brunet static const struct of_device_id clkc_match_table[] = {
188507500138SMaxime Jourdan 	{
188607500138SMaxime Jourdan 		.compatible = "amlogic,axg-audio-clkc",
188707500138SMaxime Jourdan 		.data = &axg_audioclk_data
188807500138SMaxime Jourdan 	}, {
188907500138SMaxime Jourdan 		.compatible = "amlogic,g12a-audio-clkc",
189007500138SMaxime Jourdan 		.data = &g12a_audioclk_data
1891be4fe445SJerome Brunet 	}, {
1892be4fe445SJerome Brunet 		.compatible = "amlogic,sm1-audio-clkc",
1893be4fe445SJerome Brunet 		.data = &sm1_audioclk_data
189407500138SMaxime Jourdan 	}, {}
18951cd50181SJerome Brunet };
18961cd50181SJerome Brunet MODULE_DEVICE_TABLE(of, clkc_match_table);
18971cd50181SJerome Brunet 
18981cd50181SJerome Brunet static struct platform_driver axg_audio_driver = {
18991cd50181SJerome Brunet 	.probe		= axg_audio_clkc_probe,
19001cd50181SJerome Brunet 	.driver		= {
19011cd50181SJerome Brunet 		.name	= "axg-audio-clkc",
19021cd50181SJerome Brunet 		.of_match_table = clkc_match_table,
19031cd50181SJerome Brunet 	},
19041cd50181SJerome Brunet };
19051cd50181SJerome Brunet module_platform_driver(axg_audio_driver);
19061cd50181SJerome Brunet 
1907be4fe445SJerome Brunet MODULE_DESCRIPTION("Amlogic AXG/G12A/SM1 Audio Clock driver");
19081cd50181SJerome Brunet MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
19091cd50181SJerome Brunet MODULE_LICENSE("GPL v2");
1910