xref: /openbmc/linux/sound/soc/codecs/rt722-sdca-sdw.h (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1*7f5d6036SJack Yu /* SPDX-License-Identifier: GPL-2.0-only */
2*7f5d6036SJack Yu /*
3*7f5d6036SJack Yu  * rt722-sdca-sdw.h -- RT722 SDCA ALSA SoC audio driver header
4*7f5d6036SJack Yu  *
5*7f5d6036SJack Yu  * Copyright(c) 2023 Realtek Semiconductor Corp.
6*7f5d6036SJack Yu  */
7*7f5d6036SJack Yu 
8*7f5d6036SJack Yu #ifndef __RT722_SDW_H__
9*7f5d6036SJack Yu #define __RT722_SDW_H__
10*7f5d6036SJack Yu 
11*7f5d6036SJack Yu #include <linux/regmap.h>
12*7f5d6036SJack Yu #include <linux/soundwire/sdw_registers.h>
13*7f5d6036SJack Yu 
14*7f5d6036SJack Yu static const struct reg_default rt722_sdca_reg_defaults[] = {
15*7f5d6036SJack Yu 	{ 0x202d, 0x00 },
16*7f5d6036SJack Yu 	{ 0x2f01, 0x00 },
17*7f5d6036SJack Yu 	{ 0x2f02, 0x09 },
18*7f5d6036SJack Yu 	{ 0x2f03, 0x00 },
19*7f5d6036SJack Yu 	{ 0x2f04, 0x00 },
20*7f5d6036SJack Yu 	{ 0x2f05, 0x0b },
21*7f5d6036SJack Yu 	{ 0x2f06, 0x01 },
22*7f5d6036SJack Yu 	{ 0x2f08, 0x00 },
23*7f5d6036SJack Yu 	{ 0x2f09, 0x00 },
24*7f5d6036SJack Yu 	{ 0x2f0a, 0x00 },
25*7f5d6036SJack Yu 	{ 0x2f35, 0x00 },
26*7f5d6036SJack Yu 	{ 0x2f36, 0x00 },
27*7f5d6036SJack Yu 	{ 0x2f50, 0xf0 },
28*7f5d6036SJack Yu 	{ 0x2f58, 0x07 },
29*7f5d6036SJack Yu 	{ 0x2f59, 0x07 },
30*7f5d6036SJack Yu 	{ 0x2f5a, 0x07 },
31*7f5d6036SJack Yu 	{ 0x2f5b, 0x07 },
32*7f5d6036SJack Yu 	{ 0x2f5c, 0x27 },
33*7f5d6036SJack Yu 	{ 0x2f5d, 0x07 },
34*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_CS01, RT722_SDCA_CTL_SAMPLE_FREQ_INDEX,
35*7f5d6036SJack Yu 		0), 0x09 },
36*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_CS11, RT722_SDCA_CTL_SAMPLE_FREQ_INDEX,
37*7f5d6036SJack Yu 		0), 0x09 },
38*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_PDE12, RT722_SDCA_CTL_REQ_POWER_STATE,
39*7f5d6036SJack Yu 		0), 0x03 },
40*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_PDE40, RT722_SDCA_CTL_REQ_POWER_STATE,
41*7f5d6036SJack Yu 		0), 0x03 },
42*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU05, RT722_SDCA_CTL_FU_MUTE, CH_L),
43*7f5d6036SJack Yu 		0x01 },
44*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU05, RT722_SDCA_CTL_FU_MUTE, CH_R),
45*7f5d6036SJack Yu 		0x01 },
46*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU0F, RT722_SDCA_CTL_FU_MUTE, CH_L),
47*7f5d6036SJack Yu 		0x01 },
48*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU0F, RT722_SDCA_CTL_FU_MUTE, CH_R),
49*7f5d6036SJack Yu 		0x01 },
50*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_CS1F, RT722_SDCA_CTL_SAMPLE_FREQ_INDEX,
51*7f5d6036SJack Yu 		0), 0x09 },
52*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_MUTE, CH_01),
53*7f5d6036SJack Yu 		0x01 },
54*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_MUTE, CH_02),
55*7f5d6036SJack Yu 		0x01 },
56*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_MUTE, CH_03),
57*7f5d6036SJack Yu 		0x01 },
58*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_MUTE, CH_04),
59*7f5d6036SJack Yu 		0x01 },
60*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_PDE2A, RT722_SDCA_CTL_REQ_POWER_STATE, 0),
61*7f5d6036SJack Yu 		0x03 },
62*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_IT26, RT722_SDCA_CTL_VENDOR_DEF, 0),
63*7f5d6036SJack Yu 		0x00 },
64*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_CS31, RT722_SDCA_CTL_SAMPLE_FREQ_INDEX, 0),
65*7f5d6036SJack Yu 		0x09 },
66*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_USER_FU06, RT722_SDCA_CTL_FU_MUTE, CH_L),
67*7f5d6036SJack Yu 		0x01 },
68*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_USER_FU06, RT722_SDCA_CTL_FU_MUTE, CH_R),
69*7f5d6036SJack Yu 		0x01 },
70*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_PDE23, RT722_SDCA_CTL_REQ_POWER_STATE, 0),
71*7f5d6036SJack Yu 		0x03 },
72*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_OT23, RT722_SDCA_CTL_VENDOR_DEF, 0), 0x00 },
73*7f5d6036SJack Yu };
74*7f5d6036SJack Yu 
75*7f5d6036SJack Yu static const struct reg_default rt722_sdca_mbq_defaults[] = {
76*7f5d6036SJack Yu 	{ 0x200003c, 0xc214 },
77*7f5d6036SJack Yu 	{ 0x2000046, 0x8004 },
78*7f5d6036SJack Yu 	{ 0x6100006, 0x0005 },
79*7f5d6036SJack Yu 	{ 0x6100010, 0x2630 },
80*7f5d6036SJack Yu 	{ 0x6100011, 0x152f },
81*7f5d6036SJack Yu 	{ 0x6100013, 0x0102 },
82*7f5d6036SJack Yu 	{ 0x6100015, 0x2200 },
83*7f5d6036SJack Yu 	{ 0x6100017, 0x0102 },
84*7f5d6036SJack Yu 	{ 0x6100025, 0x2a29 },
85*7f5d6036SJack Yu 	{ 0x6100026, 0x2a00 },
86*7f5d6036SJack Yu 	{ 0x6100028, 0x2a2a },
87*7f5d6036SJack Yu 	{ 0x6100029, 0x4141 },
88*7f5d6036SJack Yu 	{ 0x6100055, 0x0000 },
89*7f5d6036SJack Yu 	{ 0x5810000, 0x702d },
90*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU05, RT722_SDCA_CTL_FU_VOLUME,
91*7f5d6036SJack Yu 		CH_L), 0x0000 },
92*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU05, RT722_SDCA_CTL_FU_VOLUME,
93*7f5d6036SJack Yu 		CH_R), 0x0000 },
94*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU0F, RT722_SDCA_CTL_FU_VOLUME,
95*7f5d6036SJack Yu 		CH_L), 0x0000 },
96*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_USER_FU0F, RT722_SDCA_CTL_FU_VOLUME,
97*7f5d6036SJack Yu 		CH_R), 0x0000 },
98*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_PLATFORM_FU44, RT722_SDCA_CTL_FU_CH_GAIN,
99*7f5d6036SJack Yu 		CH_L), 0x0000 },
100*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_PLATFORM_FU44, RT722_SDCA_CTL_FU_CH_GAIN,
101*7f5d6036SJack Yu 		CH_R), 0x0000 },
102*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_VOLUME,
103*7f5d6036SJack Yu 		CH_01), 0x0000 },
104*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_VOLUME,
105*7f5d6036SJack Yu 		CH_02), 0x0000 },
106*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_VOLUME,
107*7f5d6036SJack Yu 		CH_03), 0x0000 },
108*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_USER_FU1E, RT722_SDCA_CTL_FU_VOLUME,
109*7f5d6036SJack Yu 		CH_04), 0x0000 },
110*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_FU15, RT722_SDCA_CTL_FU_CH_GAIN, CH_01),
111*7f5d6036SJack Yu 		0x0000 },
112*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_FU15, RT722_SDCA_CTL_FU_CH_GAIN, CH_02),
113*7f5d6036SJack Yu 		0x0000 },
114*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_FU15, RT722_SDCA_CTL_FU_CH_GAIN, CH_03),
115*7f5d6036SJack Yu 		0x0000 },
116*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_FU15, RT722_SDCA_CTL_FU_CH_GAIN, CH_04),
117*7f5d6036SJack Yu 		0x0000 },
118*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_USER_FU06, RT722_SDCA_CTL_FU_VOLUME, CH_L),
119*7f5d6036SJack Yu 		0x0000 },
120*7f5d6036SJack Yu 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_USER_FU06, RT722_SDCA_CTL_FU_VOLUME, CH_R),
121*7f5d6036SJack Yu 		0x0000 },
122*7f5d6036SJack Yu };
123*7f5d6036SJack Yu 
124*7f5d6036SJack Yu #endif /* __RT722_SDW_H__ */
125