Lines Matching defs:substream

256 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
260 struct snd_pcm_substream *substream =
265 dpcm_fe_dai_do_trigger(substream,
331 * @substream: the pcm substream
334 * Sets the substream runtime hardware parameters.
336 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
339 substream->runtime->hw = *hw;
386 static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
389 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
401 ret = snd_pcm_hw_constraint_single(substream->runtime, \
419 static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
422 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
453 static void soc_pcm_update_symmetry(struct snd_pcm_substream *substream)
455 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
471 substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX;
474 static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
476 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
482 ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 0, bits);
488 static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
490 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
493 int stream = substream->stream;
517 soc_pcm_set_msb(substream, bits);
518 soc_pcm_set_msb(substream, cpu_bits);
636 static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream)
638 struct snd_pcm_hardware *hw = &substream->runtime->hw;
639 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
647 snd_soc_runtime_calc_hw(rtd, hw, substream->stream);
653 static int soc_pcm_components_open(struct snd_pcm_substream *substream)
655 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
660 ret = snd_soc_component_module_get_when_open(component, substream);
664 ret = snd_soc_component_open(component, substream);
672 static int soc_pcm_components_close(struct snd_pcm_substream *substream,
675 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
680 int r = snd_soc_component_close(component, substream, rollback);
684 snd_soc_component_module_put_when_close(component, substream, rollback);
691 struct snd_pcm_substream *substream, int rollback)
700 snd_soc_runtime_deactivate(rtd, substream->stream);
710 snd_soc_dai_shutdown(dai, substream, rollback);
712 snd_soc_link_shutdown(substream, rollback);
714 soc_pcm_components_close(substream, rollback);
716 snd_soc_pcm_component_pm_runtime_put(rtd, substream, rollback);
726 * Called by ALSA when a PCM substream is closed. Private data can be
731 struct snd_pcm_substream *substream)
733 return soc_pcm_clean(rtd, substream, 0);
737 static int soc_pcm_close(struct snd_pcm_substream *substream)
739 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
742 __soc_pcm_close(rtd, substream);
747 static int soc_hw_sanity_check(struct snd_pcm_substream *substream)
749 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
750 struct snd_pcm_hardware *hw = &substream->runtime->hw;
786 * Called by ALSA when a PCM substream is opened, the runtime->hw record is
791 struct snd_pcm_substream *substream)
802 ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);
806 ret = soc_pcm_components_open(substream);
810 ret = snd_soc_link_startup(substream);
816 ret = snd_soc_dai_startup(dai, substream);
826 soc_pcm_init_runtime_hw(substream);
828 soc_pcm_update_symmetry(substream);
830 ret = soc_hw_sanity_check(substream);
834 soc_pcm_apply_msb(substream);
838 ret = soc_pcm_apply_symmetry(substream, dai);
843 snd_soc_runtime_activate(rtd, substream->stream);
847 soc_pcm_clean(rtd, substream, 1);
853 static int soc_pcm_open(struct snd_pcm_substream *substream)
855 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
859 ret = __soc_pcm_open(rtd, substream);
865 * Called by ALSA when the PCM substream is prepared, can set format, sample
870 struct snd_pcm_substream *substream)
877 ret = snd_soc_link_prepare(substream);
881 ret = snd_soc_pcm_component_prepare(substream);
885 ret = snd_soc_pcm_dai_prepare(substream);
890 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
896 snd_soc_dapm_stream_event(rtd, substream->stream,
901 snd_soc_dai_digital_mute(dai, 0, substream->stream);
909 static int soc_pcm_prepare(struct snd_pcm_substream *substream)
911 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
915 ret = __soc_pcm_prepare(rtd, substream);
932 struct snd_pcm_substream *substream, int rollback)
944 if (snd_soc_dai_stream_active(dai, substream->stream) == 1) {
946 snd_soc_dai_digital_mute(dai, 1, substream->stream);
951 snd_soc_dapm_stream_stop(rtd, substream->stream);
954 snd_soc_link_hw_free(substream, rollback);
957 snd_soc_pcm_component_hw_free(substream, rollback);
961 if (snd_soc_dai_stream_valid(dai, substream->stream))
962 snd_soc_dai_hw_free(dai, substream, rollback);
971 struct snd_pcm_substream *substream)
973 return soc_pcm_hw_clean(rtd, substream, 0);
977 static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
979 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
983 ret = __soc_pcm_hw_free(rtd, substream);
994 struct snd_pcm_substream *substream,
1004 ret = soc_pcm_params_symmetry(substream, params);
1008 ret = snd_soc_link_hw_params(substream, params);
1013 unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream);
1029 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream))
1039 ret = snd_soc_dai_hw_params(codec_dai, substream,
1045 snd_soc_dapm_update_dai(substream, &tmp_params, codec_dai);
1056 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream))
1078 ret = snd_soc_dai_hw_params(cpu_dai, substream, &tmp_params);
1084 snd_soc_dapm_update_dai(substream, &tmp_params, cpu_dai);
1087 ret = snd_soc_pcm_component_hw_params(substream, params);
1090 soc_pcm_hw_clean(rtd, substream, 1);
1096 static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
1099 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
1103 ret = __soc_pcm_hw_params(rtd, substream, params);
1109 static int (* const trigger[][TRIGGER_MAX])(struct snd_pcm_substream *substream, int cmd, int rollback) = {
1122 static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1124 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
1156 r = trigger[start][i](substream, cmd, 0);
1190 r = trigger[stop][i - 1](substream, cmd, rollback);
1204 static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
1206 struct snd_pcm_runtime *runtime = substream->runtime;
1211 offset = snd_soc_pcm_component_pointer(substream);
1214 snd_soc_pcm_dai_delay(substream, &cpu_delay, &codec_delay);
1215 snd_soc_pcm_component_delay(substream, &cpu_delay, &codec_delay);
1552 * FE substream.
1682 static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
1684 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1685 struct snd_pcm_runtime *runtime = substream->runtime;
1688 int stream = substream->stream;
1716 static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream)
1718 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1719 struct snd_pcm_runtime *runtime = substream->runtime;
1723 int stream = substream->stream;
1753 static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
1755 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1756 struct snd_pcm_runtime *runtime = substream->runtime;
1759 int stream = substream->stream;
1801 static void dpcm_runtime_setup_be_rate(struct snd_pcm_substream *substream)
1803 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1804 struct snd_pcm_runtime *runtime = substream->runtime;
1807 int stream = substream->stream;
1865 /* A backend may not have the requested substream */
1923 static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
1925 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1926 int stream = substream->stream;
1938 __soc_pcm_close(fe, substream);
1989 static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
1991 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
1992 int stream = substream->stream;
2000 soc_pcm_hw_clean(fe, substream, 0);
2091 static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
2094 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2095 int ret, stream = substream->stream;
2111 ret = __soc_pcm_hw_params(fe, substream, params);
2294 static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream,
2297 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2305 ret = soc_pcm_trigger(substream, cmd);
2309 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd);
2314 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd);
2321 ret = soc_pcm_trigger(substream, cmd);
2326 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
2328 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2329 int stream = substream->stream;
2342 ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
2347 ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
2360 ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
2365 ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
2378 ret = snd_soc_pcm_dai_bespoke_trigger(substream, cmd);
2413 static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
2415 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2416 int stream = substream->stream;
2427 return dpcm_fe_dai_do_trigger(substream, cmd);
2467 static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
2469 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
2470 int stream = substream->stream, ret = 0;
2494 ret = __soc_pcm_prepare(fe, substream);
2509 struct snd_pcm_substream *substream =
2522 err = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
2542 struct snd_pcm_substream *substream =
2594 ret = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START);
2871 dev_err(rtd->dev, "substream %s has no playback, no capture\n",
2958 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd;
2960 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd;
3036 /* get the substream for this BE */
3040 return be->pcm->streams[stream].substream;