Lines Matching +full:mt8195 +full:- +full:audio

1 // SPDX-License-Identifier: GPL-2.0
3 * MediaTek ALSA SoC Audio DAI PCM I/F Control
12 #include "mt8195-afe-clk.h"
13 #include "mt8195-afe-common.h"
14 #include "mt8195-reg.h"
60 return -EINVAL; in mtk_dai_pcm_mode()
122 struct snd_pcm_runtime * const runtime = substream->runtime; in mtk_dai_pcm_configure()
124 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mtk_dai_pcm_configure()
130 unsigned int bit_width = dai->sample_bits; in mtk_dai_pcm_configure()
136 if (dai->id != MT8195_AFE_IO_PCM) in mtk_dai_pcm_configure()
137 return -EINVAL; in mtk_dai_pcm_configure()
139 pcmif_priv = afe_priv->dai_priv[dai->id]; in mtk_dai_pcm_configure()
140 slave_mode = pcmif_priv->slave_mode; in mtk_dai_pcm_configure()
141 lrck_inv = pcmif_priv->lrck_inv; in mtk_dai_pcm_configure()
142 bck_inv = pcmif_priv->bck_inv; in mtk_dai_pcm_configure()
143 fmt = pcmif_priv->format; in mtk_dai_pcm_configure()
146 fs = mt8195_afe_fs_timing(runtime->rate); in mtk_dai_pcm_configure()
148 return -EINVAL; in mtk_dai_pcm_configure()
153 if (runtime->rate % 8000) in mtk_dai_pcm_configure()
159 regmap_update_bits(afe->regmap, PCM_INTF_CON2, mask, val); in mtk_dai_pcm_configure()
165 mode = mtk_dai_pcm_mode(runtime->rate); in mtk_dai_pcm_configure()
167 return -EINVAL; in mtk_dai_pcm_configure()
216 regmap_update_bits(afe->regmap, PCM_INTF_CON1, mask, val); in mtk_dai_pcm_configure()
228 dev_dbg(dai->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n", in mtk_dai_pcm_prepare()
229 __func__, dai->id, substream->stream, in mtk_dai_pcm_prepare()
230 p->active, c->active); in mtk_dai_pcm_prepare()
232 if (p->active || c->active) in mtk_dai_pcm_prepare()
241 struct mt8195_afe_private *afe_priv = afe->platform_priv; in mtk_dai_pcm_set_fmt()
244 dev_dbg(dai->dev, "%s fmt 0x%x\n", __func__, fmt); in mtk_dai_pcm_set_fmt()
246 if (dai->id != MT8195_AFE_IO_PCM) in mtk_dai_pcm_set_fmt()
247 return -EINVAL; in mtk_dai_pcm_set_fmt()
249 pcmif_priv = afe_priv->dai_priv[dai->id]; in mtk_dai_pcm_set_fmt()
253 pcmif_priv->format = MTK_DAI_PCM_FMT_I2S; in mtk_dai_pcm_set_fmt()
256 pcmif_priv->format = MTK_DAI_PCM_FMT_MODEA; in mtk_dai_pcm_set_fmt()
259 pcmif_priv->format = MTK_DAI_PCM_FMT_MODEB; in mtk_dai_pcm_set_fmt()
262 return -EINVAL; in mtk_dai_pcm_set_fmt()
267 pcmif_priv->bck_inv = 0; in mtk_dai_pcm_set_fmt()
268 pcmif_priv->lrck_inv = 0; in mtk_dai_pcm_set_fmt()
271 pcmif_priv->bck_inv = 0; in mtk_dai_pcm_set_fmt()
272 pcmif_priv->lrck_inv = 1; in mtk_dai_pcm_set_fmt()
275 pcmif_priv->bck_inv = 1; in mtk_dai_pcm_set_fmt()
276 pcmif_priv->lrck_inv = 0; in mtk_dai_pcm_set_fmt()
279 pcmif_priv->bck_inv = 1; in mtk_dai_pcm_set_fmt()
280 pcmif_priv->lrck_inv = 1; in mtk_dai_pcm_set_fmt()
283 return -EINVAL; in mtk_dai_pcm_set_fmt()
288 pcmif_priv->slave_mode = 1; in mtk_dai_pcm_set_fmt()
291 pcmif_priv->slave_mode = 0; in mtk_dai_pcm_set_fmt()
294 return -EINVAL; in mtk_dai_pcm_set_fmt()
338 struct mt8195_afe_private *afe_priv = afe->platform_priv; in init_pcmif_priv_data()
341 pcmif_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_pcmif_priv), in init_pcmif_priv_data()
344 return -ENOMEM; in init_pcmif_priv_data()
346 afe_priv->dai_priv[MT8195_AFE_IO_PCM] = pcmif_priv; in init_pcmif_priv_data()
354 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8195_dai_pcm_register()
356 return -ENOMEM; in mt8195_dai_pcm_register()
358 list_add(&dai->list, &afe->sub_dais); in mt8195_dai_pcm_register()
360 dai->dai_drivers = mtk_dai_pcm_driver; in mt8195_dai_pcm_register()
361 dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_pcm_driver); in mt8195_dai_pcm_register()
363 dai->dapm_widgets = mtk_dai_pcm_widgets; in mt8195_dai_pcm_register()
364 dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_pcm_widgets); in mt8195_dai_pcm_register()
365 dai->dapm_routes = mtk_dai_pcm_routes; in mt8195_dai_pcm_register()
366 dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_pcm_routes); in mt8195_dai_pcm_register()