Lines Matching refs:substream

22 static int create_page_table(struct snd_pcm_substream *substream,  in create_page_table()  argument
25 struct snd_soc_pcm_runtime *rtd = substream->private_data; in create_page_table()
30 struct snd_dma_buffer *dmab = snd_pcm_get_dma_buf(substream); in create_page_table()
31 int stream = substream->stream; in create_page_table()
41 static int sof_pcm_dsp_params(struct snd_sof_pcm *spcm, struct snd_pcm_substream *substream, in sof_pcm_dsp_params() argument
46 int ret = snd_sof_ipc_pcm_params(sdev, substream, reply); in sof_pcm_dsp_params()
64 snd_pcm_period_elapsed(sps->substream); in sof_pcm_period_elapsed_work()
70 void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream) in snd_sof_pcm_period_elapsed() argument
72 struct snd_soc_pcm_runtime *rtd = substream->private_data; in snd_sof_pcm_period_elapsed()
93 schedule_work(&spcm->stream[substream->stream].period_elapsed_work); in snd_sof_pcm_period_elapsed()
98 static int sof_pcm_hw_params(struct snd_pcm_substream *substream, in sof_pcm_hw_params() argument
101 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_hw_params()
102 struct snd_pcm_runtime *runtime = substream->runtime; in sof_pcm_hw_params()
120 spcm->pcm.pcm_id, substream->stream); in sof_pcm_hw_params()
125 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); in sof_pcm_hw_params()
138 ret = create_page_table(substream, runtime->dma_area, in sof_pcm_hw_params()
150 pcm.comp_id = spcm->stream[substream->stream].comp_id; in sof_pcm_hw_params()
153 spcm->stream[substream->stream].page_table.addr; in sof_pcm_hw_params()
155 pcm.params.direction = substream->stream; in sof_pcm_hw_params()
188 substream, in sof_pcm_hw_params()
207 ret = sof_pcm_dsp_params(spcm, substream, &ipc_params_reply); in sof_pcm_hw_params()
211 spcm->prepared[substream->stream] = true; in sof_pcm_hw_params()
214 memcpy(&spcm->params[substream->stream], params, sizeof(*params)); in sof_pcm_hw_params()
219 static int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, in sof_pcm_dsp_pcm_free() argument
229 stream.comp_id = spcm->stream[substream->stream].comp_id; in sof_pcm_dsp_pcm_free()
235 spcm->prepared[substream->stream] = false; in sof_pcm_dsp_pcm_free()
240 static int sof_pcm_hw_free(struct snd_pcm_substream *substream) in sof_pcm_hw_free() argument
242 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_hw_free()
258 substream->stream); in sof_pcm_hw_free()
260 if (spcm->prepared[substream->stream]) { in sof_pcm_hw_free()
261 ret = sof_pcm_dsp_pcm_free(substream, sdev, spcm); in sof_pcm_hw_free()
266 snd_pcm_lib_free_pages(substream); in sof_pcm_hw_free()
268 cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work); in sof_pcm_hw_free()
270 ret = snd_sof_pcm_platform_hw_free(sdev, substream); in sof_pcm_hw_free()
279 static int sof_pcm_prepare(struct snd_pcm_substream *substream) in sof_pcm_prepare() argument
281 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_prepare()
296 if (spcm->prepared[substream->stream]) in sof_pcm_prepare()
300 substream->stream); in sof_pcm_prepare()
303 ret = sof_pcm_hw_params(substream, &spcm->params[substream->stream]); in sof_pcm_prepare()
316 static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) in sof_pcm_trigger() argument
318 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_trigger()
338 spcm->pcm.pcm_id, substream->stream, cmd); in sof_pcm_trigger()
342 stream.comp_id = spcm->stream[substream->stream].comp_id; in sof_pcm_trigger()
354 ret = sof_pcm_prepare(substream); in sof_pcm_trigger()
381 snd_sof_pcm_platform_trigger(sdev, substream, cmd); in sof_pcm_trigger()
389 snd_sof_pcm_platform_trigger(sdev, substream, cmd); in sof_pcm_trigger()
393 ret = sof_pcm_dsp_pcm_free(substream, sdev, spcm); in sof_pcm_trigger()
398 static snd_pcm_uframes_t sof_pcm_pointer(struct snd_pcm_substream *substream) in sof_pcm_pointer() argument
400 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_pointer()
413 return sof_ops(sdev)->pcm_pointer(sdev, substream); in sof_pcm_pointer()
420 host = bytes_to_frames(substream->runtime, in sof_pcm_pointer()
421 spcm->stream[substream->stream].posn.host_posn); in sof_pcm_pointer()
422 dai = bytes_to_frames(substream->runtime, in sof_pcm_pointer()
423 spcm->stream[substream->stream].posn.dai_posn); in sof_pcm_pointer()
426 spcm->pcm.pcm_id, substream->stream, host, dai); in sof_pcm_pointer()
431 static int sof_pcm_open(struct snd_pcm_substream *substream) in sof_pcm_open() argument
433 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_open()
434 struct snd_pcm_runtime *runtime = substream->runtime; in sof_pcm_open()
451 substream->stream); in sof_pcm_open()
453 INIT_WORK(&spcm->stream[substream->stream].period_elapsed_work, in sof_pcm_open()
456 caps = &spcm->pcm.caps[substream->stream]; in sof_pcm_open()
459 snd_pcm_hw_constraint_step(substream->runtime, 0, in sof_pcm_open()
462 snd_pcm_hw_constraint_step(substream->runtime, 0, in sof_pcm_open()
494 substream->wait_time = 500; in sof_pcm_open()
496 spcm->stream[substream->stream].posn.host_posn = 0; in sof_pcm_open()
497 spcm->stream[substream->stream].posn.dai_posn = 0; in sof_pcm_open()
498 spcm->stream[substream->stream].substream = substream; in sof_pcm_open()
499 spcm->prepared[substream->stream] = false; in sof_pcm_open()
501 ret = snd_sof_pcm_platform_open(sdev, substream); in sof_pcm_open()
508 static int sof_pcm_close(struct snd_pcm_substream *substream) in sof_pcm_close() argument
510 struct snd_soc_pcm_runtime *rtd = substream->private_data; in sof_pcm_close()
526 substream->stream); in sof_pcm_close()
528 err = snd_sof_pcm_platform_close(sdev, substream); in sof_pcm_close()
588 snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, in sof_pcm_new()
605 snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, in sof_pcm_new()