Lines Matching full:afe

11 #include "mt8183-afe-clk.h"
12 #include "mt8183-afe-common.h"
79 static int get_i2s_id_by_name(struct mtk_base_afe *afe, in get_i2s_id_by_name() argument
96 static struct mtk_afe_i2s_priv *get_i2s_priv_by_name(struct mtk_base_afe *afe, in get_i2s_priv_by_name() argument
99 struct mt8183_afe_private *afe_priv = afe->platform_priv; in get_i2s_priv_by_name()
100 int dai_id = get_i2s_id_by_name(afe, name); in get_i2s_priv_by_name()
122 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8183_i2s_hd_get() local
125 i2s_priv = get_i2s_priv_by_name(afe, kcontrol->id.name); in mt8183_i2s_hd_get()
128 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mt8183_i2s_hd_get()
141 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mt8183_i2s_hd_set() local
151 dev_info(afe->dev, "%s(), kcontrol name %s, hd_en %d\n", in mt8183_i2s_hd_set()
154 i2s_priv = get_i2s_priv_by_name(afe, kcontrol->id.name); in mt8183_i2s_hd_set()
157 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mt8183_i2s_hd_set()
277 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_apll_event() local
285 mt8183_apll1_enable(afe); in mtk_apll_event()
287 mt8183_apll2_enable(afe); in mtk_apll_event()
291 mt8183_apll1_disable(afe); in mtk_apll_event()
293 mt8183_apll2_disable(afe); in mtk_apll_event()
307 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_mclk_en_event() local
313 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_mclk_en_event()
316 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_mclk_en_event()
322 mt8183_mck_enable(afe, i2s_priv->mclk_id, i2s_priv->mclk_rate); in mtk_mclk_en_event()
326 mt8183_mck_disable(afe, i2s_priv->mclk_id); in mtk_mclk_en_event()
428 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_share_connect() local
431 i2s_priv = get_i2s_priv_by_name(afe, sink->name); in mtk_afe_i2s_share_connect()
434 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_afe_i2s_share_connect()
441 return i2s_priv->share_i2s_id == get_i2s_id_by_name(afe, source->name); in mtk_afe_i2s_share_connect()
449 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_hd_connect() local
452 i2s_priv = get_i2s_priv_by_name(afe, sink->name); in mtk_afe_i2s_hd_connect()
455 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_afe_i2s_hd_connect()
459 if (get_i2s_id_by_name(afe, sink->name) == in mtk_afe_i2s_hd_connect()
460 get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_hd_connect()
467 if (i2s_priv->share_i2s_id == get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_hd_connect()
478 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_apll_connect() local
483 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_afe_i2s_apll_connect()
486 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_afe_i2s_apll_connect()
491 cur_apll = mt8183_get_apll_by_name(afe, source->name); in mtk_afe_i2s_apll_connect()
494 i2s_need_apll = mt8183_get_apll_by_rate(afe, i2s_priv->rate); in mtk_afe_i2s_apll_connect()
504 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_i2s_mclk_connect() local
507 i2s_priv = get_i2s_priv_by_name(afe, sink->name); in mtk_afe_i2s_mclk_connect()
510 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_afe_i2s_mclk_connect()
514 if (get_i2s_id_by_name(afe, sink->name) == in mtk_afe_i2s_mclk_connect()
515 get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_mclk_connect()
522 if (i2s_priv->share_i2s_id == get_i2s_id_by_name(afe, source->name)) in mtk_afe_i2s_mclk_connect()
533 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt); in mtk_afe_mclk_apll_connect() local
537 i2s_priv = get_i2s_priv_by_name(afe, w->name); in mtk_afe_mclk_apll_connect()
540 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_afe_mclk_apll_connect()
545 cur_apll = mt8183_get_apll_by_name(afe, source->name); in mtk_afe_mclk_apll_connect()
704 static int mtk_dai_i2s_config(struct mtk_base_afe *afe, in mtk_dai_i2s_config() argument
708 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mtk_dai_i2s_config()
712 unsigned int rate_reg = mt8183_rate_transform(afe->dev, in mtk_dai_i2s_config()
718 dev_info(afe->dev, "%s(), id %d, rate %d, format %d\n", in mtk_dai_i2s_config()
729 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_dai_i2s_config()
734 regmap_update_bits(afe->regmap, AFE_DAC_CON1, in mtk_dai_i2s_config()
739 regmap_update_bits(afe->regmap, AFE_I2S_CON, in mtk_dai_i2s_config()
747 regmap_update_bits(afe->regmap, AFE_I2S_CON1, in mtk_dai_i2s_config()
755 regmap_update_bits(afe->regmap, AFE_I2S_CON2, in mtk_dai_i2s_config()
762 regmap_update_bits(afe->regmap, AFE_I2S_CON3, in mtk_dai_i2s_config()
769 regmap_update_bits(afe->regmap, AFE_I2S_CON4, in mtk_dai_i2s_config()
773 dev_warn(afe->dev, "%s(), id %d not support\n", in mtk_dai_i2s_config()
780 ret = mtk_dai_i2s_config(afe, params, i2s_priv->share_i2s_id); in mtk_dai_i2s_config()
789 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mtk_dai_i2s_hw_params() local
791 return mtk_dai_i2s_config(afe, params, dai->id); in mtk_dai_i2s_hw_params()
797 struct mtk_base_afe *afe = dev_get_drvdata(dai->dev); in mtk_dai_i2s_set_sysclk() local
798 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mtk_dai_i2s_set_sysclk()
804 dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); in mtk_dai_i2s_set_sysclk()
809 dev_warn(afe->dev, "%s(), dir != SND_SOC_CLOCK_OUT", __func__); in mtk_dai_i2s_set_sysclk()
813 dev_info(afe->dev, "%s(), freq %d\n", __func__, freq); in mtk_dai_i2s_set_sysclk()
815 apll = mt8183_get_apll_by_rate(afe, freq); in mtk_dai_i2s_set_sysclk()
816 apll_rate = mt8183_get_apll_rate(afe, apll); in mtk_dai_i2s_set_sysclk()
819 dev_warn(afe->dev, "%s(), freq > apll rate", __func__); in mtk_dai_i2s_set_sysclk()
824 dev_warn(afe->dev, "%s(), APLL cannot generate freq Hz", in mtk_dai_i2s_set_sysclk()
837 dev_warn(afe->dev, "%s(), share_i2s_priv == NULL", in mtk_dai_i2s_set_sysclk()
851 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mtk_dai_i2s_set_fmt() local
852 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mtk_dai_i2s_set_fmt()
863 dev_warn(afe->dev, "%s(), id %d not support\n", in mtk_dai_i2s_set_fmt()
877 dev_warn(afe->dev, "%s(), DAI format %d not support\n", in mtk_dai_i2s_set_fmt()
1005 * @afe: Pointer to &struct mtk_base_afe
1009 int mt8183_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name, in mt8183_dai_i2s_set_share() argument
1015 secondary_i2s_priv = get_i2s_priv_by_name(afe, secondary_i2s_name); in mt8183_dai_i2s_set_share()
1019 main_i2s_id = get_i2s_id_by_name(afe, main_i2s_name); in mt8183_dai_i2s_set_share()
1029 static int mt8183_dai_i2s_set_priv(struct mtk_base_afe *afe) in mt8183_dai_i2s_set_priv() argument
1031 struct mt8183_afe_private *afe_priv = afe->platform_priv; in mt8183_dai_i2s_set_priv()
1036 i2s_priv = devm_kzalloc(afe->dev, in mt8183_dai_i2s_set_priv()
1051 int mt8183_dai_i2s_register(struct mtk_base_afe *afe) in mt8183_dai_i2s_register() argument
1056 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8183_dai_i2s_register()
1060 list_add(&dai->list, &afe->sub_dais); in mt8183_dai_i2s_register()
1073 ret = mt8183_dai_i2s_set_priv(afe); in mt8183_dai_i2s_register()