Lines Matching +full:dai +full:- +full:format

1 // SPDX-License-Identifier: GPL-2.0
3 * MediaTek 8365 ALSA SoC Audio DAI PCM Control
13 #include "mt8365-afe-clk.h"
14 #include "mt8365-afe-common.h"
20 unsigned int format; member
23 /* DAI Drivers */
27 regmap_update_bits(afe->regmap, PCM_INTF_CON1, in mt8365_dai_enable_pcm1()
33 regmap_update_bits(afe->regmap, PCM_INTF_CON1, in mt8365_dai_disable_pcm1()
38 struct snd_soc_dai *dai) in mt8365_dai_configure_pcm1() argument
40 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_configure_pcm1()
41 struct mt8365_afe_private *afe_priv = afe->platform_priv; in mt8365_dai_configure_pcm1()
42 struct mt8365_pcm_intf_data *pcm_priv = afe_priv->dai_priv[MT8365_AFE_IO_PCM1]; in mt8365_dai_configure_pcm1()
43 bool slave_mode = pcm_priv->slave_mode; in mt8365_dai_configure_pcm1()
44 bool lrck_inv = pcm_priv->lrck_inv; in mt8365_dai_configure_pcm1()
45 bool bck_inv = pcm_priv->bck_inv; in mt8365_dai_configure_pcm1()
46 unsigned int fmt = pcm_priv->format; in mt8365_dai_configure_pcm1()
47 unsigned int bit_width = dai->symmetric_sample_bits; in mt8365_dai_configure_pcm1()
77 switch (substream->runtime->rate) { in mt8365_dai_configure_pcm1()
91 return -EINVAL; in mt8365_dai_configure_pcm1()
101 regmap_update_bits(afe->regmap, PCM_INTF_CON1, in mt8365_dai_configure_pcm1()
108 struct snd_soc_dai *dai) in mt8365_dai_pcm1_startup() argument
110 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_pcm1_startup()
112 if (snd_soc_dai_active(dai)) in mt8365_dai_pcm1_startup()
121 struct snd_soc_dai *dai) in mt8365_dai_pcm1_shutdown() argument
123 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_pcm1_shutdown()
125 if (snd_soc_dai_active(dai)) in mt8365_dai_pcm1_shutdown()
133 struct snd_soc_dai *dai) in mt8365_dai_pcm1_prepare() argument
135 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_pcm1_prepare()
138 if ((snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK) + in mt8365_dai_pcm1_prepare()
139 snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)) > 1) { in mt8365_dai_pcm1_prepare()
140 dev_info(afe->dev, "%s '%s' active(%u-%u) already\n", in mt8365_dai_pcm1_prepare()
142 snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK), in mt8365_dai_pcm1_prepare()
143 snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)); in mt8365_dai_pcm1_prepare()
147 ret = mt8365_dai_configure_pcm1(substream, dai); in mt8365_dai_pcm1_prepare()
156 static int mt8365_dai_pcm1_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) in mt8365_dai_pcm1_set_fmt() argument
158 struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); in mt8365_dai_pcm1_set_fmt()
159 struct mt8365_afe_private *afe_priv = afe->platform_priv; in mt8365_dai_pcm1_set_fmt()
160 struct mt8365_pcm_intf_data *pcm_priv = afe_priv->dai_priv[MT8365_AFE_IO_PCM1]; in mt8365_dai_pcm1_set_fmt()
164 pcm_priv->format = MT8365_PCM_FORMAT_I2S; in mt8365_dai_pcm1_set_fmt()
167 return -EINVAL; in mt8365_dai_pcm1_set_fmt()
172 pcm_priv->bck_inv = false; in mt8365_dai_pcm1_set_fmt()
173 pcm_priv->lrck_inv = false; in mt8365_dai_pcm1_set_fmt()
176 pcm_priv->bck_inv = false; in mt8365_dai_pcm1_set_fmt()
177 pcm_priv->lrck_inv = true; in mt8365_dai_pcm1_set_fmt()
180 pcm_priv->bck_inv = true; in mt8365_dai_pcm1_set_fmt()
181 pcm_priv->lrck_inv = false; in mt8365_dai_pcm1_set_fmt()
184 pcm_priv->bck_inv = true; in mt8365_dai_pcm1_set_fmt()
185 pcm_priv->lrck_inv = true; in mt8365_dai_pcm1_set_fmt()
188 return -EINVAL; in mt8365_dai_pcm1_set_fmt()
193 pcm_priv->slave_mode = true; in mt8365_dai_pcm1_set_fmt()
196 pcm_priv->slave_mode = false; in mt8365_dai_pcm1_set_fmt()
199 return -EINVAL; in mt8365_dai_pcm1_set_fmt()
244 /* DAI widget */
251 /* DAI route */
265 struct mt8365_afe_private *afe_priv = afe->platform_priv; in init_pcmif_priv_data()
268 pcmif_priv = devm_kzalloc(afe->dev, sizeof(struct mt8365_pcm_intf_data), in init_pcmif_priv_data()
271 return -ENOMEM; in init_pcmif_priv_data()
273 afe_priv->dai_priv[MT8365_AFE_IO_PCM1] = pcmif_priv; in init_pcmif_priv_data()
279 struct mtk_base_afe_dai *dai; in mt8365_dai_pcm_register() local
281 dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); in mt8365_dai_pcm_register()
282 if (!dai) in mt8365_dai_pcm_register()
283 return -ENOMEM; in mt8365_dai_pcm_register()
285 list_add(&dai->list, &afe->sub_dais); in mt8365_dai_pcm_register()
286 dai->dai_drivers = mtk_dai_pcm_driver; in mt8365_dai_pcm_register()
287 dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_pcm_driver); in mt8365_dai_pcm_register()
288 dai->dapm_widgets = mtk_dai_pcm_widgets; in mt8365_dai_pcm_register()
289 dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_pcm_widgets); in mt8365_dai_pcm_register()
290 dai->dapm_routes = mtk_dai_pcm_routes; in mt8365_dai_pcm_register()
291 dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_pcm_routes); in mt8365_dai_pcm_register()