aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/components/codec/da7212/fsl_dialog7212.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/components/codec/da7212/fsl_dialog7212.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/components/codec/da7212/fsl_dialog7212.h1266
1 files changed, 1266 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/components/codec/da7212/fsl_dialog7212.h b/lib/chibios-contrib/ext/mcux-sdk/components/codec/da7212/fsl_dialog7212.h
new file mode 100644
index 000000000..81c47a833
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/components/codec/da7212/fsl_dialog7212.h
@@ -0,0 +1,1266 @@
1/*
2 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2020 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_DIALOG7212_H_
9#define _FSL_DIALOG7212_H_
10
11#include "fsl_codec_i2c.h"
12
13/*!
14 * @addtogroup da7212
15 * @{
16 */
17/*******************************************************************************
18 * Definitions
19 ******************************************************************************/
20/*! @name Driver version */
21/*@{*/
22/*! @brief CLOCK driver version 2.2.2. */
23#define FSL_DA7212_DRIVER_VERSION (MAKE_VERSION(2, 2, 2))
24/*@}*/
25
26/*! @brief da7212 handle size */
27#ifndef DA7212_I2C_HANDLER_SIZE
28#define DA7212_I2C_HANDLER_SIZE CODEC_I2C_MASTER_HANDLER_SIZE
29#endif
30
31#define DA7212_INIT_SIZE (36U)
32#define DA7212_DAC_MAX_VOL (DA7213_DAC_GAIN_12DB)
33#define DA7212_DAC_MIN_VOL (DA7212_DAC_GAIN_MUTE)
34
35/*! @brief DA7212 I2C address */
36#define DA7212_ADDRESS (0x1A)
37
38#define DA7212_AUX_REGISTER_SIZE (33)
39#define DA7212_MIC2_REGISTER_SIZE (33)
40#define DA7212_MIC1_REGISTER_SIZE (24)
41
42#define DA7212_DAC_MUTE_ENABLED (0xC0)
43#define DA7212_DAC_MUTE_DISABLED (0x80)
44
45#define DA7212_MAX_VOLUME_STEPS (15)
46#define DA7212_MIN_VOLUME_STEPS (0)
47
48#define DA7212_MAX_VOLUME_STEPS (15)
49
50#define DA7212_CHANGE_FREQ_SIZE (0x05)
51
52#define CLEAR_REGISTER (0x00)
53
54#define DA7212_I2C_BAUDRATE (100000U)
55/***************************************************************************************************/
56/* * Register values. */
57
58/******************Status registers*********************/
59#define DIALOG7212_STATUS1 0x02
60#define DIALOG7212_PLL_STATUS 0x03
61#define DIALOG7212_AUX_L_GAIN_STATUS 0x04
62#define DIALOG7212_AUX_R_GAIN_STATUS 0x05
63#define DIALOG7212_MIC_1_GAIN_STATUS 0x06
64#define DIALOG7212_MIC_2_GAIN_STATUS 0x07
65#define DIALOG7212_MIXIN_L_GAIN_STATUS 0x08
66#define DIALOG7212_MIXIN_R_GAIN_STATUS 0x09
67#define DIALOG7212_ADC_L_GAIN_STATUS 0x0A
68#define DIALOG7212_ADC_R_GAIN_STATUS 0x0B
69#define DIALOG7212_DAC_L_GAIN_STATUS 0x0C
70#define DIALOG7212_DAC_R_GAIN_STATUS 0x0D
71#define DIALOG7212_HP_L_GAIN_STATUS 0x0E
72#define DIALOG7212_HP_R_GAIN_STATUS 0x0F
73#define DIALOG7212_LINE_GAIN_STATUS 0x10
74/***************System Initialisation Registers************/
75#define DIALOG7212_CIF_CTRL 0x1d
76#define DIALOG7212_DIG_ROUTING_DAI 0x21
77#define DIALOG7212_SR 0x22
78#define DIALOG7212_REFERENCES 0x23
79#define DIALOG7212_PLL_FRAC_TOP 0x24
80#define DIALOG7212_PLL_FRAC_BOT 0x25
81#define DIALOG7212_PLL_INTEGER 0x26
82#define DIALOG7212_PLL_CTRL 0x27
83#define DIALOG7212_DAI_CLK_MODE 0x28
84#define DIALOG7212_DAI_CTRL 0x29
85#define DIALOG7212_DIG_ROUTING_DAC 0x2A
86#define DIALOG7212_ALC_CTRL1 0x2B
87/************Input Gain/ Select Filter Registers**********/
88#define DIALOG7212_AUX_L_GAIN 0x30
89#define DIALOG7212_AUX_R_GAIN 0x31
90#define DIALOG7212_MIXIN_L_SELECT 0x32
91#define DIALOG7212_MIXIN_R_SELECT 0x33
92#define DIALOG7212_MIXIN_L_GAIN 0x34
93#define DIALOG7212_MIXIN_R_GAIN 0x35
94#define DIALOG7212_ADC_L_GAIN 0x36
95#define DIALOG7212_ADC_R_GAIN 0x37
96#define DIALOG7212_ADC_FILTERS1 0x38
97#define DIALOG7212_MIC_1_GAIN 0x39
98#define DIALOG7212_MIC_2_GAIN 0x3A
99/************Output Gain/ Select Filter Registers**********/
100#define DIALOG7212_DAC_FILTERS5 0x40
101#define DIALOG7212_DAC_FILTERS2 0x41
102#define DIALOG7212_DAC_FILTERS3 0x42
103#define DIALOG7212_DAC_FILTERS4 0x43
104#define DIALOG7212_DAC_FILTERS1 0x44
105#define DIALOG7212_DAC_L_GAIN 0x45
106#define DIALOG7212_DAC_R_GAIN 0x46
107#define DIALOG7212_CP_CTRL 0x47
108#define DIALOG7212_HP_L_GAIN 0x48
109#define DIALOG7212_HP_R_GAIN 0x49
110#define DIALOG7212_LINE_GAIN 0x4A
111#define DIALOG7212_MIXOUT_L_SELECT 0x4B
112#define DIALOG7212_MIXOUT_R_SELECT 0x4C
113/**************System Controller Registers(1)*************/
114#define DIALOG7212_SYSTEM_MODES_INPUT 0x50
115#define DIALOG7212_SYSTEM_MODES_OUTPUT 0x51
116/*****************Control Registers(2)********************/
117#define DIALOG7212_AUX_L_CTRL 0x60
118#define DIALOG7212_AUX_R_CTRL 0x61
119#define DIALOG7212_MICBIAS_CTRL 0x62
120#define DIALOG7212_MIC_1_CTRL 0x63
121#define DIALOG7212_MIC_2_CTRL 0x64
122#define DIALOG7212_MIXIN_L_CTRL 0x65
123#define DIALOG7212_MIXIN_R_CTRL 0x66
124#define DIALOG7212_ADC_L_CTRL 0x67
125#define DIALOG7212_ADC_R_CTRL 0x68
126#define DIALOG7212_DAC_L_CTRL 0x69
127#define DIALOG7212_DAC_R_CTRL 0x6A
128#define DIALOG7212_HP_L_CTRL 0x6B
129#define DIALOG7212_HP_R_CTRL 0x6C
130#define DIALOG7212_LINE_CTRL 0x6D
131#define DIALOG7212_MIXOUT_L_CTRL 0x6E
132#define DIALOG7212_MIXOUT_R_CTRL 0x6F
133/************ Registers**********/
134
135/****************Configuration Registers*****************/
136#define DIALOG7212_LDO_CTRL 0x90
137#define DIALOG7212_GAIN_RAMP_CTRL 0x92
138#define DIALOG7212_MIC_CONFIG 0x93
139#define DIALOG7212_PC_COUNT 0x94
140#define DIALOG7212_CP_VOL_THRESHOLD1 0x95
141#define DIALOG7212_CP_DELAY 0x96
142#define DIALOG7212_CP_DETECTOR 0x97
143#define DIALOG7212_DAI_OFFSET 0x98
144#define DIALOG7212_DIG_CTRL 0x99
145#define DIALOG7212_ALC_CTRL2 0x9A
146#define DIALOG7212_ALC_CTRL3 0x9B
147#define DIALOG7212_ALC_NOISE 0x9C
148#define DIALOG7212_ALC_TARGET_MIN 0x9D
149#define DIALOG7212_ALC_TARGET_MAX 0x9E
150#define DIALOG7212_ALC_GAIN_LIMITS 0x9F
151#define DIALOG7212_ALC_ANA_GAIN_LIMITS 0xA0
152#define DIALOG7212_ALC_ANTICLIP_CTRL 0xA1
153#define DIALOG7212_ALC_ANTICLIP_LEVEL 0xA2
154#define DIALOG7212_DAC_NG_SETUP_TIME 0xAF
155#define DIALOG7212_DAC_NG_OFF_THRESH 0xB0
156#define DIALOG7212_DAC_NG_ON_THRESH 0xB1
157#define DIALOG7212_DAC_NG_CTRL 0xB2
158//#define DIALOG7212_DAC_NG_SPARE 0xB3
159/************Tone Generation & Beep Registers************/
160#define DIALOG7212_TONE_GEN_CFG1 0xB4
161#define DIALOG7212_TONE_GEN_CFG2 0xB5
162#define DIALOG7212_TONE_GEN_CYCLES 0xB6
163#define DIALOG7212_TONE_GEN_FREQ1_L 0xB7
164#define DIALOG7212_TONE_GEN_FREQ1_U 0xB8
165#define DIALOG7212_TONE_GEN_FREQ2_L 0xB9
166#define DIALOG7212_TONE_GEN_FREQ2_U 0xBA
167#define DIALOG7212_TONE_GEN_ON_PER 0xBB
168#define DIALOG7212_TONE_GEN_OFF_PER 0xBC
169
170/************System Controller Registers(2)*************/
171#define DIALOG7212_SYSTEM_STATUS 0xE0
172
173#define DIALOG7212_SYSTEM_ACTIVE 0xFD
174
175/******************Driver DA7212 Macros*****************/
176
177/******************Status registers*********************/
178/* DIALOG7212_PLL_STATUS 0x03*/
179#define DIALOG7212_PLL_STATUS_BYPASS_ACTIVE_MASK (1U << 3)
180#define DIALOG7212_PLL_STATUS_MCLK_STATUS_MASK (1U << 2)
181#define DIALOG7212_PLL_STATUS_SRM_LOCK_MASK (1U << 1)
182#define DIALOG7212_PLL_STATUS_LOCK_MASK (1U << 0)
183
184/* DIALOG7212_AUX_L_GAIN_STATUS 0x04*/
185#define DIALOG7212_AUX_L_AMP_GAIN_STATUS_MASK (0x3F)
186#define DIALOG7212_AUX_L_AMP_GAIN_STATUS_SHIFT (0U)
187#define DIALOG7212_AUX_L_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_AUX_L_AMP_GAIN_STATUS_SHIFT)
188
189/* DIALOG7212_AUX_R_GAIN_STATUS 0x05*/
190#define DIALOG7212_AUX_R_AMP_GAIN_STATUS_MASK (0x3F)
191#define DIALOG7212_AUX_R_AMP_GAIN_STATUS_SHIFT (0U)
192#define DIALOG7212_AUX_R_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_AUX_R_AMP_GAIN_STATUS_SHIFT)
193
194/* DIALOG7212_MIC_1_GAIN_STATUS 0x06*/
195#define DIALOG7212_MIC_1_AMP_GAIN_STATUS_MASK (0x07)
196#define DIALOG7212_MIC_1_AMP_GAIN_STATUS_SHIFT (0U)
197#define DIALOG7212_MIC_1_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_MIC_1_AMP_GAIN_STATUS_SHIFT)
198
199/* DIALOG7212_MIC_2_GAIN_STATUS 0x07*/
200#define DIALOG7212_MIC_2_AMP_GAIN_STATUS_MASK (0x07)
201#define DIALOG7212_MIC_2_AMP_GAIN_STATUS_SHIFT (0U)
202#define DIALOG7212_MIC_2_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_MIC_2_AMP_GAIN_STATUS_SHIFT)
203
204/* DIALOG7212_MIXIN_L_GAIN_STATUS 0x08*/
205#define DIALOG7212_MIXIN_L_AMP_GAIN_STATUS_MASK (0x0F)
206#define DIALOG7212_MIXIN_L_AMP_GAIN_STATUS_SHIFT (0U)
207#define DIALOG7212_MIXIN_L_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_MIXIN_L_AMP_GAIN_STATUS_SHIFT)
208
209/* DIALOG7212_MIXIN_R_GAIN_STATUS 0x09*/
210#define DIALOG7212_MIXIN_R_AMP_GAIN_STATUS_MASK (0x0F)
211#define DIALOG7212_MIXIN_R_AMP_GAIN_STATUS_SHIFT (0U)
212#define DIALOG7212_MIXIN_R_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_MIXIN_R_AMP_GAIN_STATUS_SHIFT)
213
214/* DIALOG7212_ADC_L_GAIN_STATUS 0x0A*/
215#define DIALOG7212_ADC_L_GAIN_STATUS_MASK (0x7F)
216#define DIALOG7212_ADC_L_GAIN_STATUS_SHIFT (0U)
217#define DIALOG7212_ADC_L_GAIN_STATUS_VAL(x) ((x) << DIALOG7212_ADC_L_GAIN_STATUS_SHIFT)
218
219/* DIALOG7212_ADC_R_GAIN_STATUS 0x0B*/
220#define DIALOG7212_ADC_R_GAIN_STATUS_MASK (0x7F)
221#define DIALOG7212_ADC_R_GAIN_STATUS_SHIFT (0U)
222#define DIALOG7212_ADC_R_GAIN_STATUS_VAL(x) ((x) << DIALOG7212_ADC_R_GAIN_STATUS_SHIFT)
223
224/* DIALOG7212_DAC_L_GAIN_STATUS 0x0C*/
225#define DIALOG7212_DAC_L_GAIN_STATUS_MASK (0x7F)
226#define DIALOG7212_DAC_L_GAIN_STATUS_SHIFT (0U)
227#define DIALOG7212_DAC_L_GAIN_STATUS_VAL(x) ((x) << DIALOG7212_DAC_L_GAIN_STATUS_SHIFT)
228
229/* DIALOG7212_DAC_R_GAIN_STATUS 0x0D*/
230#define DIALOG7212_DAC_R_GAIN_STATUS_MASK (0x7F)
231#define DIALOG7212_DAC_R_GAIN_STATUS_SHIFT (0U)
232#define DIALOG7212_DAC_R_GAIN_STATUS_VAL(x) ((x) << DIALOG7212_DAC_R_GAIN_STATUS_SHIFT)
233
234/* DIALOG7212_HP_L_GAIN_STATUS 0x0E*/
235#define DIALOG7212_HP_L_AMP_GAIN_STATUS_MASK (0x3F)
236#define DIALOG7212_HP_L_AMP_GAIN_STATUS_SHIFT (0U)
237#define DIALOG7212_HP_L_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_HP_L_AMP_GAIN_STATUS_SHIFT)
238
239/* DIALOG7212_HP_R_GAIN_STATUS 0x0F*/
240#define DIALOG7212_HP_R_AMP_GAIN_STATUS_MASK (0x3F)
241#define DIALOG7212_HP_R_AMP_GAIN_STATUS_SHIFT (0U)
242#define DIALOG7212_HP_R_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_HP_R_AMP_GAIN_STATUS_SHIFT)
243
244/* DIALOG7212_LINE_GAIN_STATUS 0x10*/
245#define DIALOG7212_LINE_AMP_GAIN_STATUS_MASK (0x3F)
246#define DIALOG7212_LINE_AMP_GAIN_STATUS_SHIFT (0U)
247#define DIALOG7212_LINE_AMP_GAIN_STATUS(x) ((x) << DIALOG7212_LINE_AMP_GAIN_STATUS_SHIFT)
248
249/***************System Initialisation Registers************/
250
251/* DIALOG7212_CIF_CTRL 0x1d */
252#define DIALOG7212_CIF_CTRL_CIF_REG_SOFT_RESET_MASK (1U << 7)
253#define DIALOG7212_CIF_CTRL_CIF_I2C_WRITE_MODE_MASK (1U << 0)
254
255/* DIALOG7212_DIG_ROUTING_DAI 0x21 */
256#define DIALOG7212_DIG_ROUTING_DAI_R_SRC_MASK (0x30)
257#define DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT (4U)
258#define DIALOG7212_DIG_ROUTING_DAI_R_SRC_ADC_LEFT (0U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
259#define DIALOG7212_DIG_ROUTING_DAI_R_SRC_ADC_RIGHT (1U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
260#define DIALOG7212_DIG_ROUTING_DAI_R_SRC_DAI_LEFT (2U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
261#define DIALOG7212_DIG_ROUTING_DAI_R_SRC_DAI_RIGHT (3U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
262#define DIALOG7212_DIG_ROUTING_DAI_L_SRC_MASK (0x03)
263#define DIALOG7212_DIG_ROUTING_DAI_L_SRC_SHIFT (4U)
264#define DIALOG7212_DIG_ROUTING_DAI_L_SRC_ADC_LEFT (0U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
265#define DIALOG7212_DIG_ROUTING_DAI_L_SRC_ADC_RIGHT (1U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
266#define DIALOG7212_DIG_ROUTING_DAI_L_SRC_DAI_LEFT (2U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
267#define DIALOG7212_DIG_ROUTING_DAI_L_SRC_DAI_RIGHT (3U << DIALOG7212_DIG_ROUTING_DAI_R_SRC_SHIFT)
268
269/* DIALOG7212_SR 0x22 */
270#define DIALOG7212_SR_MASK (0x0F)
271#define DIALOG7212_SR_SHIFT (0U)
272#define DIALOG7212_SR_8KHZ (1U << DIALOG7212_SR_SHIFT)
273#define DIALOG7212_SR_11_025KHZ (2U << DIALOG7212_SR_SHIFT)
274#define DIALOG7212_SR_12KHZ (3U << DIALOG7212_SR_SHIFT)
275#define DIALOG7212_SR_16KHZ (5U << DIALOG7212_SR_SHIFT)
276#define DIALOG7212_SR_22KHZ (6U << DIALOG7212_SR_SHIFT)
277#define DIALOG7212_SR_24KHZ (7U << DIALOG7212_SR_SHIFT)
278#define DIALOG7212_SR_32KHZ (9U << DIALOG7212_SR_SHIFT)
279#define DIALOG7212_SR_44_1KHZ (10U << DIALOG7212_SR_SHIFT)
280#define DIALOG7212_SR_48KHZ (11U << DIALOG7212_SR_SHIFT)
281#define DIALOG7212_SR_88_2KHZ (14U << DIALOG7212_SR_SHIFT)
282#define DIALOG7212_SR_96KHZ (15U << DIALOG7212_SR_SHIFT)
283
284/* DIALOG7212_REFERENCES 0x23 */
285#define DIALOG7212_REFERENCES_VMID_FAST_DISCHARGE_MASK (1U << 5)
286#define DIALOG7212_REFERENCES_VMID_FAST_CHARGE_MASK (1U << 4)
287#define DIALOG7212_REFERENCES_BIAS_EN_MASK (1U << 3)
288
289/* DIALOG7212_PLL_FRAC_TOP 0x24 */
290#define DIALOG7212_PLL_FBDIV_FRAC_TOP_MASK (0x1F)
291#define DIALOG7212_PLL_FBDIV_FRAC_TOP_SHIFT (0U)
292#define DIALOG7212_PLL_FBDIV_FRAC_TOP(x) ((x) << DIALOG7212_PLL_FBDIV_FRAC_TOP_SHIFT)
293
294/* DIALOG7212_PLL_FRAC_BOT 0x25 */
295#define DIALOG7212_PLL_FBDIV_FRAC_BOT_MASK (0xFF)
296#define DIALOG7212_PLL_FBDIV_FRAC_BOT_SHIFT (0U)
297#define DIALOG7212_PLL_FBDIV_FRAC_BOT(x) ((x) << DIALOG7212_PLL_FBDIV_FRAC_BOT_SHIFT)
298
299/* DIALOG7212_PLL_INTEGER 0x26 */
300#define DIALOG7212_PLL_FBDIV_INTEGER_MASK (0xFF)
301#define DIALOG7212_PLL_FBDIV_INTEGER_SHIFT (0U)
302#define DIALOG7212_PLL_FBDIV_INTEGER_BOT(x) ((x) << DIALOG7212_PLL_FBDIV_INTEGER_SHIFT)
303
304/* DIALOG7212_PLL_CTRL 0x27 */
305#define DIALOG7212_PLL_EN_MASK (1U << 7)
306#define DIALOG7212_PLL_SRM_EN_MASK (1U << 6)
307#define DIALOG7212_PLL_32K_MODE_MASK (1U << 5)
308#define DIALOG7212_PLL_MCLKSQR_EN_MASK (1U << 4)
309#define DIALOG7212_PLL_INDIV_MASK (0x06)
310#define DIALOG7212_PLL_INDIV_SHIFT (2U)
311#define DIALOG7212_PLL_INDIV_2_10MHZ (0U << DIALOG7212_PLL_INDIV_SHIFT)
312#define DIALOG7212_PLL_INDIV_10_20MHZ (1U << DIALOG7212_PLL_INDIV_SHIFT)
313#define DIALOG7212_PLL_INDIV_20_40MHZ (2U << DIALOG7212_PLL_INDIV_SHIFT)
314#define DIALOG7212_PLL_INDIV_40_80MHZ (3U << DIALOG7212_PLL_INDIV_SHIFT)
315
316/* DIALOG7212_DAI_CLK_MODE 0x28 */
317#define DIALOG7212_DAI_CLK_EN_MASK (1U << 7)
318#define DIALOG7212_DAI_WCLK_POL_MASK (1U << 3)
319#define DIALOG7212_DAI_CLK_POL_MASK (1U << 2)
320#define DIALOG7212_DAI_BCLKS_PER_WCLK_MASK (0x03)
321#define DIALOG7212_DAI_BCLKS_PER_WCLK_SHIFT (0U)
322#define DIALOG7212_DAI_BCLKS_PER_WCLK_BCLK32 (0U << DIALOG7212_DAI_BCLKS_PER_WCLK_SHIFT)
323#define DIALOG7212_DAI_BCLKS_PER_WCLK_BCLK64 (1U << DIALOG7212_DAI_BCLKS_PER_WCLK_SHIFT)
324#define DIALOG7212_DAI_BCLKS_PER_WCLK_BCLK128 (2U << DIALOG7212_DAI_BCLKS_PER_WCLK_SHIFT)
325#define DIALOG7212_DAI_BCLKS_PER_WCLK_BCLK256 (3U << DIALOG7212_DAI_BCLKS_PER_WCLK_SHIFT)
326
327/* DIALOG7212_DAI_CTRL 0x29 */
328#define DIALOG7212_DAI_EN_MASK (1U << 7)
329#define DIALOG7212_DAI_OE_MASK (1U << 6)
330#define DIALOG7212_DAI_TDM_MODE_EN_MASK (1U << 5)
331#define DIALOG7212_DAI_MONO_MODE_MASK (1U << 4)
332#define DIALOG7212_DAI_WORD_LENGTH_MASK (0x06)
333#define DIALOG7212_DAI_WORD_LENGTH_SHIFT (2U)
334#define DIALOG7212_DAI_WORD_LENGTH_16B (0U << DIALOG7212_DAI_WORD_LENGTH_SHIFT)
335#define DIALOG7212_DAI_WORD_LENGTH_20B (1U << DIALOG7212_DAI_WORD_LENGTH_SHIFT)
336#define DIALOG7212_DAI_WORD_LENGTH_24B (2U << DIALOG7212_DAI_WORD_LENGTH_SHIFT)
337#define DIALOG7212_DAI_WORD_LENGTH_32B (3U << DIALOG7212_DAI_WORD_LENGTH_SHIFT)
338#define DIALOG7212_DAI_FORMAT_MASK (0x03)
339#define DIALOG7212_DAI_FORMAT_SHIFT (0U)
340#define DIALOG7212_DAI_FORMAT_I2S_MODE (0U << DIALOG7212_DAI_FORMAT_SHIFT)
341#define DIALOG7212_DAI_FORMAT_LEFT_JUSTIFIED (1U << DIALOG7212_DAI_FORMAT_SHIFT)
342#define DIALOG7212_DAI_FORMAT_RIGTH_JUSTIFIED (2U << DIALOG7212_DAI_FORMAT_SHIFT)
343#define DIALOG7212_DAI_FORMAT_DSP_MODE (3U << DIALOG7212_DAI_FORMAT_SHIFT)
344
345/* DIALOG7212_DIG_ROUTING_DAC 0x2A */
346#define DIALOG7212_DIG_ROUTING_DAC_R_MONO_MASK (1U << 7)
347#define DIALOG7212_DIG_ROUTING_DAC_R_RSC_MASK (0x30)
348#define DIALOG7212_DIG_ROUTING_DAC_R_RSC_SHIFT (4U)
349#define DIALOG7212_DIG_ROUTING_DAC_R_RSC_ADC_L_OUTPUT (0U << DIALOG7212_DIG_ROUTING_DAC_R_RSC_SHIFT)
350#define DIALOG7212_DIG_ROUTING_DAC_R_RSC_ADC_R_OUTPUT (1U << DIALOG7212_DIG_ROUTING_DAC_R_RSC_SHIFT)
351#define DIALOG7212_DIG_ROUTING_DAC_R_RSC_DAC_L (2U << DIALOG7212_DIG_ROUTING_DAC_R_RSC_SHIFT)
352#define DIALOG7212_DIG_ROUTING_DAC_R_RSC_DAC_R (3U << DIALOG7212_DIG_ROUTING_DAC_R_RSC_SHIFT)
353#define DIALOG7212_DIG_ROUTING_DAC_L_MONO_MASK (1U << 3)
354#define DIALOG7212_DIG_ROUTING_DAC_L_RSC_MASK (0x03)
355#define DIALOG7212_DIG_ROUTING_DAC_L_RSC_SHIFT (0U)
356#define DIALOG7212_DIG_ROUTING_DAC_L_RSC_ADC_L_OUTPUT (0U << DIALOG7212_DIG_ROUTING_DAC_L_RSC_SHIFT)
357#define DIALOG7212_DIG_ROUTING_DAC_L_RSC_ADC_R_OUTPUT (1U << DIALOG7212_DIG_ROUTING_DAC_L_RSC_SHIFT)
358#define DIALOG7212_DIG_ROUTING_DAC_L_RSC_DAC_L (2U << DIALOG7212_DIG_ROUTING_DAC_L_RSC_SHIFT)
359#define DIALOG7212_DIG_ROUTING_DAC_L_RSC_DAC_R (3U << DIALOG7212_DIG_ROUTING_DAC_L_RSC_SHIFT)
360
361/* DIALOG7212_ALC_CTRL1 0x2B */
362#define DIALOG7212_ALC_R_EN_MASK (1U << 7)
363#define DIALOG7212_ALC_CALIB_OVERFLOW_MASK (1U << 5)
364#define DIALOG7212_ALC_AUTO_CALIB_EN_MASK (1U << 4)
365#define DIALOG7212_ALC_L_EN_MASK (1U << 3)
366#define DIALOG7212_ALC_CALIB_MODE_MASK (1U << 2)
367#define DIALOG7212_ALC_SYNC_MODE_MASK (1U << 1)
368#define DIALOG7212_ALC_OFFSET_EN_MASK (1U << 0)
369
370/************Input Gain/ Select Filter Registers**********/
371/* DIALOG7212_AUX_L_GAIN 0x30 */
372#define DIALOG7212_AUX_L_AMP_GAIN_MASK (0x3F)
373#define DIALOG7212_AUX_L_AMP_GAIN_SHIFT (0U)
374#define DIALOG7212_AUX_L_AMP_GAIN(x) ((x) << DIALOG7212_AUX_L_AMP_GAIN_SHIFT)
375
376/* DIALOG7212_AUX_R_GAIN 0x31 */
377#define DIALOG7212_AUX_R_AMP_GAIN_MASK (0x3F)
378#define DIALOG7212_AUX_R_AMP_GAIN_SHIFT (0U)
379#define DIALOG7212_AUX_R_AMP_GAIN(x) ((x) << DIALOG7212_AUX_R_AMP_GAIN_SHIFT)
380
381/* DIALOG7212_MIXIN_L_SELECT 0x32 */
382#define DIALOG7212_MIXIN_L_SELECT_DMIC_L_EN_MASK (1U << 7)
383#define DIALOG7212_MIXIN_L_SELECT_MIXING_R_MASK (1U << 3)
384#define DIALOG7212_MIXIN_L_SELECT_MIC2_SEL_MASK (1U << 2)
385#define DIALOG7212_MIXIN_L_SELECT_MIC1_SEL_MASK (1U << 1)
386#define DIALOG7212_MIXIN_L_SELECT_AUX_L_SEL_MASK (1U << 0)
387
388/* DIALOG7212_MIXIN_R_SELECT 0x33 */
389#define DIALOG7212_MIXIN_R_SELECT_DMIC_R_EN_MASK (1U << 7)
390#define DIALOG7212_MIXIN_R_SELECT_MIXING_L_MASK (1U << 3)
391#define DIALOG7212_MIXIN_R_SELECT_MIC2_SEL_MASK (1U << 2)
392#define DIALOG7212_MIXIN_R_SELECT_MIC1_SEL_MASK (1U << 1)
393#define DIALOG7212_MIXIN_R_SELECT_AUX_R_SEL_MASK (1U << 0)
394
395/* DIALOG7212_MIXIN_L_GAIN 0x34 */
396#define DIALOG7212_MIXIN_L_AMP_GAIN_MASK (0x0F)
397#define DIALOG7212_MIXIN_L_AMP_GAIN_SHIFT (0U)
398#define DIALOG7212_MIXIN_L_AMP_GAIN(x) ((x) << DIALOG7212_MIXIN_L_AMP_GAIN_SHIFT)
399
400/* DIALOG7212_MIXIN_R_GAIN 0x35 */
401#define DIALOG7212_MIXIN_R_AMP_GAIN_MASK (0x0F)
402#define DIALOG7212_MIXIN_R_AMP_GAIN_SHIFT (0U)
403#define DIALOG7212_MIXIN_R_AMP_GAIN(x) ((x) << DIALOG7212_MIXIN_R_AMP_GAIN_SHIFT)
404
405/* DIALOG7212_ADC_L_GAIN 0x36 */
406#define DIALOG7212_ADC_L_DIGITAL_GAIN_MASK (0x7F)
407#define DIALOG7212_ADC_L_DIGITAL_GAIN_SHIFT (0U)
408#define DIALOG7212_ADC_L_DIGITAL_GAIN(x) ((x) << DIALOG7212_ADC_L_DIGITAL_GAIN_SHIFT)
409
410/* DIALOG7212_ADC_R_GAIN 0x37 */
411#define DIALOG7212_ADC_R_DIGITAL_GAIN_MASK (0x7F)
412#define DIALOG7212_ADC_R_DIGITAL_GAIN_SHIFT (0U)
413#define DIALOG7212_ADC_R_DIGITAL_GAIN(x) ((x) << DIALOG7212_ADC_R_DIGITAL_GAIN_SHIFT)
414
415/* DIALOG7212_ADC_FILTERS1 0x38 */
416#define DIALOG7212_ADC_FILTERS1_ADC_HPF_EN_MASK (1U << 7)
417#define DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_MASK (0x30)
418#define DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_SHIFT (5U)
419#define DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_2HZ (0U << DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_SHIFT)
420#define DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_4HZ (1U << DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_SHIFT)
421#define DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_8HZ (2U << DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_SHIFT)
422#define DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_16HZ (3U << DIALOG7212_ADC_FILTERS1_ADC_AUDIO_HPF_CORNER_SHIFT)
423#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_EN_MASK (1U << 3)
424#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_MASK (0x07)
425#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT (0U)
426#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_2_5HZ (0U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
427#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_25HZ (1U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
428#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_50HZ (2U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
429#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_100HZ (3U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
430#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_150HZ (4U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
431#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_200HZ (5U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
432#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_300HZ (6U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
433#define DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_400HZ (7U << DIALOG7212_ADC_FILTERS1_ADC_VOICE_HPF_CORNER_SHIFT)
434
435/* DIALOG7212_MIC_1_GAIN 0x39 */
436#define DIALOG7212_MIC_1_AMP_GAIN_MASK (0x07)
437#define DIALOG7212_MIC_1_AMP_GAIN_SHIFT (0U)
438#define DIALOG7212_MIC_1_AMP_GAIN_N6DB (0U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
439#define DIALOG7212_MIC_1_AMP_GAIN_0DB (1U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
440#define DIALOG7212_MIC_1_AMP_GAIN_P6DB (2U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
441#define DIALOG7212_MIC_1_AMP_GAIN_P12DB (3U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
442#define DIALOG7212_MIC_1_AMP_GAIN_P18DB (4U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
443#define DIALOG7212_MIC_1_AMP_GAIN_P24DB (5U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
444#define DIALOG7212_MIC_1_AMP_GAIN_P30DB (6U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
445#define DIALOG7212_MIC_1_AMP_GAIN_P36DB (7U << DIALOG7212_MIC_1_AMP_GAIN_SHIFT)
446
447/* DIALOG7212_MIC_2_GAIN 0x3A */
448#define DIALOG7212_MIC_2_AMP_GAIN_MASK (0x07)
449#define DIALOG7212_MIC_2_AMP_GAIN_SHIFT (0U)
450#define DIALOG7212_MIC_2_AMP_GAIN_N6DB (0U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
451#define DIALOG7212_MIC_2_AMP_GAIN_0DB (1U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
452#define DIALOG7212_MIC_2_AMP_GAIN_P6DB (2U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
453#define DIALOG7212_MIC_2_AMP_GAIN_P12DB (3U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
454#define DIALOG7212_MIC_2_AMP_GAIN_P18DB (4U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
455#define DIALOG7212_MIC_2_AMP_GAIN_P24DB (5U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
456#define DIALOG7212_MIC_2_AMP_GAIN_P30DB (6U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
457#define DIALOG7212_MIC_2_AMP_GAIN_P36DB (7U << DIALOG7212_MIC_2_AMP_GAIN_SHIFT)
458
459/************Output Gain/ Select Filter Registers**********/
460/* DIALOG7212_DAC_FILTERS5 0x40 */
461#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_EN_MASK (1U << 7)
462#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_MASK (0x07)
463#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT (4U)
464#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_1 (0U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
465#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_2 (1U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
466#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_4 (2U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
467#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_8 (3U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
468#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_16 (4U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
469#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_32 (5U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
470#define DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_64 (6U << DIALOG7212_DAC_FILTERS5_SOFTMUTE_RATE_SHIFT)
471
472/* DIALOG7212_DAC_FILTERS2 0x41 */
473#define DIALOG7212_DAC_FILTERS2_EQ_BAND2_MASK (0xF0)
474#define DIALOG7212_DAC_FILTERS2_EQ_BAND2_SHIFT (4U)
475#define DIALOG7212_DAC_FILTERS2_EQ_BAND2(x) ((x) << DIALOG7212_DAC_FILTERS2_EQ_BAND2_SHIFT)
476#define DIALOG7212_DAC_FILTERS2_EQ_BAND1_MASK (0x0F)
477#define DIALOG7212_DAC_FILTERS2_EQ_BAND1_SHIFT (0U)
478#define DIALOG7212_DAC_FILTERS2_EQ_BAND1(x) ((x) << DIALOG7212_DAC_FILTERS2_EQ_BAND1_SHIFT)
479
480/* DIALOG7212_DAC_FILTERS3 0x42 */
481#define DIALOG7212_DAC_FILTERS3_EQ_BAND4_MASK (0xF0)
482#define DIALOG7212_DAC_FILTERS3_EQ_BAND4_SHIFT (4U)
483#define DIALOG7212_DAC_FILTERS3_EQ_BAND4(x) ((x) << DIALOG7212_DAC_FILTERS2_EQ_BAND4_SHIFT)
484#define DIALOG7212_DAC_FILTERS3_EQ_BAND3_MASK (0x0F)
485#define DIALOG7212_DAC_FILTERS3_EQ_BAND3_SHIFT (0U)
486#define DIALOG7212_DAC_FILTERS3_EQ_BAND3(x) ((x) << DIALOG7212_DAC_FILTERS2_EQ_BAND3_SHIFT)
487
488/* DIALOG7212_DAC_FILTERS4 0x43 */
489#define DIALOG7212_DAC_FILTERS4_EQ_EN_MASK (1U << 7)
490#define DIALOG7212_DAC_FILTERS4_EQ_BAND5_MASK (0x0F)
491#define DIALOG7212_DAC_FILTERS4_EQ_BAND5_SHIFT (0U)
492#define DIALOG7212_DAC_FILTERS4_EQ_BAND5(x) ((x) << DIALOG7212_DAC_FILTERS2_EQ_BAND5_SHIFT)
493
494/* DIALOG7212_DAC_FILTERS1 0x44 */
495#define DIALOG7212_DAC_FILTERS1_HPF_EN_MASK (1U << 7)
496#define DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_MASK (0x30)
497#define DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_SHIFT (5U)
498#define DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_2HZ (0U << DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_SHIFT)
499#define DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_4HZ (1U << DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_SHIFT)
500#define DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_8HZ (2U << DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_SHIFT)
501#define DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_16HZ (3U << DIALOG7212_DAC_FILTERS1_DAC_AUDIO_HPF_CORNER_SHIFT)
502#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_EN_MASK (1U << 3)
503#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_MASK (0x07)
504#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT (0U)
505#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_2_5HZ (0U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
506#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_25HZ (1U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
507#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_50HZ (2U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
508#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_100HZ (3U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
509#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_150HZ (4U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
510#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_200HZ (5U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
511#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_300HZ (6U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
512#define DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_400HZ (7U << DIALOG7212_DAC_FILTERS1_DAC_VOICE_HPF_CORNER_SHIFT)
513
514/* DIALOG7212_DAC_L_GAIN 0x45 */
515#define DIALOG7212_DAC_L_DIGITAL_GAIN_MASK (0x7F)
516#define DIALOG7212_DAC_L_DIGITAL_GAIN_SHIFT (0U)
517#define DIALOG7212_DAC_L_DIGITAL_GAIN(x) ((x) << DIALOG7212_DAC_L_DIGITAL_GAIN_SHIFT)
518
519/* DIALOG7212_DAC_R_GAIN 0x46 */
520#define DIALOG7212_DAC_R_DIGITAL_GAIN_MASK (0x7F)
521#define DIALOG7212_DAC_R_DIGITAL_GAIN_SHIFT (0U)
522#define DIALOG7212_DAC_R_DIGITAL_GAIN(x) ((x) << DIALOG7212_DAC_R_DIGITAL_GAIN_SHIFT)
523
524/* DIALOG7212_CP_CTRL 0x47 */
525#define DIALOG7212_CP_CTRL_EN_MASK (1U << 7)
526#define DIALOG7212_CP_CTRL_SMALL_SWIT_CH_FREQ_EN_MASK (1U << 6)
527#define DIALOG7212_CP_CTRL_MCHANGE_MASK (0x30)
528#define DIALOG7212_CP_CTRL_MCHANGE_SHIFT (4U)
529#define DIALOG7212_CP_CTRL_MCHANGE_CP_MOD (0U << DIALOG7212_CP_CTRL_MCHANGE_SHIFT)
530#define DIALOG7212_CP_CTRL_MCHANGE_PGA (1U << DIALOG7212_CP_CTRL_MCHANGE_SHIFT)
531#define DIALOG7212_CP_CTRL_MCHANGE_DAC (2U << DIALOG7212_CP_CTRL_MCHANGE_SHIFT)
532#define DIALOG7212_CP_CTRL_MCHANGE_OUTPUT (3U << DIALOG7212_CP_CTRL_MCHANGE_SHIFT)
533#define DIALOG7212_CP_CTRL_MOD_MASK (0x0C)
534#define DIALOG7212_CP_CTRL_MOD_SHIFT (2U)
535#define DIALOG7212_CP_CTRL_MOD_STANDBY (0U << DIALOG7212_CP_CTRL_MOD_SHIFT)
536#define DIALOG7212_CP_CTRL_MOD_CPVDD_2 (2U << DIALOG7212_CP_CTRL_MOD_SHIFT)
537#define DIALOG7212_CP_CTRL_MOD_CPVDD_1 (3U << DIALOG7212_CP_CTRL_MOD_SHIFT)
538#define DIALOG7212_CP_CTRL_ANALOG_VLL_MASK (0x03)
539#define DIALOG7212_CP_CTRL_ANALOG_VLL_SHIFT (0U)
540#define DIALOG7212_CP_CTRL_ANALOG_VLL_NO_FEEDBACK (0U << DIALOG7212_CP_CTRL_ANALOG_VLL_SHIFT)
541#define DIALOG7212_CP_CTRL_ANALOG_VLL_LV_BOOSTS_CP (1U << DIALOG7212_CP_CTRL_ANALOG_VLL_SHIFT)
542#define DIALOG7212_CP_CTRL_ANALOG_VLL_LV_RESTART_CP (2U << DIALOG7212_CP_CTRL_ANALOG_VLL_SHIFT)
543
544/* DIALOG7212_HP_L_GAIN 0x48 */
545#define DIALOG7212_HP_L_AMP_GAIN_MASK (0x3F)
546#define DIALOG7212_HP_L_AMP_GAIN_SHIFT (0U)
547#define DIALOG7212_HP_L_AMP_GAIN(x) ((x) << DIALOG7212_HP_L_AMP_GAIN_SHIFT)
548
549/* DIALOG7212_HP_R_GAIN 0x49 */
550#define DIALOG7212_HP_R_AMP_GAIN_MASK (0x3F)
551#define DIALOG7212_HP_R_AMP_GAIN_SHIFT (0U)
552#define DIALOG7212_HP_R_AMP_GAIN(x) ((x) << DIALOG7212_HP_R_AMP_GAIN_SHIFT)
553
554/* DIALOG7212_LINE_GAIN 0x4A */
555#define DIALOG7212_LINE_AMP_GAIN_MASK (0x3F)
556#define DIALOG7212_LINE_AMP_GAIN_SHIFT (0U)
557#define DIALOG7212_LINE_AMP_GAIN(x) ((x) << DIALOG7212_LINE_AMP_GAIN_SHIFT)
558
559/* DIALOG7212_MIXOUT_L_SELECT 0x4B */
560#define DIALOG7212_MIXOUT_L_SELECT_MIXIN_R_INV_MASK (1U << 6)
561#define DIALOG7212_MIXOUT_L_SELECT_MIXIN_L_INV_MASK (1U << 5)
562#define DIALOG7212_MIXOUT_L_SELECT_AUX_L_INV_MASK (1U << 4)
563#define DIALOG7212_MIXOUT_L_SELECT_DAC_L_MASK (1U << 3)
564#define DIALOG7212_MIXOUT_L_SELECT_MIXIN_R_MASK (1U << 2)
565#define DIALOG7212_MIXOUT_L_SELECT_MIXIN_L_MASK (1U << 1)
566#define DIALOG7212_MIXOUT_L_SELECT_AUX_L_MASK (1U << 0)
567
568/* DIALOG7212_MIXOUT_R_SELECT 0x4C */
569#define DIALOG7212_MIXOUT_R_SELECT_MIXIN_L_INV_MASK (1U << 6)
570#define DIALOG7212_MIXOUT_R_SELECT_MIXIN_R_INV_MASK (1U << 5)
571#define DIALOG7212_MIXOUT_R_SELECT_AUX_R_INV_MASK (1U << 4)
572#define DIALOG7212_MIXOUT_R_SELECT_DAC_R_MASK (1U << 3)
573#define DIALOG7212_MIXOUT_R_SELECT_MIXIN_L_MASK (1U << 2)
574#define DIALOG7212_MIXOUT_R_SELECT_MIXIN_R_MASK (1U << 1)
575#define DIALOG7212_MIXOUT_R_SELECT_AUX_R_MASK (1U << 0)
576
577/**************System Controller Registers(1)*************/
578/* DIALOG7212_SYSTEM_MODES_INPUT 0x50 */
579#define DIALOG7212_SYSTEM_MODES_INPUT_ADC_R_MASK (1U << 7)
580#define DIALOG7212_SYSTEM_MODES_INPUT_ADC_L_MASK (1U << 6)
581#define DIALOG7212_SYSTEM_MODES_INPUT_MIXIN_R_MASK (1U << 5)
582#define DIALOG7212_SYSTEM_MODES_INPUT_MIXIN_L_MASK (1U << 4)
583#define DIALOG7212_SYSTEM_MODES_INPUT_MIC_2_MASK (1U << 3)
584#define DIALOG7212_SYSTEM_MODES_INPUT_MIC_1_MASK (1U << 2)
585#define DIALOG7212_SYSTEM_MODES_INPUT_MIC_BIAS_MASK (1U << 1)
586#define DIALOG7212_SYSTEM_MODES_INPUT_MODE_SUBMIT_MASK (1U << 0)
587
588/* DIALOG7212_SYSTEM_MODES_OUTPUT 0x51 */
589#define DIALOG7212_SYSTEM_MODES_OUTPUT_DAC_R_MASK (1U << 7)
590#define DIALOG7212_SYSTEM_MODES_OUTPUT_DAC_L_MASK (1U << 6)
591#define DIALOG7212_SYSTEM_MODES_OUTPUT_HP_R_MASK (1U << 5)
592#define DIALOG7212_SYSTEM_MODES_OUTPUT_HP_L_MASK (1U << 4)
593#define DIALOG7212_SYSTEM_MODES_OUTPUT_LINE_MASK (1U << 3)
594#define DIALOG7212_SYSTEM_MODES_OUTPUT_AUX_R_MASK (1U << 2)
595#define DIALOG7212_SYSTEM_MODES_OUTPUT_AUX_L_MASK (1U << 1)
596#define DIALOG7212_SYSTEM_MODES_OUTPUT_MODE_SUBMIT_MASK (1U << 0)
597
598/*****************Control Registers(2)********************/
599/* DIALOG7212_AUX_L_CTRL 0x60 */
600#define DIALOG7212_AUX_L_CTRL_AMP_EN_MASK (1U << 7)
601#define DIALOG7212_AUX_L_CTRL_AMP_MUTE_EN_MASK (1U << 6)
602#define DIALOG7212_AUX_L_CTRL_AMP_RAMP_EN_MASK (1U << 5)
603#define DIALOG7212_AUX_L_CTRL_AMP_ZC_EN_MASK (1U << 4)
604#define DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_MASK (0x0C)
605#define DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_SHIFT (2U)
606#define DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_INPUT_AUX_L (0U << DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_SHIFT)
607#define DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_INPUT_AUX_L_IF (1U << DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_SHIFT)
608#define DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_NO_ZC_POSSBLE (2U << DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_SHIFT)
609#define DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_OUTPUT_AUX_L (3U << DIALOG7212_AUX_L_CTRL_AMP_ZC_SEL_SHIFT)
610
611/* DIALOG7212_AUX_R_CTRL 0x61 */
612#define DIALOG7212_AUX_R_CTRL_AMP_EN_MASK (1U << 7)
613#define DIALOG7212_AUX_R_CTRL_AMP_MUTE_EN_MASK (1U << 6)
614#define DIALOG7212_AUX_R_CTRL_AMP_RAMP_EN_MASK (1U << 5)
615#define DIALOG7212_AUX_R_CTRL_AMP_ZC_EN_MASK (1U << 4)
616#define DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_MASK (0x0C)
617#define DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_SHIFT (2U)
618#define DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_INPUT_AUX_R (0U << DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_SHIFT)
619#define DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_INPUT_AUX_R_IF (1U << DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_SHIFT)
620#define DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_NO_ZC_POSSBLE (2U << DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_SHIFT)
621#define DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_OUTPUT_AUX_R (3U << DIALOG7212_AUX_R_CTRL_AMP_ZC_SEL_SHIFT)
622
623/* DIALOG7212_MICBIAS_CTRL 0x62 */
624#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_EN_MASK (1U << 7)
625#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_LEVEL_MASK (0x30)
626#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_SHIFT (4U)
627#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_1_6V (0U << DIALOG7212_MICBIAS_CTRL_MICBIAS2_SHIFT)
628#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_2_2V (1U << DIALOG7212_MICBIAS_CTRL_MICBIAS2_SHIFT)
629#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_2_5V (2U << DIALOG7212_MICBIAS_CTRL_MICBIAS2_SHIFT)
630#define DIALOG7212_MICBIAS_CTRL_MICBIAS2_3_0V (3U << DIALOG7212_MICBIAS_CTRL_MICBIAS2_SHIFT)
631#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_EN_MASK (1U << 3)
632#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_LEVEL_MASK (0x03)
633#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_SHIFT (0U)
634#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_1_6V (0U << DIALOG7212_MICBIAS_CTRL_MICBIAS1_SHIFT)
635#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_2_2V (1U << DIALOG7212_MICBIAS_CTRL_MICBIAS1_SHIFT)
636#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_2_5V (2U << DIALOG7212_MICBIAS_CTRL_MICBIAS1_SHIFT)
637#define DIALOG7212_MICBIAS_CTRL_MICBIAS1_3_0V (3U << DIALOG7212_MICBIAS_CTRL_MICBIAS1_SHIFT)
638
639/* DIALOG7212_MIC_1_CTRL 0x63 */
640#define DIALOG7212_MIC_1_CTRL_AMP_EN_MASK (1U << 7)
641#define DIALOG7212_MIC_1_CTRL_AMP_MUTE_EN_MASK (1U << 6)
642#define DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_MASK (0x0C)
643#define DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_SHIFT (2U)
644#define DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_DIFFERENTIAL (0U << DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_SHIFT)
645#define DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_MIC_1_P (1U << DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_SHIFT)
646#define DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_MIC_1_N (2U << DIALOG7212_MIC_1_CTRL_AMP_IN_SEL_SHIFT)
647
648/* DIALOG7212_MIC_2_CTRL 0x64 */
649#define DIALOG7212_MIC_2_CTRL_AMP_EN_MASK (1U << 7)
650#define DIALOG7212_MIC_2_CTRL_AMP_MUTE_EN_MASK (1U << 6)
651#define DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_MASK (0x0C)
652#define DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_SHIFT (2U)
653#define DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_DIFFERENTIAL (0U << DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_SHIFT)
654#define DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_MIC_2_P (1U << DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_SHIFT)
655#define DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_MIC_2_N (2U << DIALOG7212_MIC_2_CTRL_AMP_IN_SEL_SHIFT)
656
657/* DIALOG7212_MIXIN_L_CTRL 0x65 */
658#define DIALOG7212_MIXIN_L_CTRL_AMP_EN_MASK (1U << 7)
659#define DIALOG7212_MIXIN_L_CTRL_AMP_MUTE_EN_MASK (1U << 6)
660#define DIALOG7212_MIXIN_L_CTRL_AMP_RAMP_EN_MASK (1U << 5)
661#define DIALOG7212_MIXIN_L_CTRL_AMP_ZC_EN_MASK (1U << 4)
662#define DIALOG7212_MIXIN_L_CTRL_AMP_MIX_EN_MASK (1U << 3)
663
664/* DIALOG7212_MIXIN_R_CTRL 0x66 */
665#define DIALOG7212_MIXIN_R_CTRL_AMP_EN_MASK (1U << 7)
666#define DIALOG7212_MIXIN_R_CTRL_AMP_MUTE_EN_MASK (1U << 6)
667#define DIALOG7212_MIXIN_R_CTRL_AMP_RAMP_EN_MASK (1U << 5)
668#define DIALOG7212_MIXIN_R_CTRL_AMP_ZC_EN_MASK (1U << 4)
669#define DIALOG7212_MIXIN_R_CTRL_AMP_MIX_EN_MASK (1U << 3)
670
671/* DIALOG7212_ADC_L_CTRL 0x67 */
672#define DIALOG7212_ADC_L_CTRL_ADC_EN_MASK (1U << 7)
673#define DIALOG7212_ADC_L_CTRL_ADC_MUTE_EN_MASK (1U << 6)
674#define DIALOG7212_ADC_L_CTRL_ADC_RAMP_EN_MASK (1U << 5)
675
676/* DIALOG7212_ADC_R_CTRL 0x68 */
677#define DIALOG7212_ADC_R_CTRL_ADC_EN_MASK (1U << 7)
678#define DIALOG7212_ADC_R_CTRL_ADC_MUTE_EN_MASK (1U << 6)
679#define DIALOG7212_ADC_R_CTRL_ADC_RAMP_EN_MASK (1U << 5)
680
681/* DIALOG7212_DAC_L_CTRL 0x69 */
682#define DIALOG7212_DAC_L_CTRL_ADC_EN_MASK (1U << 7)
683#define DIALOG7212_DAC_L_CTRL_ADC_MUTE_EN_MASK (1U << 6)
684#define DIALOG7212_DAC_L_CTRL_ADC_RAMP_EN_MASK (1U << 5)
685
686/* DIALOG7212_DAC_R_CTRL 0x6A */
687#define DIALOG7212_DAC_R_CTRL_ADC_EN_MASK (1U << 7)
688#define DIALOG7212_DAC_R_CTRL_ADC_MUTE_EN_MASK (1U << 6)
689#define DIALOG7212_DAC_R_CTRL_ADC_RAMP_EN_MASK (1U << 5)
690
691/* DIALOG7212_HP_L_CTRL 0x6B */
692#define DIALOG7212_HP_L_CTRL_AMP_EN_MASK (1U << 7)
693#define DIALOG7212_HP_L_CTRL_AMP_MUTE_EN_MASK (1U << 6)
694#define DIALOG7212_HP_L_CTRL_AMP_RAMP_EN_MASK (1U << 5)
695#define DIALOG7212_HP_L_CTRL_AMP_ZC_EN_MASK (1U << 4)
696#define DIALOG7212_HP_L_CTRL_AMP_OE_MASK (1U << 3)
697#define DIALOG7212_HP_L_CTRL_AMP_MIN_GAIN_EN_MASK (1U << 2)
698
699/* DIALOG7212_HP_R_CTRL 0x6C */
700#define DIALOG7212_HP_R_CTRL_AMP_EN_MASK (1U << 7)
701#define DIALOG7212_HP_R_CTRL_AMP_MUTE_EN_MASK (1U << 6)
702#define DIALOG7212_HP_R_CTRL_AMP_RAMP_EN_MASK (1U << 5)
703#define DIALOG7212_HP_R_CTRL_AMP_ZC_EN_MASK (1U << 4)
704#define DIALOG7212_HP_R_CTRL_AMP_OE_MASK (1U << 3)
705#define DIALOG7212_HP_R_CTRL_AMP_MIN_GAIN_EN_MASK (1U << 2)
706
707/* DIALOG7212_LINE_CTRL 0x6D */
708#define DIALOG7212_LINE_CTRL_AMP_EN_MASK (1U << 7)
709#define DIALOG7212_LINE_CTRL_AMP_MUTE_EN_MASK (1U << 6)
710#define DIALOG7212_LINE_CTRL_AMP_RAMP_EN_MASK (1U << 5)
711#define DIALOG7212_LINE_CTRL_AMP_OE_MASK (1U << 3)
712#define DIALOG7212_LINE_CTRL_AMP_MIN_GAIN_EN_MASK (1U << 2)
713
714/* DIALOG7212_MIXOUT_L_CTRL 0x6E */
715#define DIALOG7212_MIXOUT_L_CTRL_AMP_EN_MASK (1U << 7)
716#define DIALOG7212_MIXOUT_L_CTRL_AMP_SOFT_MIX_EN_MASK (1U << 4)
717#define DIALOG7212_MIXOUT_L_CTRL_AMP_MIX_EN_MASK (1U << 3)
718
719/* DIALOG7212_MIXOUT_R_CTRL 0x6F */
720#define DIALOG7212_MIXOUT_R_CTRL_AMP_EN_MASK (1U << 7)
721#define DIALOG7212_MIXOUT_R_CTRL_AMP_SOFT_MIX_EN_MASK (1U << 4)
722#define DIALOG7212_MIXOUT_R_CTRL_AMP_MIX_EN_MASK (1U << 3)
723
724/*****************Configuration Registers*****************/
725/* DIALOG7212_LDO_CTRL 0x90 */
726#define DIALOG7212_LDO_CTRL_EN_MASK (1U << 7)
727#define DIALOG7212_LDO_CTRL_LEVEL_SELECT_MASK (0x30)
728#define DIALOG7212_LDO_CTRL_LEVEL_SELECT_SHIFT (4U)
729#define DIALOG7212_LDO_CTRL_LEVEL_SELECT_1_05V (0U << DIALOG7212_LDO_CTRL_LEVEL_SELECT_SHIFT)
730#define DIALOG7212_LDO_CTRL_LEVEL_SELECT_1_10V (1U << DIALOG7212_LDO_CTRL_LEVEL_SELECT_SHIFT)
731#define DIALOG7212_LDO_CTRL_LEVEL_SELECT_1_20V (2U << DIALOG7212_LDO_CTRL_LEVEL_SELECT_SHIFT)
732#define DIALOG7212_LDO_CTRL_LEVEL_SELECT_1_40V (3U << DIALOG7212_LDO_CTRL_LEVEL_SELECT_SHIFT)
733
734/* DIALOG7212_GAIN_RAMP_CTRL 0x92 */
735#define DIALOG7212_GAIN_RAMP_CTRL_RATE_MASK (0x03)
736#define DIALOG7212_GAIN_RAMP_CTRL_RATE_SHIFT (0U)
737#define DIALOG7212_GAIN_RAMP_CTRL_RATE_NR_DIV_8 (0U << DIALOG7212_GAIN_RAMP_CTRL_RATE_SHIFT)
738#define DIALOG7212_GAIN_RAMP_CTRL_RATE_NR_DIV_16 (1U << DIALOG7212_GAIN_RAMP_CTRL_RATE_SHIFT)
739#define DIALOG7212_GAIN_RAMP_CTRL_RATE_NR_MUL_16 (2U << DIALOG7212_GAIN_RAMP_CTRL_RATE_SHIFT)
740#define DIALOG7212_GAIN_RAMP_CTRL_RATE_NR_MUL_32 (3U << DIALOG7212_GAIN_RAMP_CTRL_RATE_SHIFT)
741
742/* DIALOG7212_MIC_CONFIG 0x93 */
743#define DIALOG7212_MIC_CONFIG_DMIC_CLK_RATE_MASK (1U << 2)
744#define DIALOG7212_MIC_CONFIG_DMIC_SAMPLEPHASE_MASK (1U << 1)
745#define DIALOG7212_MIC_CONFIG_DMIC_DATA_SEL_MASK (1U << 0)
746
747/* DIALOG7212_PC_COUNT 0x94 */
748#define DIALOG7212_PC_COUNT_RESYNC_MASK (1U << 1)
749#define DIALOG7212_PC_COUNT_FREERU_MASK (1U << 0)
750
751/* DIALOG7212_CP_VOL_THRESHOLD1 0x95 */
752#define DIALOG7212_CP_VOL_THRESHOLD1_VDD2_MASK (0x3F)
753#define DIALOG7212_CP_VOL_THRESHOLD1_VDD2_SHIFT (0U)
754#define DIALOG7212_CP_VOL_THRESHOLD1_VDD2(x) ((x) << DIALOG7212_CP_VOL_THRESHOLD1_VDD2_SHIFT)
755
756/* DIALOG7212_CP_DELAY 0x96 */
757#define DIALOG7212_CP_DELAY_ON_OFF_MASK (0xC0)
758#define DIALOG7212_CP_DELAY_ON_OFF_SHIFT (6U)
759#define DIALOG7212_CP_DELAY_ON_OFF_LIMITER_ON (0U << DIALOG7212_CP_DELAY_ON_OFF_SHIFT)
760#define DIALOG7212_CP_DELAY_ON_OFF_LIMITER_OFF (1U << DIALOG7212_CP_DELAY_ON_OFF_SHIFT)
761#define DIALOG7212_CP_DELAY_ON_OFF_LIMITER_AUT (2U << DIALOG7212_CP_DELAY_ON_OFF_SHIFT)
762#define DIALOG7212_CP_DELAY_TAU_DELAY_MASK (0x38)
763#define DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT (3U)
764#define DIALOG7212_CP_DELAY_TAU_DELAY_0MS (0U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
765#define DIALOG7212_CP_DELAY_TAU_DELAY_2MS (1U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
766#define DIALOG7212_CP_DELAY_TAU_DELAY_4MS (2U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
767#define DIALOG7212_CP_DELAY_TAU_DELAY_16MS (3U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
768#define DIALOG7212_CP_DELAY_TAU_DELAY_64MS (4U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
769#define DIALOG7212_CP_DELAY_TAU_DELAY_128MS (5U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
770#define DIALOG7212_CP_DELAY_TAU_DELAY_256MS (6U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
771#define DIALOG7212_CP_DELAY_TAU_DELAY_512MS (7U << DIALOG7212_CP_DELAY_TAU_DELAY_SHIFT)
772#define DIALOG7212_CP_DELAY_FCONTROL_MASK (0x07)
773#define DIALOG7212_CP_DELAY_FCONTROL_SHIFT (0U)
774#define DIALOG7212_CP_DELAY_FCONTROL_1MHZ (0U << DIALOG7212_CP_DELAY_FCONTROL_SHIFT)
775#define DIALOG7212_CP_DELAY_FCONTROL_500KHZ (1U << DIALOG7212_CP_DELAY_FCONTROL_SHIFT)
776#define DIALOG7212_CP_DELAY_FCONTROL_250KHZ (2U << DIALOG7212_CP_DELAY_FCONTROL_SHIFT)
777#define DIALOG7212_CP_DELAY_FCONTROL_125KHZ (3U << DIALOG7212_CP_DELAY_FCONTROL_SHIFT)
778#define DIALOG7212_CP_DELAY_FCONTROL_63KHZ (4U << DIALOG7212_CP_DELAY_FCONTROL_SHIFT)
779#define DIALOG7212_CP_DELAY_FCONTROL_0HZ_OR_1MHZ (5U << DIALOG7212_CP_DELAY_FCONTROL_SHIFT)
780
781/* DIALOG7212_CP_DETECTOR 0x97 */
782#define DIALOG7212_CP_DETECTOR_DROP_MASK (0x03)
783#define DIALOG7212_CP_DETECTOR_DROP_SHIFT (0U)
784#define DIALOG7212_CP_DETECTOR_DROP_25MV (0U << DIALOG7212_CP_DETECTOR_DROP_SHIFT)
785#define DIALOG7212_CP_DETECTOR_DROP_50MV (1U << DIALOG7212_CP_DETECTOR_DROP_SHIFT)
786#define DIALOG7212_CP_DETECTOR_DROP_75MV (2U << DIALOG7212_CP_DETECTOR_DROP_SHIFT)
787#define DIALOG7212_CP_DETECTOR_DROP_100MV (3U << DIALOG7212_CP_DETECTOR_DROP_SHIFT)
788
789/* DIALOG7212_DAI_OFFSET 0x98 */
790#define DIALOG7212_DAI_OFFSET_MASK (0xFF)
791#define DIALOG7212_DAI_OFFSET_SHIFT (0U)
792#define DIALOG7212_DAI_OFFSET_VAL(x) (x << DIALOG7212_DAI_OFFSET_SHIFT)
793
794/* DIALOG7212_DIG_CTRL 0x99 */
795#define DIALOG7212_DIG_CTRL_R_INV_MASK (1U << 7)
796#define DIALOG7212_DIG_CTRL_L_INV_MASK (1U << 3)
797
798/* DIALOG7212_ALC_CTRL2 0x9A */
799#define DIALOG7212_ALC_CTRL2_RELEASE_MASK (0xF0)
800#define DIALOG7212_ALC_CTRL2_RELEASE_SHIFT (4U)
801#define DIALOG7212_ALC_CTRL2_RELEASE(x) ((x) << DIALOG7212_ALC_CTRL2_RELEASE_SHIFT)
802#define DIALOG7212_ALC_CTRL2_ATTACK_MASK (0x0F)
803#define DIALOG7212_ALC_CTRL2_ATTACK_SHIFT (0U)
804#define DIALOG7212_ALC_CTRL2_ATTACK(x) ((x) << DIALOG7212_ALC_CTRL2_RELEASE_SHIFT)
805
806/* DIALOG7212_ALC_CTRL3 0x9B */
807#define DIALOG7212_ALC_CTRL3_INTEG_RELEASE_MASK (0xC0)
808#define DIALOG7212_ALC_CTRL3_INTEG_RELEASE_SHIFT (6U)
809#define DIALOG7212_ALC_CTRL3_INTEG_RELEASE_1DIV4 (0U << DIALOG7212_ALC_CTRL3_INTEG_RELEASE_SHIFT)
810#define DIALOG7212_ALC_CTRL3_INTEG_RELEASE_1DIV16 (1U << DIALOG7212_ALC_CTRL3_INTEG_RELEASE_SHIFT)
811#define DIALOG7212_ALC_CTRL3_INTEG_RELEASE_1DIV256 (2U << DIALOG7212_ALC_CTRL3_INTEG_RELEASE_SHIFT)
812#define DIALOG7212_ALC_CTRL3_INTEG_ATTACK_MASK (0x30)
813#define DIALOG7212_ALC_CTRL3_INTEG_ATTACK_SHIFT (4U)
814#define DIALOG7212_ALC_CTRL3_INTEG_ATTACK_1DIV4 (0U << DIALOG7212_ALC_CTRL3_INTEG_ATTACK_SHIFT)
815#define DIALOG7212_ALC_CTRL3_INTEG_ATTACK_1DIV16 (1U << DIALOG7212_ALC_CTRL3_INTEG_ATTACK_SHIFT)
816#define DIALOG7212_ALC_CTRL3_INTEG_ATTACK_1DIV256 (2U << DIALOG7212_ALC_CTRL3_INTEG_ATTACK_SHIFT)
817#define DIALOG7212_ALC_CTRL3_HOLD_MASK (0x0F)
818#define DIALOG7212_ALC_CTRL3_HOLD_SHIFT (0U)
819#define DIALOG7212_ALC_CTRL3_HOLD(x) ((x) << DIALOG7212_ALC_CTRL3_HOLD_SHIFT)
820
821/* DIALOG7212_ALC_NOISE 0x9C */
822#define DIALOG7212_ALC_NOISE_MASK (0x3F)
823#define DIALOG7212_ALC_NOISE_SHIFT (0U)
824#define DIALOG7212_ALC_NOISE_VAL(x) ((x) << DIALOG7212_ALC_NOISE_SHIFT)
825
826/* DIALOG7212_ALC_TARGET_MIN 0x9D */
827#define DIALOG7212_ALC_TARGET_MIN_THRESHOLD_MIN_MASK (0x3F)
828#define DIALOG7212_ALC_TARGET_MIN_THRESHOLD_MIN_SHIFT (0U)
829#define DIALOG7212_ALC_TARGET_MIN_THRESHOLD_MIN(x) ((x) << DIALOG7212_ALC_TARGET_MIN_THRESHOLD_MIN_SHIFT)
830
831/* DIALOG7212_ALC_TARGET_MAX 0x9E */
832#define DIALOG7212_ALC_TARGET_MAX_THRESHOLD_MAX_MASK (0x3F)
833#define DIALOG7212_ALC_TARGET_MAX_THRESHOLD_MAX_SHIFT (0U)
834#define DIALOG7212_ALC_TARGET_MAX_THRESHOLD_MAX(x) ((x) << DIALOG7212_ALC_TARGET_MAX_THRESHOLD_MIN_SHIFT)
835
836/* DIALOG7212_ALC_GAIN_LIMITS 0x9F */
837#define DIALOG7212_ALC_GAIN_LIMITS_GAIN_MAX_MASK (0xF0)
838#define DIALOG7212_ALC_GAIN_LIMITS_GAIN_MAX_SHIFT (4U)
839#define DIALOG7212_ALC_GAIN_LIMITS_GAIN_MAX(x) ((x) << DIALOG7212_ALC_GAIN_LIMITS_GAIN_MAX_SHIFT)
840#define DIALOG7212_ALC_GAIN_LIMITS_ATTEN_MAX_MASK (0x0F)
841#define DIALOG7212_ALC_GAIN_LIMITS_ATTEN_MAX_SHIFT (0U)
842#define DIALOG7212_ALC_GAIN_LIMITS_ATTEN_MAX(x) ((x) << DIALOG7212_ALC_GAIN_LIMITS_ATTEN_MAX_SHIFT)
843
844/* DIALOG7212_ALC_ANA_GAIN_LIMITS 0xA0 */
845#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_MASK (0x70)
846#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT (4U)
847#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_0DB (1U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
848#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_6DB (2U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
849#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_12DB (3U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
850#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_18DB (4U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
851#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_24DB (5U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
852#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_30DB (6U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
853#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_36DB (7U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MAX_SHIFT)
854#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_MASK (0x07)
855#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT (0U)
856#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_0DB (1U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
857#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_6DB (2U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
858#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_12DB (3U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
859#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_18DB (4U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
860#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_24DB (5U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
861#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_30DB (6U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
862#define DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_36DB (7U << DIALOG7212_ALC_ANA_GAIN_LIMITS_MIN_SHIFT)
863
864/* DIALOG7212_ALC_ANTICLIP_CTRL 0xA1 */
865#define DIALOG7212_ALC_ANTICLIP_CTRL_EN_MASK (1U << 7)
866
867/* DIALOG7212_ALC_ANTICLIP_LEVEL 0xA2 */
868#define DIALOG7212_ALC_ANTICLIP_LEVEL_MASK (0x7F)
869#define DIALOG7212_ALC_ANTICLIP_LEVEL_SHIFT (0U)
870#define DIALOG7212_ALC_ANTICLIP_LEVEL_VAL(x) ((x) << DIALOG7212_ALC_ANTICLIP_LEVEL_SHIFT)
871
872/* DIALOG7212_DAC_NG_SETUP_TIME 0xAF */
873#define DIALOG7212_DAC_NG_SETUP_TIME_RAMPDN_RATE_MASK (1U << 3)
874#define DIALOG7212_DAC_NG_SETUP_TIME_RAMPUP_RATE_MASK (1U << 2)
875#define DIALOG7212_DAC_NG_SETUP_TIME_MASK (0x03)
876#define DIALOG7212_DAC_NG_SETUP_TIME_SHIFT (0U)
877#define DIALOG7212_DAC_NG_SETUP_TIME_256 (1U << DIALOG7212_DAC_NG_SETUP_TIME_SHIFT)
878#define DIALOG7212_DAC_NG_SETUP_TIME_512 (2U << DIALOG7212_DAC_NG_SETUP_TIME_SHIFT)
879#define DIALOG7212_DAC_NG_SETUP_TIME_1024 (3U << DIALOG7212_DAC_NG_SETUP_TIME_SHIFT)
880#define DIALOG7212_DAC_NG_SETUP_TIME_2048 (4U << DIALOG7212_DAC_NG_SETUP_TIME_SHIFT)
881
882/* DIALOG7212_DAC_NG_OFF_THRESH 0xB0 */
883#define DIALOG7212_DAC_NG_OFF_THRESHOLD_MASK (0x07)
884#define DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT (0U)
885#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N90DB (0U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
886#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N84DB (1U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
887#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N78DB (2U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
888#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N72DB (3U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
889#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N66DB (4U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
890#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N60DB (5U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
891#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N54DB (6U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
892#define DIALOG7212_DAC_NG_OFF_THRESHOLD_N48DB (7U << DIALOG7212_DAC_NG_OFF_THRESHOLD_SHIFT)
893
894/* DIALOG7212_DAC_NG_ON_THRESH 0xB1 */
895#define DIALOG7212_DAC_NG_ON_THRESHOLD_MASK (0x07)
896#define DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT (0U)
897#define DIALOG7212_DAC_NG_ON_THRESHOLD_N90DB (0U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
898#define DIALOG7212_DAC_NG_ON_THRESHOLD_N84DB (1U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
899#define DIALOG7212_DAC_NG_ON_THRESHOLD_N78DB (2U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
900#define DIALOG7212_DAC_NG_ON_THRESHOLD_N72DB (3U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
901#define DIALOG7212_DAC_NG_ON_THRESHOLD_N66DB (4U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
902#define DIALOG7212_DAC_NG_ON_THRESHOLD_N60DB (5U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
903#define DIALOG7212_DAC_NG_ON_THRESHOLD_N54DB (6U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
904#define DIALOG7212_DAC_NG_ON_THRESHOLD_N48DB (7U << DIALOG7212_DAC_NG_ON_THRESHOLD_SHIFT)
905
906/* DIALOG7212_DAC_NG_CTRL 0xB2 */
907#define DIALOG7212_DAC_NG_CTRL_EN_MASK (1U << 7)
908
909/*************Tone Generation & Beep Registers************/
910/* DIALOG7212_TONE_GEN_CFG1 0xB4 */
911#define DIALOG7212_TONE_GEN_CFG1_START_STOPN_MASK (1U << 7)
912#define DIALOG7212_TONE_GEN_CFG1_DMTF_EN_MASK (1U << 4)
913#define DIALOG7212_TONE_GEN_CFG1_DMTF_REG_MASK (0x0F)
914#define DIALOG7212_TONE_GEN_CFG1_DMTF_REG_SHIFT (0U)
915#define DIALOG7212_TONE_GEN_CFG1_DMTF_REG(x) ((x) << DIALOG7212_TONE_GEN_CFG1_DMTF_REG_SHIFT)
916
917/* DIALOG7212_TONE_GEN_CFG2 0xB5 */
918#define DIALOG7212_TONE_GEN_CFG2_GAIN_MASK (0xF0)
919#define DIALOG7212_TONE_GEN_CFG2_GAIN_SHIFT (4U)
920#define DIALOG7212_TONE_GEN_CFG2_GAIN(x) ((x) << DIALOG7212_TONE_GEN_CFG2_GAIN_SHIFT)
921#define DIALOG7212_TONE_GEN_CFG2_SWG_SEL_MASK (0x03)
922#define DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SHIFT (0U)
923#define DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SUM__BOTH (0U << DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SHIFT)
924#define DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SWG1_ONLY (1U << DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SHIFT)
925#define DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SWG2_ONLY (2U << DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SHIFT)
926#define DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SUM_BOTH (3U << DIALOG7212_TONE_GEN_CFG2_SWG_SEL_SHIFT)
927
928/* DIALOG7212_TONE_GEN_CYCLES 0xB6 */
929#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_MASK (0x07)
930#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT (0U)
931#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_1 (0U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
932#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_2 (1U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
933#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_4 (2U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
934#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_8 (3U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
935#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_16 (4U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
936#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_32 (5U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
937#define DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_INFINITE (6U << DIALOG7212_TONE_GEN_CYCLES_BEEP_CYCLES_SHIFT)
938
939/* DIALOG7212_TONE_GEN_FREQ1_L 0xB7 */
940#define DIALOG7212_TONE_GEN_FREQ1_L_MASK (0xFF)
941#define DIALOG7212_TONE_GEN_FREQ1_L_SHIFT (0U)
942#define DIALOG7212_TONE_GEN_FREQ1_L_VAL(x) ((x) << DIALOG7212_TONE_GEN_FREQ1_L_SHIFT)
943
944/* DIALOG7212_TONE_GEN_FREQ1_U 0xB8 */
945#define DIALOG7212_TONE_GEN_FREQ1_U_MASK (0xFF)
946#define DIALOG7212_TONE_GEN_FREQ1_U_SHIFT (0U)
947#define DIALOG7212_TONE_GEN_FREQ1_U_VAL(x) ((x) << DIALOG7212_TONE_GEN_FREQ1_U_SHIFT)
948
949/* DIALOG7212_TONE_GEN_FREQ2_L 0xB9 */
950#define DIALOG7212_TONE_GEN_FREQ2_L_MASK (0xFF)
951#define DIALOG7212_TONE_GEN_FREQ2_L_SHIFT (0U)
952#define DIALOG7212_TONE_GEN_FREQ2_L_VAL(x) ((x) << DIALOG7212_TONE_GEN_FREQ2_L_SHIFT)
953
954/* DIALOG7212_TONE_GEN_FREQ2_U 0xBA */
955#define DIALOG7212_TONE_GEN_FREQ2_U_MASK (0xFF)
956#define DIALOG7212_TONE_GEN_FREQ2_U_SHIFT (0U)
957#define DIALOG7212_TONE_GEN_FREQ2_U_VAL(x) ((x) << DIALOG7212_TONE_GEN_FREQ2_U_SHIFT)
958
959/* DIALOG7212_TONE_GEN_ON_PER 0xBB */
960#define DIALOG7212_TONE_GEN_ON_PER_BEEP_ON_PER_MASK (0x3F)
961#define DIALOG7212_TONE_GEN_ON_PER_BEEP_ON_PER_SHIFT (0U)
962#define DIALOG7212_TONE_GEN_ON_PER_BEEP_ON_PER(x) ((x) << DIALOG7212_TONE_GEN_ON_PER_BEEP_ON_PER_SHIFT)
963
964/* DIALOG7212_TONE_GEN_OFF_PER 0xBC */
965#define DIALOG7212_TONE_GEN_OFF_PER_BEEP_OFF_PER_MASK (0x3F)
966#define DIALOG7212_TONE_GEN_OFF_PER_BEEP_OFF_PER_SHIFT (0U)
967#define DIALOG7212_TONE_GEN_OFF_PER_BEEP_OFF_PER(x) ((x) << DIALOG7212_TONE_GEN_OFF_PER_BEEP_OFF_PER_SHIFT)
968
969/*************System Controller Registers(2)*************/
970/* DIALOG7212_SYSTEM_STATUS 0xE0 */
971#define DIALOG7212_SYSTEM_STATUS_SC2_BUSY_MASK (1U << 1)
972#define DIALOG7212_SYSTEM_STATUS_SC1_BUSY_MASK (1U << 0)
973
974/* DIALOG7212_SYSTEM_ACTIVE 0xFD */
975#define DIALOG7212_SYSTEM_ACTIVE_MASK (1U << 0)
976
977/*! @brief da7212 volume setting range */
978#define DA7212_HEADPHONE_MAX_VOLUME_VALUE 0x3FU
979
980/*! @brief DA7212 input source select */
981typedef enum _da7212_Input
982{
983 kDA7212_Input_AUX = 0x0, /*!< Input from AUX */
984 kDA7212_Input_MIC1_Dig, /*!< Input from MIC1 Digital */
985 kDA7212_Input_MIC1_An, /*!< Input from Mic1 Analog */
986 kDA7212_Input_MIC2, /*!< Input from MIC2 */
987 kDA7212_Input_MAX
988} da7212_Input_t;
989
990/*! @brief da7212 play channel */
991enum _da7212_play_channel
992{
993 kDA7212_HeadphoneLeft = 1U, /*!< headphone left */
994 kDA7212_HeadphoneRight = 2U, /*!< headphone right */
995 kDA7212_Speaker = 4U, /*!< speaker channel */
996};
997
998/*! @brief DA7212 output device select */
999typedef enum _da7212_Output
1000{
1001 kDA7212_Output_HP = 0x0, /*!< Output to headphone */
1002 kDA7212_Output_SP, /*!< Output to speaker */
1003 kDA7212_Output_MAX
1004} da7212_Output_t;
1005
1006/*! @brief DA7212 module */
1007enum _da7212_module
1008{
1009 kDA7212_ModuleADC, /*!< module ADC*/
1010 kDA7212_ModuleDAC, /*!< module DAC */
1011 kDA7212_ModuleHeadphone, /*!< module headphone */
1012 kDA7212_ModuleSpeaker, /*!< module speaker */
1013};
1014
1015/*! @brief DA7212 functionality */
1016typedef enum _da7212_dac_source
1017{
1018 kDA7212_DACSourceADC = 0x0U, /*!< DAC source from ADC */
1019 kDA7212_DACSourceInputStream = 0x3U /*!< DAC source from */
1020} da7212_dac_source_t;
1021
1022/*! @brief DA7212 volume */
1023typedef enum _da7212_volume
1024{
1025 kDA7212_DACGainMute = 0x7, /*!< Mute DAC */
1026 kDA7212_DACGainM72DB = 0x17, /*!< DAC volume -72db */
1027 kDA7212_DACGainM60DB = 0x1F, /*!< DAC volume -60db */
1028 kDA7212_DACGainM54DB = 0x27, /*!< DAC volume -54db */
1029 kDA7212_DACGainM48DB = 0x2F, /*!< DAC volume -48db */
1030 kDA7212_DACGainM42DB = 0x37, /*!< DAC volume -42db */
1031 kDA7212_DACGainM36DB = 0x3F, /*!< DAC volume -36db */
1032 kDA7212_DACGainM30DB = 0x47, /*!< DAC volume -30db */
1033 kDA7212_DACGainM24DB = 0x4F, /*!< DAC volume -24db */
1034 kDA7212_DACGainM18DB = 0x57, /*!< DAC volume -18db */
1035 kDA7212_DACGainM12DB = 0x5F, /*!< DAC volume -12db */
1036 kDA7212_DACGainM6DB = 0x67, /*!< DAC volume -6bb */
1037 kDA7212_DACGain0DB = 0x6F, /*!< DAC volume +0db */
1038 kDA7212_DACGain6DB = 0x77, /*!< DAC volume +6db */
1039 kDA7212_DACGain12DB = 0x7F /*!< DAC volume +12db */
1040} da7212_volume_t;
1041
1042/*!
1043 * @brief The audio data transfer protocol choice.
1044 */
1045typedef enum _da7212_protocol
1046{
1047 kDA7212_BusI2S = 0x0, /*!< I2S Type */
1048 kDA7212_BusLeftJustified, /*!< Left justified */
1049 kDA7212_BusRightJustified, /*!< Right Justified */
1050 kDA7212_BusDSPMode, /*!< DSP mode */
1051} da7212_protocol_t;
1052
1053/*! @brief da7212 system clock source */
1054typedef enum _da7212_sys_clk_source
1055{
1056 kDA7212_SysClkSourceMCLK = 0U, /*!< da7212 system clock soure from MCLK */
1057 kDA7212_SysClkSourcePLL = 1U << 14, /*!< da7212 system clock soure from pLL */
1058} da7212_sys_clk_source_t;
1059
1060/*! @brief DA7212 pll clock source */
1061typedef enum _da7212_pll_clk_source
1062{
1063 kDA7212_PLLClkSourceMCLK = 0U, /*!< DA7212 PLL clock source from MCLK */
1064} da7212_pll_clk_source_t;
1065
1066/*! @brief DA7212 output clock frequency */
1067typedef enum _da7212_pll_out_clk
1068{
1069 kDA7212_PLLOutputClk11289600 = 11289600U, /*!< output 112896000U */
1070 kDA7212_PLLOutputClk12288000 = 12288000U, /*!< output 12288000U */
1071} da7212_pll_out_clk_t;
1072
1073/*!@brief master mode bits per frame */
1074typedef enum _da7212_master_bits
1075{
1076 kDA7212_MasterBits32PerFrame = 0U, /*!< master mode bits32 per frame */
1077 kDA7212_MasterBits64PerFrame = 1U, /*!< master mode bits64 per frame */
1078 kDA7212_MasterBits128PerFrame = 2U, /*!< master mode bits128 per frame */
1079 kDA7212_MasterBits256PerFrame = 3U, /*!< master mode bits256 per frame */
1080} da7212_master_bits_t;
1081
1082/*! @brief da7212 pll configuration */
1083typedef struct _da7212_pll_config
1084{
1085 da7212_pll_clk_source_t source; /*!< pll reference clock source */
1086 uint32_t refClock_HZ; /*!< pll reference clock frequency */
1087 da7212_pll_out_clk_t outputClock_HZ; /*!< pll output clock frequency */
1088} da7212_pll_config_t;
1089
1090/*! @brief da7212 audio format */
1091typedef struct _da7212_audio_format
1092{
1093 uint32_t mclk_HZ; /*!< master clock frequency */
1094 uint32_t sampleRate; /*!< sample rate */
1095 uint32_t bitWidth; /*!< bit width */
1096 bool isBclkInvert; /*!< bit clock intervet */
1097} da7212_audio_format_t;
1098
1099/*! @brief DA7212 configure structure */
1100typedef struct da7212_config
1101{
1102 bool isMaster; /*!< If DA7212 is master, true means master, false means slave. */
1103 da7212_protocol_t protocol; /*!< Audio bus format, can be I2S, LJ, RJ or DSP mode. */
1104 da7212_dac_source_t dacSource; /*!< DA7212 data source. */
1105 da7212_audio_format_t format; /*!< audio format */
1106 uint8_t slaveAddress; /*!< device address */
1107 codec_i2c_config_t i2cConfig; /*!< i2c configuration */
1108
1109 da7212_sys_clk_source_t sysClkSource; /*!< system clock source */
1110 da7212_pll_config_t *pll; /*!< pll configuration */
1111} da7212_config_t;
1112
1113/*! @brief da7212 codec handler
1114 */
1115typedef struct _da7212_handle
1116{
1117 da7212_config_t *config; /*!< da7212 config pointer */
1118 uint8_t i2cHandle[DA7212_I2C_HANDLER_SIZE]; /*!< i2c handle */
1119} da7212_handle_t;
1120
1121/*******************************************************************************
1122 * API
1123 ******************************************************************************/
1124
1125#if defined(__cplusplus)
1126extern "C" {
1127#endif
1128
1129/*!
1130 * @brief DA7212 initialize function.
1131 *
1132 * @param handle DA7212 handle pointer.
1133 * @param codecConfig Codec configure structure. This parameter can be NULL, if NULL, set as default settings.
1134 * The default setting:
1135 * @code
1136 * sgtl_init_t codec_config
1137 * codec_config.route = kDA7212_RoutePlayback
1138 * codec_config.bus = kDA7212_BusI2S
1139 * codec_config.isMaster = false
1140 * @endcode
1141 */
1142status_t DA7212_Init(da7212_handle_t *handle, da7212_config_t *codecConfig);
1143
1144/*!
1145 * @brief Set DA7212 audio format.
1146 *
1147 * @param handle DA7212 handle pointer.
1148 * @param masterClock_Hz Master clock frequency in Hz. If DA7212 is slave, use the frequency of master, if DA7212 as
1149 * master, it should be 1228000 while sample rate frequency is 8k/12K/16K/24K/32K/48K/96K, 11289600 whie sample rate is
1150 * 11.025K/22.05K/44.1K
1151 * @param sampleRate_Hz Sample rate frequency in Hz.
1152 * @param dataBits How many bits in a word of a audio frame, DA7212 only supports 16/20/24/32 bits.
1153 */
1154status_t DA7212_ConfigAudioFormat(da7212_handle_t *handle,
1155 uint32_t masterClock_Hz,
1156 uint32_t sampleRate_Hz,
1157 uint32_t dataBits);
1158
1159/*!
1160 * @brief DA7212 set PLL configuration
1161 * This function will enable the GPIO1 FLL clock output function, so user can see
1162 * the generated fll output clock frequency from WM8904 GPIO1.
1163 *
1164 * @param handle DA7212 handler pointer.
1165 * @param config PLL configuration pointer.
1166 *
1167 */
1168status_t DA7212_SetPLLConfig(da7212_handle_t *handle, da7212_pll_config_t *config);
1169
1170/*!
1171 * @brief Set DA7212 playback volume.
1172 *
1173 * @param handle DA7212 handle pointer.
1174 * @param volume The volume of playback.
1175 */
1176void DA7212_ChangeHPVolume(da7212_handle_t *handle, da7212_volume_t volume);
1177
1178/*!
1179 * @brief Mute or unmute DA7212.
1180 *
1181 * @param handle DA7212 handle pointer.
1182 * @param isMuted True means mute, false means unmute.
1183 */
1184void DA7212_Mute(da7212_handle_t *handle, bool isMuted);
1185
1186/*!
1187 * @brief Set the input data source of DA7212.
1188 *
1189 * @param handle DA7212 handle pointer.
1190 * @param DA7212_Input Input data source.
1191 */
1192void DA7212_ChangeInput(da7212_handle_t *handle, da7212_Input_t DA7212_Input);
1193
1194/*!
1195 * @brief Set the output device of DA7212.
1196 *
1197 * @param handle DA7212 handle pointer.
1198 * @param DA7212_Output Output device of DA7212.
1199 */
1200void DA7212_ChangeOutput(da7212_handle_t *handle, da7212_Output_t DA7212_Output);
1201
1202/*!
1203 * @brief Set module volume.
1204 *
1205 * @param handle DA7212 handle pointer.
1206 * @param channel shoule be a value of _da7212_channel.
1207 * @param volume volume range 0 - 0x3F mapped to range -57dB - 6dB.
1208 */
1209status_t DA7212_SetChannelVolume(da7212_handle_t *handle, uint32_t channel, uint32_t volume);
1210
1211/*!
1212 * @brief Set module mute.
1213 *
1214 * @param handle DA7212 handle pointer.
1215 * @param channel shoule be a value of _da7212_channel.
1216 * @param isMute true is mute, false is unmute.
1217 */
1218status_t DA7212_SetChannelMute(da7212_handle_t *handle, uint32_t channel, bool isMute);
1219
1220/*!
1221 * @brief Set protocol for DA7212.
1222 *
1223 * @param handle DA7212 handle pointer.
1224 * @param protocol da7212_protocol_t.
1225 */
1226status_t DA7212_SetProtocol(da7212_handle_t *handle, da7212_protocol_t protocol);
1227
1228/*!
1229 * @brief Set master mode bits per frame for DA7212.
1230 *
1231 * @param handle DA7212 handle pointer.
1232 * @param bitWidth audio data bitwidth.
1233 */
1234status_t DA7212_SetMasterModeBits(da7212_handle_t *handle, uint32_t bitWidth);
1235
1236/*!
1237 * @brief Write a register for DA7212.
1238 *
1239 * @param handle DA7212 handle pointer.
1240 * @param u8Register DA7212 register address to be written.
1241 * @param u8RegisterData Data to be written into regsiter
1242 */
1243status_t DA7212_WriteRegister(da7212_handle_t *handle, uint8_t u8Register, uint8_t u8RegisterData);
1244
1245/*!
1246 * @brief Get a register value of DA7212.
1247 *
1248 * @param handle DA7212 handle pointer.
1249 * @param u8Register DA7212 register address to be read.
1250 * @param pu8RegisterData Pointer where the read out value to be stored.
1251 */
1252status_t DA7212_ReadRegister(da7212_handle_t *handle, uint8_t u8Register, uint8_t *pu8RegisterData);
1253
1254/*!
1255 * @brief Deinit DA7212.
1256 *
1257 * @param handle DA7212 handle pointer.
1258 */
1259status_t DA7212_Deinit(da7212_handle_t *handle);
1260
1261#if defined(__cplusplus)
1262}
1263#endif
1264
1265/*! @} */
1266#endif /* _FSL_DIALOG7212_H_ */