Lines Matching +full:dai +full:- +full:format
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
13 #include "../sof-priv.h"
14 #include "../sof-audio.h"
26 snd_pcm_format_t format; member
36 * of the FEs connected to the BE DAI.
46 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, dir); in hda_check_fes()
47 fe_hstream = fe_substream->runtime->private_data; in hda_check_fes()
48 if (fe_hstream->stream_tag == stream_tag) in hda_check_fes()
64 int stream_dir = substream->stream; in hda_link_stream_assign()
66 if (!bus->ppcap) { in hda_link_stream_assign()
67 dev_err(bus->dev, "stream type not supported\n"); in hda_link_stream_assign()
71 spin_lock_irq(&bus->reg_lock); in hda_link_stream_assign()
72 list_for_each_entry(stream, &bus->stream_list, list) { in hda_link_stream_assign()
75 if (stream->direction != substream->stream) in hda_link_stream_assign()
81 if (!hstream->link_locked) { in hda_link_stream_assign()
82 if (stream->opened) { in hda_link_stream_assign()
88 stream->stream_tag)) { in hda_link_stream_assign()
99 hda_stream->host_reserved = 1; in hda_link_stream_assign()
110 if (!res->decoupled) in hda_link_stream_assign()
113 res->link_locked = 1; in hda_link_stream_assign()
114 res->link_substream = substream; in hda_link_stream_assign()
116 spin_unlock_irq(&bus->reg_lock); in hda_link_stream_assign()
124 struct hdac_stream *hstream = &stream->hstream; in hda_link_dma_params()
125 unsigned char stream_tag = hstream->stream_tag; in hda_link_dma_params()
126 struct hdac_bus *bus = hstream->bus; in hda_link_dma_params()
133 format_val = snd_hdac_calc_stream_format(params->s_freq, params->ch, in hda_link_dma_params()
134 params->format, in hda_link_dma_params()
135 params->link_bps, 0); in hda_link_dma_params()
137 dev_dbg(bus->dev, "format_val=%d, rate=%d, ch=%d, format=%d\n", in hda_link_dma_params()
138 format_val, params->s_freq, params->ch, params->format); in hda_link_dma_params()
142 if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) { in hda_link_dma_params()
143 list_for_each_entry(link, &bus->hlink_list, list) { in hda_link_dma_params()
144 if (link->index == params->link_index) in hda_link_dma_params()
150 stream->link_prepared = 1; in hda_link_dma_params()
155 /* Send DAI_CONFIG IPC to the DAI that matches the dai_name and direction */
164 list_for_each_entry(sof_dai, &hda_stream->sdev->dai_list, list) { in hda_link_config_ipc()
165 if (!sof_dai->cpu_dai_name) in hda_link_config_ipc()
168 if (!strcmp(dai_name, sof_dai->cpu_dai_name) && in hda_link_config_ipc()
169 dir == sof_dai->comp_dai.direction) { in hda_link_config_ipc()
170 config = sof_dai->dai_config; in hda_link_config_ipc()
173 dev_err(hda_stream->sdev->dev, in hda_link_config_ipc()
174 "error: no config for DAI %s\n", in hda_link_config_ipc()
175 sof_dai->name); in hda_link_config_ipc()
176 return -EINVAL; in hda_link_config_ipc()
180 config->hda.link_dma_ch = channel; in hda_link_config_ipc()
183 ret = sof_ipc_tx_message(hda_stream->sdev->ipc, in hda_link_config_ipc()
184 config->hdr.cmd, in hda_link_config_ipc()
186 config->hdr.size, in hda_link_config_ipc()
190 dev_err(hda_stream->sdev->dev, in hda_link_config_ipc()
191 "error: failed to set dai config for %s\n", in hda_link_config_ipc()
192 sof_dai->name); in hda_link_config_ipc()
197 return -EINVAL; in hda_link_config_ipc()
202 struct snd_soc_dai *dai) in hda_link_hw_params() argument
204 struct hdac_stream *hstream = substream->runtime->private_data; in hda_link_hw_params()
205 struct hdac_bus *bus = hstream->bus; in hda_link_hw_params()
216 link_dev = snd_soc_dai_get_dma_data(dai, substream); in hda_link_hw_params()
220 return -EBUSY; in hda_link_hw_params()
222 snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); in hda_link_hw_params()
225 stream_tag = hdac_stream(link_dev)->stream_tag; in hda_link_hw_params()
230 ret = hda_link_config_ipc(hda_stream, dai->name, stream_tag - 1, in hda_link_hw_params()
231 substream->stream); in hda_link_hw_params()
235 link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); in hda_link_hw_params()
237 return -EINVAL; in hda_link_hw_params()
239 /* set the stream tag in the codec dai dma params */ in hda_link_hw_params()
240 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in hda_link_hw_params()
248 p_params.stream = substream->stream; in hda_link_hw_params()
249 p_params.link_dma_id = stream_tag - 1; in hda_link_hw_params()
250 p_params.link_index = link->index; in hda_link_hw_params()
251 p_params.format = params_format(params); in hda_link_hw_params()
253 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in hda_link_hw_params()
254 p_params.link_bps = codec_dai->driver->playback.sig_bits; in hda_link_hw_params()
256 p_params.link_bps = codec_dai->driver->capture.sig_bits; in hda_link_hw_params()
262 struct snd_soc_dai *dai) in hda_link_pcm_prepare() argument
265 snd_soc_dai_get_dma_data(dai, substream); in hda_link_pcm_prepare()
267 snd_soc_component_get_drvdata(dai->component); in hda_link_pcm_prepare()
269 int stream = substream->stream; in hda_link_pcm_prepare()
271 if (link_dev->link_prepared) in hda_link_pcm_prepare()
274 dev_dbg(sdev->dev, "hda: prepare stream dir %d\n", substream->stream); in hda_link_pcm_prepare()
276 return hda_link_hw_params(substream, &rtd->dpcm[stream].hw_params, in hda_link_pcm_prepare()
277 dai); in hda_link_pcm_prepare()
281 int cmd, struct snd_soc_dai *dai) in hda_link_pcm_trigger() argument
284 snd_soc_dai_get_dma_data(dai, substream); in hda_link_pcm_trigger()
293 hstream = substream->runtime->private_data; in hda_link_pcm_trigger()
294 bus = hstream->bus; in hda_link_pcm_trigger()
297 link = snd_hdac_ext_bus_get_link(bus, asoc_rtd_to_codec(rtd, 0)->component->name); in hda_link_pcm_trigger()
299 return -EINVAL; in hda_link_pcm_trigger()
303 dev_dbg(dai->dev, "In %s cmd=%d\n", __func__, cmd); in hda_link_pcm_trigger()
307 ret = hda_link_pcm_prepare(substream, dai); in hda_link_pcm_trigger()
309 dev_err(dai->dev, in hda_link_pcm_trigger()
325 ret = hda_link_config_ipc(hda_stream, dai->name, in hda_link_pcm_trigger()
326 DMA_CHAN_INVALID, substream->stream); in hda_link_pcm_trigger()
330 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in hda_link_pcm_trigger()
331 stream_tag = hdac_stream(link_dev)->stream_tag; in hda_link_pcm_trigger()
335 link_dev->link_prepared = 0; in hda_link_pcm_trigger()
342 return -EINVAL; in hda_link_pcm_trigger()
348 struct snd_soc_dai *dai) in hda_link_hw_free() argument
359 hstream = substream->runtime->private_data; in hda_link_hw_free()
360 bus = hstream->bus; in hda_link_hw_free()
362 link_dev = snd_soc_dai_get_dma_data(dai, substream); in hda_link_hw_free()
365 dev_dbg(dai->dev, in hda_link_hw_free()
367 return -EINVAL; in hda_link_hw_free()
373 ret = hda_link_config_ipc(hda_stream, dai->name, DMA_CHAN_INVALID, in hda_link_hw_free()
374 substream->stream); in hda_link_hw_free()
378 link = snd_hdac_ext_bus_get_link(bus, asoc_rtd_to_codec(rtd, 0)->component->name); in hda_link_hw_free()
380 return -EINVAL; in hda_link_hw_free()
382 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in hda_link_hw_free()
383 stream_tag = hdac_stream(link_dev)->stream_tag; in hda_link_hw_free()
387 snd_soc_dai_set_dma_data(dai, substream, NULL); in hda_link_hw_free()
389 link_dev->link_prepared = 0; in hda_link_hw_free()
392 hda_stream->host_reserved = 0; in hda_link_hw_free()
419 * common dai driver for skl+ platforms.
420 * some products who use this DAI array only physically have a subset of
538 .name = "Analog CPU DAI",
550 .name = "Digital CPU DAI",
562 .name = "Alt Analog CPU DAI",
575 .name = "Probe Extraction CPU DAI",