Lines Matching refs:substream

155 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,  in snd_soc_set_runtime_hwparams()  argument
158 struct snd_pcm_runtime *runtime = substream->runtime; in snd_soc_set_runtime_hwparams()
192 static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, in soc_pcm_apply_symmetry() argument
195 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_apply_symmetry()
203 ret = snd_pcm_hw_constraint_single(substream->runtime, in soc_pcm_apply_symmetry()
219 ret = snd_pcm_hw_constraint_single(substream->runtime, in soc_pcm_apply_symmetry()
235 ret = snd_pcm_hw_constraint_single(substream->runtime, in soc_pcm_apply_symmetry()
249 static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, in soc_pcm_params_symmetry() argument
252 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_params_symmetry()
300 static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream) in soc_pcm_has_symmetry() argument
302 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_has_symmetry()
320 static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits) in soc_pcm_set_msb() argument
322 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_set_msb()
328 ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 0, bits); in soc_pcm_set_msb()
334 static void soc_pcm_apply_msb(struct snd_pcm_substream *substream) in soc_pcm_apply_msb() argument
336 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_apply_msb()
342 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_apply_msb()
364 soc_pcm_set_msb(substream, bits); in soc_pcm_apply_msb()
365 soc_pcm_set_msb(substream, cpu_bits); in soc_pcm_apply_msb()
368 static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) in soc_pcm_init_runtime_hw() argument
370 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_init_runtime_hw()
372 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_init_runtime_hw()
383 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
401 substream->stream)) in soc_pcm_init_runtime_hw()
405 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
448 static int soc_pcm_open(struct snd_pcm_substream *substream) in soc_pcm_open() argument
450 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_open()
451 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_open()
470 ret = cpu_dai->driver->ops->startup(substream, cpu_dai); in soc_pcm_open()
479 ret = platform->driver->ops->open(substream); in soc_pcm_open()
490 ret = codec_dai->driver->ops->startup(substream, in soc_pcm_open()
500 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
507 ret = rtd->dai_link->ops->startup(substream); in soc_pcm_open()
520 soc_pcm_init_runtime_hw(substream); in soc_pcm_open()
525 if (soc_pcm_has_symmetry(substream)) in soc_pcm_open()
546 soc_pcm_apply_msb(substream); in soc_pcm_open()
550 ret = soc_pcm_apply_symmetry(substream, cpu_dai); in soc_pcm_open()
557 ret = soc_pcm_apply_symmetry(substream, in soc_pcm_open()
574 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
581 rtd->dai_link->ops->shutdown(substream); in soc_pcm_open()
590 codec_dai->driver->ops->shutdown(substream, codec_dai); in soc_pcm_open()
594 platform->driver->ops->close(substream); in soc_pcm_open()
598 cpu_dai->driver->ops->shutdown(substream, cpu_dai); in soc_pcm_open()
649 static int soc_pcm_close(struct snd_pcm_substream *substream) in soc_pcm_close() argument
651 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_close()
659 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_close()
671 snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream); in soc_pcm_close()
674 cpu_dai->driver->ops->shutdown(substream, cpu_dai); in soc_pcm_close()
679 codec_dai->driver->ops->shutdown(substream, codec_dai); in soc_pcm_close()
683 rtd->dai_link->ops->shutdown(substream); in soc_pcm_close()
686 platform->driver->ops->close(substream); in soc_pcm_close()
688 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_close()
728 static int soc_pcm_prepare(struct snd_pcm_substream *substream) in soc_pcm_prepare() argument
730 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_prepare()
739 ret = rtd->dai_link->ops->prepare(substream); in soc_pcm_prepare()
748 ret = platform->driver->ops->prepare(substream); in soc_pcm_prepare()
759 ret = codec_dai->driver->ops->prepare(substream, in soc_pcm_prepare()
771 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); in soc_pcm_prepare()
780 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
786 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
791 substream->stream); in soc_pcm_prepare()
792 snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream); in soc_pcm_prepare()
810 int soc_dai_hw_params(struct snd_pcm_substream *substream, in soc_dai_hw_params() argument
817 ret = dai->driver->ops->hw_params(substream, params, dai); in soc_dai_hw_params()
833 static int soc_pcm_hw_params(struct snd_pcm_substream *substream, in soc_pcm_hw_params() argument
836 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_hw_params()
843 ret = soc_pcm_params_symmetry(substream, params); in soc_pcm_hw_params()
848 ret = rtd->dai_link->ops->hw_params(substream, params); in soc_pcm_hw_params()
874 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
888 ret = soc_dai_hw_params(substream, &codec_params, codec_dai); in soc_pcm_hw_params()
898 ret = soc_dai_hw_params(substream, params, cpu_dai); in soc_pcm_hw_params()
903 ret = platform->driver->ops->hw_params(substream, params); in soc_pcm_hw_params()
923 cpu_dai->driver->ops->hw_free(substream, cpu_dai); in soc_pcm_hw_params()
932 codec_dai->driver->ops->hw_free(substream, codec_dai); in soc_pcm_hw_params()
937 rtd->dai_link->ops->hw_free(substream); in soc_pcm_hw_params()
946 static int soc_pcm_hw_free(struct snd_pcm_substream *substream) in soc_pcm_hw_free() argument
948 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_hw_free()
952 bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in soc_pcm_hw_free()
978 substream->stream); in soc_pcm_hw_free()
983 rtd->dai_link->ops->hw_free(substream); in soc_pcm_hw_free()
987 platform->driver->ops->hw_free(substream); in soc_pcm_hw_free()
993 codec_dai->driver->ops->hw_free(substream, codec_dai); in soc_pcm_hw_free()
997 cpu_dai->driver->ops->hw_free(substream, cpu_dai); in soc_pcm_hw_free()
1003 static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) in soc_pcm_trigger() argument
1005 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_trigger()
1014 ret = codec_dai->driver->ops->trigger(substream, in soc_pcm_trigger()
1022 ret = platform->driver->ops->trigger(substream, cmd); in soc_pcm_trigger()
1028 ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai); in soc_pcm_trigger()
1034 ret = rtd->dai_link->ops->trigger(substream, cmd); in soc_pcm_trigger()
1042 static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, in soc_pcm_bespoke_trigger() argument
1045 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_bespoke_trigger()
1055 ret = codec_dai->driver->ops->bespoke_trigger(substream, in soc_pcm_bespoke_trigger()
1063 ret = platform->driver->bespoke_trigger(substream, cmd); in soc_pcm_bespoke_trigger()
1069 ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai); in soc_pcm_bespoke_trigger()
1080 static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) in soc_pcm_pointer() argument
1082 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_pointer()
1086 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_pointer()
1093 offset = platform->driver->ops->pointer(substream); in soc_pcm_pointer()
1096 delay += cpu_dai->driver->ops->delay(substream, cpu_dai); in soc_pcm_pointer()
1102 codec_dai->driver->ops->delay(substream, in soc_pcm_pointer()
1112 delay += platform->driver->delay(substream, rtd->codec_dais[0]); in soc_pcm_pointer()
1547 static u64 dpcm_runtime_base_format(struct snd_pcm_substream *substream) in dpcm_runtime_base_format() argument
1549 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_runtime_base_format()
1552 int stream = substream->stream; in dpcm_runtime_base_format()
1582 static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) in dpcm_set_fe_runtime() argument
1584 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_set_fe_runtime()
1585 struct snd_soc_pcm_runtime *rtd = substream->private_data; in dpcm_set_fe_runtime()
1588 u64 format = dpcm_runtime_base_format(substream); in dpcm_set_fe_runtime()
1590 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_set_fe_runtime()
1596 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
1606 struct snd_pcm_substream *substream = in dpcm_set_fe_update_state() local
1609 snd_pcm_stream_lock_irq(substream); in dpcm_set_fe_update_state()
1611 dpcm_fe_dai_do_trigger(substream, in dpcm_set_fe_update_state()
1616 snd_pcm_stream_unlock_irq(substream); in dpcm_set_fe_update_state()
1695 static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) in dpcm_fe_dai_shutdown() argument
1697 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_shutdown()
1698 int stream = substream->stream; in dpcm_fe_dai_shutdown()
1703 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
1708 soc_pcm_close(substream); in dpcm_fe_dai_shutdown()
1761 static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) in dpcm_fe_dai_hw_free() argument
1763 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_free()
1764 int err, stream = substream->stream; in dpcm_fe_dai_hw_free()
1772 err = soc_pcm_hw_free(substream); in dpcm_fe_dai_hw_free()
1868 static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, in dpcm_fe_dai_hw_params() argument
1871 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_params()
1872 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params()
1877 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1879 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
1890 ret = soc_pcm_hw_params(substream, params); in dpcm_fe_dai_hw_params()
1904 struct snd_pcm_substream *substream, int cmd) in dpcm_do_trigger() argument
1911 ret = soc_pcm_trigger(substream, cmd); in dpcm_do_trigger()
2012 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) in dpcm_fe_dai_do_trigger() argument
2014 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_do_trigger()
2015 int stream = substream->stream, ret; in dpcm_fe_dai_do_trigger()
2027 ret = soc_pcm_trigger(substream, cmd); in dpcm_fe_dai_do_trigger()
2033 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2038 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2047 ret = soc_pcm_trigger(substream, cmd); in dpcm_fe_dai_do_trigger()
2055 ret = soc_pcm_bespoke_trigger(substream, cmd); in dpcm_fe_dai_do_trigger()
2086 static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) in dpcm_fe_dai_trigger() argument
2088 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_trigger()
2089 int stream = substream->stream; in dpcm_fe_dai_trigger()
2100 return dpcm_fe_dai_do_trigger(substream, cmd); in dpcm_fe_dai_trigger()
2137 static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) in dpcm_fe_dai_prepare() argument
2139 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_prepare()
2140 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare()
2156 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2161 ret = soc_pcm_prepare(substream); in dpcm_fe_dai_prepare()
2179 static int soc_pcm_ioctl(struct snd_pcm_substream *substream, in soc_pcm_ioctl() argument
2182 struct snd_soc_pcm_runtime *rtd = substream->private_data; in soc_pcm_ioctl()
2186 return platform->driver->ops->ioctl(substream, cmd, arg); in soc_pcm_ioctl()
2187 return snd_pcm_lib_ioctl(substream, cmd, arg); in soc_pcm_ioctl()
2192 struct snd_pcm_substream *substream = in dpcm_run_update_shutdown() local
2205 err = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2233 struct snd_pcm_substream *substream = in dpcm_run_update_startup() local
2282 ret = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START); in dpcm_run_update_startup()
2604 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; in soc_new_pcm()
2606 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; in soc_new_pcm()
2688 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2763 int snd_soc_platform_trigger(struct snd_pcm_substream *substream, in snd_soc_platform_trigger() argument
2767 return platform->driver->ops->trigger(substream, cmd); in snd_soc_platform_trigger()