Lines Matching full:afe
12 #include "mt8195-afe-clk.h"
13 #include "mt8195-afe-common.h"
66 static unsigned int afe_adda_dl_rate_transform(struct mtk_base_afe *afe, in afe_adda_dl_rate_transform() argument
93 dev_info(afe->dev, "%s(), rate %d invalid, use 48kHz!!!\n", in afe_adda_dl_rate_transform()
99 static unsigned int afe_adda_ul_rate_transform(struct mtk_base_afe *afe, in afe_adda_ul_rate_transform() argument
116 dev_info(afe->dev, "%s(), rate %d invalid, use 48kHz!!!\n", in afe_adda_ul_rate_transform()
122 static int mt8195_adda_mtkaif_init(struct mtk_base_afe *afe) in mt8195_adda_mtkaif_init() argument
124 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mt8195_adda_mtkaif_init()
135 regmap_update_bits(afe->regmap, AFE_ADDA_MTKAIF_CFG0, mask, val); in mt8195_adda_mtkaif_init()
136 regmap_update_bits(afe->regmap, AFE_ADDA6_MTKAIF_CFG0, mask, val); in mt8195_adda_mtkaif_init()
140 regmap_update_bits(afe->regmap, AFE_AUD_PAD_TOP, mask, val); in mt8195_adda_mtkaif_init()
143 dev_info(afe->dev, "%s(), calibration fail\n", __func__); in mt8195_adda_mtkaif_init()
166 regmap_update_bits(afe->regmap, AFE_ADDA_MTKAIF_RX_CFG2, mask, val); in mt8195_adda_mtkaif_init()
187 regmap_update_bits(afe->regmap, AFE_ADDA6_MTKAIF_RX_CFG2, mask, val); in mt8195_adda_mtkaif_init()
197 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_adda_mtkaif_cfg_event() local
199 dev_dbg(afe->dev, "%s(), name %s, event 0x%x\n", in mtk_adda_mtkaif_cfg_event()
204 mt8195_adda_mtkaif_init(afe); in mtk_adda_mtkaif_cfg_event()
218 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_adda_dl_event() local
220 dev_dbg(afe->dev, "%s(), name %s, event 0x%x\n", in mtk_adda_dl_event()
225 /* should delayed 1/fs(smallest is 8k) = 125us before afe off */ in mtk_adda_dl_event()
235 static void mtk_adda_ul_mictype(struct mtk_base_afe *afe, int adda, bool dmic) in mtk_adda_ul_mictype() argument
249 dev_info(afe->dev, "%s(), wrong parameter\n", __func__); in mtk_adda_ul_mictype()
260 regmap_update_bits(afe->regmap, reg, mask, val); in mtk_adda_ul_mictype()
268 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_adda_ul_event() local
269 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mtk_adda_ul_event()
272 dev_dbg(afe->dev, "%s(), name %s, event 0x%x\n", in mtk_adda_ul_event()
277 mtk_adda_ul_mictype(afe, MTK_AFE_ADDA, param->mtkaif_dmic_on); in mtk_adda_ul_event()
280 /* should delayed 1/fs(smallest is 8k) = 125us before afe off */ in mtk_adda_ul_event()
295 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_adda6_ul_event() local
296 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mtk_adda6_ul_event()
300 dev_dbg(afe->dev, "%s(), name %s, event 0x%x\n", in mtk_adda6_ul_event()
305 mtk_adda_ul_mictype(afe, MTK_AFE_ADDA6, param->mtkaif_dmic_on); in mtk_adda6_ul_event()
310 regmap_update_bits(afe->regmap, in mtk_adda6_ul_event()
316 /* should delayed 1/fs(smallest is 8k) = 125us before afe off */ in mtk_adda6_ul_event()
331 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_audio_hires_event() local
332 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mtk_audio_hires_event()
336 dev_dbg(afe->dev, "%s(), name %s, event 0x%x\n", in mtk_audio_hires_event()
349 mt8195_afe_set_clk_parent(afe, clk, clk_parent); in mtk_audio_hires_event()
354 static struct mtk_dai_adda_priv *get_adda_priv_by_name(struct mtk_base_afe *afe, in get_adda_priv_by_name() argument
357 struct mt8195_afe_private *afe_priv = afe->platform_priv; in get_adda_priv_by_name()
377 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_adda_hires_connect() local
380 adda_priv = get_adda_priv_by_name(afe, w->name); in mtk_afe_adda_hires_connect()
383 dev_info(afe->dev, "adda_priv == NULL"); in mtk_afe_adda_hires_connect()
543 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); in mt8195_adda_dl_gain_put() local
548 regmap_update_bits(afe->regmap, reg, mask, DL_2_GAIN_CTL_PRE(value)); in mt8195_adda_dl_gain_put()
556 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); in mt8195_adda_dl_gain_get() local
561 regmap_read(afe->regmap, reg, &value); in mt8195_adda_dl_gain_get()
572 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8195_adda6_only_get() local
573 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mt8195_adda6_only_get()
584 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8195_adda6_only_set() local
585 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mt8195_adda6_only_set()
591 dev_info(afe->dev, "%s(), kcontrol name %s, mtkaif_adda6_only %d\n", in mt8195_adda6_only_set()
603 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8195_adda_dmic_get() local
604 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mt8195_adda_dmic_get()
615 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8195_adda_dmic_set() local
616 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mt8195_adda_dmic_set()
622 dev_dbg(afe->dev, "%s(), kcontrol name %s, dmic_on %d\n", in mt8195_adda_dmic_set()
639 static int mtk_dai_da_configure(struct mtk_base_afe *afe, in mtk_dai_da_configure() argument
647 val |= DL_2_INPUT_MODE_CTL(afe_adda_dl_rate_transform(afe, rate)); in mtk_dai_da_configure()
664 regmap_update_bits(afe->regmap, AFE_ADDA_DL_SRC2_CON0, mask, val); in mtk_dai_da_configure()
672 regmap_update_bits(afe->regmap, AFE_ADDA_DL_SDM_DCCOMP_CON, mask, val); in mtk_dai_da_configure()
677 static int mtk_dai_ad_configure(struct mtk_base_afe *afe, in mtk_dai_ad_configure() argument
684 val |= UL_VOICE_MODE_CTL(afe_adda_ul_rate_transform(afe, rate)); in mtk_dai_ad_configure()
688 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, in mtk_dai_ad_configure()
692 regmap_update_bits(afe->regmap, AFE_ADDA6_UL_SRC_CON0, in mtk_dai_ad_configure()
705 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mtk_dai_adda_hw_params() local
706 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mtk_dai_adda_hw_params()
712 dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %d\n", in mtk_dai_adda_hw_params()
721 ret = mtk_dai_da_configure(afe, rate, id); in mtk_dai_adda_hw_params()
723 ret = mtk_dai_ad_configure(afe, rate, id); in mtk_dai_adda_hw_params()
787 static int init_adda_priv_data(struct mtk_base_afe *afe) in init_adda_priv_data() argument
789 struct mt8195_afe_private *afe_priv = afe->platform_priv; in init_adda_priv_data()
799 adda_priv = devm_kzalloc(afe->dev, in init_adda_priv_data()
811 int mt8195_dai_adda_register(struct mtk_base_afe *afe) in mt8195_dai_adda_register() argument
815 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8195_dai_adda_register()
819 list_add(&dai->list, &afe->sub_dais); in mt8195_dai_adda_register()
831 return init_adda_priv_data(afe); in mt8195_dai_adda_register()