Lines Matching +full:dmic +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0
10 #include "mt8183-afe-common.h"
11 #include "mt8183-interconnection.h"
12 #include "mt8183-reg.h"
77 dev_warn(afe->dev, "%s(), rate %d invalid, use 48kHz!!!\n", in adda_dl_rate_transform()
100 dev_warn(afe->dev, "%s(), rate %d invalid, use 48kHz!!!\n", in adda_ul_rate_transform()
146 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mtk_adda_ul_event()
148 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mtk_adda_ul_event()
150 dev_dbg(afe->dev, "%s(), name %s, event 0x%x\n", in mtk_adda_ul_event()
151 __func__, w->name, event); in mtk_adda_ul_event()
155 /* update setting to dmic */ in mtk_adda_ul_event()
156 if (afe_priv->mtkaif_dmic) { in mtk_adda_ul_event()
157 /* mtkaif_rxif_data_mode = 1, dmic */ in mtk_adda_ul_event()
158 regmap_update_bits(afe->regmap, AFE_ADDA_MTKAIF_RX_CFG0, in mtk_adda_ul_event()
161 /* dmic mode, 3.25M*/ in mtk_adda_ul_event()
162 regmap_update_bits(afe->regmap, AFE_ADDA_MTKAIF_RX_CFG0, in mtk_adda_ul_event()
164 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, in mtk_adda_ul_event()
166 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, in mtk_adda_ul_event()
169 /* turn on dmic, ch1, ch2 */ in mtk_adda_ul_event()
170 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, in mtk_adda_ul_event()
172 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, in mtk_adda_ul_event()
187 /* mtkaif dmic */
202 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mt8183_adda_dmic_get()
204 ucontrol->value.integer.value[0] = afe_priv->mtkaif_dmic; in mt8183_adda_dmic_get()
214 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mt8183_adda_dmic_set()
215 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in mt8183_adda_dmic_set()
217 if (ucontrol->value.enumerated.item[0] >= e->items) in mt8183_adda_dmic_set()
218 return -EINVAL; in mt8183_adda_dmic_set()
220 afe_priv->mtkaif_dmic = ucontrol->value.integer.value[0]; in mt8183_adda_dmic_set()
222 dev_info(afe->dev, "%s(), kcontrol name %s, mtkaif_dmic %d\n", in mt8183_adda_dmic_set()
223 __func__, kcontrol->id.name, afe_priv->mtkaif_dmic); in mt8183_adda_dmic_set()
303 struct mt8183_afe_private *afe_priv = afe->platform_priv; in set_mtkaif_rx()
307 switch (afe_priv->mtkaif_protocol) { in set_mtkaif_rx()
309 regmap_write(afe->regmap, AFE_AUD_PAD_TOP, 0x38); in set_mtkaif_rx()
310 regmap_write(afe->regmap, AFE_AUD_PAD_TOP, 0x39); in set_mtkaif_rx()
312 regmap_write(afe->regmap, AFE_ADDA_MTKAIF_CFG0, in set_mtkaif_rx()
315 if (afe_priv->mtkaif_phase_cycle[0] >= in set_mtkaif_rx()
316 afe_priv->mtkaif_phase_cycle[1]) { in set_mtkaif_rx()
318 delay_cycle = afe_priv->mtkaif_phase_cycle[0] - in set_mtkaif_rx()
319 afe_priv->mtkaif_phase_cycle[1]; in set_mtkaif_rx()
322 delay_cycle = afe_priv->mtkaif_phase_cycle[1] - in set_mtkaif_rx()
323 afe_priv->mtkaif_phase_cycle[0]; in set_mtkaif_rx()
326 regmap_update_bits(afe->regmap, in set_mtkaif_rx()
331 regmap_update_bits(afe->regmap, in set_mtkaif_rx()
337 regmap_write(afe->regmap, AFE_AUD_PAD_TOP, 0x31); in set_mtkaif_rx()
338 regmap_write(afe->regmap, AFE_ADDA_MTKAIF_CFG0, in set_mtkaif_rx()
342 regmap_write(afe->regmap, AFE_AUD_PAD_TOP, 0x31); in set_mtkaif_rx()
343 regmap_write(afe->regmap, AFE_ADDA_MTKAIF_CFG0, 0x0); in set_mtkaif_rx()
359 dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %d\n", in mtk_dai_adda_hw_params()
360 __func__, dai->id, substream->stream, rate); in mtk_dai_adda_hw_params()
362 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in mtk_dai_adda_hw_params()
367 regmap_write(afe->regmap, AFE_ADDA_PREDIS_CON0, 0); in mtk_dai_adda_hw_params()
368 regmap_write(afe->regmap, AFE_ADDA_PREDIS_CON1, 0); in mtk_dai_adda_hw_params()
373 /* set output mode */ in mtk_dai_adda_hw_params()
395 /* SA suggest apply -0.3db to audio/speech path */ in mtk_dai_adda_hw_params()
398 /* turn on down-link gain */ in mtk_dai_adda_hw_params()
401 regmap_write(afe->regmap, AFE_ADDA_DL_SRC2_CON0, dl_src2_con0); in mtk_dai_adda_hw_params()
402 regmap_write(afe->regmap, AFE_ADDA_DL_SRC2_CON1, dl_src2_con1); in mtk_dai_adda_hw_params()
405 regmap_update_bits(afe->regmap, in mtk_dai_adda_hw_params()
417 regmap_update_bits(afe->regmap, in mtk_dai_adda_hw_params()
431 regmap_write(afe->regmap, AFE_ADDA_IIR_COEF_02_01, 0x00000000); in mtk_dai_adda_hw_params()
432 regmap_write(afe->regmap, AFE_ADDA_IIR_COEF_04_03, 0x00003FB8); in mtk_dai_adda_hw_params()
433 regmap_write(afe->regmap, AFE_ADDA_IIR_COEF_06_05, 0x3FB80000); in mtk_dai_adda_hw_params()
434 regmap_write(afe->regmap, AFE_ADDA_IIR_COEF_08_07, 0x3FB80000); in mtk_dai_adda_hw_params()
435 regmap_write(afe->regmap, AFE_ADDA_IIR_COEF_10_09, 0x0000C048); in mtk_dai_adda_hw_params()
437 regmap_write(afe->regmap, AFE_ADDA_UL_SRC_CON0, ul_src_con0); in mtk_dai_adda_hw_params()
440 regmap_update_bits(afe->regmap, in mtk_dai_adda_hw_params()
493 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8183_dai_adda_register()
495 return -ENOMEM; in mt8183_dai_adda_register()
497 list_add(&dai->list, &afe->sub_dais); in mt8183_dai_adda_register()
499 dai->dai_drivers = mtk_dai_adda_driver; in mt8183_dai_adda_register()
500 dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_adda_driver); in mt8183_dai_adda_register()
502 dai->controls = mtk_adda_controls; in mt8183_dai_adda_register()
503 dai->num_controls = ARRAY_SIZE(mtk_adda_controls); in mt8183_dai_adda_register()
504 dai->dapm_widgets = mtk_dai_adda_widgets; in mt8183_dai_adda_register()
505 dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_adda_widgets); in mt8183_dai_adda_register()
506 dai->dapm_routes = mtk_dai_adda_routes; in mt8183_dai_adda_register()
507 dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_adda_routes); in mt8183_dai_adda_register()