Lines Matching refs:substream
137 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, in snd_soc_set_runtime_hwparams() argument
140 struct snd_pcm_runtime *runtime = substream->runtime; in snd_soc_set_runtime_hwparams()
174 static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, in soc_pcm_apply_symmetry() argument
177 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_apply_symmetry()
185 ret = snd_pcm_hw_constraint_minmax(substream->runtime, in soc_pcm_apply_symmetry()
201 ret = snd_pcm_hw_constraint_minmax(substream->runtime, in soc_pcm_apply_symmetry()
218 ret = snd_pcm_hw_constraint_minmax(substream->runtime, in soc_pcm_apply_symmetry()
233 static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, in soc_pcm_params_symmetry() argument
236 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_params_symmetry()
284 static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream) in soc_pcm_has_symmetry() argument
286 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_has_symmetry()
304 static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits) in soc_pcm_set_msb() argument
306 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_set_msb()
312 ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 0, bits); in soc_pcm_set_msb()
318 static void soc_pcm_apply_msb(struct snd_pcm_substream *substream) in soc_pcm_apply_msb() argument
320 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_apply_msb()
326 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_apply_msb()
348 soc_pcm_set_msb(substream, bits); in soc_pcm_apply_msb()
349 soc_pcm_set_msb(substream, cpu_bits); in soc_pcm_apply_msb()
352 static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) in soc_pcm_init_runtime_hw() argument
354 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_init_runtime_hw()
356 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_init_runtime_hw()
367 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
375 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
418 static int soc_pcm_open(struct snd_pcm_substream *substream) in soc_pcm_open() argument
420 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_open()
421 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_open()
440 ret = cpu_dai->driver->ops->startup(substream, cpu_dai); in soc_pcm_open()
449 ret = platform->driver->ops->open(substream); in soc_pcm_open()
460 ret = codec_dai->driver->ops->startup(substream, in soc_pcm_open()
470 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
477 ret = rtd->dai_link->ops->startup(substream); in soc_pcm_open()
490 soc_pcm_init_runtime_hw(substream); in soc_pcm_open()
495 if (soc_pcm_has_symmetry(substream)) in soc_pcm_open()
516 soc_pcm_apply_msb(substream); in soc_pcm_open()
520 ret = soc_pcm_apply_symmetry(substream, cpu_dai); in soc_pcm_open()
527 ret = soc_pcm_apply_symmetry(substream, in soc_pcm_open()
544 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
551 rtd->dai_link->ops->shutdown(substream); in soc_pcm_open()
560 codec_dai->driver->ops->shutdown(substream, codec_dai); in soc_pcm_open()
564 platform->driver->ops->close(substream); in soc_pcm_open()
568 cpu_dai->driver->ops->shutdown(substream, cpu_dai); in soc_pcm_open()
619 static int soc_pcm_close(struct snd_pcm_substream *substream) in soc_pcm_close() argument
621 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_close()
629 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_close()
641 snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream); in soc_pcm_close()
644 cpu_dai->driver->ops->shutdown(substream, cpu_dai); in soc_pcm_close()
649 codec_dai->driver->ops->shutdown(substream, codec_dai); in soc_pcm_close()
653 rtd->dai_link->ops->shutdown(substream); in soc_pcm_close()
656 platform->driver->ops->close(substream); in soc_pcm_close()
658 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_close()
698 static int soc_pcm_prepare(struct snd_pcm_substream *substream) in soc_pcm_prepare() argument
700 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_prepare()
709 ret = rtd->dai_link->ops->prepare(substream); in soc_pcm_prepare()
718 ret = platform->driver->ops->prepare(substream); in soc_pcm_prepare()
729 ret = codec_dai->driver->ops->prepare(substream, in soc_pcm_prepare()
741 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); in soc_pcm_prepare()
750 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
756 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
761 substream->stream); in soc_pcm_prepare()
762 snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream); in soc_pcm_prepare()
780 int soc_dai_hw_params(struct snd_pcm_substream *substream, in soc_dai_hw_params() argument
787 ret = dai->driver->ops->hw_params(substream, params, dai); in soc_dai_hw_params()
803 static int soc_pcm_hw_params(struct snd_pcm_substream *substream, in soc_pcm_hw_params() argument
806 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_hw_params()
813 ret = soc_pcm_params_symmetry(substream, params); in soc_pcm_hw_params()
818 ret = rtd->dai_link->ops->hw_params(substream, params); in soc_pcm_hw_params()
841 ret = soc_dai_hw_params(substream, &codec_params, codec_dai); in soc_pcm_hw_params()
851 ret = soc_dai_hw_params(substream, params, cpu_dai); in soc_pcm_hw_params()
856 ret = platform->driver->ops->hw_params(substream, params); in soc_pcm_hw_params()
876 cpu_dai->driver->ops->hw_free(substream, cpu_dai); in soc_pcm_hw_params()
885 codec_dai->driver->ops->hw_free(substream, codec_dai); in soc_pcm_hw_params()
890 rtd->dai_link->ops->hw_free(substream); in soc_pcm_hw_params()
899 static int soc_pcm_hw_free(struct snd_pcm_substream *substream) in soc_pcm_hw_free() argument
901 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_hw_free()
905 bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in soc_pcm_hw_free()
931 substream->stream); in soc_pcm_hw_free()
936 rtd->dai_link->ops->hw_free(substream); in soc_pcm_hw_free()
940 platform->driver->ops->hw_free(substream); in soc_pcm_hw_free()
946 codec_dai->driver->ops->hw_free(substream, codec_dai); in soc_pcm_hw_free()
950 cpu_dai->driver->ops->hw_free(substream, cpu_dai); in soc_pcm_hw_free()
956 static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) in soc_pcm_trigger() argument
958 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_trigger()
967 ret = codec_dai->driver->ops->trigger(substream, in soc_pcm_trigger()
975 ret = platform->driver->ops->trigger(substream, cmd); in soc_pcm_trigger()
981 ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai); in soc_pcm_trigger()
987 ret = rtd->dai_link->ops->trigger(substream, cmd); in soc_pcm_trigger()
995 static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, in soc_pcm_bespoke_trigger() argument
998 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_bespoke_trigger()
1008 ret = codec_dai->driver->ops->bespoke_trigger(substream, in soc_pcm_bespoke_trigger()
1016 ret = platform->driver->bespoke_trigger(substream, cmd); in soc_pcm_bespoke_trigger()
1022 ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai); in soc_pcm_bespoke_trigger()
1033 static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) in soc_pcm_pointer() argument
1035 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_pointer()
1039 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_pointer()
1046 offset = platform->driver->ops->pointer(substream); in soc_pcm_pointer()
1049 delay += cpu_dai->driver->ops->delay(substream, cpu_dai); in soc_pcm_pointer()
1055 codec_dai->driver->ops->delay(substream, in soc_pcm_pointer()
1065 delay += platform->driver->delay(substream, rtd->codec_dais[0]); in soc_pcm_pointer()
1501 static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) in dpcm_set_fe_runtime() argument
1503 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_set_fe_runtime()
1504 struct snd_soc_pcm_runtime *rtd = substream->private_data; in dpcm_set_fe_runtime()
1508 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_set_fe_runtime()
1514 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
1524 struct snd_pcm_substream *substream = in dpcm_set_fe_update_state() local
1527 snd_pcm_stream_lock_irq(substream); in dpcm_set_fe_update_state()
1529 dpcm_fe_dai_do_trigger(substream, in dpcm_set_fe_update_state()
1534 snd_pcm_stream_unlock_irq(substream); in dpcm_set_fe_update_state()
1613 static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) in dpcm_fe_dai_shutdown() argument
1615 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_shutdown()
1616 int stream = substream->stream; in dpcm_fe_dai_shutdown()
1621 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
1626 soc_pcm_close(substream); in dpcm_fe_dai_shutdown()
1679 static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) in dpcm_fe_dai_hw_free() argument
1681 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_free()
1682 int err, stream = substream->stream; in dpcm_fe_dai_hw_free()
1690 err = soc_pcm_hw_free(substream); in dpcm_fe_dai_hw_free()
1786 static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, in dpcm_fe_dai_hw_params() argument
1789 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_params()
1790 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params()
1795 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1797 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
1808 ret = soc_pcm_hw_params(substream, params); in dpcm_fe_dai_hw_params()
1822 struct snd_pcm_substream *substream, int cmd) in dpcm_do_trigger() argument
1829 ret = soc_pcm_trigger(substream, cmd); in dpcm_do_trigger()
1930 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) in dpcm_fe_dai_do_trigger() argument
1932 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_do_trigger()
1933 int stream = substream->stream, ret; in dpcm_fe_dai_do_trigger()
1945 ret = soc_pcm_trigger(substream, cmd); in dpcm_fe_dai_do_trigger()
1951 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
1956 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
1965 ret = soc_pcm_trigger(substream, cmd); in dpcm_fe_dai_do_trigger()
1973 ret = soc_pcm_bespoke_trigger(substream, cmd); in dpcm_fe_dai_do_trigger()
2004 static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) in dpcm_fe_dai_trigger() argument
2006 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_trigger()
2007 int stream = substream->stream; in dpcm_fe_dai_trigger()
2018 return dpcm_fe_dai_do_trigger(substream, cmd); in dpcm_fe_dai_trigger()
2055 static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) in dpcm_fe_dai_prepare() argument
2057 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_prepare()
2058 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare()
2074 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2079 ret = soc_pcm_prepare(substream); in dpcm_fe_dai_prepare()
2097 static int soc_pcm_ioctl(struct snd_pcm_substream *substream, in soc_pcm_ioctl() argument
2100 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_ioctl()
2104 return platform->driver->ops->ioctl(substream, cmd, arg); in soc_pcm_ioctl()
2105 return snd_pcm_lib_ioctl(substream, cmd, arg); in soc_pcm_ioctl()
2110 struct snd_pcm_substream *substream = in dpcm_run_update_shutdown() local
2123 err = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2151 struct snd_pcm_substream *substream = in dpcm_run_update_startup() local
2200 ret = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START); in dpcm_run_update_startup()
2522 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; in soc_new_pcm()
2524 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; in soc_new_pcm()
2606 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2681 int snd_soc_platform_trigger(struct snd_pcm_substream *substream, in snd_soc_platform_trigger() argument
2685 return platform->driver->ops->trigger(substream, cmd); in snd_soc_platform_trigger()