Lines Matching +full:cmd +full:- +full:max +full:- +full:name

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
11 #include "ipc3-priv.h"
13 #include "sof-priv.h"
14 #include "sof-audio.h"
26 return -EINVAL; in sof_ipc3_pcm_hw_free()
28 if (!spcm->prepared[substream->stream]) in sof_ipc3_pcm_hw_free()
32 stream.hdr.cmd = SOF_IPC_GLB_STREAM_MSG | SOF_IPC_STREAM_PCM_FREE; in sof_ipc3_pcm_hw_free()
33 stream.comp_id = spcm->stream[substream->stream].comp_id; in sof_ipc3_pcm_hw_free()
36 return sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream)); in sof_ipc3_pcm_hw_free()
46 struct sof_ipc_fw_version *v = &sdev->fw_ready.version; in sof_ipc3_pcm_hw_params()
47 struct snd_pcm_runtime *runtime = substream->runtime; in sof_ipc3_pcm_hw_params()
55 return -EINVAL; in sof_ipc3_pcm_hw_params()
60 pcm.params.buffer.pages = PFN_UP(runtime->dma_bytes); in sof_ipc3_pcm_hw_params()
64 pcm.hdr.cmd = SOF_IPC_GLB_STREAM_MSG | SOF_IPC_STREAM_PCM_PARAMS; in sof_ipc3_pcm_hw_params()
65 pcm.comp_id = spcm->stream[substream->stream].comp_id; in sof_ipc3_pcm_hw_params()
67 pcm.params.buffer.phy_addr = spcm->stream[substream->stream].page_table.addr; in sof_ipc3_pcm_hw_params()
68 pcm.params.buffer.size = runtime->dma_bytes; in sof_ipc3_pcm_hw_params()
69 pcm.params.direction = substream->stream; in sof_ipc3_pcm_hw_params()
97 return -EINVAL; in sof_ipc3_pcm_hw_params()
101 pcm.params.stream_tag = platform_params->stream_tag; in sof_ipc3_pcm_hw_params()
103 if (platform_params->use_phy_address) in sof_ipc3_pcm_hw_params()
104 pcm.params.buffer.phy_addr = platform_params->phy_addr; in sof_ipc3_pcm_hw_params()
106 if (platform_params->no_ipc_position) { in sof_ipc3_pcm_hw_params()
111 if (v->abi_version < SOF_ABI_VER(3, 10, 0)) in sof_ipc3_pcm_hw_params()
117 if (platform_params->cont_update_posn) in sof_ipc3_pcm_hw_params()
120 dev_dbg(component->dev, "stream_tag %d", pcm.params.stream_tag); in sof_ipc3_pcm_hw_params()
123 ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm), in sof_ipc3_pcm_hw_params()
126 dev_err(component->dev, "HW params ipc failed for stream %d\n", in sof_ipc3_pcm_hw_params()
131 ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[substream->stream], in sof_ipc3_pcm_hw_params()
134 dev_err(component->dev, "%s: invalid stream data offset for PCM %d\n", in sof_ipc3_pcm_hw_params()
135 __func__, spcm->pcm.pcm_id); in sof_ipc3_pcm_hw_params()
143 struct snd_pcm_substream *substream, int cmd) in sof_ipc3_pcm_trigger() argument
152 return -EINVAL; in sof_ipc3_pcm_trigger()
155 stream.hdr.cmd = SOF_IPC_GLB_STREAM_MSG; in sof_ipc3_pcm_trigger()
156 stream.comp_id = spcm->stream[substream->stream].comp_id; in sof_ipc3_pcm_trigger()
158 switch (cmd) { in sof_ipc3_pcm_trigger()
160 stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_PAUSE; in sof_ipc3_pcm_trigger()
163 stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_RELEASE; in sof_ipc3_pcm_trigger()
166 stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START; in sof_ipc3_pcm_trigger()
171 stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP; in sof_ipc3_pcm_trigger()
174 dev_err(component->dev, "Unhandled trigger cmd %d\n", cmd); in sof_ipc3_pcm_trigger()
175 return -EINVAL; in sof_ipc3_pcm_trigger()
179 return sof_ipc_tx_message_no_reply(sdev->ipc, &stream, sizeof(stream)); in sof_ipc3_pcm_trigger()
193 list_for_each_entry(dai, &sdev->dai_list, list) { in ssp_dai_config_pcm_params_match()
194 if (!dai->name || strcmp(link_name, dai->name)) in ssp_dai_config_pcm_params_match()
196 for (i = 0; i < dai->number_configs; i++) { in ssp_dai_config_pcm_params_match()
197 struct sof_dai_private_data *private = dai->private; in ssp_dai_config_pcm_params_match()
199 config = &private->dai_config[i]; in ssp_dai_config_pcm_params_match()
200 if (config->ssp.fsync_rate == params_rate(params)) { in ssp_dai_config_pcm_params_match()
201 dev_dbg(sdev->dev, "DAI config %d matches pcm hw params\n", i); in ssp_dai_config_pcm_params_match()
202 dai->current_config = i; in ssp_dai_config_pcm_params_match()
214 struct snd_sof_dai *dai = snd_sof_find_dai(component, (char *)rtd->dai_link->name); in sof_ipc3_pcm_dai_link_fixup()
222 dev_err(component->dev, "%s: No DAI found with name %s\n", __func__, in sof_ipc3_pcm_dai_link_fixup()
223 rtd->dai_link->name); in sof_ipc3_pcm_dai_link_fixup()
224 return -EINVAL; in sof_ipc3_pcm_dai_link_fixup()
227 private = dai->private; in sof_ipc3_pcm_dai_link_fixup()
229 dev_err(component->dev, "%s: No private data found for DAI %s\n", __func__, in sof_ipc3_pcm_dai_link_fixup()
230 rtd->dai_link->name); in sof_ipc3_pcm_dai_link_fixup()
231 return -EINVAL; in sof_ipc3_pcm_dai_link_fixup()
237 switch (private->comp_dai->config.frame_fmt) { in sof_ipc3_pcm_dai_link_fixup()
248 dev_err(component->dev, "No available DAI format!\n"); in sof_ipc3_pcm_dai_link_fixup()
249 return -EINVAL; in sof_ipc3_pcm_dai_link_fixup()
253 switch (private->dai_config->type) { in sof_ipc3_pcm_dai_link_fixup()
256 ssp_dai_config_pcm_params_match(sdev, (char *)rtd->dai_link->name, params); in sof_ipc3_pcm_dai_link_fixup()
258 rate->min = private->dai_config[dai->current_config].ssp.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
259 rate->max = private->dai_config[dai->current_config].ssp.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
260 channels->min = private->dai_config[dai->current_config].ssp.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
261 channels->max = private->dai_config[dai->current_config].ssp.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
263 dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
264 dev_dbg(component->dev, "channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
265 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
270 if (private->comp_dai->config.frame_fmt == SOF_IPC_FRAME_S24_4LE) { in sof_ipc3_pcm_dai_link_fixup()
271 dev_err(component->dev, "Invalid fmt %d for DAI type %d\n", in sof_ipc3_pcm_dai_link_fixup()
272 private->comp_dai->config.frame_fmt, in sof_ipc3_pcm_dai_link_fixup()
273 private->dai_config->type); in sof_ipc3_pcm_dai_link_fixup()
282 struct snd_soc_pcm_runtime *fe = dpcm->fe; in sof_ipc3_pcm_dai_link_fixup()
284 fe->dai_link->trigger[SNDRV_PCM_STREAM_PLAYBACK] = in sof_ipc3_pcm_dai_link_fixup()
293 channels->min = private->dai_config->alh.channels; in sof_ipc3_pcm_dai_link_fixup()
294 channels->max = private->dai_config->alh.channels; in sof_ipc3_pcm_dai_link_fixup()
297 rate->min = private->dai_config->esai.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
298 rate->max = private->dai_config->esai.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
299 channels->min = private->dai_config->esai.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
300 channels->max = private->dai_config->esai.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
302 dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
303 dev_dbg(component->dev, "channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
304 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
307 rate->min = private->dai_config->afe.rate; in sof_ipc3_pcm_dai_link_fixup()
308 rate->max = private->dai_config->afe.rate; in sof_ipc3_pcm_dai_link_fixup()
309 channels->min = private->dai_config->afe.channels; in sof_ipc3_pcm_dai_link_fixup()
310 channels->max = private->dai_config->afe.channels; in sof_ipc3_pcm_dai_link_fixup()
314 switch (private->dai_config->afe.format) { in sof_ipc3_pcm_dai_link_fixup()
325 dev_err(component->dev, "Not available format!\n"); in sof_ipc3_pcm_dai_link_fixup()
326 return -EINVAL; in sof_ipc3_pcm_dai_link_fixup()
329 dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
330 dev_dbg(component->dev, "channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
331 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
334 rate->min = private->dai_config->sai.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
335 rate->max = private->dai_config->sai.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
336 channels->min = private->dai_config->sai.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
337 channels->max = private->dai_config->sai.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
339 dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
340 dev_dbg(component->dev, "channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
341 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
344 rate->min = private->dai_config->acpbt.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
345 rate->max = private->dai_config->acpbt.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
346 channels->min = private->dai_config->acpbt.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
347 channels->max = private->dai_config->acpbt.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
349 dev_dbg(component->dev, in sof_ipc3_pcm_dai_link_fixup()
350 "AMD_BT rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
351 dev_dbg(component->dev, "AMD_BT channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
352 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
356 rate->min = private->dai_config->acpsp.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
357 rate->max = private->dai_config->acpsp.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
358 channels->min = private->dai_config->acpsp.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
359 channels->max = private->dai_config->acpsp.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
361 dev_dbg(component->dev, in sof_ipc3_pcm_dai_link_fixup()
362 "AMD_SP rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
363 dev_dbg(component->dev, "AMD_SP channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
364 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
368 rate->min = private->dai_config->acphs.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
369 rate->max = private->dai_config->acphs.fsync_rate; in sof_ipc3_pcm_dai_link_fixup()
370 channels->min = private->dai_config->acphs.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
371 channels->max = private->dai_config->acphs.tdm_slots; in sof_ipc3_pcm_dai_link_fixup()
373 dev_dbg(component->dev, in sof_ipc3_pcm_dai_link_fixup()
374 "AMD_HS channel_max: %d rate_max: %d\n", channels->max, rate->max); in sof_ipc3_pcm_dai_link_fixup()
377 rate->min = private->dai_config->acpdmic.pdm_rate; in sof_ipc3_pcm_dai_link_fixup()
378 rate->max = private->dai_config->acpdmic.pdm_rate; in sof_ipc3_pcm_dai_link_fixup()
379 channels->min = private->dai_config->acpdmic.pdm_ch; in sof_ipc3_pcm_dai_link_fixup()
380 channels->max = private->dai_config->acpdmic.pdm_ch; in sof_ipc3_pcm_dai_link_fixup()
382 dev_dbg(component->dev, in sof_ipc3_pcm_dai_link_fixup()
383 "AMD_DMIC rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
384 dev_dbg(component->dev, "AMD_DMIC channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
385 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
388 rate->min = private->dai_config->micfil.pdm_rate; in sof_ipc3_pcm_dai_link_fixup()
389 rate->max = private->dai_config->micfil.pdm_rate; in sof_ipc3_pcm_dai_link_fixup()
390 channels->min = private->dai_config->micfil.pdm_ch; in sof_ipc3_pcm_dai_link_fixup()
391 channels->max = private->dai_config->micfil.pdm_ch; in sof_ipc3_pcm_dai_link_fixup()
393 dev_dbg(component->dev, in sof_ipc3_pcm_dai_link_fixup()
394 "MICFIL PDM rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
395 dev_dbg(component->dev, "MICFIL PDM channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
396 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
401 struct snd_soc_pcm_runtime *fe = dpcm->fe; in sof_ipc3_pcm_dai_link_fixup()
403 fe->dai_link->trigger[SNDRV_PCM_STREAM_PLAYBACK] = in sof_ipc3_pcm_dai_link_fixup()
408 struct snd_soc_pcm_runtime *fe = dpcm->fe; in sof_ipc3_pcm_dai_link_fixup()
410 fe->dai_link->trigger[SNDRV_PCM_STREAM_CAPTURE] = in sof_ipc3_pcm_dai_link_fixup()
413 rate->min = private->dai_config->acp_sdw.rate; in sof_ipc3_pcm_dai_link_fixup()
414 rate->max = private->dai_config->acp_sdw.rate; in sof_ipc3_pcm_dai_link_fixup()
415 channels->min = private->dai_config->acp_sdw.channels; in sof_ipc3_pcm_dai_link_fixup()
416 channels->max = private->dai_config->acp_sdw.channels; in sof_ipc3_pcm_dai_link_fixup()
418 dev_dbg(component->dev, in sof_ipc3_pcm_dai_link_fixup()
419 "AMD_SDW rate_min: %d rate_max: %d\n", rate->min, rate->max); in sof_ipc3_pcm_dai_link_fixup()
420 dev_dbg(component->dev, "AMD_SDW channels_min: %d channels_max: %d\n", in sof_ipc3_pcm_dai_link_fixup()
421 channels->min, channels->max); in sof_ipc3_pcm_dai_link_fixup()
424 dev_err(component->dev, "Invalid DAI type %d\n", private->dai_config->type); in sof_ipc3_pcm_dai_link_fixup()