1 // SPDX-License-Identifier: GPL-2.0
3 // MediaTek ALSA SoC Audio DAI I2S Control
5 // Copyright (c) 2020 MediaTek Inc.
6 // Author: Shane Chien <shane.chien@mediatek.com>
9 #include <linux/bitops.h>
10 #include <linux/regmap.h>
11 #include <sound/pcm_params.h>
13 #include "mt8192-afe-clk.h"
14 #include "mt8192-afe-common.h"
15 #include "mt8192-afe-gpio.h"
16 #include "mt8192-interconnection.h"
30 I2S_HD_LOW_JITTER
= 1,
39 I2S_IN_PAD_CONNSYS
= 0,
40 I2S_IN_PAD_IO_MUX
= 1,
43 struct mtk_afe_i2s_priv
{
45 int rate
; /* for determine which apll to use */
48 const char *share_property_name
;
56 static unsigned int get_i2s_wlen(snd_pcm_format_t format
)
58 return snd_pcm_format_physical_width(format
) <= 16 ?
59 I2S_WLEN_16_BIT
: I2S_WLEN_32_BIT
;
62 #define MTK_AFE_I2S0_KCONTROL_NAME "I2S0_HD_Mux"
63 #define MTK_AFE_I2S1_KCONTROL_NAME "I2S1_HD_Mux"
64 #define MTK_AFE_I2S2_KCONTROL_NAME "I2S2_HD_Mux"
65 #define MTK_AFE_I2S3_KCONTROL_NAME "I2S3_HD_Mux"
66 #define MTK_AFE_I2S5_KCONTROL_NAME "I2S5_HD_Mux"
67 #define MTK_AFE_I2S6_KCONTROL_NAME "I2S6_HD_Mux"
68 #define MTK_AFE_I2S7_KCONTROL_NAME "I2S7_HD_Mux"
69 #define MTK_AFE_I2S8_KCONTROL_NAME "I2S8_HD_Mux"
70 #define MTK_AFE_I2S9_KCONTROL_NAME "I2S9_HD_Mux"
72 #define I2S0_HD_EN_W_NAME "I2S0_HD_EN"
73 #define I2S1_HD_EN_W_NAME "I2S1_HD_EN"
74 #define I2S2_HD_EN_W_NAME "I2S2_HD_EN"
75 #define I2S3_HD_EN_W_NAME "I2S3_HD_EN"
76 #define I2S5_HD_EN_W_NAME "I2S5_HD_EN"
77 #define I2S6_HD_EN_W_NAME "I2S6_HD_EN"
78 #define I2S7_HD_EN_W_NAME "I2S7_HD_EN"
79 #define I2S8_HD_EN_W_NAME "I2S8_HD_EN"
80 #define I2S9_HD_EN_W_NAME "I2S9_HD_EN"
82 #define I2S0_MCLK_EN_W_NAME "I2S0_MCLK_EN"
83 #define I2S1_MCLK_EN_W_NAME "I2S1_MCLK_EN"
84 #define I2S2_MCLK_EN_W_NAME "I2S2_MCLK_EN"
85 #define I2S3_MCLK_EN_W_NAME "I2S3_MCLK_EN"
86 #define I2S5_MCLK_EN_W_NAME "I2S5_MCLK_EN"
87 #define I2S6_MCLK_EN_W_NAME "I2S6_MCLK_EN"
88 #define I2S7_MCLK_EN_W_NAME "I2S7_MCLK_EN"
89 #define I2S8_MCLK_EN_W_NAME "I2S8_MCLK_EN"
90 #define I2S9_MCLK_EN_W_NAME "I2S9_MCLK_EN"
92 static int get_i2s_id_by_name(struct mtk_base_afe
*afe
,
95 if (strncmp(name
, "I2S0", 4) == 0)
96 return MT8192_DAI_I2S_0
;
97 else if (strncmp(name
, "I2S1", 4) == 0)
98 return MT8192_DAI_I2S_1
;
99 else if (strncmp(name
, "I2S2", 4) == 0)
100 return MT8192_DAI_I2S_2
;
101 else if (strncmp(name
, "I2S3", 4) == 0)
102 return MT8192_DAI_I2S_3
;
103 else if (strncmp(name
, "I2S5", 4) == 0)
104 return MT8192_DAI_I2S_5
;
105 else if (strncmp(name
, "I2S6", 4) == 0)
106 return MT8192_DAI_I2S_6
;
107 else if (strncmp(name
, "I2S7", 4) == 0)
108 return MT8192_DAI_I2S_7
;
109 else if (strncmp(name
, "I2S8", 4) == 0)
110 return MT8192_DAI_I2S_8
;
111 else if (strncmp(name
, "I2S9", 4) == 0)
112 return MT8192_DAI_I2S_9
;
117 static struct mtk_afe_i2s_priv
*get_i2s_priv_by_name(struct mtk_base_afe
*afe
,
120 struct mt8192_afe_private
*afe_priv
= afe
->platform_priv
;
121 int dai_id
= get_i2s_id_by_name(afe
, name
);
126 return afe_priv
->dai_priv
[dai_id
];
129 /* low jitter control */
130 static const char * const mt8192_i2s_hd_str
[] = {
131 "Normal", "Low_Jitter"
134 static SOC_ENUM_SINGLE_EXT_DECL(mt8192_i2s_enum
, mt8192_i2s_hd_str
);
136 static int mt8192_i2s_hd_get(struct snd_kcontrol
*kcontrol
,
137 struct snd_ctl_elem_value
*ucontrol
)
139 struct snd_soc_component
*cmpnt
= snd_soc_kcontrol_component(kcontrol
);
140 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
141 struct mtk_afe_i2s_priv
*i2s_priv
;
143 i2s_priv
= get_i2s_priv_by_name(afe
, kcontrol
->id
.name
);
146 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
150 ucontrol
->value
.integer
.value
[0] = i2s_priv
->low_jitter_en
;
155 static int mt8192_i2s_hd_set(struct snd_kcontrol
*kcontrol
,
156 struct snd_ctl_elem_value
*ucontrol
)
158 struct snd_soc_component
*cmpnt
= snd_soc_kcontrol_component(kcontrol
);
159 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
160 struct mtk_afe_i2s_priv
*i2s_priv
;
161 struct soc_enum
*e
= (struct soc_enum
*)kcontrol
->private_value
;
164 if (ucontrol
->value
.enumerated
.item
[0] >= e
->items
)
167 hd_en
= ucontrol
->value
.integer
.value
[0];
169 dev_dbg(afe
->dev
, "%s(), kcontrol name %s, hd_en %d\n",
170 __func__
, kcontrol
->id
.name
, hd_en
);
172 i2s_priv
= get_i2s_priv_by_name(afe
, kcontrol
->id
.name
);
175 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
179 i2s_priv
->low_jitter_en
= hd_en
;
184 static const struct snd_kcontrol_new mtk_dai_i2s_controls
[] = {
185 SOC_ENUM_EXT(MTK_AFE_I2S0_KCONTROL_NAME
, mt8192_i2s_enum
,
186 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
187 SOC_ENUM_EXT(MTK_AFE_I2S1_KCONTROL_NAME
, mt8192_i2s_enum
,
188 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
189 SOC_ENUM_EXT(MTK_AFE_I2S2_KCONTROL_NAME
, mt8192_i2s_enum
,
190 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
191 SOC_ENUM_EXT(MTK_AFE_I2S3_KCONTROL_NAME
, mt8192_i2s_enum
,
192 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
193 SOC_ENUM_EXT(MTK_AFE_I2S5_KCONTROL_NAME
, mt8192_i2s_enum
,
194 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
195 SOC_ENUM_EXT(MTK_AFE_I2S6_KCONTROL_NAME
, mt8192_i2s_enum
,
196 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
197 SOC_ENUM_EXT(MTK_AFE_I2S7_KCONTROL_NAME
, mt8192_i2s_enum
,
198 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
199 SOC_ENUM_EXT(MTK_AFE_I2S8_KCONTROL_NAME
, mt8192_i2s_enum
,
200 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
201 SOC_ENUM_EXT(MTK_AFE_I2S9_KCONTROL_NAME
, mt8192_i2s_enum
,
202 mt8192_i2s_hd_get
, mt8192_i2s_hd_set
),
206 /* i2s virtual mux to output widget */
207 static const char * const i2s_mux_map
[] = {
208 "Normal", "Dummy_Widget",
211 static int i2s_mux_map_value
[] = {
215 static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(i2s_mux_map_enum
,
222 static const struct snd_kcontrol_new i2s0_in_mux_control
=
223 SOC_DAPM_ENUM("I2S0 In Select", i2s_mux_map_enum
);
225 static const struct snd_kcontrol_new i2s8_in_mux_control
=
226 SOC_DAPM_ENUM("I2S8 In Select", i2s_mux_map_enum
);
228 static const struct snd_kcontrol_new i2s1_out_mux_control
=
229 SOC_DAPM_ENUM("I2S1 Out Select", i2s_mux_map_enum
);
231 static const struct snd_kcontrol_new i2s3_out_mux_control
=
232 SOC_DAPM_ENUM("I2S3 Out Select", i2s_mux_map_enum
);
234 static const struct snd_kcontrol_new i2s5_out_mux_control
=
235 SOC_DAPM_ENUM("I2S5 Out Select", i2s_mux_map_enum
);
237 static const struct snd_kcontrol_new i2s7_out_mux_control
=
238 SOC_DAPM_ENUM("I2S7 Out Select", i2s_mux_map_enum
);
240 static const struct snd_kcontrol_new i2s9_out_mux_control
=
241 SOC_DAPM_ENUM("I2S9 Out Select", i2s_mux_map_enum
);
245 TINYCONN_CH1_MUX_DL1
= 0x0,
246 TINYCONN_CH2_MUX_DL1
= 0x1,
247 TINYCONN_CH1_MUX_DL12
= 0x2,
248 TINYCONN_CH2_MUX_DL12
= 0x3,
249 TINYCONN_CH1_MUX_DL2
= 0x4,
250 TINYCONN_CH2_MUX_DL2
= 0x5,
251 TINYCONN_CH1_MUX_DL3
= 0x6,
252 TINYCONN_CH2_MUX_DL3
= 0x7,
253 TINYCONN_MUX_NONE
= 0x1f,
256 static const char * const tinyconn_mux_map
[] = {
268 static int tinyconn_mux_map_value
[] = {
270 TINYCONN_CH1_MUX_DL1
,
271 TINYCONN_CH2_MUX_DL1
,
272 TINYCONN_CH1_MUX_DL12
,
273 TINYCONN_CH2_MUX_DL12
,
274 TINYCONN_CH1_MUX_DL2
,
275 TINYCONN_CH2_MUX_DL2
,
276 TINYCONN_CH1_MUX_DL3
,
277 TINYCONN_CH2_MUX_DL3
,
280 static SOC_VALUE_ENUM_SINGLE_DECL(i2s1_tinyconn_ch1_mux_map_enum
,
285 tinyconn_mux_map_value
);
286 static const struct snd_kcontrol_new i2s1_tinyconn_ch1_mux_control
=
287 SOC_DAPM_ENUM("i2s1 ch1 tinyconn Select",
288 i2s1_tinyconn_ch1_mux_map_enum
);
290 static SOC_VALUE_ENUM_SINGLE_DECL(i2s1_tinyconn_ch2_mux_map_enum
,
295 tinyconn_mux_map_value
);
296 static const struct snd_kcontrol_new i2s1_tinyconn_ch2_mux_control
=
297 SOC_DAPM_ENUM("i2s1 ch2 tinyconn Select",
298 i2s1_tinyconn_ch2_mux_map_enum
);
300 static SOC_VALUE_ENUM_SINGLE_DECL(i2s3_tinyconn_ch1_mux_map_enum
,
305 tinyconn_mux_map_value
);
306 static const struct snd_kcontrol_new i2s3_tinyconn_ch1_mux_control
=
307 SOC_DAPM_ENUM("i2s3 ch1 tinyconn Select",
308 i2s3_tinyconn_ch1_mux_map_enum
);
310 static SOC_VALUE_ENUM_SINGLE_DECL(i2s3_tinyconn_ch2_mux_map_enum
,
315 tinyconn_mux_map_value
);
316 static const struct snd_kcontrol_new i2s3_tinyconn_ch2_mux_control
=
317 SOC_DAPM_ENUM("i2s3 ch2 tinyconn Select",
318 i2s3_tinyconn_ch2_mux_map_enum
);
321 static const char * const i2s_lpbk_mux_map
[] = {
325 static int i2s_lpbk_mux_map_value
[] = {
329 static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(i2s0_lpbk_mux_map_enum
,
334 i2s_lpbk_mux_map_value
);
336 static const struct snd_kcontrol_new i2s0_lpbk_mux_control
=
337 SOC_DAPM_ENUM("I2S Lpbk Select", i2s0_lpbk_mux_map_enum
);
339 static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(i2s2_lpbk_mux_map_enum
,
344 i2s_lpbk_mux_map_value
);
346 static const struct snd_kcontrol_new i2s2_lpbk_mux_control
=
347 SOC_DAPM_ENUM("I2S Lpbk Select", i2s2_lpbk_mux_map_enum
);
349 /* interconnection */
350 static const struct snd_kcontrol_new mtk_i2s3_ch1_mix
[] = {
351 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH1", AFE_CONN0
, I_DL1_CH1
, 1, 0),
352 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH1", AFE_CONN0
, I_DL2_CH1
, 1, 0),
353 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH1", AFE_CONN0
, I_DL3_CH1
, 1, 0),
354 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH1", AFE_CONN0
, I_DL12_CH1
, 1, 0),
355 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH1", AFE_CONN0_1
, I_DL6_CH1
, 1, 0),
356 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH1", AFE_CONN0_1
, I_DL4_CH1
, 1, 0),
357 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH1", AFE_CONN0_1
, I_DL5_CH1
, 1, 0),
358 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH1", AFE_CONN0_1
, I_DL8_CH1
, 1, 0),
359 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH1", AFE_CONN0_1
, I_DL9_CH1
, 1, 0),
360 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH1", AFE_CONN0
,
361 I_GAIN1_OUT_CH1
, 1, 0),
362 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH1", AFE_CONN0
,
363 I_ADDA_UL_CH1
, 1, 0),
364 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH2", AFE_CONN0
,
365 I_ADDA_UL_CH2
, 1, 0),
366 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH3", AFE_CONN0
,
367 I_ADDA_UL_CH3
, 1, 0),
368 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN0
,
369 I_PCM_1_CAP_CH1
, 1, 0),
370 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN0
,
371 I_PCM_2_CAP_CH1
, 1, 0),
374 static const struct snd_kcontrol_new mtk_i2s3_ch2_mix
[] = {
375 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH2", AFE_CONN1
, I_DL1_CH2
, 1, 0),
376 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH2", AFE_CONN1
, I_DL2_CH2
, 1, 0),
377 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH2", AFE_CONN1
, I_DL3_CH2
, 1, 0),
378 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH2", AFE_CONN1
, I_DL12_CH2
, 1, 0),
379 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH2", AFE_CONN1_1
, I_DL6_CH2
, 1, 0),
380 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH2", AFE_CONN1_1
, I_DL4_CH2
, 1, 0),
381 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH2", AFE_CONN1_1
, I_DL5_CH2
, 1, 0),
382 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH2", AFE_CONN1_1
, I_DL8_CH2
, 1, 0),
383 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH2", AFE_CONN1_1
, I_DL9_CH2
, 1, 0),
384 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH2", AFE_CONN1
,
385 I_GAIN1_OUT_CH2
, 1, 0),
386 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH1", AFE_CONN1
,
387 I_ADDA_UL_CH1
, 1, 0),
388 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH2", AFE_CONN1
,
389 I_ADDA_UL_CH2
, 1, 0),
390 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH3", AFE_CONN1
,
391 I_ADDA_UL_CH3
, 1, 0),
392 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN1
,
393 I_PCM_1_CAP_CH1
, 1, 0),
394 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN1
,
395 I_PCM_2_CAP_CH1
, 1, 0),
396 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH2", AFE_CONN1
,
397 I_PCM_1_CAP_CH2
, 1, 0),
398 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH2", AFE_CONN1
,
399 I_PCM_2_CAP_CH2
, 1, 0),
402 static const struct snd_kcontrol_new mtk_i2s1_ch1_mix
[] = {
403 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH1", AFE_CONN28
, I_DL1_CH1
, 1, 0),
404 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH1", AFE_CONN28
, I_DL2_CH1
, 1, 0),
405 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH1", AFE_CONN28
, I_DL3_CH1
, 1, 0),
406 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH1", AFE_CONN28
, I_DL12_CH1
, 1, 0),
407 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH1", AFE_CONN28_1
, I_DL6_CH1
, 1, 0),
408 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH1", AFE_CONN28_1
, I_DL4_CH1
, 1, 0),
409 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH1", AFE_CONN28_1
, I_DL5_CH1
, 1, 0),
410 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH1", AFE_CONN28_1
, I_DL8_CH1
, 1, 0),
411 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH1", AFE_CONN28_1
, I_DL9_CH1
, 1, 0),
412 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH1", AFE_CONN28
,
413 I_GAIN1_OUT_CH1
, 1, 0),
414 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH1", AFE_CONN28
,
415 I_ADDA_UL_CH1
, 1, 0),
416 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN28
,
417 I_PCM_1_CAP_CH1
, 1, 0),
418 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN28
,
419 I_PCM_2_CAP_CH1
, 1, 0),
422 static const struct snd_kcontrol_new mtk_i2s1_ch2_mix
[] = {
423 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH2", AFE_CONN29
, I_DL1_CH2
, 1, 0),
424 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH2", AFE_CONN29
, I_DL2_CH2
, 1, 0),
425 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH2", AFE_CONN29
, I_DL3_CH2
, 1, 0),
426 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH2", AFE_CONN29
, I_DL12_CH2
, 1, 0),
427 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH2", AFE_CONN29_1
, I_DL6_CH2
, 1, 0),
428 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH2", AFE_CONN29_1
, I_DL4_CH2
, 1, 0),
429 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH2", AFE_CONN29_1
, I_DL5_CH2
, 1, 0),
430 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH2", AFE_CONN29_1
, I_DL8_CH2
, 1, 0),
431 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH2", AFE_CONN29_1
, I_DL9_CH2
, 1, 0),
432 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH2", AFE_CONN29
,
433 I_GAIN1_OUT_CH2
, 1, 0),
434 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH2", AFE_CONN29
,
435 I_ADDA_UL_CH2
, 1, 0),
436 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN29
,
437 I_PCM_1_CAP_CH1
, 1, 0),
438 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN29
,
439 I_PCM_2_CAP_CH1
, 1, 0),
440 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH2", AFE_CONN29
,
441 I_PCM_1_CAP_CH2
, 1, 0),
442 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH2", AFE_CONN29
,
443 I_PCM_2_CAP_CH2
, 1, 0),
446 static const struct snd_kcontrol_new mtk_i2s5_ch1_mix
[] = {
447 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH1", AFE_CONN30
, I_DL1_CH1
, 1, 0),
448 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH1", AFE_CONN30
, I_DL2_CH1
, 1, 0),
449 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH1", AFE_CONN30
, I_DL3_CH1
, 1, 0),
450 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH1", AFE_CONN30
, I_DL12_CH1
, 1, 0),
451 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH1", AFE_CONN30_1
, I_DL6_CH1
, 1, 0),
452 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH1", AFE_CONN30_1
, I_DL4_CH1
, 1, 0),
453 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH1", AFE_CONN30_1
, I_DL5_CH1
, 1, 0),
454 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH1", AFE_CONN30_1
, I_DL8_CH1
, 1, 0),
455 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH1", AFE_CONN30_1
, I_DL9_CH1
, 1, 0),
456 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH1", AFE_CONN30
,
457 I_GAIN1_OUT_CH1
, 1, 0),
458 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH1", AFE_CONN30
,
459 I_ADDA_UL_CH1
, 1, 0),
460 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN30
,
461 I_PCM_1_CAP_CH1
, 1, 0),
462 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN30
,
463 I_PCM_2_CAP_CH1
, 1, 0),
466 static const struct snd_kcontrol_new mtk_i2s5_ch2_mix
[] = {
467 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH2", AFE_CONN31
, I_DL1_CH2
, 1, 0),
468 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH2", AFE_CONN31
, I_DL2_CH2
, 1, 0),
469 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH2", AFE_CONN31
, I_DL3_CH2
, 1, 0),
470 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH2", AFE_CONN31
, I_DL12_CH2
, 1, 0),
471 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH2", AFE_CONN31_1
, I_DL6_CH2
, 1, 0),
472 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH2", AFE_CONN31_1
, I_DL4_CH2
, 1, 0),
473 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH2", AFE_CONN31_1
, I_DL5_CH2
, 1, 0),
474 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH2", AFE_CONN31_1
, I_DL8_CH2
, 1, 0),
475 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH2", AFE_CONN31_1
, I_DL9_CH2
, 1, 0),
476 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH2", AFE_CONN31
,
477 I_GAIN1_OUT_CH2
, 1, 0),
478 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH2", AFE_CONN31
,
479 I_ADDA_UL_CH2
, 1, 0),
480 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN31
,
481 I_PCM_1_CAP_CH1
, 1, 0),
482 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN31
,
483 I_PCM_2_CAP_CH1
, 1, 0),
484 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH2", AFE_CONN31
,
485 I_PCM_1_CAP_CH2
, 1, 0),
486 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH2", AFE_CONN31
,
487 I_PCM_2_CAP_CH2
, 1, 0),
490 static const struct snd_kcontrol_new mtk_i2s7_ch1_mix
[] = {
491 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH1", AFE_CONN54
, I_DL1_CH1
, 1, 0),
492 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH1", AFE_CONN54
, I_DL2_CH1
, 1, 0),
493 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH1", AFE_CONN54
, I_DL3_CH1
, 1, 0),
494 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH1", AFE_CONN54
, I_DL12_CH1
, 1, 0),
495 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH1", AFE_CONN54_1
, I_DL6_CH1
, 1, 0),
496 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH1", AFE_CONN54_1
, I_DL4_CH1
, 1, 0),
497 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH1", AFE_CONN54_1
, I_DL5_CH1
, 1, 0),
498 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH1", AFE_CONN54_1
, I_DL9_CH1
, 1, 0),
499 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH1", AFE_CONN54
,
500 I_GAIN1_OUT_CH1
, 1, 0),
501 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH1", AFE_CONN54
,
502 I_ADDA_UL_CH1
, 1, 0),
503 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN54
,
504 I_PCM_1_CAP_CH1
, 1, 0),
505 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN54
,
506 I_PCM_2_CAP_CH1
, 1, 0),
509 static const struct snd_kcontrol_new mtk_i2s7_ch2_mix
[] = {
510 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH2", AFE_CONN55
, I_DL1_CH2
, 1, 0),
511 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH2", AFE_CONN55
, I_DL2_CH2
, 1, 0),
512 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH2", AFE_CONN55
, I_DL3_CH2
, 1, 0),
513 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH2", AFE_CONN55
, I_DL12_CH2
, 1, 0),
514 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH2", AFE_CONN55_1
, I_DL6_CH2
, 1, 0),
515 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH2", AFE_CONN55_1
, I_DL4_CH2
, 1, 0),
516 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH2", AFE_CONN55_1
, I_DL5_CH2
, 1, 0),
517 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH2", AFE_CONN55_1
, I_DL9_CH2
, 1, 0),
518 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH2", AFE_CONN55
,
519 I_GAIN1_OUT_CH2
, 1, 0),
520 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH2", AFE_CONN55
,
521 I_ADDA_UL_CH2
, 1, 0),
522 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN55
,
523 I_PCM_1_CAP_CH1
, 1, 0),
524 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN55
,
525 I_PCM_2_CAP_CH1
, 1, 0),
526 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH2", AFE_CONN55
,
527 I_PCM_1_CAP_CH2
, 1, 0),
528 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH2", AFE_CONN55
,
529 I_PCM_2_CAP_CH2
, 1, 0),
532 static const struct snd_kcontrol_new mtk_i2s9_ch1_mix
[] = {
533 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH1", AFE_CONN56
, I_DL1_CH1
, 1, 0),
534 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH1", AFE_CONN56
, I_DL2_CH1
, 1, 0),
535 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH1", AFE_CONN56
, I_DL3_CH1
, 1, 0),
536 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH1", AFE_CONN56
, I_DL12_CH1
, 1, 0),
537 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH1", AFE_CONN56_1
, I_DL6_CH1
, 1, 0),
538 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH1", AFE_CONN56_1
, I_DL4_CH1
, 1, 0),
539 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH1", AFE_CONN56_1
, I_DL5_CH1
, 1, 0),
540 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH1", AFE_CONN56_1
, I_DL8_CH1
, 1, 0),
541 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH1", AFE_CONN56_1
, I_DL9_CH1
, 1, 0),
542 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH1", AFE_CONN56
,
543 I_GAIN1_OUT_CH1
, 1, 0),
544 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH1", AFE_CONN56
,
545 I_ADDA_UL_CH1
, 1, 0),
546 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN56
,
547 I_PCM_1_CAP_CH1
, 1, 0),
548 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN56
,
549 I_PCM_2_CAP_CH1
, 1, 0),
552 static const struct snd_kcontrol_new mtk_i2s9_ch2_mix
[] = {
553 SOC_DAPM_SINGLE_AUTODISABLE("DL1_CH2", AFE_CONN57
, I_DL1_CH2
, 1, 0),
554 SOC_DAPM_SINGLE_AUTODISABLE("DL2_CH2", AFE_CONN57
, I_DL2_CH2
, 1, 0),
555 SOC_DAPM_SINGLE_AUTODISABLE("DL3_CH2", AFE_CONN57
, I_DL3_CH2
, 1, 0),
556 SOC_DAPM_SINGLE_AUTODISABLE("DL12_CH2", AFE_CONN57
, I_DL12_CH2
, 1, 0),
557 SOC_DAPM_SINGLE_AUTODISABLE("DL6_CH2", AFE_CONN57_1
, I_DL6_CH2
, 1, 0),
558 SOC_DAPM_SINGLE_AUTODISABLE("DL4_CH2", AFE_CONN57_1
, I_DL4_CH2
, 1, 0),
559 SOC_DAPM_SINGLE_AUTODISABLE("DL5_CH2", AFE_CONN57_1
, I_DL5_CH2
, 1, 0),
560 SOC_DAPM_SINGLE_AUTODISABLE("DL8_CH2", AFE_CONN57_1
, I_DL8_CH2
, 1, 0),
561 SOC_DAPM_SINGLE_AUTODISABLE("DL9_CH2", AFE_CONN57_1
, I_DL9_CH2
, 1, 0),
562 SOC_DAPM_SINGLE_AUTODISABLE("GAIN1_OUT_CH2", AFE_CONN57
,
563 I_GAIN1_OUT_CH2
, 1, 0),
564 SOC_DAPM_SINGLE_AUTODISABLE("ADDA_UL_CH2", AFE_CONN57
,
565 I_ADDA_UL_CH2
, 1, 0),
566 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH1", AFE_CONN57
,
567 I_PCM_1_CAP_CH1
, 1, 0),
568 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH1", AFE_CONN57
,
569 I_PCM_2_CAP_CH1
, 1, 0),
570 SOC_DAPM_SINGLE_AUTODISABLE("PCM_1_CAP_CH2", AFE_CONN57
,
571 I_PCM_1_CAP_CH2
, 1, 0),
572 SOC_DAPM_SINGLE_AUTODISABLE("PCM_2_CAP_CH2", AFE_CONN57
,
573 I_PCM_2_CAP_CH2
, 1, 0),
578 SUPPLY_SEQ_I2S_MCLK_EN
,
579 SUPPLY_SEQ_I2S_HD_EN
,
583 static int mtk_i2s_en_event(struct snd_soc_dapm_widget
*w
,
584 struct snd_kcontrol
*kcontrol
,
587 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
588 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
589 struct mtk_afe_i2s_priv
*i2s_priv
;
591 i2s_priv
= get_i2s_priv_by_name(afe
, w
->name
);
594 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
598 dev_dbg(cmpnt
->dev
, "%s(), name %s, event 0x%x\n",
599 __func__
, w
->name
, event
);
602 case SND_SOC_DAPM_PRE_PMU
:
603 mt8192_afe_gpio_request(afe
->dev
, true, i2s_priv
->id
, 0);
605 case SND_SOC_DAPM_POST_PMD
:
606 mt8192_afe_gpio_request(afe
->dev
, false, i2s_priv
->id
, 0);
615 static int mtk_apll_event(struct snd_soc_dapm_widget
*w
,
616 struct snd_kcontrol
*kcontrol
,
619 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
620 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
622 dev_dbg(cmpnt
->dev
, "%s(), name %s, event 0x%x\n",
623 __func__
, w
->name
, event
);
626 case SND_SOC_DAPM_PRE_PMU
:
627 if (strcmp(w
->name
, APLL1_W_NAME
) == 0)
628 mt8192_apll1_enable(afe
);
630 mt8192_apll2_enable(afe
);
632 case SND_SOC_DAPM_POST_PMD
:
633 if (strcmp(w
->name
, APLL1_W_NAME
) == 0)
634 mt8192_apll1_disable(afe
);
636 mt8192_apll2_disable(afe
);
645 static int i2s_out_tinyconn_event(struct snd_soc_dapm_widget
*w
,
646 struct snd_kcontrol
*kcontrol
,
649 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
650 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
652 unsigned int reg_shift
;
653 unsigned int reg_mask_shift
;
655 dev_dbg(afe
->dev
, "%s(), event 0x%x\n", __func__
, event
);
657 if (strstr(w
->name
, "I2S1")) {
659 reg_shift
= I2S2_32BIT_EN_SFT
;
660 reg_mask_shift
= I2S2_32BIT_EN_MASK_SFT
;
661 } else if (strstr(w
->name
, "I2S3")) {
663 reg_shift
= I2S4_32BIT_EN_SFT
;
664 reg_mask_shift
= I2S4_32BIT_EN_MASK_SFT
;
665 } else if (strstr(w
->name
, "I2S5")) {
667 reg_shift
= I2S5_32BIT_EN_SFT
;
668 reg_mask_shift
= I2S5_32BIT_EN_MASK_SFT
;
669 } else if (strstr(w
->name
, "I2S7")) {
671 reg_shift
= I2S7_32BIT_EN_SFT
;
672 reg_mask_shift
= I2S7_32BIT_EN_MASK_SFT
;
673 } else if (strstr(w
->name
, "I2S9")) {
675 reg_shift
= I2S9_32BIT_EN_SFT
;
676 reg_mask_shift
= I2S9_32BIT_EN_MASK_SFT
;
679 reg_shift
= I2S2_32BIT_EN_SFT
;
680 reg_mask_shift
= I2S2_32BIT_EN_MASK_SFT
;
681 dev_warn(afe
->dev
, "%s(), error widget name %s, use i2s1\n",
686 case SND_SOC_DAPM_PRE_PMU
:
687 regmap_update_bits(afe
->regmap
, reg
, reg_mask_shift
,
690 case SND_SOC_DAPM_PRE_PMD
:
691 regmap_update_bits(afe
->regmap
, reg
, reg_mask_shift
,
701 static int mtk_mclk_en_event(struct snd_soc_dapm_widget
*w
,
702 struct snd_kcontrol
*kcontrol
,
705 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
706 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
707 struct mtk_afe_i2s_priv
*i2s_priv
;
709 dev_dbg(cmpnt
->dev
, "%s(), name %s, event 0x%x\n",
710 __func__
, w
->name
, event
);
712 i2s_priv
= get_i2s_priv_by_name(afe
, w
->name
);
714 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
719 case SND_SOC_DAPM_PRE_PMU
:
720 mt8192_mck_enable(afe
, i2s_priv
->mclk_id
, i2s_priv
->mclk_rate
);
722 case SND_SOC_DAPM_POST_PMD
:
723 i2s_priv
->mclk_rate
= 0;
724 mt8192_mck_disable(afe
, i2s_priv
->mclk_id
);
733 static const struct snd_soc_dapm_widget mtk_dai_i2s_widgets
[] = {
734 SND_SOC_DAPM_INPUT("CONNSYS"),
736 SND_SOC_DAPM_MIXER("I2S1_CH1", SND_SOC_NOPM
, 0, 0,
738 ARRAY_SIZE(mtk_i2s1_ch1_mix
)),
739 SND_SOC_DAPM_MIXER("I2S1_CH2", SND_SOC_NOPM
, 0, 0,
741 ARRAY_SIZE(mtk_i2s1_ch2_mix
)),
743 SND_SOC_DAPM_MIXER("I2S3_CH1", SND_SOC_NOPM
, 0, 0,
745 ARRAY_SIZE(mtk_i2s3_ch1_mix
)),
746 SND_SOC_DAPM_MIXER("I2S3_CH2", SND_SOC_NOPM
, 0, 0,
748 ARRAY_SIZE(mtk_i2s3_ch2_mix
)),
750 SND_SOC_DAPM_MIXER("I2S5_CH1", SND_SOC_NOPM
, 0, 0,
752 ARRAY_SIZE(mtk_i2s5_ch1_mix
)),
753 SND_SOC_DAPM_MIXER("I2S5_CH2", SND_SOC_NOPM
, 0, 0,
755 ARRAY_SIZE(mtk_i2s5_ch2_mix
)),
757 SND_SOC_DAPM_MIXER("I2S7_CH1", SND_SOC_NOPM
, 0, 0,
759 ARRAY_SIZE(mtk_i2s7_ch1_mix
)),
760 SND_SOC_DAPM_MIXER("I2S7_CH2", SND_SOC_NOPM
, 0, 0,
762 ARRAY_SIZE(mtk_i2s7_ch2_mix
)),
764 SND_SOC_DAPM_MIXER("I2S9_CH1", SND_SOC_NOPM
, 0, 0,
766 ARRAY_SIZE(mtk_i2s9_ch1_mix
)),
767 SND_SOC_DAPM_MIXER("I2S9_CH2", SND_SOC_NOPM
, 0, 0,
769 ARRAY_SIZE(mtk_i2s9_ch2_mix
)),
771 SND_SOC_DAPM_MUX_E("I2S1_TINYCONN_CH1_MUX", SND_SOC_NOPM
, 0, 0,
772 &i2s1_tinyconn_ch1_mux_control
,
773 i2s_out_tinyconn_event
,
774 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_PRE_PMD
),
775 SND_SOC_DAPM_MUX_E("I2S1_TINYCONN_CH2_MUX", SND_SOC_NOPM
, 0, 0,
776 &i2s1_tinyconn_ch2_mux_control
,
777 i2s_out_tinyconn_event
,
778 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_PRE_PMD
),
779 SND_SOC_DAPM_MUX_E("I2S3_TINYCONN_CH1_MUX", SND_SOC_NOPM
, 0, 0,
780 &i2s3_tinyconn_ch1_mux_control
,
781 i2s_out_tinyconn_event
,
782 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_PRE_PMD
),
783 SND_SOC_DAPM_MUX_E("I2S3_TINYCONN_CH2_MUX", SND_SOC_NOPM
, 0, 0,
784 &i2s3_tinyconn_ch2_mux_control
,
785 i2s_out_tinyconn_event
,
786 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_PRE_PMD
),
789 SND_SOC_DAPM_SUPPLY_S("I2S0_EN", SUPPLY_SEQ_I2S_EN
,
790 AFE_I2S_CON
, I2S_EN_SFT
, 0,
792 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
793 SND_SOC_DAPM_SUPPLY_S("I2S1_EN", SUPPLY_SEQ_I2S_EN
,
794 AFE_I2S_CON1
, I2S_EN_SFT
, 0,
796 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
797 SND_SOC_DAPM_SUPPLY_S("I2S2_EN", SUPPLY_SEQ_I2S_EN
,
798 AFE_I2S_CON2
, I2S_EN_SFT
, 0,
800 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
801 SND_SOC_DAPM_SUPPLY_S("I2S3_EN", SUPPLY_SEQ_I2S_EN
,
802 AFE_I2S_CON3
, I2S_EN_SFT
, 0,
804 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
805 SND_SOC_DAPM_SUPPLY_S("I2S5_EN", SUPPLY_SEQ_I2S_EN
,
806 AFE_I2S_CON4
, I2S5_EN_SFT
, 0,
808 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
809 SND_SOC_DAPM_SUPPLY_S("I2S6_EN", SUPPLY_SEQ_I2S_EN
,
810 AFE_I2S_CON6
, I2S6_EN_SFT
, 0,
812 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
813 SND_SOC_DAPM_SUPPLY_S("I2S7_EN", SUPPLY_SEQ_I2S_EN
,
814 AFE_I2S_CON7
, I2S7_EN_SFT
, 0,
816 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
817 SND_SOC_DAPM_SUPPLY_S("I2S8_EN", SUPPLY_SEQ_I2S_EN
,
818 AFE_I2S_CON8
, I2S8_EN_SFT
, 0,
820 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
821 SND_SOC_DAPM_SUPPLY_S("I2S9_EN", SUPPLY_SEQ_I2S_EN
,
822 AFE_I2S_CON9
, I2S9_EN_SFT
, 0,
824 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
826 SND_SOC_DAPM_SUPPLY_S(I2S0_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
827 AFE_I2S_CON
, I2S1_HD_EN_SFT
, 0, NULL
, 0),
828 SND_SOC_DAPM_SUPPLY_S(I2S1_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
829 AFE_I2S_CON1
, I2S2_HD_EN_SFT
, 0, NULL
, 0),
830 SND_SOC_DAPM_SUPPLY_S(I2S2_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
831 AFE_I2S_CON2
, I2S3_HD_EN_SFT
, 0, NULL
, 0),
832 SND_SOC_DAPM_SUPPLY_S(I2S3_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
833 AFE_I2S_CON3
, I2S4_HD_EN_SFT
, 0, NULL
, 0),
834 SND_SOC_DAPM_SUPPLY_S(I2S5_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
835 AFE_I2S_CON4
, I2S5_HD_EN_SFT
, 0, NULL
, 0),
836 SND_SOC_DAPM_SUPPLY_S(I2S6_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
837 AFE_I2S_CON6
, I2S6_HD_EN_SFT
, 0, NULL
, 0),
838 SND_SOC_DAPM_SUPPLY_S(I2S7_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
839 AFE_I2S_CON7
, I2S7_HD_EN_SFT
, 0, NULL
, 0),
840 SND_SOC_DAPM_SUPPLY_S(I2S8_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
841 AFE_I2S_CON8
, I2S8_HD_EN_SFT
, 0, NULL
, 0),
842 SND_SOC_DAPM_SUPPLY_S(I2S9_HD_EN_W_NAME
, SUPPLY_SEQ_I2S_HD_EN
,
843 AFE_I2S_CON9
, I2S9_HD_EN_SFT
, 0, NULL
, 0),
846 SND_SOC_DAPM_SUPPLY_S(I2S0_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
849 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
850 SND_SOC_DAPM_SUPPLY_S(I2S1_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
853 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
854 SND_SOC_DAPM_SUPPLY_S(I2S2_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
857 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
858 SND_SOC_DAPM_SUPPLY_S(I2S3_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
861 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
862 SND_SOC_DAPM_SUPPLY_S(I2S5_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
865 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
866 SND_SOC_DAPM_SUPPLY_S(I2S6_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
869 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
870 SND_SOC_DAPM_SUPPLY_S(I2S7_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
873 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
874 SND_SOC_DAPM_SUPPLY_S(I2S8_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
877 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
878 SND_SOC_DAPM_SUPPLY_S(I2S9_MCLK_EN_W_NAME
, SUPPLY_SEQ_I2S_MCLK_EN
,
881 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
884 SND_SOC_DAPM_SUPPLY_S(APLL1_W_NAME
, SUPPLY_SEQ_APLL
,
887 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
888 SND_SOC_DAPM_SUPPLY_S(APLL2_W_NAME
, SUPPLY_SEQ_APLL
,
891 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
893 /* allow i2s on without codec on */
894 SND_SOC_DAPM_OUTPUT("I2S_DUMMY_OUT"),
895 SND_SOC_DAPM_MUX("I2S1_Out_Mux",
896 SND_SOC_NOPM
, 0, 0, &i2s1_out_mux_control
),
897 SND_SOC_DAPM_MUX("I2S3_Out_Mux",
898 SND_SOC_NOPM
, 0, 0, &i2s3_out_mux_control
),
899 SND_SOC_DAPM_MUX("I2S5_Out_Mux",
900 SND_SOC_NOPM
, 0, 0, &i2s5_out_mux_control
),
901 SND_SOC_DAPM_MUX("I2S7_Out_Mux",
902 SND_SOC_NOPM
, 0, 0, &i2s7_out_mux_control
),
903 SND_SOC_DAPM_MUX("I2S9_Out_Mux",
904 SND_SOC_NOPM
, 0, 0, &i2s9_out_mux_control
),
906 SND_SOC_DAPM_INPUT("I2S_DUMMY_IN"),
907 SND_SOC_DAPM_MUX("I2S0_In_Mux",
908 SND_SOC_NOPM
, 0, 0, &i2s0_in_mux_control
),
909 SND_SOC_DAPM_MUX("I2S8_In_Mux",
910 SND_SOC_NOPM
, 0, 0, &i2s8_in_mux_control
),
913 SND_SOC_DAPM_MUX("I2S0_Lpbk_Mux",
914 SND_SOC_NOPM
, 0, 0, &i2s0_lpbk_mux_control
),
915 SND_SOC_DAPM_MUX("I2S2_Lpbk_Mux",
916 SND_SOC_NOPM
, 0, 0, &i2s2_lpbk_mux_control
),
919 static int mtk_afe_i2s_share_connect(struct snd_soc_dapm_widget
*source
,
920 struct snd_soc_dapm_widget
*sink
)
922 struct snd_soc_dapm_widget
*w
= sink
;
923 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
924 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
925 struct mtk_afe_i2s_priv
*i2s_priv
;
927 i2s_priv
= get_i2s_priv_by_name(afe
, sink
->name
);
929 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
933 if (i2s_priv
->share_i2s_id
< 0)
936 return i2s_priv
->share_i2s_id
== get_i2s_id_by_name(afe
, source
->name
);
939 static int mtk_afe_i2s_hd_connect(struct snd_soc_dapm_widget
*source
,
940 struct snd_soc_dapm_widget
*sink
)
942 struct snd_soc_dapm_widget
*w
= sink
;
943 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
944 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
945 struct mtk_afe_i2s_priv
*i2s_priv
;
947 i2s_priv
= get_i2s_priv_by_name(afe
, sink
->name
);
949 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
953 if (get_i2s_id_by_name(afe
, sink
->name
) ==
954 get_i2s_id_by_name(afe
, source
->name
))
955 return i2s_priv
->low_jitter_en
;
957 /* check if share i2s need hd en */
958 if (i2s_priv
->share_i2s_id
< 0)
961 if (i2s_priv
->share_i2s_id
== get_i2s_id_by_name(afe
, source
->name
))
962 return i2s_priv
->low_jitter_en
;
967 static int mtk_afe_i2s_apll_connect(struct snd_soc_dapm_widget
*source
,
968 struct snd_soc_dapm_widget
*sink
)
970 struct snd_soc_dapm_widget
*w
= sink
;
971 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
972 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
973 struct mtk_afe_i2s_priv
*i2s_priv
;
977 i2s_priv
= get_i2s_priv_by_name(afe
, w
->name
);
979 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
984 cur_apll
= mt8192_get_apll_by_name(afe
, source
->name
);
986 /* choose APLL from i2s rate */
987 i2s_need_apll
= mt8192_get_apll_by_rate(afe
, i2s_priv
->rate
);
989 if (i2s_need_apll
== cur_apll
)
995 static int mtk_afe_i2s_mclk_connect(struct snd_soc_dapm_widget
*source
,
996 struct snd_soc_dapm_widget
*sink
)
998 struct snd_soc_dapm_widget
*w
= sink
;
999 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
1000 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
1001 struct mtk_afe_i2s_priv
*i2s_priv
;
1003 i2s_priv
= get_i2s_priv_by_name(afe
, sink
->name
);
1005 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
1009 if (get_i2s_id_by_name(afe
, sink
->name
) ==
1010 get_i2s_id_by_name(afe
, source
->name
))
1011 return (i2s_priv
->mclk_rate
> 0) ? 1 : 0;
1013 /* check if share i2s need mclk */
1014 if (i2s_priv
->share_i2s_id
< 0)
1017 if (i2s_priv
->share_i2s_id
== get_i2s_id_by_name(afe
, source
->name
))
1018 return (i2s_priv
->mclk_rate
> 0) ? 1 : 0;
1023 static int mtk_afe_mclk_apll_connect(struct snd_soc_dapm_widget
*source
,
1024 struct snd_soc_dapm_widget
*sink
)
1026 struct snd_soc_dapm_widget
*w
= sink
;
1027 struct snd_soc_component
*cmpnt
= snd_soc_dapm_to_component(w
->dapm
);
1028 struct mtk_base_afe
*afe
= snd_soc_component_get_drvdata(cmpnt
);
1029 struct mtk_afe_i2s_priv
*i2s_priv
;
1032 i2s_priv
= get_i2s_priv_by_name(afe
, w
->name
);
1034 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
1039 cur_apll
= mt8192_get_apll_by_name(afe
, source
->name
);
1041 if (i2s_priv
->mclk_apll
== cur_apll
)
1047 static const struct snd_soc_dapm_route mtk_dai_i2s_routes
[] = {
1048 {"Connsys I2S", NULL
, "CONNSYS"},
1051 {"I2S0", NULL
, "I2S0_EN"},
1052 {"I2S0", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1053 {"I2S0", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1054 {"I2S0", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1055 {"I2S0", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1056 {"I2S0", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1057 {"I2S0", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1058 {"I2S0", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1059 {"I2S0", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1061 {"I2S0", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1062 {"I2S0", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1063 {"I2S0", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1064 {"I2S0", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1065 {"I2S0", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1066 {"I2S0", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1067 {"I2S0", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1068 {"I2S0", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1069 {"I2S0", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1070 {I2S0_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1071 {I2S0_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1073 {"I2S0", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1074 {"I2S0", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1075 {"I2S0", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1076 {"I2S0", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1077 {"I2S0", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1078 {"I2S0", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1079 {"I2S0", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1080 {"I2S0", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1081 {"I2S0", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1082 {I2S0_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1083 {I2S0_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1086 {"I2S1_CH1", "DL1_CH1", "DL1"},
1087 {"I2S1_CH2", "DL1_CH2", "DL1"},
1088 {"I2S1_TINYCONN_CH1_MUX", "DL1_CH1", "DL1"},
1089 {"I2S1_TINYCONN_CH2_MUX", "DL1_CH2", "DL1"},
1091 {"I2S1_CH1", "DL2_CH1", "DL2"},
1092 {"I2S1_CH2", "DL2_CH2", "DL2"},
1093 {"I2S1_TINYCONN_CH1_MUX", "DL2_CH1", "DL2"},
1094 {"I2S1_TINYCONN_CH2_MUX", "DL2_CH2", "DL2"},
1096 {"I2S1_CH1", "DL3_CH1", "DL3"},
1097 {"I2S1_CH2", "DL3_CH2", "DL3"},
1098 {"I2S1_TINYCONN_CH1_MUX", "DL3_CH1", "DL3"},
1099 {"I2S1_TINYCONN_CH2_MUX", "DL3_CH2", "DL3"},
1101 {"I2S1_CH1", "DL12_CH1", "DL12"},
1102 {"I2S1_CH2", "DL12_CH2", "DL12"},
1103 {"I2S1_TINYCONN_CH1_MUX", "DL12_CH1", "DL12"},
1104 {"I2S1_TINYCONN_CH2_MUX", "DL12_CH2", "DL12"},
1106 {"I2S1_CH1", "DL4_CH1", "DL4"},
1107 {"I2S1_CH2", "DL4_CH2", "DL4"},
1109 {"I2S1_CH1", "DL5_CH1", "DL5"},
1110 {"I2S1_CH2", "DL5_CH2", "DL5"},
1112 {"I2S1_CH1", "DL6_CH1", "DL6"},
1113 {"I2S1_CH2", "DL6_CH2", "DL6"},
1115 {"I2S1_CH1", "DL8_CH1", "DL8"},
1116 {"I2S1_CH2", "DL8_CH2", "DL8"},
1118 {"I2S1", NULL
, "I2S1_CH1"},
1119 {"I2S1", NULL
, "I2S1_CH2"},
1120 {"I2S1", NULL
, "I2S3_TINYCONN_CH1_MUX"},
1121 {"I2S1", NULL
, "I2S3_TINYCONN_CH2_MUX"},
1123 {"I2S1", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1124 {"I2S1", NULL
, "I2S1_EN"},
1125 {"I2S1", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1126 {"I2S1", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1127 {"I2S1", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1128 {"I2S1", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1129 {"I2S1", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1130 {"I2S1", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1131 {"I2S1", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1133 {"I2S1", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1134 {"I2S1", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1135 {"I2S1", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1136 {"I2S1", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1137 {"I2S1", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1138 {"I2S1", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1139 {"I2S1", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1140 {"I2S1", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1141 {"I2S1", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1142 {I2S1_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1143 {I2S1_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1145 {"I2S1", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1146 {"I2S1", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1147 {"I2S1", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1148 {"I2S1", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1149 {"I2S1", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1150 {"I2S1", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1151 {"I2S1", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1152 {"I2S1", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1153 {"I2S1", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1154 {I2S1_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1155 {I2S1_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1158 {"I2S2", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1159 {"I2S2", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1160 {"I2S2", NULL
, "I2S2_EN"},
1161 {"I2S2", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1162 {"I2S2", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1163 {"I2S2", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1164 {"I2S2", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1165 {"I2S2", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1166 {"I2S2", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1168 {"I2S2", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1169 {"I2S2", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1170 {"I2S2", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1171 {"I2S2", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1172 {"I2S2", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1173 {"I2S2", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1174 {"I2S2", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1175 {"I2S2", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1176 {"I2S2", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1177 {I2S2_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1178 {I2S2_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1180 {"I2S2", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1181 {"I2S2", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1182 {"I2S2", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1183 {"I2S2", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1184 {"I2S2", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1185 {"I2S2", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1186 {"I2S2", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1187 {"I2S2", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1188 {"I2S2", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1189 {I2S2_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1190 {I2S2_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1193 {"I2S3_CH1", "DL1_CH1", "DL1"},
1194 {"I2S3_CH2", "DL1_CH2", "DL1"},
1195 {"I2S3_TINYCONN_CH1_MUX", "DL1_CH1", "DL1"},
1196 {"I2S3_TINYCONN_CH2_MUX", "DL1_CH2", "DL1"},
1198 {"I2S3_CH1", "DL2_CH1", "DL2"},
1199 {"I2S3_CH2", "DL2_CH2", "DL2"},
1200 {"I2S3_TINYCONN_CH1_MUX", "DL2_CH1", "DL2"},
1201 {"I2S3_TINYCONN_CH2_MUX", "DL2_CH2", "DL2"},
1203 {"I2S3_CH1", "DL3_CH1", "DL3"},
1204 {"I2S3_CH2", "DL3_CH2", "DL3"},
1205 {"I2S3_TINYCONN_CH1_MUX", "DL3_CH1", "DL3"},
1206 {"I2S3_TINYCONN_CH2_MUX", "DL3_CH2", "DL3"},
1208 {"I2S3_CH1", "DL12_CH1", "DL12"},
1209 {"I2S3_CH2", "DL12_CH2", "DL12"},
1210 {"I2S3_TINYCONN_CH1_MUX", "DL12_CH1", "DL12"},
1211 {"I2S3_TINYCONN_CH2_MUX", "DL12_CH2", "DL12"},
1213 {"I2S3_CH1", "DL4_CH1", "DL4"},
1214 {"I2S3_CH2", "DL4_CH2", "DL4"},
1216 {"I2S3_CH1", "DL5_CH1", "DL5"},
1217 {"I2S3_CH2", "DL5_CH2", "DL5"},
1219 {"I2S3_CH1", "DL6_CH1", "DL6"},
1220 {"I2S3_CH2", "DL6_CH2", "DL6"},
1222 {"I2S3_CH1", "DL8_CH1", "DL8"},
1223 {"I2S3_CH2", "DL8_CH2", "DL8"},
1225 {"I2S3", NULL
, "I2S3_CH1"},
1226 {"I2S3", NULL
, "I2S3_CH2"},
1227 {"I2S3", NULL
, "I2S3_TINYCONN_CH1_MUX"},
1228 {"I2S3", NULL
, "I2S3_TINYCONN_CH2_MUX"},
1230 {"I2S3", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1231 {"I2S3", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1232 {"I2S3", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1233 {"I2S3", NULL
, "I2S3_EN"},
1234 {"I2S3", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1235 {"I2S3", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1236 {"I2S3", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1237 {"I2S3", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1238 {"I2S3", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1240 {"I2S3", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1241 {"I2S3", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1242 {"I2S3", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1243 {"I2S3", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1244 {"I2S3", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1245 {"I2S3", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1246 {"I2S3", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1247 {"I2S3", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1248 {"I2S3", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1249 {I2S3_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1250 {I2S3_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1252 {"I2S3", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1253 {"I2S3", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1254 {"I2S3", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1255 {"I2S3", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1256 {"I2S3", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1257 {"I2S3", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1258 {"I2S3", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1259 {"I2S3", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1260 {"I2S3", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1261 {I2S3_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1262 {I2S3_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1265 {"I2S5_CH1", "DL1_CH1", "DL1"},
1266 {"I2S5_CH2", "DL1_CH2", "DL1"},
1268 {"I2S5_CH1", "DL2_CH1", "DL2"},
1269 {"I2S5_CH2", "DL2_CH2", "DL2"},
1271 {"I2S5_CH1", "DL3_CH1", "DL3"},
1272 {"I2S5_CH2", "DL3_CH2", "DL3"},
1274 {"I2S5_CH1", "DL12_CH1", "DL12"},
1275 {"I2S5_CH2", "DL12_CH2", "DL12"},
1277 {"I2S5_CH1", "DL4_CH1", "DL4"},
1278 {"I2S5_CH2", "DL4_CH2", "DL4"},
1280 {"I2S5_CH1", "DL5_CH1", "DL5"},
1281 {"I2S5_CH2", "DL5_CH2", "DL5"},
1283 {"I2S5_CH1", "DL6_CH1", "DL6"},
1284 {"I2S5_CH2", "DL6_CH2", "DL6"},
1286 {"I2S5_CH1", "DL8_CH1", "DL8"},
1287 {"I2S5_CH2", "DL8_CH2", "DL8"},
1289 {"I2S5", NULL
, "I2S5_CH1"},
1290 {"I2S5", NULL
, "I2S5_CH2"},
1292 {"I2S5", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1293 {"I2S5", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1294 {"I2S5", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1295 {"I2S5", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1296 {"I2S5", NULL
, "I2S5_EN"},
1297 {"I2S5", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1298 {"I2S5", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1299 {"I2S5", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1300 {"I2S5", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1302 {"I2S5", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1303 {"I2S5", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1304 {"I2S5", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1305 {"I2S5", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1306 {"I2S5", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1307 {"I2S5", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1308 {"I2S5", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1309 {"I2S5", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1310 {"I2S5", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1311 {I2S5_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1312 {I2S5_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1314 {"I2S5", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1315 {"I2S5", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1316 {"I2S5", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1317 {"I2S5", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1318 {"I2S5", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1319 {"I2S5", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1320 {"I2S5", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1321 {"I2S5", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1322 {"I2S5", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1323 {I2S5_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1324 {I2S5_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1327 {"I2S6", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1328 {"I2S6", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1329 {"I2S6", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1330 {"I2S6", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1331 {"I2S6", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1332 {"I2S6", NULL
, "I2S6_EN"},
1333 {"I2S6", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1334 {"I2S6", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1335 {"I2S6", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1337 {"I2S6", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1338 {"I2S6", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1339 {"I2S6", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1340 {"I2S6", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1341 {"I2S6", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1342 {"I2S6", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1343 {"I2S6", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1344 {"I2S6", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1345 {"I2S6", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1346 {I2S6_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1347 {I2S6_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1349 {"I2S6", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1350 {"I2S6", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1351 {"I2S6", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1352 {"I2S6", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1353 {"I2S6", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1354 {"I2S6", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1355 {"I2S6", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1356 {"I2S6", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1357 {"I2S6", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1358 {I2S6_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1359 {I2S6_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1362 {"I2S7", NULL
, "I2S7_CH1"},
1363 {"I2S7", NULL
, "I2S7_CH2"},
1365 {"I2S7", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1366 {"I2S7", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1367 {"I2S7", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1368 {"I2S7", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1369 {"I2S7", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1370 {"I2S7", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1371 {"I2S7", NULL
, "I2S7_EN"},
1372 {"I2S7", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1373 {"I2S7", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1375 {"I2S7", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1376 {"I2S7", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1377 {"I2S7", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1378 {"I2S7", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1379 {"I2S7", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1380 {"I2S7", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1381 {"I2S7", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1382 {"I2S7", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1383 {"I2S7", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1384 {I2S7_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1385 {I2S7_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1387 {"I2S7", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1388 {"I2S7", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1389 {"I2S7", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1390 {"I2S7", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1391 {"I2S7", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1392 {"I2S7", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1393 {"I2S7", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1394 {"I2S7", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1395 {"I2S7", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1396 {I2S7_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1397 {I2S7_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1400 {"I2S8", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1401 {"I2S8", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1402 {"I2S8", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1403 {"I2S8", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1404 {"I2S8", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1405 {"I2S8", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1406 {"I2S8", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1407 {"I2S8", NULL
, "I2S8_EN"},
1408 {"I2S8", NULL
, "I2S9_EN", mtk_afe_i2s_share_connect
},
1410 {"I2S8", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1411 {"I2S8", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1412 {"I2S8", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1413 {"I2S8", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1414 {"I2S8", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1415 {"I2S8", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1416 {"I2S8", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1417 {"I2S8", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1418 {"I2S8", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1419 {I2S8_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1420 {I2S8_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1422 {"I2S8", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1423 {"I2S8", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1424 {"I2S8", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1425 {"I2S8", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1426 {"I2S8", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1427 {"I2S8", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1428 {"I2S8", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1429 {"I2S8", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1430 {"I2S8", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1431 {I2S8_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1432 {I2S8_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1435 {"I2S9_CH1", "DL1_CH1", "DL1"},
1436 {"I2S9_CH2", "DL1_CH2", "DL1"},
1438 {"I2S9_CH1", "DL2_CH1", "DL2"},
1439 {"I2S9_CH2", "DL2_CH2", "DL2"},
1441 {"I2S9_CH1", "DL3_CH1", "DL3"},
1442 {"I2S9_CH2", "DL3_CH2", "DL3"},
1444 {"I2S9_CH1", "DL12_CH1", "DL12"},
1445 {"I2S9_CH2", "DL12_CH2", "DL12"},
1447 {"I2S9_CH1", "DL4_CH1", "DL4"},
1448 {"I2S9_CH2", "DL4_CH2", "DL4"},
1450 {"I2S9_CH1", "DL5_CH1", "DL5"},
1451 {"I2S9_CH2", "DL5_CH2", "DL5"},
1453 {"I2S9_CH1", "DL6_CH1", "DL6"},
1454 {"I2S9_CH2", "DL6_CH2", "DL6"},
1456 {"I2S9_CH1", "DL8_CH1", "DL8"},
1457 {"I2S9_CH2", "DL8_CH2", "DL8"},
1459 {"I2S9_CH1", "DL9_CH1", "DL9"},
1460 {"I2S9_CH2", "DL9_CH2", "DL9"},
1462 {"I2S9", NULL
, "I2S9_CH1"},
1463 {"I2S9", NULL
, "I2S9_CH2"},
1465 {"I2S9", NULL
, "I2S0_EN", mtk_afe_i2s_share_connect
},
1466 {"I2S9", NULL
, "I2S1_EN", mtk_afe_i2s_share_connect
},
1467 {"I2S9", NULL
, "I2S2_EN", mtk_afe_i2s_share_connect
},
1468 {"I2S9", NULL
, "I2S3_EN", mtk_afe_i2s_share_connect
},
1469 {"I2S9", NULL
, "I2S5_EN", mtk_afe_i2s_share_connect
},
1470 {"I2S9", NULL
, "I2S6_EN", mtk_afe_i2s_share_connect
},
1471 {"I2S9", NULL
, "I2S7_EN", mtk_afe_i2s_share_connect
},
1472 {"I2S9", NULL
, "I2S8_EN", mtk_afe_i2s_share_connect
},
1473 {"I2S9", NULL
, "I2S9_EN"},
1475 {"I2S9", NULL
, I2S0_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1476 {"I2S9", NULL
, I2S1_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1477 {"I2S9", NULL
, I2S2_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1478 {"I2S9", NULL
, I2S3_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1479 {"I2S9", NULL
, I2S5_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1480 {"I2S9", NULL
, I2S6_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1481 {"I2S9", NULL
, I2S7_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1482 {"I2S9", NULL
, I2S8_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1483 {"I2S9", NULL
, I2S9_HD_EN_W_NAME
, mtk_afe_i2s_hd_connect
},
1484 {I2S9_HD_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_i2s_apll_connect
},
1485 {I2S9_HD_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_i2s_apll_connect
},
1487 {"I2S9", NULL
, I2S0_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1488 {"I2S9", NULL
, I2S1_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1489 {"I2S9", NULL
, I2S2_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1490 {"I2S9", NULL
, I2S3_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1491 {"I2S9", NULL
, I2S5_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1492 {"I2S9", NULL
, I2S6_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1493 {"I2S9", NULL
, I2S7_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1494 {"I2S9", NULL
, I2S8_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1495 {"I2S9", NULL
, I2S9_MCLK_EN_W_NAME
, mtk_afe_i2s_mclk_connect
},
1496 {I2S9_MCLK_EN_W_NAME
, NULL
, APLL1_W_NAME
, mtk_afe_mclk_apll_connect
},
1497 {I2S9_MCLK_EN_W_NAME
, NULL
, APLL2_W_NAME
, mtk_afe_mclk_apll_connect
},
1499 /* allow i2s on without codec on */
1500 {"I2S0", NULL
, "I2S0_In_Mux"},
1501 {"I2S0_In_Mux", "Dummy_Widget", "I2S_DUMMY_IN"},
1503 {"I2S8", NULL
, "I2S8_In_Mux"},
1504 {"I2S8_In_Mux", "Dummy_Widget", "I2S_DUMMY_IN"},
1506 {"I2S1_Out_Mux", "Dummy_Widget", "I2S1"},
1507 {"I2S_DUMMY_OUT", NULL
, "I2S1_Out_Mux"},
1509 {"I2S3_Out_Mux", "Dummy_Widget", "I2S3"},
1510 {"I2S_DUMMY_OUT", NULL
, "I2S3_Out_Mux"},
1512 {"I2S5_Out_Mux", "Dummy_Widget", "I2S5"},
1513 {"I2S_DUMMY_OUT", NULL
, "I2S5_Out_Mux"},
1515 {"I2S7_Out_Mux", "Dummy_Widget", "I2S7"},
1516 {"I2S_DUMMY_OUT", NULL
, "I2S7_Out_Mux"},
1518 {"I2S9_Out_Mux", "Dummy_Widget", "I2S9"},
1519 {"I2S_DUMMY_OUT", NULL
, "I2S9_Out_Mux"},
1522 {"I2S0_Lpbk_Mux", "Lpbk", "I2S3"},
1523 {"I2S2_Lpbk_Mux", "Lpbk", "I2S1"},
1524 {"I2S0", NULL
, "I2S0_Lpbk_Mux"},
1525 {"I2S2", NULL
, "I2S2_Lpbk_Mux"},
1529 static int mtk_dai_connsys_i2s_hw_params(struct snd_pcm_substream
*substream
,
1530 struct snd_pcm_hw_params
*params
,
1531 struct snd_soc_dai
*dai
)
1533 struct mtk_base_afe
*afe
= snd_soc_dai_get_drvdata(dai
);
1534 unsigned int rate
= params_rate(params
);
1535 unsigned int rate_reg
= mt8192_rate_transform(afe
->dev
,
1537 unsigned int i2s_con
= 0;
1539 dev_dbg(afe
->dev
, "%s(), id %d, stream %d, rate %d\n",
1540 __func__
, dai
->id
, substream
->stream
, rate
);
1542 /* non-inverse, i2s mode, proxy mode, 16bits, from connsys */
1543 i2s_con
|= 0 << INV_PAD_CTRL_SFT
;
1544 i2s_con
|= I2S_FMT_I2S
<< I2S_FMT_SFT
;
1545 i2s_con
|= 1 << I2S_SRC_SFT
;
1546 i2s_con
|= get_i2s_wlen(SNDRV_PCM_FORMAT_S16_LE
) << I2S_WLEN_SFT
;
1547 i2s_con
|= 0 << I2SIN_PAD_SEL_SFT
;
1548 regmap_write(afe
->regmap
, AFE_CONNSYS_I2S_CON
, i2s_con
);
1551 regmap_update_bits(afe
->regmap
,
1552 AFE_CONNSYS_I2S_CON
,
1553 I2S_BYPSRC_MASK_SFT
,
1554 0x0 << I2S_BYPSRC_SFT
);
1556 /* proxy mode, set i2s for asrc */
1557 regmap_update_bits(afe
->regmap
,
1558 AFE_CONNSYS_I2S_CON
,
1560 rate_reg
<< I2S_MODE_SFT
);
1564 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON3
, 0x140000);
1567 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON3
, 0x001B9000);
1570 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON3
, 0x001E0000);
1574 /* Calibration setting */
1575 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON4
, 0x00140000);
1576 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON9
, 0x00036000);
1577 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON10
, 0x0002FC00);
1578 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON6
, 0x00007EF4);
1579 regmap_write(afe
->regmap
, AFE_ASRC_2CH_CON5
, 0x00FF5986);
1581 /* 0:Stereo 1:Mono */
1582 regmap_update_bits(afe
->regmap
,
1584 CHSET_IS_MONO_MASK_SFT
,
1585 0x0 << CHSET_IS_MONO_SFT
);
1590 static int mtk_dai_connsys_i2s_trigger(struct snd_pcm_substream
*substream
,
1591 int cmd
, struct snd_soc_dai
*dai
)
1593 struct mtk_base_afe
*afe
= snd_soc_dai_get_drvdata(dai
);
1594 struct mt8192_afe_private
*afe_priv
= afe
->platform_priv
;
1596 dev_dbg(afe
->dev
, "%s(), cmd %d, stream %d\n",
1597 __func__
, cmd
, substream
->stream
);
1600 case SNDRV_PCM_TRIGGER_START
:
1601 case SNDRV_PCM_TRIGGER_RESUME
:
1603 regmap_update_bits(afe
->regmap
,
1604 AFE_CONNSYS_I2S_CON
,
1608 /* calibrator enable */
1609 regmap_update_bits(afe
->regmap
,
1612 0x1 << CALI_EN_SFT
);
1615 regmap_update_bits(afe
->regmap
,
1617 CON0_CHSET_STR_CLR_MASK_SFT
,
1618 0x1 << CON0_CHSET_STR_CLR_SFT
);
1619 regmap_update_bits(afe
->regmap
,
1621 CON0_ASM_ON_MASK_SFT
,
1622 0x1 << CON0_ASM_ON_SFT
);
1624 afe_priv
->dai_on
[dai
->id
] = true;
1626 case SNDRV_PCM_TRIGGER_STOP
:
1627 case SNDRV_PCM_TRIGGER_SUSPEND
:
1628 regmap_update_bits(afe
->regmap
,
1630 CON0_ASM_ON_MASK_SFT
,
1631 0 << CON0_ASM_ON_SFT
);
1632 regmap_update_bits(afe
->regmap
,
1638 regmap_update_bits(afe
->regmap
,
1639 AFE_CONNSYS_I2S_CON
,
1644 regmap_update_bits(afe
->regmap
,
1645 AFE_CONNSYS_I2S_CON
,
1646 I2S_BYPSRC_MASK_SFT
,
1647 0x1 << I2S_BYPSRC_SFT
);
1649 afe_priv
->dai_on
[dai
->id
] = false;
1657 static const struct snd_soc_dai_ops mtk_dai_connsys_i2s_ops
= {
1658 .hw_params
= mtk_dai_connsys_i2s_hw_params
,
1659 .trigger
= mtk_dai_connsys_i2s_trigger
,
1663 static int mtk_dai_i2s_config(struct mtk_base_afe
*afe
,
1664 struct snd_pcm_hw_params
*params
,
1667 struct mt8192_afe_private
*afe_priv
= afe
->platform_priv
;
1668 struct mtk_afe_i2s_priv
*i2s_priv
= afe_priv
->dai_priv
[i2s_id
];
1670 unsigned int rate
= params_rate(params
);
1671 unsigned int rate_reg
= mt8192_rate_transform(afe
->dev
,
1673 snd_pcm_format_t format
= params_format(params
);
1674 unsigned int i2s_con
= 0;
1677 dev_dbg(afe
->dev
, "%s(), id %d, rate %d, format %d\n",
1678 __func__
, i2s_id
, rate
, format
);
1681 i2s_priv
->rate
= rate
;
1683 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
1686 case MT8192_DAI_I2S_0
:
1687 i2s_con
= I2S_IN_PAD_IO_MUX
<< I2SIN_PAD_SEL_SFT
;
1688 i2s_con
|= rate_reg
<< I2S_OUT_MODE_SFT
;
1689 i2s_con
|= I2S_FMT_I2S
<< I2S_FMT_SFT
;
1690 i2s_con
|= get_i2s_wlen(format
) << I2S_WLEN_SFT
;
1691 regmap_update_bits(afe
->regmap
, AFE_I2S_CON
,
1692 0xffffeffe, i2s_con
);
1694 case MT8192_DAI_I2S_1
:
1695 i2s_con
= I2S1_SEL_O28_O29
<< I2S2_SEL_O03_O04_SFT
;
1696 i2s_con
|= rate_reg
<< I2S2_OUT_MODE_SFT
;
1697 i2s_con
|= I2S_FMT_I2S
<< I2S2_FMT_SFT
;
1698 i2s_con
|= get_i2s_wlen(format
) << I2S2_WLEN_SFT
;
1699 regmap_update_bits(afe
->regmap
, AFE_I2S_CON1
,
1700 0xffffeffe, i2s_con
);
1702 case MT8192_DAI_I2S_2
:
1703 i2s_con
= 8 << I2S3_UPDATE_WORD_SFT
;
1704 i2s_con
|= rate_reg
<< I2S3_OUT_MODE_SFT
;
1705 i2s_con
|= I2S_FMT_I2S
<< I2S3_FMT_SFT
;
1706 i2s_con
|= get_i2s_wlen(format
) << I2S3_WLEN_SFT
;
1707 regmap_update_bits(afe
->regmap
, AFE_I2S_CON2
,
1708 0xffffeffe, i2s_con
);
1710 case MT8192_DAI_I2S_3
:
1711 i2s_con
= rate_reg
<< I2S4_OUT_MODE_SFT
;
1712 i2s_con
|= I2S_FMT_I2S
<< I2S4_FMT_SFT
;
1713 i2s_con
|= get_i2s_wlen(format
) << I2S4_WLEN_SFT
;
1714 regmap_update_bits(afe
->regmap
, AFE_I2S_CON3
,
1715 0xffffeffe, i2s_con
);
1717 case MT8192_DAI_I2S_5
:
1718 i2s_con
= rate_reg
<< I2S5_OUT_MODE_SFT
;
1719 i2s_con
|= I2S_FMT_I2S
<< I2S5_FMT_SFT
;
1720 i2s_con
|= get_i2s_wlen(format
) << I2S5_WLEN_SFT
;
1721 regmap_update_bits(afe
->regmap
, AFE_I2S_CON4
,
1722 0xffffeffe, i2s_con
);
1724 case MT8192_DAI_I2S_6
:
1725 i2s_con
= rate_reg
<< I2S6_OUT_MODE_SFT
;
1726 i2s_con
|= I2S_FMT_I2S
<< I2S6_FMT_SFT
;
1727 i2s_con
|= get_i2s_wlen(format
) << I2S6_WLEN_SFT
;
1728 regmap_update_bits(afe
->regmap
, AFE_I2S_CON6
,
1729 0xffffeffe, i2s_con
);
1731 case MT8192_DAI_I2S_7
:
1732 i2s_con
= rate_reg
<< I2S7_OUT_MODE_SFT
;
1733 i2s_con
|= I2S_FMT_I2S
<< I2S7_FMT_SFT
;
1734 i2s_con
|= get_i2s_wlen(format
) << I2S7_WLEN_SFT
;
1735 regmap_update_bits(afe
->regmap
, AFE_I2S_CON7
,
1736 0xffffeffe, i2s_con
);
1738 case MT8192_DAI_I2S_8
:
1739 i2s_con
= rate_reg
<< I2S8_OUT_MODE_SFT
;
1740 i2s_con
|= I2S_FMT_I2S
<< I2S8_FMT_SFT
;
1741 i2s_con
|= get_i2s_wlen(format
) << I2S8_WLEN_SFT
;
1742 regmap_update_bits(afe
->regmap
, AFE_I2S_CON8
,
1743 0xffffeffe, i2s_con
);
1745 case MT8192_DAI_I2S_9
:
1746 i2s_con
= rate_reg
<< I2S9_OUT_MODE_SFT
;
1747 i2s_con
|= I2S_FMT_I2S
<< I2S9_FMT_SFT
;
1748 i2s_con
|= get_i2s_wlen(format
) << I2S9_WLEN_SFT
;
1749 regmap_update_bits(afe
->regmap
, AFE_I2S_CON9
,
1750 0xffffeffe, i2s_con
);
1753 dev_warn(afe
->dev
, "%s(), id %d not support\n",
1759 if (i2s_priv
&& i2s_priv
->share_i2s_id
>= 0)
1760 ret
= mtk_dai_i2s_config(afe
, params
, i2s_priv
->share_i2s_id
);
1765 static int mtk_dai_i2s_hw_params(struct snd_pcm_substream
*substream
,
1766 struct snd_pcm_hw_params
*params
,
1767 struct snd_soc_dai
*dai
)
1769 struct mtk_base_afe
*afe
= snd_soc_dai_get_drvdata(dai
);
1771 return mtk_dai_i2s_config(afe
, params
, dai
->id
);
1774 static int mtk_dai_i2s_set_sysclk(struct snd_soc_dai
*dai
,
1775 int clk_id
, unsigned int freq
, int dir
)
1777 struct mtk_base_afe
*afe
= dev_get_drvdata(dai
->dev
);
1778 struct mt8192_afe_private
*afe_priv
= afe
->platform_priv
;
1779 struct mtk_afe_i2s_priv
*i2s_priv
= afe_priv
->dai_priv
[dai
->id
];
1784 dev_warn(afe
->dev
, "%s(), i2s_priv == NULL", __func__
);
1788 if (dir
!= SND_SOC_CLOCK_OUT
) {
1789 dev_warn(afe
->dev
, "%s(), dir != SND_SOC_CLOCK_OUT", __func__
);
1793 dev_dbg(afe
->dev
, "%s(), freq %d\n", __func__
, freq
);
1795 apll
= mt8192_get_apll_by_rate(afe
, freq
);
1796 apll_rate
= mt8192_get_apll_rate(afe
, apll
);
1798 if (freq
> apll_rate
) {
1799 dev_warn(afe
->dev
, "%s(), freq > apll rate", __func__
);
1803 if (apll_rate
% freq
!= 0) {
1804 dev_warn(afe
->dev
, "%s(), APLL can't gen freq Hz", __func__
);
1808 i2s_priv
->mclk_rate
= freq
;
1809 i2s_priv
->mclk_apll
= apll
;
1811 if (i2s_priv
->share_i2s_id
> 0) {
1812 struct mtk_afe_i2s_priv
*share_i2s_priv
;
1814 share_i2s_priv
= afe_priv
->dai_priv
[i2s_priv
->share_i2s_id
];
1815 if (!share_i2s_priv
) {
1816 dev_warn(afe
->dev
, "%s(), share_i2s_priv = NULL",
1821 share_i2s_priv
->mclk_rate
= i2s_priv
->mclk_rate
;
1822 share_i2s_priv
->mclk_apll
= i2s_priv
->mclk_apll
;
1828 static const struct snd_soc_dai_ops mtk_dai_i2s_ops
= {
1829 .hw_params
= mtk_dai_i2s_hw_params
,
1830 .set_sysclk
= mtk_dai_i2s_set_sysclk
,
1834 #define MTK_CONNSYS_I2S_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
1836 #define MTK_I2S_RATES (SNDRV_PCM_RATE_8000_48000 |\
1837 SNDRV_PCM_RATE_88200 |\
1838 SNDRV_PCM_RATE_96000 |\
1839 SNDRV_PCM_RATE_176400 |\
1840 SNDRV_PCM_RATE_192000)
1842 #define MTK_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
1843 SNDRV_PCM_FMTBIT_S24_LE |\
1844 SNDRV_PCM_FMTBIT_S32_LE)
1846 static struct snd_soc_dai_driver mtk_dai_i2s_driver
[] = {
1848 .name
= "CONNSYS_I2S",
1849 .id
= MT8192_DAI_CONNSYS_I2S
,
1851 .stream_name
= "Connsys I2S",
1854 .rates
= MTK_CONNSYS_I2S_RATES
,
1855 .formats
= MTK_I2S_FORMATS
,
1857 .ops
= &mtk_dai_connsys_i2s_ops
,
1861 .id
= MT8192_DAI_I2S_0
,
1863 .stream_name
= "I2S0",
1866 .rates
= MTK_I2S_RATES
,
1867 .formats
= MTK_I2S_FORMATS
,
1869 .ops
= &mtk_dai_i2s_ops
,
1873 .id
= MT8192_DAI_I2S_1
,
1875 .stream_name
= "I2S1",
1878 .rates
= MTK_I2S_RATES
,
1879 .formats
= MTK_I2S_FORMATS
,
1881 .ops
= &mtk_dai_i2s_ops
,
1885 .id
= MT8192_DAI_I2S_2
,
1887 .stream_name
= "I2S2",
1890 .rates
= MTK_I2S_RATES
,
1891 .formats
= MTK_I2S_FORMATS
,
1893 .ops
= &mtk_dai_i2s_ops
,
1897 .id
= MT8192_DAI_I2S_3
,
1899 .stream_name
= "I2S3",
1902 .rates
= MTK_I2S_RATES
,
1903 .formats
= MTK_I2S_FORMATS
,
1905 .ops
= &mtk_dai_i2s_ops
,
1909 .id
= MT8192_DAI_I2S_5
,
1911 .stream_name
= "I2S5",
1914 .rates
= MTK_I2S_RATES
,
1915 .formats
= MTK_I2S_FORMATS
,
1917 .ops
= &mtk_dai_i2s_ops
,
1921 .id
= MT8192_DAI_I2S_6
,
1923 .stream_name
= "I2S6",
1926 .rates
= MTK_I2S_RATES
,
1927 .formats
= MTK_I2S_FORMATS
,
1929 .ops
= &mtk_dai_i2s_ops
,
1933 .id
= MT8192_DAI_I2S_7
,
1935 .stream_name
= "I2S7",
1938 .rates
= MTK_I2S_RATES
,
1939 .formats
= MTK_I2S_FORMATS
,
1941 .ops
= &mtk_dai_i2s_ops
,
1945 .id
= MT8192_DAI_I2S_8
,
1947 .stream_name
= "I2S8",
1950 .rates
= MTK_I2S_RATES
,
1951 .formats
= MTK_I2S_FORMATS
,
1953 .ops
= &mtk_dai_i2s_ops
,
1957 .id
= MT8192_DAI_I2S_9
,
1959 .stream_name
= "I2S9",
1962 .rates
= MTK_I2S_RATES
,
1963 .formats
= MTK_I2S_FORMATS
,
1965 .ops
= &mtk_dai_i2s_ops
,
1969 /* this enum is merely for mtk_afe_i2s_priv declare */
1983 static const struct mtk_afe_i2s_priv mt8192_i2s_priv
[DAI_I2S_NUM
] = {
1985 .id
= MT8192_DAI_I2S_0
,
1986 .mclk_id
= MT8192_I2S0_MCK
,
1987 .share_property_name
= "i2s0-share",
1991 .id
= MT8192_DAI_I2S_1
,
1992 .mclk_id
= MT8192_I2S1_MCK
,
1993 .share_property_name
= "i2s1-share",
1997 .id
= MT8192_DAI_I2S_2
,
1998 .mclk_id
= MT8192_I2S2_MCK
,
1999 .share_property_name
= "i2s2-share",
2003 .id
= MT8192_DAI_I2S_3
,
2004 .mclk_id
= MT8192_I2S3_MCK
,
2005 .share_property_name
= "i2s3-share",
2009 .id
= MT8192_DAI_I2S_5
,
2010 .mclk_id
= MT8192_I2S5_MCK
,
2011 .share_property_name
= "i2s5-share",
2015 .id
= MT8192_DAI_I2S_6
,
2016 .mclk_id
= MT8192_I2S6_MCK
,
2017 .share_property_name
= "i2s6-share",
2021 .id
= MT8192_DAI_I2S_7
,
2022 .mclk_id
= MT8192_I2S7_MCK
,
2023 .share_property_name
= "i2s7-share",
2027 .id
= MT8192_DAI_I2S_8
,
2028 .mclk_id
= MT8192_I2S8_MCK
,
2029 .share_property_name
= "i2s8-share",
2033 .id
= MT8192_DAI_I2S_9
,
2034 .mclk_id
= MT8192_I2S9_MCK
,
2035 .share_property_name
= "i2s9-share",
2040 static int mt8192_dai_i2s_get_share(struct mtk_base_afe
*afe
)
2042 struct mt8192_afe_private
*afe_priv
= afe
->platform_priv
;
2043 const struct device_node
*of_node
= afe
->dev
->of_node
;
2045 const char *property_name
;
2046 struct mtk_afe_i2s_priv
*i2s_priv
;
2049 for (i
= 0; i
< DAI_I2S_NUM
; i
++) {
2050 i2s_priv
= afe_priv
->dai_priv
[mt8192_i2s_priv
[i
].id
];
2051 property_name
= mt8192_i2s_priv
[i
].share_property_name
;
2052 if (of_property_read_string(of_node
, property_name
, &of_str
))
2054 i2s_priv
->share_i2s_id
= get_i2s_id_by_name(afe
, of_str
);
2060 static int mt8192_dai_i2s_set_priv(struct mtk_base_afe
*afe
)
2065 for (i
= 0; i
< DAI_I2S_NUM
; i
++) {
2066 ret
= mt8192_dai_set_priv(afe
, mt8192_i2s_priv
[i
].id
,
2067 sizeof(struct mtk_afe_i2s_priv
),
2068 &mt8192_i2s_priv
[i
]);
2076 int mt8192_dai_i2s_register(struct mtk_base_afe
*afe
)
2078 struct mtk_base_afe_dai
*dai
;
2081 dev_dbg(afe
->dev
, "%s()\n", __func__
);
2083 dai
= devm_kzalloc(afe
->dev
, sizeof(*dai
), GFP_KERNEL
);
2087 list_add(&dai
->list
, &afe
->sub_dais
);
2089 dai
->dai_drivers
= mtk_dai_i2s_driver
;
2090 dai
->num_dai_drivers
= ARRAY_SIZE(mtk_dai_i2s_driver
);
2092 dai
->controls
= mtk_dai_i2s_controls
;
2093 dai
->num_controls
= ARRAY_SIZE(mtk_dai_i2s_controls
);
2094 dai
->dapm_widgets
= mtk_dai_i2s_widgets
;
2095 dai
->num_dapm_widgets
= ARRAY_SIZE(mtk_dai_i2s_widgets
);
2096 dai
->dapm_routes
= mtk_dai_i2s_routes
;
2097 dai
->num_dapm_routes
= ARRAY_SIZE(mtk_dai_i2s_routes
);
2099 /* set all dai i2s private data */
2100 ret
= mt8192_dai_i2s_set_priv(afe
);
2104 /* parse share i2s */
2105 ret
= mt8192_dai_i2s_get_share(afe
);