Lines Matching refs:afe

84 static int mt2701_dai_num_to_i2s(struct mtk_base_afe *afe, int num)  in mt2701_dai_num_to_i2s()  argument
86 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_dai_num_to_i2s()
90 dev_err(afe->dev, "%s, num not available, num %d, val %d\n", in mt2701_dai_num_to_i2s()
111 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_afe_i2s_startup() local
112 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_afe_i2s_startup()
113 int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); in mt2701_afe_i2s_startup()
119 return mt2701_afe_enable_mclk(afe, mode ? 1 : i2s_num); in mt2701_afe_i2s_startup()
122 static int mt2701_afe_i2s_path_disable(struct mtk_base_afe *afe, in mt2701_afe_i2s_path_disable() argument
135 regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, in mt2701_afe_i2s_path_disable()
138 mt2701_afe_disable_i2s(afe, i2s_path, stream_dir); in mt2701_afe_i2s_path_disable()
146 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_afe_i2s_shutdown() local
147 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_afe_i2s_shutdown()
148 int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); in mt2701_afe_i2s_shutdown()
162 mt2701_afe_i2s_path_disable(afe, i2s_path, substream->stream); in mt2701_afe_i2s_shutdown()
166 mt2701_afe_i2s_path_disable(afe, i2s_path, !substream->stream); in mt2701_afe_i2s_shutdown()
170 mt2701_afe_disable_mclk(afe, mode ? 1 : i2s_num); in mt2701_afe_i2s_shutdown()
173 static int mt2701_i2s_path_enable(struct mtk_base_afe *afe, in mt2701_i2s_path_enable() argument
178 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_i2s_path_enable()
209 regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, mask, val); in mt2701_i2s_path_enable()
211 regmap_update_bits(afe->regmap, reg, in mt2701_i2s_path_enable()
217 mt2701_afe_enable_i2s(afe, i2s_path, stream_dir); in mt2701_i2s_path_enable()
220 regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, in mt2701_i2s_path_enable()
223 regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, in mt2701_i2s_path_enable()
226 regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, in mt2701_i2s_path_enable()
234 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_afe_i2s_prepare() local
235 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_afe_i2s_prepare()
236 int ret, i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); in mt2701_afe_i2s_prepare()
248 ret = mt2701_mclk_configuration(afe, mode ? 1 : i2s_num); in mt2701_afe_i2s_prepare()
256 mt2701_i2s_path_enable(afe, i2s_path, !substream->stream, in mt2701_afe_i2s_prepare()
259 mt2701_i2s_path_enable(afe, i2s_path, substream->stream, in mt2701_afe_i2s_prepare()
268 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_afe_i2s_set_sysclk() local
269 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_afe_i2s_set_sysclk()
270 int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); in mt2701_afe_i2s_set_sysclk()
290 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_btmrg_startup() local
291 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_btmrg_startup()
294 ret = mt2701_enable_btmrg_clk(afe); in mt2701_btmrg_startup()
307 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_btmrg_hw_params() local
314 dev_err(afe->dev, "unsupported rate %d\n", stream_fs); in mt2701_btmrg_hw_params()
318 regmap_update_bits(afe->regmap, AFE_MRGIF_CON, in mt2701_btmrg_hw_params()
331 regmap_update_bits(afe->regmap, AFE_DAIBT_CON0, msk, val); in mt2701_btmrg_hw_params()
333 regmap_update_bits(afe->regmap, AFE_DAIBT_CON0, in mt2701_btmrg_hw_params()
336 regmap_update_bits(afe->regmap, AFE_MRGIF_CON, in mt2701_btmrg_hw_params()
339 regmap_update_bits(afe->regmap, AFE_MRGIF_CON, in mt2701_btmrg_hw_params()
348 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_btmrg_shutdown() local
349 struct mt2701_afe_private *afe_priv = afe->platform_priv; in mt2701_btmrg_shutdown()
353 regmap_update_bits(afe->regmap, AFE_DAIBT_CON0, in mt2701_btmrg_shutdown()
355 regmap_update_bits(afe->regmap, AFE_MRGIF_CON, in mt2701_btmrg_shutdown()
357 regmap_update_bits(afe->regmap, AFE_MRGIF_CON, in mt2701_btmrg_shutdown()
359 mt2701_disable_btmrg_clk(afe); in mt2701_btmrg_shutdown()
368 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_simple_fe_startup() local
374 memif_tmp = &afe->memif[MT2701_MEMIF_DLM]; in mt2701_simple_fe_startup()
376 dev_warn(afe->dev, "memif is not available"); in mt2701_simple_fe_startup()
388 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_simple_fe_hw_params() local
393 regmap_update_bits(afe->regmap, in mt2701_simple_fe_hw_params()
404 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_dlm_fe_startup() local
410 memif_tmp = &afe->memif[i]; in mt2701_dlm_fe_startup()
417 memif_data = afe->memif[i].data; in mt2701_dlm_fe_startup()
418 regmap_update_bits(afe->regmap, in mt2701_dlm_fe_startup()
430 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_dlm_fe_shutdown() local
435 memif_data = afe->memif[i].data; in mt2701_dlm_fe_shutdown()
436 regmap_update_bits(afe->regmap, in mt2701_dlm_fe_shutdown()
449 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_dlm_fe_hw_params() local
452 regmap_update_bits(afe->regmap, in mt2701_dlm_fe_hw_params()
456 regmap_update_bits(afe->regmap, in mt2701_dlm_fe_hw_params()
460 regmap_update_bits(afe->regmap, in mt2701_dlm_fe_hw_params()
471 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt2701_dlm_fe_trigger() local
472 struct mtk_base_afe_memif *memif_tmp = &afe->memif[MT2701_MEMIF_DL1]; in mt2701_dlm_fe_trigger()
477 regmap_update_bits(afe->regmap, memif_tmp->data->enable_reg, in mt2701_dlm_fe_trigger()
485 regmap_update_bits(afe->regmap, memif_tmp->data->enable_reg, in mt2701_dlm_fe_trigger()
959 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); in mt2701_afe_pcm_probe() local
961 snd_soc_component_init_regmap(component, afe->regmap); in mt2701_afe_pcm_probe()
1279 struct mtk_base_afe *afe = dev; in mt2701_asys_isr() local
1284 regmap_read(afe->regmap, ASYS_IRQ_STATUS, &status); in mt2701_asys_isr()
1285 regmap_write(afe->regmap, ASYS_IRQ_CLR, status); in mt2701_asys_isr()
1288 memif = &afe->memif[id]; in mt2701_asys_isr()
1292 irq = &afe->irqs[memif->irq_usage]; in mt2701_asys_isr()
1302 struct mtk_base_afe *afe = dev_get_drvdata(dev); in mt2701_afe_runtime_suspend() local
1304 return mt2701_afe_disable_clock(afe); in mt2701_afe_runtime_suspend()
1309 struct mtk_base_afe *afe = dev_get_drvdata(dev); in mt2701_afe_runtime_resume() local
1311 return mt2701_afe_enable_clock(afe); in mt2701_afe_runtime_resume()
1316 struct mtk_base_afe *afe; in mt2701_afe_pcm_dev_probe() local
1321 afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); in mt2701_afe_pcm_dev_probe()
1322 if (!afe) in mt2701_afe_pcm_dev_probe()
1325 afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), in mt2701_afe_pcm_dev_probe()
1327 if (!afe->platform_priv) in mt2701_afe_pcm_dev_probe()
1330 afe_priv = afe->platform_priv; in mt2701_afe_pcm_dev_probe()
1332 afe->dev = &pdev->dev; in mt2701_afe_pcm_dev_probe()
1333 dev = afe->dev; in mt2701_afe_pcm_dev_probe()
1347 IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); in mt2701_afe_pcm_dev_probe()
1353 afe->regmap = syscon_node_to_regmap(dev->parent->of_node); in mt2701_afe_pcm_dev_probe()
1354 if (IS_ERR(afe->regmap)) { in mt2701_afe_pcm_dev_probe()
1356 return PTR_ERR(afe->regmap); in mt2701_afe_pcm_dev_probe()
1359 mutex_init(&afe->irq_alloc_lock); in mt2701_afe_pcm_dev_probe()
1362 afe->memif_size = MT2701_MEMIF_NUM; in mt2701_afe_pcm_dev_probe()
1363 afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), in mt2701_afe_pcm_dev_probe()
1365 if (!afe->memif) in mt2701_afe_pcm_dev_probe()
1368 for (i = 0; i < afe->memif_size; i++) { in mt2701_afe_pcm_dev_probe()
1369 afe->memif[i].data = &memif_data_array[i]; in mt2701_afe_pcm_dev_probe()
1370 afe->memif[i].irq_usage = -1; in mt2701_afe_pcm_dev_probe()
1374 afe->irqs_size = MT2701_IRQ_ASYS_END; in mt2701_afe_pcm_dev_probe()
1375 afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), in mt2701_afe_pcm_dev_probe()
1377 if (!afe->irqs) in mt2701_afe_pcm_dev_probe()
1380 for (i = 0; i < afe->irqs_size; i++) in mt2701_afe_pcm_dev_probe()
1381 afe->irqs[i].irq_data = &irq_data[i]; in mt2701_afe_pcm_dev_probe()
1391 afe->mtk_afe_hardware = &mt2701_afe_hardware; in mt2701_afe_pcm_dev_probe()
1392 afe->memif_fs = mt2701_memif_fs; in mt2701_afe_pcm_dev_probe()
1393 afe->irq_fs = mt2701_irq_fs; in mt2701_afe_pcm_dev_probe()
1394 afe->reg_back_up_list = mt2701_afe_backup_list; in mt2701_afe_pcm_dev_probe()
1395 afe->reg_back_up_list_num = ARRAY_SIZE(mt2701_afe_backup_list); in mt2701_afe_pcm_dev_probe()
1396 afe->runtime_resume = mt2701_afe_runtime_resume; in mt2701_afe_pcm_dev_probe()
1397 afe->runtime_suspend = mt2701_afe_runtime_suspend; in mt2701_afe_pcm_dev_probe()
1400 ret = mt2701_init_clock(afe); in mt2701_afe_pcm_dev_probe()
1406 platform_set_drvdata(pdev, afe); in mt2701_afe_pcm_dev_probe()