Lines Matching refs:afe

76 static int get_i2s_id_by_name(struct mtk_base_afe *afe,  in get_i2s_id_by_name()  argument
91 static struct mtk_afe_i2s_priv *get_i2s_priv_by_name(struct mtk_base_afe *afe, in get_i2s_priv_by_name() argument
94 struct mt8186_afe_private *afe_priv = afe->platform_priv; in get_i2s_priv_by_name()
95 int dai_id = get_i2s_id_by_name(afe, name); in get_i2s_priv_by_name()
117 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8186_i2s_hd_get() local
120 i2s_priv = get_i2s_priv_by_name(afe, kcontrol->id.name); in mt8186_i2s_hd_get()
130 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8186_i2s_hd_set() local
140 dev_dbg(afe->dev, "%s(), kcontrol name %s, hd_en %d\n", in mt8186_i2s_hd_set()
143 i2s_priv = get_i2s_priv_by_name(afe, kcontrol->id.name); in mt8186_i2s_hd_set()
362 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_i2s_en_event() local
365 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_i2s_en_event()
372 mt8186_afe_gpio_request(afe->dev, true, i2s_priv->id, 0); in mtk_i2s_en_event()
375 mt8186_afe_gpio_request(afe->dev, false, i2s_priv->id, 0); in mtk_i2s_en_event()
389 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_apll_event() local
397 mt8186_apll1_enable(afe); in mtk_apll_event()
399 mt8186_apll2_enable(afe); in mtk_apll_event()
403 mt8186_apll1_disable(afe); in mtk_apll_event()
405 mt8186_apll2_disable(afe); in mtk_apll_event()
419 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_mclk_en_event() local
425 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_mclk_en_event()
429 mt8186_mck_enable(afe, i2s_priv->mclk_id, i2s_priv->mclk_rate); in mtk_mclk_en_event()
433 mt8186_mck_disable(afe, i2s_priv->mclk_id); in mtk_mclk_en_event()
542 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_share_connect() local
545 i2s_priv = get_i2s_priv_by_name(afe, sink->name); in mtk_afe_i2s_share_connect()
549 return i2s_priv->share_i2s_id == get_i2s_id_by_name(afe, source->name); in mtk_afe_i2s_share_connect()
557 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_hd_connect() local
560 i2s_priv = get_i2s_priv_by_name(afe, sink->name); in mtk_afe_i2s_hd_connect()
561 if (get_i2s_id_by_name(afe, sink->name) == in mtk_afe_i2s_hd_connect()
562 get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_hd_connect()
569 if (i2s_priv->share_i2s_id == get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_hd_connect()
580 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_apll_connect() local
585 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_afe_i2s_apll_connect()
587 cur_apll = mt8186_get_apll_by_name(afe, source->name); in mtk_afe_i2s_apll_connect()
589 i2s_need_apll = mt8186_get_apll_by_rate(afe, i2s_priv->rate); in mtk_afe_i2s_apll_connect()
599 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_mclk_connect() local
602 i2s_priv = get_i2s_priv_by_name(afe, sink->name); in mtk_afe_i2s_mclk_connect()
603 if (get_i2s_id_by_name(afe, sink->name) == in mtk_afe_i2s_mclk_connect()
604 get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_mclk_connect()
611 if (i2s_priv->share_i2s_id == get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_mclk_connect()
622 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_mclk_apll_connect() local
626 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_afe_mclk_apll_connect()
628 cur_apll = mt8186_get_apll_by_name(afe, source->name); in mtk_afe_mclk_apll_connect()
813 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mtk_dai_connsys_i2s_hw_params() local
815 unsigned int rate_reg = mt8186_rate_transform(afe->dev, in mtk_dai_connsys_i2s_hw_params()
819 dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %d\n", in mtk_dai_connsys_i2s_hw_params()
828 regmap_write(afe->regmap, AFE_CONNSYS_I2S_CON, i2s_con); in mtk_dai_connsys_i2s_hw_params()
831 regmap_update_bits(afe->regmap, AFE_CONNSYS_I2S_CON, in mtk_dai_connsys_i2s_hw_params()
835 regmap_update_bits(afe->regmap, AFE_CONNSYS_I2S_CON, in mtk_dai_connsys_i2s_hw_params()
839 regmap_write(afe->regmap, AFE_ASRC_2CH_CON3, 0x1b9000); in mtk_dai_connsys_i2s_hw_params()
841 regmap_write(afe->regmap, AFE_ASRC_2CH_CON3, 0x140000); in mtk_dai_connsys_i2s_hw_params()
843 regmap_write(afe->regmap, AFE_ASRC_2CH_CON3, 0x1e0000); in mtk_dai_connsys_i2s_hw_params()
846 regmap_write(afe->regmap, AFE_ASRC_2CH_CON4, 0x140000); in mtk_dai_connsys_i2s_hw_params()
847 regmap_write(afe->regmap, AFE_ASRC_2CH_CON9, 0x36000); in mtk_dai_connsys_i2s_hw_params()
848 regmap_write(afe->regmap, AFE_ASRC_2CH_CON10, 0x2fc00); in mtk_dai_connsys_i2s_hw_params()
849 regmap_write(afe->regmap, AFE_ASRC_2CH_CON6, 0x7ef4); in mtk_dai_connsys_i2s_hw_params()
850 regmap_write(afe->regmap, AFE_ASRC_2CH_CON5, 0xff5986); in mtk_dai_connsys_i2s_hw_params()
853 regmap_update_bits(afe->regmap, AFE_ASRC_2CH_CON2, in mtk_dai_connsys_i2s_hw_params()
862 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mtk_dai_connsys_i2s_trigger() local
863 struct mt8186_afe_private *afe_priv = afe->platform_priv; in mtk_dai_connsys_i2s_trigger()
865 dev_dbg(afe->dev, "%s(), cmd %d, stream %d\n", in mtk_dai_connsys_i2s_trigger()
872 regmap_update_bits(afe->regmap, in mtk_dai_connsys_i2s_trigger()
878 regmap_update_bits(afe->regmap, in mtk_dai_connsys_i2s_trigger()
884 regmap_update_bits(afe->regmap, in mtk_dai_connsys_i2s_trigger()
888 regmap_update_bits(afe->regmap, in mtk_dai_connsys_i2s_trigger()
897 regmap_update_bits(afe->regmap, AFE_ASRC_2CH_CON0, in mtk_dai_connsys_i2s_trigger()
899 regmap_update_bits(afe->regmap, AFE_ASRC_2CH_CON5, in mtk_dai_connsys_i2s_trigger()
903 regmap_update_bits(afe->regmap, AFE_CONNSYS_I2S_CON, in mtk_dai_connsys_i2s_trigger()
907 regmap_update_bits(afe->regmap, AFE_CONNSYS_I2S_CON, in mtk_dai_connsys_i2s_trigger()
924 static int mtk_dai_i2s_config(struct mtk_base_afe *afe, in mtk_dai_i2s_config() argument
928 struct mt8186_afe_private *afe_priv = afe->platform_priv; in mtk_dai_i2s_config()
932 unsigned int rate_reg = mt8186_rate_transform(afe->dev, in mtk_dai_i2s_config()
938 dev_dbg(afe->dev, "%s(), id %d, rate %d, format %d\n", in mtk_dai_i2s_config()
949 regmap_update_bits(afe->regmap, AFE_I2S_CON, in mtk_dai_i2s_config()
957 regmap_update_bits(afe->regmap, AFE_I2S_CON1, in mtk_dai_i2s_config()
965 regmap_update_bits(afe->regmap, AFE_I2S_CON2, in mtk_dai_i2s_config()
972 regmap_update_bits(afe->regmap, AFE_I2S_CON3, in mtk_dai_i2s_config()
976 dev_err(afe->dev, "%s(), id %d not support\n", in mtk_dai_i2s_config()
983 ret = mtk_dai_i2s_config(afe, params, i2s_priv->share_i2s_id); in mtk_dai_i2s_config()
995 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mtk_dai_i2s_hw_params() local
997 return mtk_dai_i2s_config(afe, params, dai->id); in mtk_dai_i2s_hw_params()
1003 struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); in mtk_dai_i2s_set_sysclk() local
1004 struct mt8186_afe_private *afe_priv = afe->platform_priv; in mtk_dai_i2s_set_sysclk()
1010 dev_err(afe->dev, "%s(), dir != SND_SOC_CLOCK_OUT", __func__); in mtk_dai_i2s_set_sysclk()
1014 dev_dbg(afe->dev, "%s(), freq %d\n", __func__, freq); in mtk_dai_i2s_set_sysclk()
1016 apll = mt8186_get_apll_by_rate(afe, freq); in mtk_dai_i2s_set_sysclk()
1017 apll_rate = mt8186_get_apll_rate(afe, apll); in mtk_dai_i2s_set_sysclk()
1020 dev_err(afe->dev, "%s(), freq > apll rate", __func__); in mtk_dai_i2s_set_sysclk()
1025 dev_err(afe->dev, "%s(), APLL cannot generate freq Hz", __func__); in mtk_dai_i2s_set_sysclk()
1037 dev_err(afe->dev, "%s(), share_i2s_priv == NULL", __func__); in mtk_dai_i2s_set_sysclk()
1168 int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name, in mt8186_dai_i2s_set_share() argument
1174 secondary_i2s_priv = get_i2s_priv_by_name(afe, secondary_i2s_name); in mt8186_dai_i2s_set_share()
1178 main_i2s_id = get_i2s_id_by_name(afe, main_i2s_name); in mt8186_dai_i2s_set_share()
1188 static int mt8186_dai_i2s_set_priv(struct mtk_base_afe *afe) in mt8186_dai_i2s_set_priv() argument
1194 ret = mt8186_dai_set_priv(afe, mt8186_i2s_priv[i].id, in mt8186_dai_i2s_set_priv()
1204 int mt8186_dai_i2s_register(struct mtk_base_afe *afe) in mt8186_dai_i2s_register() argument
1209 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8186_dai_i2s_register()
1213 list_add(&dai->list, &afe->sub_dais); in mt8186_dai_i2s_register()
1226 ret = mt8186_dai_i2s_set_priv(afe); in mt8186_dai_i2s_register()