1 /*
2  * Copyright 2020 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef _FSL_AUDIOMIX_H_
9 #define _FSL_AUDIOMIX_H_
10 
11 #include "fsl_common.h"
12 
13 /*!
14  * @addtogroup audiomix
15  * @{
16  */
17 
18 /*******************************************************************************
19  * Definitions
20  ******************************************************************************/
21 
22 /*! @name Driver version */
23 /*@{*/
24 /*! @brief AUDIOMIX driver version 2.0.1. */
25 #define FSL_AUDIOMIX_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
26 /*@}*/
27 
28 /*!@brief AUDIOMIX attach id combination */
29 #define AUDIOMIX_ATTACH_ID(offset, mask, value) \
30     ((uint32_t)(offset) | ((uint32_t)(mask) << 16U) | ((uint32_t)(value) << 24U))
31 #define GET_AUDIOMIX_ATTACH_ID_OFFSET(id) ((uint32_t)(id)&0xFFFFU)
32 #define GET_AUDIOMIX_ATTACH_ID_MASK(id)   (((uint32_t)(id) >> 16U) & 0xFFU)
33 #define GET_AUDIOMIX_ATTACH_ID_value(id)  (((uint32_t)(id) >> 24U) & 0xFFU)
34 
35 /*!@brief audio mix attch clk id */
36 typedef enum _audiomix_attch_clk
37 {
38     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI1_ROOT =
39         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 0U << 1U), /*!< attach SAI1 MCLK2 to SAI1 root */
40     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI2_ROOT =
41         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 1U << 1U), /*!< attach SAI1 MCLK2 to SAI2 root */
42     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI3_ROOT =
43         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 2U << 1U), /*!< attach SAI1 MCLK2 to SAI3 root */
44     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI5_ROOT =
45         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 4U << 1U), /*!< attach SAI1 MCLK2 to SAI5 root */
46     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI6_ROOT =
47         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 5U << 1U), /*!< attach SAI1 MCLK2 to SAI6 root */
48     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI7_ROOT =
49         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 6U << 1U), /*!< attach SAI1 MCLK2 to SAI7 root */
50     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI1_MCLK =
51         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 7U << 1U), /*!< attach SAI1 MCLK2 to SAI1 MCLK */
52     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI2_MCLK =
53         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 8U << 1U), /*!< attach SAI1 MCLK2 to SAI2 MCLK */
54     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI3_MCLK =
55         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 9U << 1U), /*!< attach SAI1 MCLK2 to SAI3 MCLK */
56     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI5_MCLK =
57         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 11U << 1U), /*!< attach SAI1 MCLK2 to SAI5 MCLK */
58     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI6_MCLK =
59         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 12U << 1U), /*!< attach SAI1 MCLK2 to SAI6 MCLK */
60     kAUDIOMIX_Attach_SAI1_MCLK2_To_SAI7_MCLK =
61         AUDIOMIX_ATTACH_ID(0X300U, 0x1EU, 13U << 1U), /*!< attach SAI1 MCLK2 to SAI7 MCLK */
62 
63     kAUDIOMIX_Attach_SAI1_MCLK1_To_SAI1_ROOT =
64         AUDIOMIX_ATTACH_ID(0X300U, 0x1U, 0U), /*!< attach SAI1 MCLK1 to SAI1 root */
65     kAUDIOMIX_Attach_SAI1_MCLK1_To_SAI1_MCLK =
66         AUDIOMIX_ATTACH_ID(0X300U, 0x1U, 1U), /*!< attach SAI1 MCLK1 to SAI1 MCLK */
67 
68     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI1_ROOT =
69         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 0U << 1U), /*!< attach SAI2 MCLK2 to SAI1 root */
70     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI2_ROOT =
71         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 1U << 1U), /*!< attach SAI2 MCLK2 to SAI2 root */
72     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI3_ROOT =
73         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 2U << 1U), /*!< attach SAI2 MCLK2 to SAI3 root */
74     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI5_ROOT =
75         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 4U << 1U), /*!< attach SAI2 MCLK2 to SAI5 root */
76     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI6_ROOT =
77         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 5U << 1U), /*!< attach SAI2 MCLK2 to SAI6 root */
78     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI7_ROOT =
79         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 6U << 1U), /*!< attach SAI2 MCLK2 to SAI7 root */
80     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI1_MCLK =
81         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 7U << 1U), /*!< attach SAI2 MCLK2 to SAI1 MCLK */
82     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI2_MCLK =
83         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 8U << 1U), /*!< attach SAI2 MCLK2 to SAI2 MCLK */
84     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI3_MCLK =
85         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 9U << 1U), /*!< attach SAI2 MCLK2 to SAI3 MCLK */
86     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI5_MCLK =
87         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 11U << 1U), /*!< attach SAI2 MCLK2 to SAI5 MCLK */
88     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI6_MCLK =
89         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 12U << 1U), /*!< attach SAI2 MCLK2 to SAI6 MCLK */
90     kAUDIOMIX_Attach_SAI2_MCLK2_To_SAI7_MCLK =
91         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 13U << 1U), /*!< attach SAI2 MCLK2 to SAI7 MCLK */
92     kAUDIOMIX_Attach_SAI2_MCLK2_To_SPDIF_ExtCLK =
93         AUDIOMIX_ATTACH_ID(0X304U, 0x1EU, 14U << 1U), /*!< attach SAI2 MCLK2 to SPDIF EXTCLK */
94 
95     kAUDIOMIX_Attach_SAI2_MCLK1_To_SAI2_ROOT =
96         AUDIOMIX_ATTACH_ID(0X304U, 0x1U, 0U), /*!< attach SAI2 MCLK1 to SAI2 root */
97     kAUDIOMIX_Attach_SAI2_MCLK1_To_SAI2_MCLK =
98         AUDIOMIX_ATTACH_ID(0X304U, 0x1U, 1U), /*!< attach SAI2 MCLK1 to SAI2 MCLK */
99 
100     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI1_ROOT =
101         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 0U << 1U), /*!< attach SAI3 MCLK2 to SAI1 root */
102     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI2_ROOT =
103         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 1U << 1U), /*!< attach SAI3 MCLK2 to SAI2 root */
104     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI3_ROOT =
105         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 2U << 1U), /*!< attach SAI3 MCLK2 to SAI3 root */
106     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI5_ROOT =
107         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 4U << 1U), /*!< attach SAI3 MCLK2 to SAI5 root */
108     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI6_ROOT =
109         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 5U << 1U), /*!< attach SAI3 MCLK2 to SAI6 root */
110     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI7_ROOT =
111         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 6U << 1U), /*!< attach SAI3 MCLK2 to SAI7 root */
112     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI1_MCLK =
113         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 7U << 1U), /*!< attach SAI3 MCLK2 to SAI1 MCLK */
114     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI2_MCLK =
115         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 8U << 1U), /*!< attach SAI3 MCLK2 to SAI2 MCLK */
116     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI3_MCLK =
117         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 9U << 1U), /*!< attach SAI3 MCLK2 to SAI3 MCLK */
118     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI5_MCLK =
119         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 11U << 1U), /*!< attach SAI3 MCLK2 to SAI5 MCLK */
120     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI6_MCLK =
121         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 12U << 1U), /*!< attach SAI3 MCLK2 to SAI6 MCLK */
122     kAUDIOMIX_Attach_SAI3_MCLK2_To_SAI7_MCLK =
123         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 13U << 1U), /*!< attach SAI3 MCLK2 to SAI7 MCLK */
124     kAUDIOMIX_Attach_SAI3_MCLK2_To_SPDIF_ExtCLK =
125         AUDIOMIX_ATTACH_ID(0X308U, 0x1EU, 14U << 1U), /*!< attach SAI3 MCLK2 to SPDIF EXTCLK */
126 
127     kAUDIOMIX_Attach_SAI3_MCLK1_To_SAI3_ROOT =
128         AUDIOMIX_ATTACH_ID(0X308U, 0x1U, 0U), /*!< attach SAI3 MCLK1 to SAI3 root */
129     kAUDIOMIX_Attach_SAI3_MCLK1_To_SAI3_MCLK =
130         AUDIOMIX_ATTACH_ID(0X308U, 0x1U, 1U), /*!< attach SAI3 MCLK1 to SAI3 MCLK */
131 
132     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI1_ROOT =
133         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 0U << 1U), /*!< attach SAI5 MCLK2 to SAI1 root */
134     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI2_ROOT =
135         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 1U << 1U), /*!< attach SAI5 MCLK2 to SAI2 root */
136     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI3_ROOT =
137         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 2U << 1U), /*!< attach SAI5 MCLK2 to SAI3 root */
138     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI5_ROOT =
139         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 4U << 1U), /*!< attach SAI5 MCLK2 to SAI5 root */
140     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI6_ROOT =
141         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 5U << 1U), /*!< attach SAI5 MCLK2 to SAI6 root */
142     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI7_ROOT =
143         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 6U << 1U), /*!< attach SAI5 MCLK2 to SAI7 root */
144     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI1_MCLK =
145         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 7U << 1U), /*!< attach SAI5 MCLK2 to SAI1 MCLK */
146     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI2_MCLK =
147         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 8U << 1U), /*!< attach SAI5 MCLK2 to SAI2 MCLK */
148     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI3_MCLK =
149         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 9U << 1U), /*!< attach SAI5 MCLK2 to SAI3 MCLK */
150     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI5_MCLK =
151         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 11U << 1U), /*!< attach SAI5 MCLK2 to SAI5 MCLK */
152     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI6_MCLK =
153         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 12U << 1U), /*!< attach SAI5 MCLK2 to SAI6 MCLK */
154     kAUDIOMIX_Attach_SAI5_MCLK2_To_SAI7_MCLK =
155         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 13U << 1U), /*!< attach SAI5 MCLK2 to SAI7 MCLK */
156     kAUDIOMIX_Attach_SAI5_MCLK2_To_SPDIF_ExtCLK =
157         AUDIOMIX_ATTACH_ID(0X30CU, 0x1EU, 14U << 1U), /*!< attach SAI5 MCLK2 to SPDIF EXTCLK */
158 
159     kAUDIOMIX_Attach_SAI5_MCLK1_To_SAI5_ROOT =
160         AUDIOMIX_ATTACH_ID(0X30CU, 0x1U, 0U), /*!< attach SAI5 MCLK1 to SAI5 root */
161     kAUDIOMIX_Attach_SAI5_MCLK1_To_SAI5_MCLK =
162         AUDIOMIX_ATTACH_ID(0X30CU, 0x1U, 1U), /*!< attach SAI5 MCLK1 to SAI5 MCLK */
163 
164     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI1_ROOT =
165         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 0U << 1U), /*!< attach SAI6 MCLK2 to SAI1 root */
166     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI2_ROOT =
167         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 1U << 1U), /*!< attach SAI6 MCLK2 to SAI2 root */
168     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI3_ROOT =
169         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 2U << 1U), /*!< attach SAI6 MCLK2 to SAI3 root */
170     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI5_ROOT =
171         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 4U << 1U), /*!< attach SAI6 MCLK2 to SAI5 root */
172     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI6_ROOT =
173         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 5U << 1U), /*!< attach SAI6 MCLK2 to SAI6 root */
174     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI7_ROOT =
175         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 6U << 1U), /*!< attach SAI6 MCLK2 to SAI7 root */
176     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI1_MCLK =
177         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 7U << 1U), /*!< attach SAI6 MCLK2 to SAI1 MCLK */
178     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI2_MCLK =
179         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 8U << 1U), /*!< attach SAI6 MCLK2 to SAI2 MCLK */
180     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI3_MCLK =
181         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 9U << 1U), /*!< attach SAI6 MCLK2 to SAI3 MCLK */
182     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI5_MCLK =
183         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 11U << 1U), /*!< attach SAI6 MCLK2 to SAI5 MCLK */
184     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI6_MCLK =
185         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 12U << 1U), /*!< attach SAI6 MCLK2 to SAI6 MCLK */
186     kAUDIOMIX_Attach_SAI6_MCLK2_To_SAI7_MCLK =
187         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 13U << 1U), /*!< attach SAI6 MCLK2 to SAI7 MCLK */
188     kAUDIOMIX_Attach_SAI6_MCLK2_To_SPDIF_ExtCLK =
189         AUDIOMIX_ATTACH_ID(0X310U, 0x1EU, 14U << 1U), /*!< attach SAI6 MCLK2 to SPDIF EXTCLK */
190 
191     kAUDIOMIX_Attach_SAI6_MCLK1_To_SAI6_ROOT =
192         AUDIOMIX_ATTACH_ID(0X310U, 0x1U, 0U), /*!< attach SAI6 MCLK2 to SAI6 root */
193     kAUDIOMIX_Attach_SAI6_MCLK1_To_SAI6_MCLK =
194         AUDIOMIX_ATTACH_ID(0X310U, 0x1U, 1U), /*!< attach SAI6 MCLK2 to SAI6 MCLK */
195 
196     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI1_ROOT =
197         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 0U << 1U), /*!< attach SAI7 MCLK2 to SAI1 root */
198     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI2_ROOT =
199         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 1U << 1U), /*!< attach SAI7 MCLK2 to SAI2 root */
200     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI3_ROOT =
201         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 2U << 1U), /*!< attach SAI7 MCLK2 to SAI3 root */
202     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI5_ROOT =
203         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 4U << 1U), /*!< attach SAI7 MCLK2 to SAI5 root */
204     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI6_ROOT =
205         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 5U << 1U), /*!< attach SAI7 MCLK2 to SAI6 root */
206     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI7_ROOT =
207         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 6U << 1U), /*!< attach SAI7 MCLK2 to SAI7 root */
208     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI1_MCLK =
209         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 7U << 1U), /*!< attach SAI7 MCLK2 to SAI1 MCLK */
210     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI2_MCLK =
211         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 8U << 1U), /*!< attach SAI7 MCLK2 to SAI2 MCLK */
212     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI3_MCLK =
213         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 9U << 1U), /*!< attach SAI7 MCLK2 to SAI3 MCLK */
214     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI5_MCLK =
215         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 11U << 1U), /*!< attach SAI7 MCLK2 to SAI5 MCLK */
216     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI6_MCLK =
217         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 12U << 1U), /*!< attach SAI7 MCLK2 to SAI6 MCLK */
218     kAUDIOMIX_Attach_SAI7_MCLK2_To_SAI7_MCLK =
219         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 13U << 1U), /*!< attach SAI7 MCLK2 to SAI7 MCLK */
220     kAUDIOMIX_Attach_SAI7_MCLK2_To_SPDIF_ExtCLK =
221         AUDIOMIX_ATTACH_ID(0X314U, 0x1EU, 14U << 1U), /*!< attach SAI7 MCLK2 to SPDIF_ExtCLK */
222 
223     kAUDIOMIX_Attach_SAI7_MCLK1_To_SAI7_ROOT =
224         AUDIOMIX_ATTACH_ID(0X314U, 0x1U, 0U), /*!< attach SAI7 MCLK1 to SAI7 root */
225     kAUDIOMIX_Attach_SAI7_MCLK1_To_SAI7_MCLK =
226         AUDIOMIX_ATTACH_ID(0X314U, 0x1U, 1U), /*!< attach SAI7 MCLK1 to SAI7 MCLK */
227 
228     kAUDIOMIX_Attach_PDM_Root_to_CCM_PDM =
229         AUDIOMIX_ATTACH_ID(0X318U, 0x3U, 0U), /*!< attach PDM ROOT to CCM PDM clock */
230     kAUDIOMIX_Attach_PDM_Root_to_SAI_PLL_DVI2 =
231         AUDIOMIX_ATTACH_ID(0X318U, 0x3U, 1U), /*!< attach PDM ROOT to sai pll div2 */
232     kAUDIOMIX_Attach_PDM_Root_to_SAI1_MCLK = AUDIOMIX_ATTACH_ID(0X318U, 0x3U, 2U), /*!< attach PDM ROOT to SAI1 mclk */
233 } audiomix_attch_clk_t;
234 
235 /*!@brief audio mix power control */
236 enum _audiomix_power_ctrl
237 {
238     kAUDIOMIX_PowerCtrlEDMA  = 1U,   /*!< edma power control */
239     kAUDIOMIX_PowerCtrlSDMA2 = 2U,   /*!< SDMA2 power control */
240     kAUDIOMIX_PowerCtrlSDMA3 = 4U,   /*!< SDMA3 power control */
241     kAUDIOMIX_PowerCtrlPDM   = 8U,   /*!< PDM power control */
242     kAUDIOMIX_PowerCtrlSAI1  = 16U,  /*!< SAI1 power control */
243     kAUDIOMIX_PowerCtrlSAI2  = 32U,  /*!< SAI2 power control */
244     kAUDIOMIX_PowerCtrlSAI3  = 64U,  /*!< SAI3 power control */
245     kAUDIOMIX_PowerCtrlSAI5  = 128U, /*!< SAI5 power control */
246     kAUDIOMIX_PowerCtrlSAI6  = 256U, /*!< SAI6 power control */
247     kAUDIOMIX_PowerCtrlSAI7  = 512U, /*!< SAI7 power control */
248 };
249 
250 /*******************************************************************************
251  * API
252  ******************************************************************************/
253 
254 #if defined(__cplusplus)
255 extern "C" {
256 #endif
257 
258 /*!
259  * @name AUDIOMIX clock Setting
260  * @{
261  */
262 
263 /*!
264  * @brief audiomix attach clock.
265  *
266  * @param base audiomix base address.
267  * @param id attach clock id.
268  */
269 void AUDIOMIX_AttachClk(AUDIOMIX_Type *base, audiomix_attch_clk_t id);
270 
271 /*!
272  * @brief audiomix low power ack bit status.
273  *
274  * @param base audiomix base address.
275  * @param ip reference _audiomix_power_ctrl, can be a value or combine value in _audiomix_power_ctrl
276  */
AUDIOMIX_GetIPStopAck(AUDIOMIX_Type * base,uint32_t ip)277 static inline uint32_t AUDIOMIX_GetIPStopAck(AUDIOMIX_Type *base, uint32_t ip)
278 {
279     uint32_t reg = base->IPG_LP_CTRL;
280 
281     return reg & (ip << 10U);
282 }
283 
284 /*!
285  * @brief audiomix low power stop mode
286  *
287  * @param base audiomix base address.
288  * @param ip reference _audiomix_power_ctrl, can be a value or combine value in _audiomix_power_ctrl
289  */
AUDIOMIX_SetIPStop(AUDIOMIX_Type * base,uint32_t ip)290 static inline void AUDIOMIX_SetIPStop(AUDIOMIX_Type *base, uint32_t ip)
291 {
292     base->IPG_LP_CTRL |= ip & 0x3FFU;
293 }
294 
295 /*!
296  * @brief audiomix earc reset
297  *
298  * @param base audiomix base address.
299  * @param enable true is reset, flase is release.
300  */
AUDIOMIX_SetEARCReset(AUDIOMIX_Type * base,bool enable)301 static inline void AUDIOMIX_SetEARCReset(AUDIOMIX_Type *base, bool enable)
302 {
303     if (enable)
304     {
305         base->EARC &= ~AUDIOMIX_EARC_RESETB_MASK;
306     }
307     else
308     {
309         base->EARC |= AUDIOMIX_EARC_RESETB_MASK;
310     }
311 }
312 
313 /*!
314  * @brief audiomix earc PHY reset
315  *
316  * @param base audiomix base address.
317  * @param enable true is reset, flase is release.
318  */
AUDIOMIX_SetEARCPhyReset(AUDIOMIX_Type * base,bool enable)319 static inline void AUDIOMIX_SetEARCPhyReset(AUDIOMIX_Type *base, bool enable)
320 {
321     if (enable)
322     {
323         base->EARC &= ~AUDIOMIX_EARC_PHY_RESETB_MASK;
324     }
325     else
326     {
327         base->EARC |= AUDIOMIX_EARC_PHY_RESETB_MASK;
328     }
329 }
330 
331 /*!
332  * @brief Initializes the SAI PLL.
333  * note This function can't detect whether the AUDIO PLL has been enabled and
334  * used by some IPs.
335  *
336  * @param base audiomix base address.
337  * @param config Pointer to the configuration structure(see ref ccm_analog_frac_pll_config_t enumeration).
338  *
339  */
340 void AUDIOMIX_InitAudioPll(AUDIOMIX_Type *base, const ccm_analog_frac_pll_config_t *config);
341 
342 /*!
343  * brief De-initialize the SAI PLL.
344  */
345 void AUDIOMIX_DeinitAudioPll1(AUDIOMIX_Type *base);
346 
347 /*!
348  * @brief Get the sai PLL output freq.
349  *
350  * @retval sai pll output freq.
351  */
352 uint32_t AUDIOMIX_GetAudioPllFreq(AUDIOMIX_Type *base);
353 /* @} */
354 
355 #if defined(__cplusplus)
356 }
357 #endif
358 /* @} */
359 #endif /* _FSL_AUDIOMIX_H_ */
360