Lines Matching defs:substream

258  * @substream: the pcm substream
261 * Sets the substream runtime hardware parameters.
263 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
266 struct snd_pcm_runtime *runtime = substream->runtime;
304 static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
307 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
315 ret = snd_pcm_hw_constraint_single(substream->runtime,
331 ret = snd_pcm_hw_constraint_single(substream->runtime,
347 ret = snd_pcm_hw_constraint_single(substream->runtime,
361 static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
364 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
424 static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
426 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
444 static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
446 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
452 ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 0, bits);
458 static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
460 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
464 int stream = substream->stream;
488 soc_pcm_set_msb(substream, bits);
489 soc_pcm_set_msb(substream, cpu_bits);
592 static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream)
594 struct snd_pcm_hardware *hw = &substream->runtime->hw;
595 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
603 snd_soc_runtime_calc_hw(rtd, hw, substream->stream);
609 static int soc_pcm_components_open(struct snd_pcm_substream *substream)
611 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
616 ret = snd_soc_component_module_get_when_open(component, substream);
620 ret = snd_soc_component_open(component, substream);
628 static int soc_pcm_components_close(struct snd_pcm_substream *substream,
631 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
636 r = snd_soc_component_close(component, substream, rollback);
640 snd_soc_component_module_put_when_close(component, substream, rollback);
646 static int soc_pcm_clean(struct snd_pcm_substream *substream, int rollback)
648 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
656 snd_soc_runtime_deactivate(rtd, substream->stream);
659 snd_soc_dai_shutdown(dai, substream, rollback);
661 snd_soc_link_shutdown(substream, rollback);
663 soc_pcm_components_close(substream, rollback);
666 snd_soc_dapm_stream_stop(rtd, substream->stream);
670 snd_soc_pcm_component_pm_runtime_put(rtd, substream, rollback);
680 * Called by ALSA when a PCM substream is closed. Private data can be
684 static int soc_pcm_close(struct snd_pcm_substream *substream)
686 return soc_pcm_clean(substream, 0);
690 * Called by ALSA when a PCM substream is opened, the runtime->hw record is
694 static int soc_pcm_open(struct snd_pcm_substream *substream)
696 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
697 struct snd_pcm_runtime *runtime = substream->runtime;
707 ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);
713 ret = soc_pcm_components_open(substream);
717 ret = snd_soc_link_startup(substream);
723 ret = snd_soc_dai_startup(dai, substream);
733 soc_pcm_init_runtime_hw(substream);
741 if (soc_pcm_has_symmetry(substream))
762 soc_pcm_apply_msb(substream);
767 ret = soc_pcm_apply_symmetry(substream, dai);
781 snd_soc_runtime_activate(rtd, substream->stream);
787 soc_pcm_clean(substream, 1);
803 * Called by ALSA when the PCM substream is prepared, can set format, sample
807 static int soc_pcm_prepare(struct snd_pcm_substream *substream)
809 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
815 ret = snd_soc_link_prepare(substream);
819 ret = snd_soc_pcm_component_prepare(substream);
823 ret = snd_soc_pcm_dai_prepare(substream);
830 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
836 snd_soc_dapm_stream_event(rtd, substream->stream,
840 snd_soc_dai_digital_mute(dai, 0, substream->stream);
863 static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
866 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
874 ret = soc_pcm_params_symmetry(substream, params);
878 ret = snd_soc_link_hw_params(substream, params);
899 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream))
906 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
911 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
916 ret = snd_soc_dai_hw_params(codec_dai, substream,
926 snd_soc_dapm_update_dai(substream, &codec_params, codec_dai);
934 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream))
937 ret = snd_soc_dai_hw_params(cpu_dai, substream, params);
947 snd_soc_dapm_update_dai(substream, params, cpu_dai);
950 ret = snd_soc_pcm_component_hw_params(substream, params, &component);
959 snd_soc_pcm_component_hw_free(substream, component);
965 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream))
968 snd_soc_dai_hw_free(cpu_dai, substream);
976 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream))
979 snd_soc_dai_hw_free(codec_dai, substream);
983 snd_soc_link_hw_free(substream);
992 static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
994 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
1002 int active = snd_soc_dai_stream_active(dai, substream->stream);
1011 snd_soc_dai_digital_mute(dai, 1, substream->stream);
1015 snd_soc_link_hw_free(substream);
1018 snd_soc_pcm_component_hw_free(substream, NULL);
1022 if (!snd_soc_dai_stream_valid(dai, substream->stream))
1025 snd_soc_dai_hw_free(dai, substream);
1032 static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1040 ret = snd_soc_link_trigger(substream, cmd);
1044 ret = snd_soc_pcm_component_trigger(substream, cmd);
1048 ret = snd_soc_pcm_dai_trigger(substream, cmd);
1053 ret = snd_soc_pcm_dai_trigger(substream, cmd);
1057 ret = snd_soc_pcm_component_trigger(substream, cmd);
1061 ret = snd_soc_link_trigger(substream, cmd);
1073 static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
1075 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
1078 struct snd_pcm_runtime *runtime = substream->runtime;
1088 offset = snd_soc_pcm_component_pointer(substream);
1095 snd_soc_dai_delay(cpu_dai, substream));
1101 snd_soc_dai_delay(codec_dai, substream));
1399 * FE substream.
1552 static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
1555 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1558 int stream = substream->stream;
1588 static void dpcm_runtime_merge_chan(struct snd_pcm_substream *substream,
1592 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1594 int stream = substream->stream;
1642 static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
1647 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1649 int stream = substream->stream;
1682 static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
1684 struct snd_pcm_runtime *runtime = substream->runtime;
1685 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
1694 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream))
1699 substream->stream));
1702 dpcm_runtime_merge_format(substream, &runtime->hw.formats);
1703 dpcm_runtime_merge_chan(substream, &runtime->hw.channels_min,
1705 dpcm_runtime_merge_rate(substream, &runtime->hw.rates,
1709 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
1719 struct snd_pcm_substream *substream =
1722 snd_pcm_stream_lock_irq(substream);
1724 dpcm_fe_dai_do_trigger(substream,
1729 snd_pcm_stream_unlock_irq(substream);
1763 /* A backend may not have the requested substream */
1868 static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
1870 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1871 int stream = substream->stream;
1881 soc_pcm_close(substream);
1934 static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
1936 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1937 int err, stream = substream->stream;
1945 err = soc_pcm_hw_free(substream);
2038 static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
2041 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2042 int ret, stream = substream->stream;
2060 ret = soc_pcm_hw_params(substream, params);
2074 struct snd_pcm_substream *substream, int cmd)
2081 ret = soc_pcm_trigger(substream, cmd);
2184 static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream,
2187 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2195 ret = soc_pcm_trigger(substream, cmd);
2199 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd);
2204 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd);
2211 ret = soc_pcm_trigger(substream, cmd);
2216 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
2218 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2219 int stream = substream->stream;
2232 ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
2237 ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
2250 ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
2255 ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
2268 ret = snd_soc_pcm_dai_bespoke_trigger(substream, cmd);
2303 static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
2305 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2306 int stream = substream->stream;
2317 return dpcm_fe_dai_do_trigger(substream, cmd);
2359 static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
2361 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2362 int stream = substream->stream, ret = 0;
2383 ret = soc_pcm_prepare(substream);
2403 struct snd_pcm_substream *substream =
2416 err = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
2444 struct snd_pcm_substream *substream =
2494 ret = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START);
2822 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd;
2824 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd;
2904 /* get the substream for this BE */
2908 return be->pcm->streams[stream].substream;