diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/components/codec/sgtl5000/fsl_sgtl5000.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/components/codec/sgtl5000/fsl_sgtl5000.h | 1045 |
1 files changed, 1045 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/components/codec/sgtl5000/fsl_sgtl5000.h b/lib/chibios-contrib/ext/mcux-sdk/components/codec/sgtl5000/fsl_sgtl5000.h new file mode 100644 index 000000000..a424b8a35 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/components/codec/sgtl5000/fsl_sgtl5000.h | |||
@@ -0,0 +1,1045 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2019 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _FSL_SGTL5000_H_ | ||
10 | #define _FSL_SGTL5000_H_ | ||
11 | |||
12 | #include "fsl_codec_i2c.h" | ||
13 | |||
14 | /*! | ||
15 | * @addtogroup sgtl5000 | ||
16 | * @{ | ||
17 | */ | ||
18 | |||
19 | /******************************************************************************* | ||
20 | * Definitions | ||
21 | ******************************************************************************/ | ||
22 | /*! @name Driver version */ | ||
23 | /*@{*/ | ||
24 | /*! @brief CLOCK driver version 2.1.1. */ | ||
25 | #define FSL_SGTL5000_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) | ||
26 | /*@}*/ | ||
27 | |||
28 | /*! @brief Define the register address of sgtl5000. */ | ||
29 | #define CHIP_ID 0x0000U | ||
30 | #define CHIP_DIG_POWER 0x0002U | ||
31 | #define CHIP_CLK_CTRL 0x0004U | ||
32 | #define CHIP_I2S_CTRL 0x0006U | ||
33 | #define CHIP_SSS_CTRL 0x000AU | ||
34 | #define CHIP_ADCDAC_CTRL 0x000EU | ||
35 | #define CHIP_DAC_VOL 0x0010U | ||
36 | #define CHIP_PAD_STRENGTH 0x0014U | ||
37 | #define CHIP_ANA_ADC_CTRL 0x0020U | ||
38 | #define CHIP_ANA_HP_CTRL 0x0022U | ||
39 | #define CHIP_ANA_CTRL 0x0024U | ||
40 | #define CHIP_LINREG_CTRL 0x0026U | ||
41 | #define CHIP_REF_CTRL 0x0028U | ||
42 | #define CHIP_MIC_CTRL 0x002AU | ||
43 | #define CHIP_LINE_OUT_CTRL 0x002CU | ||
44 | #define CHIP_LINE_OUT_VOL 0x002EU | ||
45 | #define CHIP_ANA_POWER 0x0030U | ||
46 | #define CHIP_PLL_CTRL 0x0032U | ||
47 | #define CHIP_CLK_TOP_CTRL 0x0034U | ||
48 | #define CHIP_ANA_STATUS 0x0036U | ||
49 | #define CHIP_ANA_TEST2 0x003AU | ||
50 | #define CHIP_SHORT_CTRL 0x003CU | ||
51 | #define SGTL5000_DAP_CONTROL 0x0100U | ||
52 | #define SGTL5000_DAP_PEQ 0x0102U | ||
53 | #define SGTL5000_DAP_BASS_ENHANCE 0x0104U | ||
54 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL 0x0106U | ||
55 | #define SGTL5000_DAP_AUDIO_EQ 0x0108U | ||
56 | #define SGTL5000_DAP_SGTL_SURROUND 0x010AU | ||
57 | #define SGTL5000_DAP_FILTER_COEF_ACCESS 0x010CU | ||
58 | #define SGTL5000_DAP_COEF_WR_B0_MSB 0x010EU | ||
59 | #define SGTL5000_DAP_COEF_WR_B0_LSB 0x0110U | ||
60 | #define SGTL5000_DAP_AUDIO_EQ_BASS_BAND0 0x0116U | ||
61 | #define SGTL5000_DAP_AUDIO_EQ_BAND1 0x0118U | ||
62 | #define SGTL5000_DAP_AUDIO_EQ_BAND2 0x011AU | ||
63 | #define SGTL5000_DAP_AUDIO_EQ_BAND3 0x011CU | ||
64 | #define SGTL5000_DAP_AUDIO_EQ_TREBLE_BAND4 0x011EU | ||
65 | #define SGTL5000_DAP_MAIN_CHAN 0x0120U | ||
66 | #define SGTL5000_DAP_MIX_CHAN 0x0122U | ||
67 | #define SGTL5000_DAP_AVC_CTRL 0x0124U | ||
68 | #define SGTL5000_DAP_AVC_THRESHOLD 0x0126U | ||
69 | #define SGTL5000_DAP_AVC_ATTACK 0x0128U | ||
70 | #define SGTL5000_DAP_AVC_DECAY 0x012AU | ||
71 | #define SGTL5000_DAP_COEF_WR_B1_MSB 0x012CU | ||
72 | #define SGTL5000_DAP_COEF_WR_B1_LSB 0x012EU | ||
73 | #define SGTL5000_DAP_COEF_WR_B2_MSB 0x0130U | ||
74 | #define SGTL5000_DAP_COEF_WR_B2_LSB 0x0132U | ||
75 | #define SGTL5000_DAP_COEF_WR_A1_MSB 0x0134U | ||
76 | #define SGTL5000_DAP_COEF_WR_A1_LSB 0x0136U | ||
77 | #define SGTL5000_DAP_COEF_WR_A2_MSB 0x0138U | ||
78 | #define SGTL5000_DAP_COEF_WR_A2_LSB 0x013AU | ||
79 | |||
80 | /* | ||
81 | * Field Definitions. | ||
82 | */ | ||
83 | |||
84 | /* | ||
85 | * SGTL5000_CHIP_DIG_POWER | ||
86 | */ | ||
87 | #define SGTL5000_ADC_ENABLE_CLR_MASK 0xFFBFU | ||
88 | #define SGTL5000_ADC_ENABLE_GET_MASK 0x0040U | ||
89 | #define SGTL5000_ADC_ENABLE_SHIFT 0x6U | ||
90 | #define SGTL5000_DAC_ENABLE_CLR_MASK 0xFFDFU | ||
91 | #define SGTL5000_DAC_ENABLE_GET_MASK 0x0020U | ||
92 | #define SGTL5000_DAC_ENABLE_SHIFT 0x5U | ||
93 | #define SGTL5000_DAP_ENABLE_CLR_MASK 0xFFEFU | ||
94 | #define SGTL5000_DAP_ENABLE_GET_MASK 0x0010U | ||
95 | #define SGTL5000_DAP_ENABLE_SHIFT 0x4U | ||
96 | #define SGTL5000_I2S_OUT_ENABLE_CLR_MASK 0xFFFDU | ||
97 | #define SGTL5000_I2S_OUT_ENABLE_GET_MASK 0x0002U | ||
98 | #define SGTL5000_I2S_OUT_ENABLE_SHIFT 0x1U | ||
99 | #define SGTL5000_I2S_IN_ENABLE_CLR_MASK 0xFFFEU | ||
100 | #define SGTL5000_I2S_IN_ENABLE_GET_MASK 0x0001U | ||
101 | #define SGTL5000_I2S_IN_ENABLE_SHIFT 0x0U | ||
102 | |||
103 | /* | ||
104 | * SGTL5000_CHIP_CLK_CTRL | ||
105 | */ | ||
106 | #define SGTL5000_RATE_MODE_CLR_MASK 0xFFCFU | ||
107 | #define SGTL5000_RATE_MODE_GET_MASK 0x0030U | ||
108 | #define SGTL5000_RATE_MODE_SHIFT 0x4U | ||
109 | #define SGTL5000_RATE_MODE_DIV_1 0x0000U | ||
110 | #define SGTL5000_RATE_MODE_DIV_2 0x0010U | ||
111 | #define SGTL5000_RATE_MODE_DIV_4 0x0020U | ||
112 | #define SGTL5000_RATE_MODE_DIV_6 0x0030U | ||
113 | #define SGTL5000_SYS_FS_CLR_MASK 0xFFF3U | ||
114 | #define SGTL5000_SYS_FS_GET_MASK 0x000CU | ||
115 | #define SGTL5000_SYS_FS_SHIFT 0x2U | ||
116 | #define SGTL5000_SYS_FS_32k 0x0000U | ||
117 | #define SGTL5000_SYS_FS_44_1k 0x0004U | ||
118 | #define SGTL5000_SYS_FS_48k 0x0008U | ||
119 | #define SGTL5000_SYS_FS_96k 0x000CU | ||
120 | #define SGTL5000_MCLK_FREQ_CLR_MASK 0xFFFCU | ||
121 | #define SGTL5000_MCLK_FREQ_GET_MASK 0x0003U | ||
122 | #define SGTL5000_MCLK_FREQ_SHIFT 0x0U | ||
123 | #define SGTL5000_MCLK_FREQ_256FS 0x0000U | ||
124 | #define SGTL5000_MCLK_FREQ_384FS 0x0001U | ||
125 | #define SGTL5000_MCLK_FREQ_512FS 0x0002U | ||
126 | #define SGTL5000_MCLK_FREQ_PLL 0x0003U | ||
127 | |||
128 | /* | ||
129 | * SGTL5000_CHIP_I2S_CTRL | ||
130 | */ | ||
131 | #define SGTL5000_I2S_SLCKFREQ_CLR_MASK 0xFEFFU | ||
132 | #define SGTL5000_I2S_SCLKFREQ_GET_MASK 0x0100U | ||
133 | #define SGTL5000_I2S_SCLKFREQ_SHIFT 0x8U | ||
134 | #define SGTL5000_I2S_SCLKFREQ_64FS 0x0000U | ||
135 | #define SGTL5000_I2S_SCLKFREQ_32FS 0x0100U /* Not for RJ mode */ | ||
136 | #define SGTL5000_I2S_MS_CLR_MASK 0xFF7FU | ||
137 | #define SGTL5000_I2S_MS_GET_MASK 0x0080U | ||
138 | #define SGTL5000_I2S_MS_SHIFT 0x7U | ||
139 | #define SGTL5000_I2S_MASTER 0x0080U | ||
140 | #define SGTL5000_I2S_SLAVE 0x0000U | ||
141 | #define SGTL5000_I2S_SCLK_INV_CLR_MASK 0xFFBFU | ||
142 | #define SGTL5000_I2S_SCLK_INV_GET_MASK 0x0040U | ||
143 | #define SGTL5000_I2S_SCLK_INV_SHIFT 0x6U | ||
144 | #define SGTL5000_I2S_VAILD_FALLING_EDGE 0x0040U | ||
145 | #define SGTL5000_I2S_VAILD_RISING_EDGE 0x0000U | ||
146 | #define SGTL5000_I2S_DLEN_CLR_MASK 0xFFCFU | ||
147 | #define SGTL5000_I2S_DLEN_GET_MASK 0x0030U | ||
148 | #define SGTL5000_I2S_DLEN_SHIFT 0x4U | ||
149 | #define SGTL5000_I2S_DLEN_32 0x0000U | ||
150 | #define SGTL5000_I2S_DLEN_24 0x0010U | ||
151 | #define SGTL5000_I2S_DLEN_20 0x0020U | ||
152 | #define SGTL5000_I2S_DLEN_16 0x0030U | ||
153 | #define SGTL5000_I2S_MODE_CLR_MASK 0xFFF3U | ||
154 | #define SGTL5000_I2S_MODE_GET_MASK 0x000CU | ||
155 | #define SGTL5000_I2S_MODE_SHIFT 0x2U | ||
156 | #define SGTL5000_I2S_MODE_I2S_LJ 0x0000U | ||
157 | #define SGTL5000_I2S_MODE_RJ 0x0004U | ||
158 | #define SGTL5000_I2S_MODE_PCM 0x0008U | ||
159 | #define SGTL5000_I2S_LRALIGN_CLR_MASK 0xFFFDU | ||
160 | #define SGTL5000_I2S_LRALIGN_GET_MASK 0x0002U | ||
161 | #define SGTL5000_I2S_LRALIGN_SHIFT 0x1U | ||
162 | #define SGTL5000_I2S_ONE_BIT_DELAY 0x0000U | ||
163 | #define SGTL5000_I2S_NO_DELAY 0x0002U | ||
164 | #define SGTL5000_I2S_LRPOL_CLR_MASK 0xFFFEU | ||
165 | #define SGTL5000_I2S_LRPOL_GET_MASK 0x0001U | ||
166 | #define SGTL5000_I2S_LRPOL_SHIFT 0x0U | ||
167 | #define SGTL5000_I2S_LEFT_FIRST 0x0000U | ||
168 | #define SGTL5000_I2S_RIGHT_FIRST 0x0001U | ||
169 | |||
170 | /* | ||
171 | * SGTL5000_CHIP_SSS_CTRL | ||
172 | */ | ||
173 | #define SGTL5000_DAP_MIX_LRSWAP_CLR_MASK 0xBFFFU | ||
174 | #define SGTL5000_DAP_MIX_LRSWAP_GET_MASK 0x4000U | ||
175 | #define SGTL5000_DAP_MIX_LRSWAP_SHIFT 0xEU | ||
176 | #define SGTL5000_DAP_LRSWAP_CLR_MASK 0xDFFFU | ||
177 | #define SGTL5000_DAP_LRSWAP_GET_MASK 0x2000U | ||
178 | #define SGTL5000_DAP_LRSWAP_SHIFT 0xDU | ||
179 | #define SGTL5000_DAC_LRSWAP_CLR_MASK 0xEFFFU | ||
180 | #define SGTL5000_DAC_LRSWAP_GET_MASK 0x1000U | ||
181 | #define SGTL5000_DAC_LRSWAP_SHIFT 0xCU | ||
182 | #define SGTL5000_I2S_LRSWAP_CLR_MASK 0xFBFFU | ||
183 | #define SGTL5000_I2S_LRSWAP_GET_MASK 0x0400U | ||
184 | #define SGTL5000_I2S_LRSWAP_SHIFT 0xAU | ||
185 | #define SGTL5000_DAP_MIX_SEL_CLR_MASK 0xFCFFU | ||
186 | #define SGTL5000_DAP_MIX_SEL_GET_MASK 0x0300U | ||
187 | #define SGTL5000_DAP_MIX_SEL_SHIFT 0x8U | ||
188 | #define SGTL5000_DAP_MIX_SEL_ADC 0x0000U | ||
189 | #define SGTL5000_DAP_MIX_SEL_I2S_IN 0x0100U | ||
190 | #define SGTL5000_DAP_SEL_CLR_MASK 0xFF3FU | ||
191 | #define SGTL5000_DAP_SEL_GET_MASK 0x00C0U | ||
192 | #define SGTL5000_DAP_SEL_SHIFT 0x6U | ||
193 | #define SGTL5000_DAP_SEL_ADC 0x0000U | ||
194 | #define SGTL5000_DAP_SEL_I2S_IN 0x0040U | ||
195 | #define SGTL5000_DAC_SEL_CLR_MASK 0xFFCFU | ||
196 | #define SGTL5000_DAC_SEL_GET_MASK 0x0030U | ||
197 | #define SGTL5000_DAC_SEL_SHIFT 0x4U | ||
198 | #define SGTL5000_DAC_SEL_ADC 0x0000U | ||
199 | #define SGTL5000_DAC_SEL_I2S_IN 0x0010U | ||
200 | #define SGTL5000_DAC_SEL_DAP 0x0030U | ||
201 | #define SGTL5000_I2S_OUT_SEL_CLR_MASK 0xFFFCU | ||
202 | #define SGTL5000_I2S_OUT_SEL_GET_MASK 0x0003U | ||
203 | #define SGTL5000_I2S_OUT_SEL_SHIFT 0x0U | ||
204 | #define SGTL5000_I2S_OUT_SEL_ADC 0x0000U | ||
205 | #define SGTL5000_I2S_OUT_SEL_I2S_IN 0x0001U | ||
206 | #define SGTL5000_I2S_OUT_SEL_DAP 0x0003U | ||
207 | |||
208 | /* | ||
209 | * SGTL5000_CHIP_ADCDAC_CTRL | ||
210 | */ | ||
211 | #define SGTL5000_VOL_BUSY_DAC_RIGHT 0x2000U | ||
212 | #define SGTL5000_VOL_BUSY_DAC_LEFT 0x1000U | ||
213 | #define SGTL5000_DAC_VOL_RAMP_EN_CLR_MASK 0xFDFFU | ||
214 | #define SGTL5000_DAC_VOL_RAMP_EN_GET_MASK 0x0200U | ||
215 | #define SGTL5000_DAC_VOL_RAMP_EN_SHIFT 0x9U | ||
216 | #define SGTL5000_DAC_VOL_RAMP_EXPO_CLR_MASK 0xFEFFU | ||
217 | #define SGTL5000_DAC_VOL_RAMP_EXPO_GET_MASK 0x0100U | ||
218 | #define SGTL5000_DAC_VOL_RAMP_EXPO_SHIFT 0x8U | ||
219 | #define SGTL5000_DAC_MUTE_RIGHT_CLR_MASK 0xFFF7U | ||
220 | #define SGTL5000_DAC_MUTE_RIGHT_GET_MASK 0x0008U | ||
221 | #define SGTL5000_DAC_MUTE_RIGHT_SHIFT 0x3U | ||
222 | #define SGTL5000_DAC_MUTE_LEFT_CLR_MASK 0xFFFBU | ||
223 | #define SGTL5000_DAC_MUTE_LEFT_GET_MASK 0x0004U | ||
224 | #define SGTL5000_DAC_MUTE_LEFT_SHIFT 0x2U | ||
225 | #define SGTL5000_ADC_HPF_FREEZE_CLR_MASK 0xFFFDU | ||
226 | #define SGTL5000_ADC_HPF_FREEZE_GET_MASK 0x0002U | ||
227 | #define SGTL5000_ADC_HPF_FREEZE_SHIFT 0x1U | ||
228 | #define SGTL5000_ADC_HPF_BYPASS_CLR_MASK 0xFFFEU | ||
229 | #define SGTL5000_ADC_HPF_BYPASS_GET_MASK 0x0001U | ||
230 | #define SGTL5000_ADC_HPF_BYPASS_SHIFT 0x0U | ||
231 | |||
232 | /* | ||
233 | * SGTL5000_CHIP_DAC_VOL | ||
234 | */ | ||
235 | #define SGTL5000_DAC_VOL_RIGHT_CLR_MASK 0x00FFU | ||
236 | #define SGTL5000_DAC_VOL_RIGHT_GET_MASK 0xFF00U | ||
237 | #define SGTL5000_DAC_VOL_RIGHT_SHIFT 0x8U | ||
238 | #define SGTL5000_DAC_VOL_LEFT_CLR_MASK 0xFF00U | ||
239 | #define SGTL5000_DAC_VOL_LEFT_GET_MASK 0x00FFU | ||
240 | #define SGTL5000_DAC_VOL_LEFT_SHIFT 0x0U | ||
241 | |||
242 | /* | ||
243 | * SGTL5000_CHIP_PAD_STRENGTH | ||
244 | */ | ||
245 | #define SGTL5000_PAD_I2S_LRCLK_CLR_MASK 0xFCFFU | ||
246 | #define SGTL5000_PAD_I2S_LRCLK_GET_MASK 0x0300U | ||
247 | #define SGTL5000_PAD_I2S_LRCLK_SHIFT 0x8U | ||
248 | #define SGTL5000_PAD_I2S_SCLK_CLR_MASK 0xFF3FU | ||
249 | #define SGTL5000_PAD_I2S_SCLK_GET_MASK 0x00C0U | ||
250 | #define SGTL5000_PAD_I2S_SCLK_SHIFT 0x6U | ||
251 | #define SGTL5000_PAD_I2S_DOUT_CLR_MASK 0xFFCFU | ||
252 | #define SGTL5000_PAD_I2S_DOUT_GET_MASK 0x0030U | ||
253 | #define SGTL5000_PAD_I2S_DOUT_SHIFT 0x4U | ||
254 | #define SGTL5000_PAD_I2C_SDA_CLR_MASK 0xFFF3U | ||
255 | #define SGTL5000_PAD_I2C_SDA_GET_MASK 0x000CU | ||
256 | #define SGTL5000_PAD_I2C_SDA_SHIFT 0x2U | ||
257 | #define SGTL5000_PAD_I2C_SCL_CLR_MASK 0xFFFCU | ||
258 | #define SGTL5000_PAD_I2C_SCL_GET_MASK 0x0003U | ||
259 | #define SGTL5000_PAD_I2C_SCL_SHIFT 0x0U | ||
260 | |||
261 | /* | ||
262 | * SGTL5000_CHIP_ANA_ADC_CTRL | ||
263 | */ | ||
264 | #define SGTL5000_ADC_VOL_M6DB_CLR_MASK 0xFEFFU | ||
265 | #define SGTL5000_ADC_VOL_M6DB_GET_MASK 0x0100U | ||
266 | #define SGTL5000_ADC_VOL_M6DB_SHIFT 0x8U | ||
267 | #define SGTL5000_ADC_VOL_RIGHT_CLR_MASK 0xFF0FU | ||
268 | #define SGTL5000_ADC_VOL_RIGHT_GET_MASK 0x00F0U | ||
269 | #define SGTL5000_ADC_VOL_RIGHT_SHIFT 0x4U | ||
270 | #define SGTL5000_ADC_VOL_LEFT_CLR_MASK 0xFFF0U | ||
271 | #define SGTL5000_ADC_VOL_LEFT_GET_MASK 0x000FU | ||
272 | #define SGTL5000_ADC_VOL_LEFT_SHIFT 0x0U | ||
273 | |||
274 | /* | ||
275 | * SGTL5000_CHIP_ANA_HP_CTRL | ||
276 | */ | ||
277 | #define SGTL5000_HP_VOL_RIGHT_CLR_MASK 0x80FFU | ||
278 | #define SGTL5000_HP_VOL_RIGHT_GET_MASK 0x7F00U | ||
279 | #define SGTL5000_HP_VOL_RIGHT_SHIFT 0x8U | ||
280 | #define SGTL5000_HP_VOL_LEFT_CLR_MASK 0xFF80U | ||
281 | #define SGTL5000_HP_VOL_LEFT_GET_MASK 0x007FU | ||
282 | #define SGTL5000_HP_VOL_LEFT_SHIFT 0x0U | ||
283 | |||
284 | /* | ||
285 | * SGTL5000_CHIP_ANA_CTRL | ||
286 | */ | ||
287 | #define SGTL5000_MUTE_LO_GET_MASK 0x0100U | ||
288 | #define SGTL5000_MUTE_LO_CLR_MASK 0xFEFFU | ||
289 | #define SGTL5000_MUTE_LO_SHIFT 0x8U | ||
290 | #define SGTL5000_SEL_HP_GET_MASK 0x0040U | ||
291 | #define SGTL5000_SEL_HP_CLR_MASK 0xFFBFU | ||
292 | #define SGTL5000_SEL_HP_SHIFT 0x6U | ||
293 | #define SGTL5000_SEL_HP_DAC 0x0000U | ||
294 | #define SGTL5000_SEL_HP_LINEIN 0x0040U | ||
295 | #define SGTL5000_EN_ZCD_HP_GET_MASK 0x0020U | ||
296 | #define SGTL5000_EN_ZCD_HP_CLR_MASK 0xFFDFU | ||
297 | #define SGTL5000_EN_ZCD_HP_SHIFT 0x5U | ||
298 | #define SGTL5000_MUTE_HP_GET_MASK 0x0010U | ||
299 | #define SGTL5000_MUTE_HP_CLR_MASK 0xFFEFU | ||
300 | #define SGTL5000_MUTE_HP_SHIFT 0x4U | ||
301 | #define SGTL5000_SEL_ADC_GET_MASK 0x0004U | ||
302 | #define SGTL5000_SEL_ADC_CLR_MASK 0xFFFBU | ||
303 | #define SGTL5000_SEL_ADC_SHIFT 0x2U | ||
304 | #define SGTL5000_SEL_ADC_MIC 0x0000U | ||
305 | #define SGTL5000_SEL_ADC_LINEIN 0x0004U | ||
306 | #define SGTL5000_EN_ZCD_ADC_GET_MASK 0x0002U | ||
307 | #define SGTL5000_EN_ZCD_ADC_CLR_MASK 0xFFFDU | ||
308 | #define SGTL5000_EN_ZCD_ADC_SHIFT 0x1U | ||
309 | #define SGTL5000_MUTE_ADC_GET_MASK 0x0001U | ||
310 | #define SGTL5000_MUTE_ADC_CLR_MASK 0xFFFEU | ||
311 | #define SGTL5000_MUTE_ADC_SHIFT 0x0U | ||
312 | |||
313 | /* | ||
314 | * SGTL5000_CHIP_LINREG_CTRL | ||
315 | */ | ||
316 | #define SGTL5000_VDDC_MAN_ASSN_CLR_MASK 0xFFBFU | ||
317 | #define SGTL5000_VDDC_MAN_ASSN_GET_MASK 0x0040U | ||
318 | #define SGTL5000_VDDC_MAN_ASSN_SHIFT 0x6U | ||
319 | #define SGTL5000_VDDC_MAN_ASSN_VDDA 0x0000U | ||
320 | #define SGTL5000_VDDC_MAN_ASSN_VDDIO 0x0040U | ||
321 | #define SGTL5000_VDDC_ASSN_OVRD 0x0020U | ||
322 | #define SGTL5000_LINREG_VDDD_CLR_MASK 0xFFF0U | ||
323 | #define SGTL5000_LINREG_VDDD_GET_MASK 0x000FU | ||
324 | #define SGTL5000_LINREG_VDDD_SHIFT 0x0U | ||
325 | |||
326 | /* | ||
327 | * SGTL5000_CHIP_REF_CTRL | ||
328 | */ | ||
329 | #define SGTL5000_ANA_GND_MASK 0x01f0U | ||
330 | #define SGTL5000_ANA_GND_SHIFT 0x4U | ||
331 | #define SGTL5000_ANA_GND_WIDTH 0x5U | ||
332 | #define SGTL5000_ANA_GND_BASE 0x320U /* mv */ | ||
333 | #define SGTL5000_ANA_GND_STP 0x19U /*mv */ | ||
334 | #define SGTL5000_BIAS_CTRL_MASK 0x000eU | ||
335 | #define SGTL5000_BIAS_CTRL_SHIFT 0x1U | ||
336 | #define SGTL5000_BIAS_CTRL_WIDTH 0x3U | ||
337 | #define SGTL5000_SMALL_POP 0x0001U | ||
338 | |||
339 | /* | ||
340 | * SGTL5000_CHIP_MIC_CTRL | ||
341 | */ | ||
342 | #define SGTL5000_BIAS_R__CLR_MASK 0xFCFFU | ||
343 | #define SGTL5000_BIAS_R_GET_MASK 0x0300U | ||
344 | #define SGTL5000_BIAS_R_SHIFT 0x8U | ||
345 | #define SGTL5000_BIAS_R_off 0x0000U | ||
346 | #define SGTL5000_BIAS_R_2K 0x0100U | ||
347 | #define SGTL5000_BIAS_R_4k 0x0200U | ||
348 | #define SGTL5000_BIAS_R_8k 0x0300U | ||
349 | #define SGTL5000_BIAS_VOLT_CLR_MASK 0xFF8FU | ||
350 | #define SGTL5000_BIAS_VOLT_GET_MASK 0x0070U | ||
351 | #define SGTL5000_BIAS_VOLT_SHIFT 0x4U | ||
352 | #define SGTL5000_MIC_GAIN_CLR_MASK 0xFFFCU | ||
353 | #define SGTL5000_MIC_GAIN_GET_MASK 0x0003U | ||
354 | #define SGTL5000_MIC_GAIN_SHIFT 0x0U | ||
355 | |||
356 | /* | ||
357 | * SGTL5000_CHIP_LINE_OUT_CTRL | ||
358 | */ | ||
359 | #define SGTL5000_LINE_OUT_CURRENT_CLR_MASK 0xF0FFU | ||
360 | #define SGTL5000_LINE_OUT_CURRENT_GET_MASK 0x0F00U | ||
361 | #define SGTL5000_LINE_OUT_CURRENT_SHIFT 0x8U | ||
362 | #define SGTL5000_LINE_OUT_CURRENT_180u 0x0000U | ||
363 | #define SGTL5000_LINE_OUT_CURRENT_270u 0x0100U | ||
364 | #define SGTL5000_LINE_OUT_CURRENT_360u 0x0300U | ||
365 | #define SGTL5000_LINE_OUT_CURRENT_450u 0x0700U | ||
366 | #define SGTL5000_LINE_OUT_CURRENT_540u 0x0F00U | ||
367 | #define SGTL5000_LINE_OUT_GND_CLR_MASK 0xFFC0U | ||
368 | #define SGTL5000_LINE_OUT_GND_GET_MASK 0x003FU | ||
369 | #define SGTL5000_LINE_OUT_GND_SHIFT 0x0U | ||
370 | #define SGTL5000_LINE_OUT_GND_BASE 0x320U /* mv */ | ||
371 | #define SGTL5000_LINE_OUT_GND_STP 0x19U | ||
372 | #define SGTL5000_LINE_OUT_GND_MAX 0x23U | ||
373 | |||
374 | /* | ||
375 | * SGTL5000_CHIP_LINE_OUT_VOL | ||
376 | */ | ||
377 | #define SGTL5000_LINE_OUT_VOL_RIGHT_CLR_MASK 0xE0FFU | ||
378 | #define SGTL5000_LINE_OUT_VOL_RIGHT_GET_MASK 0x1F00U | ||
379 | #define SGTL5000_LINE_OUT_VOL_RIGHT_SHIFT 0x8U | ||
380 | #define SGTL5000_LINE_OUT_VOL_LEFT_CLR_MASK 0xFFE0U | ||
381 | #define SGTL5000_LINE_OUT_VOL_LEFT_GET_MASK 0x001FU | ||
382 | #define SGTL5000_LINE_OUT_VOL_LEFT_SHIFT 0x0U | ||
383 | |||
384 | /* | ||
385 | * SGTL5000_CHIP_ANA_POWER | ||
386 | */ | ||
387 | #define SGTL5000_RIGHT_DAC_POWERUP_GET_MASK 0x4000U | ||
388 | #define SGTL5000_RIGHT_DAC_POWERUP_CLR_MASK 0xBFFFU | ||
389 | #define SGTL5000_RIGHT_DAC_POWERUP_SHIFT 0xEU | ||
390 | #define SGTL5000_LINREG_SIMPLE_POWERUP_GET_MASK 0x2000U | ||
391 | #define SGTL5000_LINREG_SIMPLE_POWERUP_CLR_MASK 0xDFFFU | ||
392 | #define SGTL5000_LINREG_SIMPLE_POWERUP_SHIFT 0xDU | ||
393 | #define SGTL5000_STARTUP_POWERUP_GET_MASK 0x1000U | ||
394 | #define SGTL5000_STARTUP_POWERUP_CLR_MASK 0xEFFFU | ||
395 | #define SGTL5000_STARTUP_POWERUP_SHIFT 0xCU | ||
396 | #define SGTL5000_VDDC_CHRGPMP_POWERUP_GET_MASK 0x0800U | ||
397 | #define SGTL5000_VDDC_CHRGPMP_POWERUP_CLR_MASK 0xF7FFU | ||
398 | #define SGTL5000_VDDC_CHRGPMP_POWERUP_SHIFT 0xBU | ||
399 | #define SGTL5000_PLL_POWERUP_GET_MASK 0x0400U | ||
400 | #define SGTL5000_PLL_POWERUP_CLR_MASK 0xFBFFU | ||
401 | #define SGTL5000_PLL_POWERUP_SHIFT 0xAU | ||
402 | #define SGTL5000_LINREG_D_POWERUP_GET_MASK 0x0200U | ||
403 | #define SGTL5000_LINREG_D_POWERUP_CLR_MASK 0xFDFFU | ||
404 | #define SGTL5000_LINREG_D_POWERUP_SHIFT 0x9U | ||
405 | #define SGTL5000_VCOAMP_POWERUP_GET_MASK 0x0100U | ||
406 | #define SGTL5000_VCOAMP_POWERUP_CLR_MASK 0xFEFFU | ||
407 | #define SGTL5000_VCOAMP_POWERUP_SHIFT 0x8U | ||
408 | #define SGTL5000_VAG_POWERUP_GET_MASK 0x0080U | ||
409 | #define SGTL5000_VAG_POWERUP_CLR_MASK 0xFF7FU | ||
410 | #define SGTL5000_VAG_POWERUP_SHIFT 0x7U | ||
411 | #define SGTL5000_RIGHT_ADC_POWERUP_GET_MASK 0x0040U | ||
412 | #define SGTL5000_RIGHT_ADC_POWERUP_CLR_MASK 0xFFBFU | ||
413 | #define SGTL5000_RIGHT_ADC_POWERUP_SHIFT 0x6U | ||
414 | #define SGTL5000_REFTOP_POWERUP_GET_MASK 0x0020U | ||
415 | #define SGTL5000_REFTOP_POWERUP_CLR_MASK 0xFFDFU | ||
416 | #define SGTL5000_REFTOP_POWERUP_SHIFT 0x5U | ||
417 | #define SGTL5000_HEADPHONE_POWERUP_GET_MASK 0x0010U | ||
418 | #define SGTL5000_HEADPHONE_POWERUP_CLR_MASK 0xFFEFU | ||
419 | #define SGTL5000_HEADPHONE_POWERUP_SHIFT 0x4U | ||
420 | #define SGTL5000_DAC_POWERUP_GET_MASK 0x0008U | ||
421 | #define SGTL5000_DAC_POWERUP_CLR_MASK 0xFFF7U | ||
422 | #define SGTL5000_DAC_POWERUP_SHIFT 0x3U | ||
423 | #define SGTL5000_CAPLESS_HEADPHONE_POWERUP_GET_MASK 0x0004U | ||
424 | #define SGTL5000_CAPLESS_HEADPHONE_POWERUP_CLR_MASK 0xFFFBU | ||
425 | #define SGTL5000_CAPLESS_HEADPHONE_POWERUP_SHIFT 0x2U | ||
426 | #define SGTL5000_ADC_POWERUP_GET_MASK 0x0002U | ||
427 | #define SGTL5000_ADC_POWERUP_CLR_MASK 0xFFFDU | ||
428 | #define SGTL5000_ADC_POWERUP_SHIFT 0x1U | ||
429 | #define SGTL5000_LINEOUT_POWERUP_GET_MASK 0x0001U | ||
430 | #define SGTL5000_LINEOUT_POWERUP_CLR_MASK 0xFFFEU | ||
431 | #define SGTL5000_LINEOUT_POWERUP_SHIFT 0x0U | ||
432 | |||
433 | /* | ||
434 | * SGTL5000_CHIP_PLL_CTRL | ||
435 | */ | ||
436 | #define SGTL5000_PLL_INT_DIV_CLR_MASK 0x07FFU | ||
437 | #define SGTL5000_PLL_INT_DIV_GET_MASK 0xF800U | ||
438 | #define SGTL5000_PLL_INT_DIV_SHIFT 0xBU | ||
439 | #define SGTL5000_PLL_FRAC_DIV_CLR_MASK 0xF8FFU | ||
440 | #define SGTL5000_PLL_FRAC_DIV_GET_MASK 0x0700U | ||
441 | #define SGTL5000_PLL_FRAC_DIV_SHIFT 0x0U | ||
442 | |||
443 | /* | ||
444 | * SGTL5000_CHIP_CLK_TOP_CTRL | ||
445 | */ | ||
446 | #define SGTL5000_ENABLE_INT_OSC_GET_MASK 0x0800U | ||
447 | #define SGTL5000_ENABLE_INT_OSC_CLR_MASK 0xF7FFU | ||
448 | #define SGTL5000_ENABLE_INT_OSC_SHIFT 0xBU | ||
449 | #define SGTL5000_INPUT_FREQ_DIV2_GET_MASK 0x0008U | ||
450 | #define SGTL5000_INPUT_FREQ_DIV2_CLR_MASK 0xFFF7U | ||
451 | #define SGTL5000_INPUT_FREQ_DIV2_SHIFT 0x3U | ||
452 | |||
453 | /* | ||
454 | * SGTL5000_CHIP_ANA_STATUS | ||
455 | */ | ||
456 | #define SGTL5000_HP_LRSHORT 0x0200U | ||
457 | #define SGTL5000_CAPLESS_SHORT 0x0100U | ||
458 | #define SGTL5000_PLL_LOCKED 0x0010U | ||
459 | |||
460 | /* | ||
461 | * SGTL5000_CHIP_SHORT_CTRL | ||
462 | */ | ||
463 | #define SGTL5000_LVLADJR_CLR_MASK 0x8FFFU | ||
464 | #define SGTL5000_LVLADJR_GET_MASK 0x7000U | ||
465 | #define SGTL5000_LVLADJR_SHIFT 0xCU | ||
466 | #define SGTL5000_LVLADJL_CLR_MASK 0xF8FFU | ||
467 | #define SGTL5000_LVLADJL_GET_MASK 0x0700U | ||
468 | #define SGTL5000_LVLADJL_SHIFT 0x8U | ||
469 | #define SGTL5000_LVLADJC_CLR_MASK 0xFF8FU | ||
470 | #define SGTL5000_LVLADJC_GET_MASK 0x0070U | ||
471 | #define SGTL5000_LVLADJC_SHIFT 0x4U | ||
472 | #define SGTL5000_LR_SHORT_MOD_CLR_MASK 0xFFF3U | ||
473 | #define SGTL5000_LR_SHORT_MOD_GET_MASK 0x000CU | ||
474 | #define SGTL5000_LR_SHORT_MOD_SHIFT 0x2U | ||
475 | #define SGTL5000_CM_SHORT_MOD_CLR_MASK 0xFFFCU | ||
476 | #define SGTL5000_CM_SHORT_MOD_GET_MASK 0x0003U | ||
477 | #define SGTL5000_CM_SHORT_MOD_SHIFT 0x0U | ||
478 | |||
479 | /* DAP control register */ | ||
480 | #define SGTL5000_DAP_CONTROL_MIX_EN_GET_MASK 0x0010U | ||
481 | #define SGTL5000_DAP_CONTROL_MIX_EN_CLR_MASK 0xFFEFU | ||
482 | #define SGTL5000_DAP_CONTROL_MIX_EN_SHIFT 0x4U | ||
483 | #define SGTL5000_DAP_CONTROL_DAP_EN_GET_MASK 0x0001U | ||
484 | #define SGTL5000_DAP_CONTROL_DAP_EN_CLR_MASK 0xFFFEU | ||
485 | #define SGTL5000_DAP_CONTROL_DAP_EN_SHIFT 0x0U | ||
486 | |||
487 | /* | ||
488 | * DAP_PEQ_REG | ||
489 | */ | ||
490 | #define SGTL5000_DAP_PEQ_EN_GET_MASK 0x0007U | ||
491 | #define SGTL5000_DAP_PEQ_EN_CLR_MASK 0xFFF8U | ||
492 | #define SGTL5000_DAP_PEQ_EN_SHIFT 0x0U | ||
493 | |||
494 | /* | ||
495 | * DAP_BASS_ENHANCE_REG | ||
496 | */ | ||
497 | #define SGTL5000_DAP_BASS_ENHANCE_MULT_GET_MASK 0xC000U | ||
498 | #define SGTL5000_DAP_BASS_ENHANCE_MULT_CLR_MASK 0x3FFFU | ||
499 | #define SGTL5000_DAP_BASS_ENHANCE_MULT_SHIFT 0xEU | ||
500 | #define SGTL5000_DAP_BASS_ENHANCE_CUTOFF_HPF_GET_MASK 0x0E00U | ||
501 | #define SGTL5000_DAP_BASS_ENHANCE_CUTOFF_HPF_CLR_MASK 0xF1FFU | ||
502 | #define SGTL5000_DAP_BASS_ENHANCE_CUTOFF_HPF_SHIFT 0x9U | ||
503 | #define SGTL5000_DAP_BASS_ENHANCE_BYPASS_HPF_GET_MASK 0x0100U | ||
504 | #define SGTL5000_DAP_BASS_ENHANCE_BYPASS_HPF_CLR_MASK 0xFEFFU | ||
505 | #define SGTL5000_DAP_BASS_ENHANCE_BYPASS_HPF_SHIFT 0x8U | ||
506 | #define SGTL5000_DAP_BASS_ENHANCE_CUTOFF_GET_MASK 0x0070U | ||
507 | #define SGTL5000_DAP_BASS_ENHANCE_CUTOFF_CLR_MASK 0xFF8FU | ||
508 | #define SGTL5000_DAP_BASS_ENHANCE_CUTOFF_SHIFT 0x4U | ||
509 | #define SGTL5000_DAP_BASS_ENHANCE_EN_GET_MASK 0x0001U | ||
510 | #define SGTL5000_DAP_BASS_ENHANCE_EN_CLR_MASK 0xFFFEU | ||
511 | #define SGTL5000_DAP_BASS_ENHANCE_EN_SHIFT 0x0U | ||
512 | |||
513 | /* | ||
514 | * DAP_BASS_ENHANCE_CTRL_REG | ||
515 | */ | ||
516 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL_LR_LEVEL_GET_MASK 0x3F00U | ||
517 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL_LR_LEVEL_CLR_MASK 0xC0FFU | ||
518 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL_LR_LEVEL_SHIFT 0x8U | ||
519 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL_BASS_LEVEL_GET_MASK 0x007FU | ||
520 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL_BASS_LEVEL_CLR_MASK 0xFF80U | ||
521 | #define SGTL5000_DAP_BASS_ENHANCE_CTRL_BASS_LEVEL_SHIFT 0x0U | ||
522 | |||
523 | /* | ||
524 | * DAP_AUDIO_EQ_REG | ||
525 | */ | ||
526 | #define SGTL5000_DAP_AUDIO_EQ_EN_GET_MASK 0x0003U | ||
527 | #define SGTL5000_DAP_AUDIO_EQ_EN_CLR_MASK 0xFFFCU | ||
528 | #define SGTL5000_DAP_AUDIO_EQ_EN_SHIFT 0x0U | ||
529 | |||
530 | /* | ||
531 | * DAP_SGTL_SURROUND_REG | ||
532 | */ | ||
533 | #define SGTL5000_DAP_SGTL_SURROUND_WIDTH_CONTROL_GET_MASK 0x0070U | ||
534 | #define SGTL5000_DAP_SGTL_SURROUND_WIDTH_CONTROL_CLR_MASK 0xFF8FU | ||
535 | #define SGTL5000_DAP_SGTL_SURROUND_WIDTH_CONTROL_SHIFT 0x4U | ||
536 | #define SGTL5000_DAP_SGTL_SURROUND_SEL_GET_MASK 0x0003U | ||
537 | #define SGTL5000_DAP_SGTL_SURROUND_SEL_CLR_MASK 0xFFFCU | ||
538 | #define SGTL5000_DAP_SGTL_SURROUND_SEL_SHIFT 0x0U | ||
539 | |||
540 | /* | ||
541 | * DAP_FILTER_COEF_ACCESS_REG | ||
542 | */ | ||
543 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_DEBUG_GET_MASK 0x1000U | ||
544 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_DEBUG_CLR_MASK 0xEFFFU | ||
545 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_DEBUG_SHIFT 0xCU | ||
546 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_RD_GET_MASK 0x0200U | ||
547 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_RD_CLR_MASK 0xFDFFU | ||
548 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_RD_SHIFT 0x9U | ||
549 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_WR_GET_MASK 0x0100U | ||
550 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_WR_CLR_MASK 0xFEFFU | ||
551 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_WR_SHIFT 0x8U | ||
552 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_INDEX_GET_MASK 0x00FFU | ||
553 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_INDEX_CLR_MASK 0xFF00U | ||
554 | #define SGTL5000_DAP_FILTER_COEF_ACCESS_INDEX_SHIFT 0x0U | ||
555 | |||
556 | /* | ||
557 | * DAP_COEF_WR_B0_MSB_REG | ||
558 | */ | ||
559 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_19_GET_MASK 0x8000U | ||
560 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_19_CLR_MASK 0x7FFFU | ||
561 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_19_SHIFT 0xFU | ||
562 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_18_GET_MASK 0x4000U | ||
563 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_18_CLR_MASK 0xBFFFU | ||
564 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_18_SHIFT 0xEU | ||
565 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_17_GET_MASK 0x2000U | ||
566 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_17_CLR_MASK 0xDFFFU | ||
567 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_17_SHIFT 0xDU | ||
568 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_16_GET_MASK 0x1000U | ||
569 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_16_CLR_MASK 0xEFFFU | ||
570 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_16_SHIFT 0xCU | ||
571 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_15_GET_MASK 0x0800U | ||
572 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_15_CLR_MASK 0xF7FFU | ||
573 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_15_SHIFT 0xBU | ||
574 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_14_GET_MASK 0x0400U | ||
575 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_14_CLR_MASK 0xFBFFU | ||
576 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_14_SHIFT 0xAU | ||
577 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_13_GET_MASK 0x0200U | ||
578 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_13_CLR_MASK 0xFDFFU | ||
579 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_13_SHIFT 0x9U | ||
580 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_12_GET_MASK 0x0100U | ||
581 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_12_CLR_MASK 0xFEFFU | ||
582 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_12_SHIFT 0x8U | ||
583 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_11_GET_MASK 0x0080U | ||
584 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_11_CLR_MASK 0xFF7FU | ||
585 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_11_SHIFT 0x7U | ||
586 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_10_GET_MASK 0x0040U | ||
587 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_10_CLR_MASK 0xFFBFU | ||
588 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_10_SHIFT 0x6U | ||
589 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_9_GET_MASK 0x0020U | ||
590 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_9_CLR_MASK 0xFFDFU | ||
591 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_9_SHIFT 0x5U | ||
592 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_8_GET_MASK 0x0010U | ||
593 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_8_CLR_MASK 0xFFEFU | ||
594 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_8_SHIFT 0x4U | ||
595 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_7_GET_MASK 0x0008U | ||
596 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_7_CLR_MASK 0xFFF7U | ||
597 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_7_SHIFT 0x3U | ||
598 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_6_GET_MASK 0x0004U | ||
599 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_6_CLR_MASK 0xFFFBU | ||
600 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_6_SHIFT 0x2U | ||
601 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_5_GET_MASK 0x0002U | ||
602 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_5_CLR_MASK 0xFFFDU | ||
603 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_5_SHIFT 0x1U | ||
604 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_4_GET_MASK 0x0001U | ||
605 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_4_CLR_MASK 0xFFFEU | ||
606 | #define SGTL5000_DAP_COEF_WR_B0_MSB_BIT_4_SHIFT 0x0U | ||
607 | |||
608 | /* | ||
609 | * DAP_COEF_WR_B0_LSB_REG | ||
610 | */ | ||
611 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_3_GET_MASK 0x0008U | ||
612 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_3_CLR_MASK 0xFFF7U | ||
613 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_3_SHIFT 0x3U | ||
614 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_2_GET_MASK 0x0004U | ||
615 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_2_CLR_MASK 0xFFFBU | ||
616 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_2_SHIFT 0x2U | ||
617 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_1_GET_MASK 0x0002U | ||
618 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_1_CLR_MASK 0xFFFDU | ||
619 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_1_SHIFT 0x1U | ||
620 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_0_GET_MASK 0x0001U | ||
621 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_0_CLR_MASK 0xFFFEU | ||
622 | #define SGTL5000_DAP_COEF_WR_B0_LSB_BIT_0_SHIFT 0x0U | ||
623 | |||
624 | /* | ||
625 | * DAP_AUDIO_EQ_BASS_BAND0_REG | ||
626 | */ | ||
627 | #define SGTL5000_DAP_AUDIO_EQ_BASS_BAND0_VOLUME_GET_MASK 0x007FU | ||
628 | #define SGTL5000_DAP_AUDIO_EQ_BASS_BAND0_VOLUME_CLR_MASK 0xFF80U | ||
629 | #define SGTL5000_DAP_AUDIO_EQ_BASS_BAND0_VOLUME_SHIFT 0x0U | ||
630 | |||
631 | /* | ||
632 | * DAP_AUDIO_EQ_BAND1_REG | ||
633 | */ | ||
634 | #define SGTL5000_DAP_AUDIO_EQ_BAND1_VOLUME_GET_MASK 0x007FU | ||
635 | #define SGTL5000_DAP_AUDIO_EQ_BAND1_VOLUME_CLR_MASK 0xFF80U | ||
636 | #define SGTL5000_DAP_AUDIO_EQ_BAND1_VOLUME_SHIFT 0x0U | ||
637 | |||
638 | /* | ||
639 | * DAP_AUDIO_EQ_BAND2_REG | ||
640 | */ | ||
641 | #define SGTL5000_DAP_AUDIO_EQ_BAND2_VOLUME_GET_MASK 0x007FU | ||
642 | #define SGTL5000_DAP_AUDIO_EQ_BAND2_VOLUME_CLR_MASK 0xFF80U | ||
643 | #define SGTL5000_DAP_AUDIO_EQ_BAND2_VOLUME_SHIFT 0x0U | ||
644 | |||
645 | /* | ||
646 | * DAP_AUDIO_EQ_BAND3_REG | ||
647 | */ | ||
648 | #define SGTL5000_DAP_AUDIO_EQ_BAND3_VOLUME_GET_MASK 0x007FU | ||
649 | #define SGTL5000_DAP_AUDIO_EQ_BAND3_VOLUME_CLR_MASK 0xFF80U | ||
650 | #define SGTL5000_DAP_AUDIO_EQ_BAND3_VOLUME_SHIFT 0x0U | ||
651 | |||
652 | /* | ||
653 | * DAP_AUDIO_EQ_TREBLE_BAND4_REG | ||
654 | */ | ||
655 | #define SGTL5000_DAP_AUDIO_EQ_TREBLE_BAND4_VOLUME_GET_MASK 0x007FU | ||
656 | #define SGTL5000_DAP_AUDIO_EQ_TREBLE_BAND4_VOLUME_CLR_MASK 0xFF80U | ||
657 | #define SGTL5000_DAP_AUDIO_EQ_TREBLE_BAND4_VOLUME_SHIFT 0x0U | ||
658 | |||
659 | /* | ||
660 | * DAP_MAIN_CHAN_REG | ||
661 | */ | ||
662 | #define SGTL5000_DAP_MAIN_CHAN_VOL_GET_MASK 0xFFFFU | ||
663 | #define SGTL5000_DAP_MAIN_CHAN_VOL_CLR_MASK 0x0000U | ||
664 | #define SGTL5000_DAP_MAIN_CHAN_VOL_SHIFT 0x0U | ||
665 | |||
666 | /* | ||
667 | * DAP_MIX_CHAN_REG | ||
668 | */ | ||
669 | #define SGTL5000_DAP_MIX_CHAN_VOL_GET_MASK 0xFFFFU | ||
670 | #define SGTL5000_DAP_MIX_CHAN_VOL_CLR_MASK 0x0000U | ||
671 | #define SGTL5000_DAP_MIX_CHAN_VOL_SHIFT 0x0U | ||
672 | |||
673 | /* | ||
674 | * DAP_AVC_CTRL_REG | ||
675 | */ | ||
676 | #define SGTL5000_DAP_AVC_CTRL_APOP_ENABLE_GET_MASK 0x4000U | ||
677 | #define SGTL5000_DAP_AVC_CTRL_APOP_ENABLE_CLR_MASK 0xBFFFU | ||
678 | #define SGTL5000_DAP_AVC_CTRL_APOP_ENABLE_SHIFT 0xEU | ||
679 | #define SGTL5000_DAP_AVC_CTRL_MAX_GAIN_GET_MASK 0x3000U | ||
680 | #define SGTL5000_DAP_AVC_CTRL_MAX_GAIN_CLR_MASK 0xCFFFU | ||
681 | #define SGTL5000_DAP_AVC_CTRL_MAX_GAIN_SHIFT 0xCU | ||
682 | #define SGTL5000_DAP_AVC_CTRL_LBI_RESPONSE_GET_MASK 0x0300U | ||
683 | #define SGTL5000_DAP_AVC_CTRL_LBI_RESPONSE_CLR_MASK 0xFCFFU | ||
684 | #define SGTL5000_DAP_AVC_CTRL_LBI_RESPONSE_SHIFT 0x8U | ||
685 | #define SGTL5000_DAP_AVC_CTRL_HARD_LIMIT_EN_GET_MASK 0x0020U | ||
686 | #define SGTL5000_DAP_AVC_CTRL_HARD_LIMIT_EN_CLR_MASK 0xFFDFU | ||
687 | #define SGTL5000_DAP_AVC_CTRL_HARD_LIMIT_EN_SHIFT 0x5U | ||
688 | #define SGTL5000_DAP_AVC_CTRL_STOP_GET_MASK 0x0004U | ||
689 | #define SGTL5000_DAP_AVC_CTRL_STOP_SHIFT 0x2U | ||
690 | #define SGTL5000_DAP_AVC_CTRL_RUNNING_GET_MASK 0x0002U | ||
691 | #define SGTL5000_DAP_AVC_CTRL_RUNNING_SHIFT 0x1U | ||
692 | #define SGTL5000_DAP_AVC_CTRL_EN_GET_MASK 0x0001U | ||
693 | #define SGTL5000_DAP_AVC_CTRL_EN_CLR_MASK 0xFFFEU | ||
694 | #define SGTL5000_DAP_AVC_CTRL_EN_SHIFT 0x0U | ||
695 | |||
696 | /* | ||
697 | * DAP_AVC_ATTACK_REG | ||
698 | */ | ||
699 | #define SGTL5000_DAP_AVC_ATTACK_RATE_GET_MASK 0x0FFFU | ||
700 | #define SGTL5000_DAP_AVC_ATTACK_RATE_CLR_MASK 0xF000U | ||
701 | #define SGTL5000_DAP_AVC_ATTACK_RATE_SHIFT 0x0U | ||
702 | |||
703 | /* | ||
704 | * DAP_AVC_DECAY_REG | ||
705 | */ | ||
706 | #define SGTL5000_DAP_AVC_DECAY_RATE_GET_MASK 0x0FFFU | ||
707 | #define SGTL5000_DAP_AVC_DECAY_RATE_CLR_MASK 0xF000U | ||
708 | #define SGTL5000_DAP_AVC_DECAY_RATE_SHIFT 0x0U | ||
709 | |||
710 | /* | ||
711 | * DAP_COEF_WR_B1_LSB_REG | ||
712 | */ | ||
713 | #define SGTL5000_DAP_COEF_WR_B1_LSB_LSB_GET_MASK 0x000FU | ||
714 | #define SGTL5000_DAP_COEF_WR_B1_LSB_LSB_CLR_MASK 0xFFF0U | ||
715 | #define SGTL5000_DAP_COEF_WR_B1_LSB_LSB_SHIFT 0x0U | ||
716 | |||
717 | /* | ||
718 | * DAP_COEF_WR_B2_LSB_REG | ||
719 | */ | ||
720 | #define SGTL5000_DAP_COEF_WR_B2_LSB_LSB_GET_MASK 0x000FU | ||
721 | #define SGTL5000_DAP_COEF_WR_B2_LSB_LSB_CLR_MASK 0xFFF0U | ||
722 | #define SGTL5000_DAP_COEF_WR_B2_LSB_LSB_SHIFT 0x0U | ||
723 | |||
724 | /* | ||
725 | * DAP_COEF_WR_A1_LSB_REG | ||
726 | */ | ||
727 | #define SGTL5000_DAP_COEF_WR_A1_LSB_LSB_GET_MASK 0x000FU | ||
728 | #define SGTL5000_DAP_COEF_WR_A1_LSB_LSB_CLR_MASK 0xFFF0U | ||
729 | #define SGTL5000_DAP_COEF_WR_A1_LSB_LSB_SHIFT 0x0U | ||
730 | |||
731 | /* | ||
732 | * DAP_COEF_WR_A2_LSB_REG | ||
733 | */ | ||
734 | #define SGTL5000_DAP_COEF_WR_A2_LSB_LSB_GET_MASK 0x000FU | ||
735 | #define SGTL5000_DAP_COEF_WR_A2_LSB_LSB_CLR_MASK 0xFFF0U | ||
736 | #define SGTL5000_DAP_COEF_WR_A2_LSB_LSB_SHIFT 0x0U | ||
737 | |||
738 | /*! @brief SGTL5000 volume setting range */ | ||
739 | #define SGTL5000_HEADPHONE_MAX_VOLUME_VALUE 0x7FU | ||
740 | #define SGTL5000_HEADPHONE_MIN_VOLUME_VALUE 0U | ||
741 | #define SGTL5000_LINE_OUT_MAX_VOLUME_VALUE 0x1FU | ||
742 | #define SGTL5000_LINE_OUT_MIN_VOLUME_VALUE 0U | ||
743 | #define SGTL5000_ADC_MAX_VOLUME_VALUE 0xFU | ||
744 | #define SGTL5000_ADC_MIN_VOLUME_VALUE 0U | ||
745 | #define SGTL5000_DAC_MAX_VOLUME_VALUE 0xF0U | ||
746 | #define SGTL5000_DAC_MIN_VOLUME_VALUE 0x3CU | ||
747 | |||
748 | /*! @brief SGTL5000 I2C address. */ | ||
749 | #define SGTL5000_I2C_ADDR 0x0A | ||
750 | |||
751 | /*! @brief sgtl handle size */ | ||
752 | #ifndef SGTL_I2C_HANDLER_SIZE | ||
753 | #define SGTL_I2C_HANDLER_SIZE CODEC_I2C_MASTER_HANDLER_SIZE | ||
754 | #endif | ||
755 | |||
756 | /*! @brief sgtl i2c baudrate */ | ||
757 | #define SGTL_I2C_BITRATE 100000U | ||
758 | |||
759 | /*! @brief Modules in Sgtl5000 board. */ | ||
760 | typedef enum _sgtl5000_module | ||
761 | { | ||
762 | kSGTL_ModuleADC = 0x0, /*!< ADC module in SGTL5000 */ | ||
763 | kSGTL_ModuleDAC, /*!< DAC module in SGTL5000 */ | ||
764 | kSGTL_ModuleDAP, /*!< DAP module in SGTL5000 */ | ||
765 | kSGTL_ModuleHP, /*!< Headphone module in SGTL5000 */ | ||
766 | kSGTL_ModuleI2SIN, /*!< I2S-IN module in SGTL5000 */ | ||
767 | kSGTL_ModuleI2SOUT, /*!< I2S-OUT module in SGTL5000 */ | ||
768 | kSGTL_ModuleLineIn, /*!< Line-in moudle in SGTL5000 */ | ||
769 | kSGTL_ModuleLineOut, /*!< Line-out module in SGTL5000 */ | ||
770 | kSGTL_ModuleMicin /*!< Micphone module in SGTL5000 */ | ||
771 | } sgtl_module_t; | ||
772 | |||
773 | /*! | ||
774 | * @brief Sgtl5000 data route. | ||
775 | * @note Only provide some typical data route, not all route listed. | ||
776 | * Users cannot combine any routes, once a new route is set, the precios one would be replaced. | ||
777 | */ | ||
778 | typedef enum _sgtl_route | ||
779 | { | ||
780 | kSGTL_RouteBypass = 0x0, /*!< LINEIN->Headphone. */ | ||
781 | kSGTL_RoutePlayback, /*!< I2SIN->DAC->Headphone. */ | ||
782 | kSGTL_RoutePlaybackandRecord, /*!< I2SIN->DAC->Headphone, LINEIN->ADC->I2SOUT. */ | ||
783 | kSGTL_RoutePlaybackwithDAP, /*!< I2SIN->DAP->DAC->Headphone. */ | ||
784 | kSGTL_RoutePlaybackwithDAPandRecord, /*!< I2SIN->DAP->DAC->HP, LINEIN->ADC->I2SOUT. */ | ||
785 | kSGTL_RouteRecord /*!< LINEIN->ADC->I2SOUT. */ | ||
786 | } sgtl_route_t; | ||
787 | |||
788 | /*! | ||
789 | * @brief The audio data transfer protocol choice. | ||
790 | * Sgtl5000 only supports I2S format and PCM format. | ||
791 | */ | ||
792 | typedef enum _sgtl_protocol | ||
793 | { | ||
794 | kSGTL_BusI2S = 0x0, /*!< I2S Type */ | ||
795 | kSGTL_BusLeftJustified, /*!< Left justified */ | ||
796 | kSGTL_BusRightJustified, /*!< Right Justified */ | ||
797 | kSGTL_BusPCMA, /*!< PCMA */ | ||
798 | kSGTL_BusPCMB /*!< PCMB */ | ||
799 | } sgtl_protocol_t; | ||
800 | |||
801 | /*! @brief sgtl play channel | ||
802 | * @anchor _sgtl_play_channel | ||
803 | */ | ||
804 | enum | ||
805 | { | ||
806 | kSGTL_HeadphoneLeft = 0, /*!< headphone left channel */ | ||
807 | kSGTL_HeadphoneRight = 1, /*!< headphone right channel */ | ||
808 | kSGTL_LineoutLeft = 2, /*!< lineout left channel */ | ||
809 | kSGTL_LineoutRight = 3, /*!< lineout right channel */ | ||
810 | }; | ||
811 | |||
812 | /*! @brief sgtl record source | ||
813 | * _sgtl_record_source | ||
814 | */ | ||
815 | enum | ||
816 | { | ||
817 | kSGTL_RecordSourceLineIn = 0U, /*!< record source line in */ | ||
818 | kSGTL_RecordSourceMic = 1U, /*!< record source single end */ | ||
819 | }; | ||
820 | |||
821 | /*! @brief sgtl play source | ||
822 | * _stgl_play_source | ||
823 | */ | ||
824 | enum | ||
825 | { | ||
826 | kSGTL_PlaySourceLineIn = 0U, /*!< play source line in */ | ||
827 | kSGTL_PlaySourceDAC = 1U, /*!< play source line in */ | ||
828 | }; | ||
829 | |||
830 | /*! @brief SGTL SCLK valid edge */ | ||
831 | typedef enum _sgtl_sclk_edge | ||
832 | { | ||
833 | kSGTL_SclkValidEdgeRising = 0U, /*!< SCLK valid edge */ | ||
834 | kSGTL_SclkValidEdgeFailling = 1U, /*!< SCLK failling edge */ | ||
835 | } sgtl_sclk_edge_t; | ||
836 | |||
837 | /*! @brief Audio format configuration. */ | ||
838 | typedef struct _sgtl_audio_format | ||
839 | { | ||
840 | uint32_t mclk_HZ; /*!< master clock */ | ||
841 | uint32_t sampleRate; /*!< Sample rate */ | ||
842 | uint32_t bitWidth; /*!< Bit width */ | ||
843 | sgtl_sclk_edge_t sclkEdge; /*!< sclk valid edge */ | ||
844 | } sgtl_audio_format_t; | ||
845 | |||
846 | /*! @brief Initailize structure of sgtl5000 */ | ||
847 | typedef struct _sgtl_config | ||
848 | { | ||
849 | sgtl_route_t route; /*!< Audio data route.*/ | ||
850 | sgtl_protocol_t bus; /*!< Audio transfer protocol */ | ||
851 | bool master_slave; /*!< Master or slave. True means master, false means slave. */ | ||
852 | sgtl_audio_format_t format; /*!< audio format */ | ||
853 | |||
854 | uint8_t slaveAddress; /*!< code device slave address */ | ||
855 | codec_i2c_config_t i2cConfig; /*!< i2c bus configuration */ | ||
856 | } sgtl_config_t; | ||
857 | |||
858 | /*! @brief SGTL codec handler | ||
859 | */ | ||
860 | typedef struct _sgtl_handle | ||
861 | { | ||
862 | sgtl_config_t *config; /*!< sgtl config pointer */ | ||
863 | uint8_t i2cHandle[SGTL_I2C_HANDLER_SIZE]; /*!< i2c handle */ | ||
864 | } sgtl_handle_t; | ||
865 | |||
866 | /******************************************************************************* | ||
867 | * API | ||
868 | ******************************************************************************/ | ||
869 | #if defined(__cplusplus) | ||
870 | extern "C" { | ||
871 | #endif | ||
872 | |||
873 | /*! | ||
874 | * @brief sgtl5000 initialize function. | ||
875 | * | ||
876 | * This function calls SGTL_I2CInit(), and in this function, some configurations | ||
877 | * are fixed. The second parameter can be NULL. If users want to change the SGTL5000 settings, | ||
878 | * a configure structure should be prepared. | ||
879 | * @note If the codec_config is NULL, it would initialize sgtl5000 using default settings. | ||
880 | * The default setting: | ||
881 | * @code | ||
882 | * sgtl_init_t codec_config | ||
883 | * codec_config.route = kSGTL_RoutePlaybackandRecord | ||
884 | * codec_config.bus = kSGTL_BusI2S | ||
885 | * codec_config.master = slave | ||
886 | * @endcode | ||
887 | * | ||
888 | * @param handle Sgtl5000 handle structure. | ||
889 | * @param config sgtl5000 configuration structure. If this pointer equals to NULL, | ||
890 | * it means using the default configuration. | ||
891 | * @return Initialization status | ||
892 | */ | ||
893 | status_t SGTL_Init(sgtl_handle_t *handle, sgtl_config_t *config); | ||
894 | |||
895 | /*! | ||
896 | * @brief Set audio data route in sgtl5000. | ||
897 | * | ||
898 | * This function would set the data route according to route. The route cannot be combined, | ||
899 | * as all route would enable different modules. | ||
900 | * | ||
901 | * @note If a new route is set, the previous route would not work. | ||
902 | * @param handle Sgtl5000 handle structure. | ||
903 | * @param route Audio data route in sgtl5000. | ||
904 | */ | ||
905 | status_t SGTL_SetDataRoute(sgtl_handle_t *handle, sgtl_route_t route); | ||
906 | |||
907 | /*! | ||
908 | * @brief Set the audio transfer protocol. | ||
909 | * | ||
910 | * Sgtl5000 only supports I2S, I2S left, I2S right, PCM A, PCM B format. | ||
911 | * @param handle Sgtl5000 handle structure. | ||
912 | * @param protocol Audio data transfer protocol. | ||
913 | */ | ||
914 | status_t SGTL_SetProtocol(sgtl_handle_t *handle, sgtl_protocol_t protocol); | ||
915 | |||
916 | /*! | ||
917 | * @brief Set sgtl5000 as master or slave. | ||
918 | * | ||
919 | * @param handle Sgtl5000 handle structure. | ||
920 | * @param master 1 represent master, 0 represent slave. | ||
921 | */ | ||
922 | void SGTL_SetMasterSlave(sgtl_handle_t *handle, bool master); | ||
923 | |||
924 | /*! | ||
925 | * @brief Set the volume of different modules in sgtl5000. | ||
926 | * | ||
927 | * This function would set the volume of sgtl5000 modules. This interface set module volume. | ||
928 | * The function assume that left channel and right channel has the same volume. | ||
929 | * | ||
930 | * kSGTL_ModuleADC volume range: 0 - 0xF, 0dB - 22.5dB | ||
931 | * kSGTL_ModuleDAC volume range: 0x3C - 0xF0, 0dB - -90dB | ||
932 | * kSGTL_ModuleHP volume range: 0 - 0x7F, 12dB - -51.5dB | ||
933 | * kSGTL_ModuleLineOut volume range: 0 - 0x1F, 0.5dB steps | ||
934 | * | ||
935 | * @param handle Sgtl5000 handle structure. | ||
936 | * @param module Sgtl5000 module, such as DAC, ADC and etc. | ||
937 | * @param volume Volume value need to be set. The value is the exact value in register. | ||
938 | */ | ||
939 | status_t SGTL_SetVolume(sgtl_handle_t *handle, sgtl_module_t module, uint32_t volume); | ||
940 | |||
941 | /*! | ||
942 | * @brief Get the volume of different modules in sgtl5000. | ||
943 | * | ||
944 | * This function gets the volume of sgtl5000 modules. This interface get DAC module volume. | ||
945 | * The function assume that left channel and right channel has the same volume. | ||
946 | * @param handle Sgtl5000 handle structure. | ||
947 | * @param module Sgtl5000 module, such as DAC, ADC and etc. | ||
948 | * @return Module value, the value is exact value in register. | ||
949 | */ | ||
950 | uint32_t SGTL_GetVolume(sgtl_handle_t *handle, sgtl_module_t module); | ||
951 | |||
952 | /*! | ||
953 | * @brief Mute/unmute modules in sgtl5000. | ||
954 | * | ||
955 | * @param handle Sgtl5000 handle structure. | ||
956 | * @param module Sgtl5000 module, such as DAC, ADC and etc. | ||
957 | * @param mute True means mute, and false means unmute. | ||
958 | */ | ||
959 | status_t SGTL_SetMute(sgtl_handle_t *handle, sgtl_module_t module, bool mute); | ||
960 | |||
961 | /*! | ||
962 | * @brief Enable expected devices. | ||
963 | * @param handle Sgtl5000 handle structure. | ||
964 | * @param module Module expected to enable. | ||
965 | */ | ||
966 | status_t SGTL_EnableModule(sgtl_handle_t *handle, sgtl_module_t module); | ||
967 | |||
968 | /*! | ||
969 | * @brief Disable expected devices. | ||
970 | * @param handle Sgtl5000 handle structure. | ||
971 | * @param module Module expected to enable. | ||
972 | */ | ||
973 | status_t SGTL_DisableModule(sgtl_handle_t *handle, sgtl_module_t module); | ||
974 | |||
975 | /*! | ||
976 | * @brief Deinit the sgtl5000 codec. Shut down Sgtl5000 modules. | ||
977 | * @param handle Sgtl5000 handle structure pointer. | ||
978 | */ | ||
979 | status_t SGTL_Deinit(sgtl_handle_t *handle); | ||
980 | |||
981 | /*! | ||
982 | * @brief Configure the data format of audio data. | ||
983 | * | ||
984 | * This function would configure the registers about the sample rate, bit depths. | ||
985 | * @param handle Sgtl5000 handle structure pointer. | ||
986 | * @param mclk Master clock frequency of I2S. | ||
987 | * @param sample_rate Sample rate of audio file running in sgtl5000. Sgtl5000 now | ||
988 | * supports 8k, 11.025k, 12k, 16k, 22.05k, 24k, 32k, 44.1k, 48k and 96k sample rate. | ||
989 | * @param bits Bit depth of audio file (Sgtl5000 only supports 16bit, 20bit, 24bit | ||
990 | * and 32 bit in HW). | ||
991 | */ | ||
992 | status_t SGTL_ConfigDataFormat(sgtl_handle_t *handle, uint32_t mclk, uint32_t sample_rate, uint32_t bits); | ||
993 | |||
994 | /*! | ||
995 | * @brief select SGTL codec play source. | ||
996 | * | ||
997 | * @param handle Sgtl5000 handle structure pointer. | ||
998 | * @param playSource play source value, reference _sgtl_play_source. | ||
999 | * | ||
1000 | * @return kStatus_Success, else failed. | ||
1001 | */ | ||
1002 | status_t SGTL_SetPlay(sgtl_handle_t *handle, uint32_t playSource); | ||
1003 | |||
1004 | /*! | ||
1005 | * @brief select SGTL codec record source. | ||
1006 | * | ||
1007 | * @param handle Sgtl5000 handle structure pointer. | ||
1008 | * @param recordSource record source value, reference _sgtl_record_source. | ||
1009 | * | ||
1010 | * @return kStatus_Success, else failed. | ||
1011 | */ | ||
1012 | status_t SGTL_SetRecord(sgtl_handle_t *handle, uint32_t recordSource); | ||
1013 | |||
1014 | /*! | ||
1015 | * @brief Write register to sgtl using I2C. | ||
1016 | * @param handle Sgtl5000 handle structure. | ||
1017 | * @param reg The register address in sgtl. | ||
1018 | * @param val Value needs to write into the register. | ||
1019 | */ | ||
1020 | status_t SGTL_WriteReg(sgtl_handle_t *handle, uint16_t reg, uint16_t val); | ||
1021 | |||
1022 | /*! | ||
1023 | * @brief Read register from sgtl using I2C. | ||
1024 | * @param handle Sgtl5000 handle structure. | ||
1025 | * @param reg The register address in sgtl. | ||
1026 | * @param val Value written to. | ||
1027 | */ | ||
1028 | status_t SGTL_ReadReg(sgtl_handle_t *handle, uint16_t reg, uint16_t *val); | ||
1029 | |||
1030 | /*! | ||
1031 | * @brief Modify some bits in the register using I2C. | ||
1032 | * @param handle Sgtl5000 handle structure. | ||
1033 | * @param reg The register address in sgtl. | ||
1034 | * @param clr_mask The mask code for the bits want to write. The bit you want to write should be 0. | ||
1035 | * @param val Value needs to write into the register. | ||
1036 | */ | ||
1037 | status_t SGTL_ModifyReg(sgtl_handle_t *handle, uint16_t reg, uint16_t clr_mask, uint16_t val); | ||
1038 | |||
1039 | #if defined(__cplusplus) | ||
1040 | } | ||
1041 | #endif | ||
1042 | |||
1043 | /*! @} */ | ||
1044 | |||
1045 | #endif /* _FSL_SGTL5000_H_ */ | ||