xref: /linux/sound/soc/codecs/rt712-sdca-sdw.h (revision c9dc580c43b8d83de0c14158e826f79e41098822)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * rt712-sdca-sdw.h -- RT712 SDCA ALSA SoC audio driver header
4  *
5  * Copyright(c) 2023 Realtek Semiconductor Corp.
6  */
7 
8 #ifndef __RT712_SDW_H__
9 #define __RT712_SDW_H__
10 
11 #include <linux/regmap.h>
12 #include <linux/soundwire/sdw_registers.h>
13 
14 static const struct reg_default rt712_sdca_reg_defaults[] = {
15 	{ 0x201a, 0x00 },
16 	{ 0x201b, 0x00 },
17 	{ 0x201c, 0x00 },
18 	{ 0x201d, 0x00 },
19 	{ 0x201e, 0x00 },
20 	{ 0x201f, 0x00 },
21 	{ 0x2029, 0x00 },
22 	{ 0x202a, 0x00 },
23 	{ 0x202d, 0x00 },
24 	{ 0x202e, 0x00 },
25 	{ 0x202f, 0x00 },
26 	{ 0x2030, 0x00 },
27 	{ 0x2031, 0x00 },
28 	{ 0x2032, 0x00 },
29 	{ 0x2033, 0x00 },
30 	{ 0x2034, 0x00 },
31 	{ 0x2230, 0x00 },
32 	{ 0x2231, 0x2f },
33 	{ 0x2232, 0x80 },
34 	{ 0x2f01, 0x00 },
35 	{ 0x2f02, 0x09 },
36 	{ 0x2f03, 0x00 },
37 	{ 0x2f04, 0x00 },
38 	{ 0x2f05, 0x0b },
39 	{ 0x2f06, 0x01 },
40 	{ 0x2f08, 0x00 },
41 	{ 0x2f09, 0x00 },
42 	{ 0x2f0a, 0x01 },
43 	{ 0x2f35, 0x01 },
44 	{ 0x2f36, 0xcf },
45 	{ 0x2f50, 0x0f },
46 	{ 0x2f54, 0x01 },
47 	{ 0x2f58, 0x07 },
48 	{ 0x2f59, 0x09 },
49 	{ 0x2f5a, 0x01 },
50 	{ 0x2f5b, 0x07 },
51 	{ 0x2f5c, 0x05 },
52 	{ 0x2f5d, 0x05 },
53 	{ 0x3201, 0x01 },
54 	{ 0x320c, 0x00 },
55 	{ 0x3301, 0x01 },
56 	{ 0x3302, 0x00 },
57 	{ 0x3303, 0x1f },
58 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_CS01, RT712_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
59 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_CS11, RT712_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
60 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU05, RT712_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
61 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU05, RT712_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
62 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU0F, RT712_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
63 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU0F, RT712_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
64 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_PDE40, RT712_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
65 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_PDE12, RT712_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
66 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_CS31, RT712_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), 0x09 },
67 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_PDE23, RT712_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
68 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_USER_FU06, RT712_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
69 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_USER_FU06, RT712_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
70 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_OT23, RT712_SDCA_CTL_VENDOR_DEF, 0), 0x00 },
71 };
72 
73 static const struct reg_default rt712_sdca_mbq_defaults[] = {
74 	{ 0x2000004, 0xaa01 },
75 	{ 0x200000e, 0x21e0 },
76 	{ 0x2000024, 0x01ba },
77 	{ 0x200004a, 0x8830 },
78 	{ 0x2000067, 0xf100 },
79 	{ 0x5800000, 0x1893 },
80 	{ 0x5b00000, 0x0407 },
81 	{ 0x5b00005, 0x0000 },
82 	{ 0x5b00029, 0x3fff },
83 	{ 0x5b0002a, 0xf000 },
84 	{ 0x5f00008, 0x7000 },
85 	{ 0x610000e, 0x0007 },
86 	{ 0x6100022, 0x2828 },
87 	{ 0x6100023, 0x2929 },
88 	{ 0x6100026, 0x2c29 },
89 	{ 0x610002c, 0x4150 },
90 	{ 0x6100045, 0x0860 },
91 	{ 0x6100046, 0x0029 },
92 	{ 0x6100053, 0x3fff },
93 	{ 0x6100055, 0x0000 },
94 	{ 0x6100060, 0x0000 },
95 	{ 0x6100064, 0x8000 },
96 	{ 0x6100065, 0x0000 },
97 	{ 0x6100067, 0xff12 },
98 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU05, RT712_SDCA_CTL_FU_VOLUME, CH_L), 0x0000 },
99 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU05, RT712_SDCA_CTL_FU_VOLUME, CH_R), 0x0000 },
100 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU0F, RT712_SDCA_CTL_FU_VOLUME, CH_L), 0x0000 },
101 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_USER_FU0F, RT712_SDCA_CTL_FU_VOLUME, CH_R), 0x0000 },
102 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_PLATFORM_FU44, RT712_SDCA_CTL_FU_CH_GAIN, CH_L), 0x0000 },
103 	{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT712_SDCA_ENT_PLATFORM_FU44, RT712_SDCA_CTL_FU_CH_GAIN, CH_R), 0x0000 },
104 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_USER_FU06, RT712_SDCA_CTL_FU_VOLUME, CH_L), 0x0000 },
105 	{ SDW_SDCA_CTL(FUNC_NUM_AMP, RT712_SDCA_ENT_USER_FU06, RT712_SDCA_CTL_FU_VOLUME, CH_R), 0x0000 },
106 };
107 
108 #endif /* __RT712_SDW_H__ */
109