Lines Matching full:afe

13 #include "mt8365-afe-clk.h"
14 #include "mt8365-afe-common.h"
21 static int mt8365_dai_set_adda_out(struct mtk_base_afe *afe, unsigned int rate) in mt8365_dai_set_adda_out() argument
31 mtk_adda_dl_rate_transform(afe, rate)); in mt8365_dai_set_adda_out()
37 regmap_update_bits(afe->regmap, AFE_ADDA_PREDIS_CON0, 0xffffffff, 0); in mt8365_dai_set_adda_out()
38 regmap_update_bits(afe->regmap, AFE_ADDA_PREDIS_CON1, 0xffffffff, 0); in mt8365_dai_set_adda_out()
39 regmap_update_bits(afe->regmap, AFE_ADDA_DL_SRC2_CON0, 0xffffffff, val); in mt8365_dai_set_adda_out()
41 regmap_update_bits(afe->regmap, AFE_ADDA_DL_SRC2_CON1, in mt8365_dai_set_adda_out()
44 regmap_update_bits(afe->regmap, AFE_ADDA_DL_SDM_DCCOMP_CON, in mt8365_dai_set_adda_out()
50 static int mt8365_dai_set_adda_in(struct mtk_base_afe *afe, unsigned int rate) in mt8365_dai_set_adda_in() argument
55 mtk_adda_ul_rate_transform(afe, rate)); in mt8365_dai_set_adda_in()
56 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, in mt8365_dai_set_adda_in()
59 regmap_update_bits(afe->regmap, AFE_ADDA_TOP_CON0, 0x1, 0x0); in mt8365_dai_set_adda_in()
64 int mt8365_dai_enable_adda_on(struct mtk_base_afe *afe) in mt8365_dai_enable_adda_on() argument
67 struct mt8365_afe_private *afe_priv = afe->platform_priv; in mt8365_dai_enable_adda_on()
73 regmap_update_bits(afe->regmap, AFE_ADDA_UL_DL_CON0, in mt8365_dai_enable_adda_on()
82 int mt8365_dai_disable_adda_on(struct mtk_base_afe *afe) in mt8365_dai_disable_adda_on() argument
85 struct mt8365_afe_private *afe_priv = afe->platform_priv; in mt8365_dai_disable_adda_on()
91 regmap_update_bits(afe->regmap, AFE_ADDA_UL_DL_CON0, in mt8365_dai_disable_adda_on()
96 dev_warn(afe->dev, "Abnormal adda_on ref count. Force it to 0\n"); in mt8365_dai_disable_adda_on()
104 static void mt8365_dai_set_adda_out_enable(struct mtk_base_afe *afe, in mt8365_dai_set_adda_out_enable() argument
107 regmap_update_bits(afe->regmap, AFE_ADDA_DL_SRC2_CON0, 0x1, enable); in mt8365_dai_set_adda_out_enable()
110 mt8365_dai_enable_adda_on(afe); in mt8365_dai_set_adda_out_enable()
112 mt8365_dai_disable_adda_on(afe); in mt8365_dai_set_adda_out_enable()
115 static void mt8365_dai_set_adda_in_enable(struct mtk_base_afe *afe, bool enable) in mt8365_dai_set_adda_in_enable() argument
118 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, 0x1, 0x1); in mt8365_dai_set_adda_in_enable()
119 mt8365_dai_enable_adda_on(afe); in mt8365_dai_set_adda_in_enable()
121 regmap_update_bits(afe->regmap, AFE_AUD_PAD_TOP, in mt8365_dai_set_adda_in_enable()
125 regmap_update_bits(afe->regmap, AFE_AUD_PAD_TOP, in mt8365_dai_set_adda_in_enable()
127 regmap_update_bits(afe->regmap, AFE_ADDA_UL_SRC_CON0, 0x1, 0x0); in mt8365_dai_set_adda_in_enable()
130 mt8365_dai_disable_adda_on(afe); in mt8365_dai_set_adda_in_enable()
137 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_int_adda_startup() local
140 mt8365_afe_enable_main_clk(afe); in mt8365_dai_int_adda_startup()
143 mt8365_afe_enable_top_cg(afe, MT8365_TOP_CG_DAC); in mt8365_dai_int_adda_startup()
144 mt8365_afe_enable_top_cg(afe, MT8365_TOP_CG_DAC_PREDIS); in mt8365_dai_int_adda_startup()
146 mt8365_afe_enable_top_cg(afe, MT8365_TOP_CG_ADC); in mt8365_dai_int_adda_startup()
155 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_int_adda_shutdown() local
156 struct mt8365_afe_private *afe_priv = afe->platform_priv; in mt8365_dai_int_adda_shutdown()
163 mt8365_dai_set_adda_out_enable(afe, false); in mt8365_dai_int_adda_shutdown()
164 mt8365_afe_set_i2s_out_enable(afe, false); in mt8365_dai_int_adda_shutdown()
166 mt8365_dai_set_adda_in_enable(afe, false); in mt8365_dai_int_adda_shutdown()
172 mt8365_afe_disable_top_cg(afe, MT8365_TOP_CG_DAC_PREDIS); in mt8365_dai_int_adda_shutdown()
173 mt8365_afe_disable_top_cg(afe, MT8365_TOP_CG_DAC); in mt8365_dai_int_adda_shutdown()
175 mt8365_afe_disable_top_cg(afe, MT8365_TOP_CG_ADC); in mt8365_dai_int_adda_shutdown()
178 mt8365_afe_disable_main_clk(afe); in mt8365_dai_int_adda_shutdown()
184 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_int_adda_prepare() local
185 struct mt8365_afe_private *afe_priv = afe->platform_priv; in mt8365_dai_int_adda_prepare()
192 dev_info(afe->dev, "%s '%s' rate = %u\n", __func__, in mt8365_dai_int_adda_prepare()
196 dev_info(afe->dev, "%s '%s' prepared already\n", in mt8365_dai_int_adda_prepare()
202 ret = mt8365_dai_set_adda_out(afe, rate); in mt8365_dai_int_adda_prepare()
206 ret = mt8365_afe_set_i2s_out(afe, rate, bit_width); in mt8365_dai_int_adda_prepare()
210 mt8365_dai_set_adda_out_enable(afe, true); in mt8365_dai_int_adda_prepare()
211 mt8365_afe_set_i2s_out_enable(afe, true); in mt8365_dai_int_adda_prepare()
213 ret = mt8365_dai_set_adda_in(afe, rate); in mt8365_dai_int_adda_prepare()
217 mt8365_dai_set_adda_in_enable(afe, true); in mt8365_dai_int_adda_prepare()
296 int mt8365_dai_adda_register(struct mtk_base_afe *afe) in mt8365_dai_adda_register() argument
300 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8365_dai_adda_register()
303 list_add(&dai->list, &afe->sub_dais); in mt8365_dai_adda_register()