Lines Matching +full:fe +full:- +full:dai +full:- +full:link

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
11 #include <sound/hda-mlink.h>
14 #include "../ipc4-priv.h"
15 #include "../ipc4-topology.h"
16 #include "../sof-priv.h"
17 #include "../sof-audio.h"
20 /* These ops are only applicable for the HDA DAI's in their current form */
24 * to the link DMA stream_tag argument is assigned to one
25 * of the FEs connected to the BE DAI.
35 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, dir); in hda_check_fes()
36 fe_hstream = fe_substream->runtime->private_data; in hda_check_fes()
37 if (fe_hstream->stream_tag == stream_tag) in hda_check_fes()
54 int stream_dir = substream->stream; in hda_link_stream_assign()
56 if (!bus->ppcap) { in hda_link_stream_assign()
57 dev_err(bus->dev, "stream type not supported\n"); in hda_link_stream_assign()
61 spin_lock_irq(&bus->reg_lock); in hda_link_stream_assign()
62 list_for_each_entry(hstream, &bus->stream_list, list) { in hda_link_stream_assign()
65 if (hstream->direction != substream->stream) in hda_link_stream_assign()
69 sdev = hda_stream->sdev; in hda_link_stream_assign()
70 chip = get_chip_info(sdev->pdata); in hda_link_stream_assign()
72 /* check if link is available */ in hda_link_stream_assign()
73 if (!hext_stream->link_locked) { in hda_link_stream_assign()
75 * choose the first available link for platforms that do not have the in hda_link_stream_assign()
78 if (!(chip->quirks & SOF_INTEL_PROCEN_FMT_QUIRK)) { in hda_link_stream_assign()
83 if (hstream->opened) { in hda_link_stream_assign()
89 hstream->stream_tag)) { in hda_link_stream_assign()
100 hda_stream->host_reserved = 1; in hda_link_stream_assign()
107 /* Make sure that host and link DMA is decoupled. */ in hda_link_stream_assign()
110 res->link_locked = 1; in hda_link_stream_assign()
111 res->link_substream = substream; in hda_link_stream_assign()
113 spin_unlock_irq(&bus->reg_lock); in hda_link_stream_assign()
134 w = snd_soc_dai_get_widget(cpu_dai, substream->stream); in hda_ipc4_get_hext_stream()
135 swidget = w->dobj.private; in hda_ipc4_get_hext_stream()
136 pipe_widget = swidget->spipe->pipe_widget; in hda_ipc4_get_hext_stream()
137 pipeline = pipe_widget->private; in hda_ipc4_get_hext_stream()
139 /* mark pipeline so that it can be skipped during FE trigger */ in hda_ipc4_get_hext_stream()
140 pipeline->skip_during_fe_trigger = true; in hda_ipc4_get_hext_stream()
187 /* set the hdac_stream in the codec dai */ in hda_codec_dai_set_stream()
188 snd_soc_dai_set_stream(codec_dai, hstream, substream->stream); in hda_codec_dai_set_stream()
201 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in hda_calc_stream_format()
202 link_bps = codec_dai->driver->playback.sig_bits; in hda_calc_stream_format()
204 link_bps = codec_dai->driver->capture.sig_bits; in hda_calc_stream_format()
210 dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val, in hda_calc_stream_format()
223 return snd_hdac_ext_bus_get_hlink_by_name(bus, codec_dai->component->name); in hda_get_hlink()
237 dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val, in generic_calc_stream_format()
266 dev_dbg(sdev->dev, "format_val=%#x, rate=%d, ch=%d, format=%d\n", format_val, in dmic_calc_stream_format()
299 struct sof_ipc4_fw_data *ipc4_data = sdev->private; in hda_ipc4_pre_trigger()
306 w = snd_soc_dai_get_widget(cpu_dai, substream->stream); in hda_ipc4_pre_trigger()
307 swidget = w->dobj.private; in hda_ipc4_pre_trigger()
308 pipe_widget = swidget->spipe->pipe_widget; in hda_ipc4_pre_trigger()
309 pipeline = pipe_widget->private; in hda_ipc4_pre_trigger()
311 if (pipe_widget->instance_id < 0) in hda_ipc4_pre_trigger()
314 mutex_lock(&ipc4_data->pipeline_state_mutex); in hda_ipc4_pre_trigger()
323 ret = sof_ipc4_set_pipeline_state(sdev, pipe_widget->instance_id, in hda_ipc4_pre_trigger()
328 pipeline->state = SOF_IPC4_PIPE_PAUSED; in hda_ipc4_pre_trigger()
331 dev_err(sdev->dev, "unknown trigger command %d\n", cmd); in hda_ipc4_pre_trigger()
332 ret = -EINVAL; in hda_ipc4_pre_trigger()
335 mutex_unlock(&ipc4_data->pipeline_state_mutex); in hda_ipc4_pre_trigger()
355 hext_stream->pplcllpl = readl(hext_stream->pplc_addr + AZX_REG_PPLCLLPL); in hda_trigger()
356 hext_stream->pplcllpu = readl(hext_stream->pplc_addr + AZX_REG_PPLCLLPU); in hda_trigger()
361 hext_stream->pplcllpl = 0; in hda_trigger()
362 hext_stream->pplcllpu = 0; in hda_trigger()
366 dev_err(sdev->dev, "unknown trigger command %d\n", cmd); in hda_trigger()
367 return -EINVAL; in hda_trigger()
376 struct sof_ipc4_fw_data *ipc4_data = sdev->private; in hda_ipc4_post_trigger()
383 w = snd_soc_dai_get_widget(cpu_dai, substream->stream); in hda_ipc4_post_trigger()
384 swidget = w->dobj.private; in hda_ipc4_post_trigger()
385 pipe_widget = swidget->spipe->pipe_widget; in hda_ipc4_post_trigger()
386 pipeline = pipe_widget->private; in hda_ipc4_post_trigger()
388 if (pipe_widget->instance_id < 0) in hda_ipc4_post_trigger()
391 mutex_lock(&ipc4_data->pipeline_state_mutex); in hda_ipc4_post_trigger()
395 if (pipeline->state != SOF_IPC4_PIPE_PAUSED) { in hda_ipc4_post_trigger()
396 ret = sof_ipc4_set_pipeline_state(sdev, pipe_widget->instance_id, in hda_ipc4_post_trigger()
400 pipeline->state = SOF_IPC4_PIPE_PAUSED; in hda_ipc4_post_trigger()
403 ret = sof_ipc4_set_pipeline_state(sdev, pipe_widget->instance_id, in hda_ipc4_post_trigger()
407 pipeline->state = SOF_IPC4_PIPE_RUNNING; in hda_ipc4_post_trigger()
408 swidget->spipe->started_count++; in hda_ipc4_post_trigger()
411 ret = sof_ipc4_set_pipeline_state(sdev, pipe_widget->instance_id, in hda_ipc4_post_trigger()
415 pipeline->state = SOF_IPC4_PIPE_RUNNING; in hda_ipc4_post_trigger()
423 swidget->spipe->started_count = 0; in hda_ipc4_post_trigger()
428 dev_err(sdev->dev, "unknown trigger command %d\n", cmd); in hda_ipc4_post_trigger()
429 ret = -EINVAL; in hda_ipc4_post_trigger()
433 mutex_unlock(&ipc4_data->pipeline_state_mutex); in hda_ipc4_post_trigger()
516 struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(cpu_dai, substream->stream); in hda_ipc3_post_trigger()
558 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dspless_get_hext_stream()
569 * This information is not available on the FE side since there we are in hda_dspless_setup_hext_stream()
572 hext_stream->hstream.format_val = format_val; in hda_dspless_setup_hext_stream()
599 chip = get_chip_info(sdev->pdata); in hda_select_dai_widget_ops()
600 sdai = swidget->private; in hda_select_dai_widget_ops()
602 if (sdev->dspless_mode_selected) { in hda_select_dai_widget_ops()
603 switch (sdai->type) { in hda_select_dai_widget_ops()
607 if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) in hda_select_dai_widget_ops()
615 switch (sdev->pdata->ipc_type) { in hda_select_dai_widget_ops()
618 struct sof_dai_private_data *private = sdai->private; in hda_select_dai_widget_ops()
620 if (private->dai_config->type == SOF_DAI_INTEL_HDA) in hda_select_dai_widget_ops()
626 struct snd_sof_widget *pipe_widget = swidget->spipe->pipe_widget; in hda_select_dai_widget_ops()
627 struct sof_ipc4_pipeline *pipeline = pipe_widget->private; in hda_select_dai_widget_ops()
629 switch (sdai->type) { in hda_select_dai_widget_ops()
631 if (pipeline->use_chain_dma) in hda_select_dai_widget_ops()
636 if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) in hda_select_dai_widget_ops()
640 if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) in hda_select_dai_widget_ops()
644 if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) in hda_select_dai_widget_ops()
646 if (pipeline->use_chain_dma) in hda_select_dai_widget_ops()