Lines Matching full:stream
63 int stream, char *buf, size_t size) in dpcm_show_state() argument
65 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
73 stream ? "Capture" : "Playback"); in dpcm_show_state()
76 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
78 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
79 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
90 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
97 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
106 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
108 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
109 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
127 int stream; in dpcm_state_read_file() local
140 for_each_pcm_streams(stream) in dpcm_state_read_file()
141 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
142 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
176 static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) in dpcm_create_debugfs_state() argument
181 stream ? "capture" : "playback"); in dpcm_create_debugfs_state()
198 int stream) in dpcm_create_debugfs_state() argument
211 * @stream: Direction of the PCM stream
212 * @action: Activate stream if 1. Deactivate if -1.
216 * Should typically be called when a stream is opened.
221 int stream, int action) in snd_soc_runtime_action() argument
229 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
280 /* DPCM stream event, send event to FE and all active BEs. */
465 int stream = substream->stream; in soc_pcm_apply_msb() local
470 pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); in soc_pcm_apply_msb()
480 pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in soc_pcm_apply_msb()
494 * snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
497 * @stream: Direction of the PCM stream
499 * Calculates the subset of stream parameters supported by all DAIs
500 * associated with the PCM stream.
503 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
521 * Skip CPUs which don't support the current stream type. in snd_soc_runtime_calc_hw()
526 if (!snd_soc_dai_stream_valid(cpu_dai, stream)) in snd_soc_runtime_calc_hw()
529 cpu_stream = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in snd_soc_runtime_calc_hw()
544 * Skip CODECs which don't support the current stream type. in snd_soc_runtime_calc_hw()
549 if (!snd_soc_dai_stream_valid(codec_dai, stream)) in snd_soc_runtime_calc_hw()
552 codec_stream = snd_soc_dai_get_pcm_stream(codec_dai, stream); in snd_soc_runtime_calc_hw()
604 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
657 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
667 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_clean()
765 /* Symmetry only applies if we've already got an active stream. */ in soc_pcm_open()
782 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
830 /* cancel any delayed stream shutdown that is pending */ in soc_pcm_prepare()
831 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
837 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
841 snd_soc_dai_digital_mute(dai, 0, substream->stream); in soc_pcm_prepare()
887 * Skip CODECs which don't support the current stream type, in soc_pcm_hw_params()
900 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
907 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_hw_params()
912 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in soc_pcm_hw_params()
932 * Skip CPUs which don't support the current stream in soc_pcm_hw_params()
935 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
966 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
977 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
1003 int active = snd_soc_dai_stream_active(dai, substream->stream); in soc_pcm_hw_free()
1012 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_free()
1023 if (!snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_free()
1113 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1119 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1130 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1133 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1134 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1138 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1139 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1141 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1148 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1154 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1157 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1161 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1166 stream ? "capture" : "playback", in dpcm_be_reparent()
1168 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1170 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1177 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1182 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1184 stream ? "capture" : "playback", in dpcm_be_disconnect()
1191 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1192 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1195 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1207 /* get BE for DAI widget and stream */
1209 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1224 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1256 int stream; in dpcm_end_walk_at_be() local
1258 /* adjust dir to stream */ in dpcm_end_walk_at_be()
1260 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1262 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1264 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1272 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1287 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1291 stream ? "capture" : "playback"); in dpcm_path_get()
1301 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1310 widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1323 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1330 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1331 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1335 stream ? "capture" : "playback", in dpcm_prune_paths()
1338 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1346 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1360 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1364 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1372 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1380 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1384 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1393 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1406 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1409 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1411 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1414 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1420 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1421 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1427 int stream) in dpcm_be_dai_startup_unwind() argument
1432 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup_unwind()
1436 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup_unwind()
1438 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1440 stream ? "capture" : "playback", in dpcm_be_dai_startup_unwind()
1441 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1443 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1446 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1451 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1455 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1461 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1465 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1468 dev_err(be->dev, "ASoC: no backend %s stream\n", in dpcm_be_dai_startup()
1469 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1474 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1478 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1480 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1481 be->dpcm[stream].state); in dpcm_be_dai_startup()
1483 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1486 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1487 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1491 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1493 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1497 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1498 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1500 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1501 be->dpcm[stream].state); in dpcm_be_dai_startup()
1503 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1507 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1515 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_startup()
1518 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1520 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1523 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1525 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1526 be->dpcm[stream].state); in dpcm_be_dai_startup()
1528 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1531 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1536 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1543 struct snd_soc_pcm_stream *stream) in dpcm_init_runtime_hw() argument
1545 runtime->hw.rate_min = stream->rate_min; in dpcm_init_runtime_hw()
1546 runtime->hw.rate_max = min_not_zero(stream->rate_max, UINT_MAX); in dpcm_init_runtime_hw()
1547 runtime->hw.channels_min = stream->channels_min; in dpcm_init_runtime_hw()
1548 runtime->hw.channels_max = stream->channels_max; in dpcm_init_runtime_hw()
1550 runtime->hw.formats &= stream->formats; in dpcm_init_runtime_hw()
1552 runtime->hw.formats = stream->formats; in dpcm_init_runtime_hw()
1553 runtime->hw.rates = stream->rates; in dpcm_init_runtime_hw()
1562 int stream = substream->stream; in dpcm_runtime_merge_format() local
1572 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_format()
1579 * Skip CODECs which don't support the current stream in dpcm_runtime_merge_format()
1582 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_format()
1585 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_format()
1598 int stream = substream->stream; in dpcm_runtime_merge_chan() local
1608 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_chan()
1617 * Skip CPUs which don't support the current stream in dpcm_runtime_merge_chan()
1620 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_chan()
1623 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_chan()
1636 codec_stream = snd_soc_dai_get_pcm_stream(asoc_rtd_to_codec(be, 0), stream); in dpcm_runtime_merge_chan()
1653 int stream = substream->stream; in dpcm_runtime_merge_rate() local
1663 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_rate()
1671 * Skip DAIs which don't support the current stream in dpcm_runtime_merge_rate()
1674 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_rate()
1677 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_rate()
1695 * Skip CPUs which don't support the current stream in dpcm_set_fe_runtime()
1698 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in dpcm_set_fe_runtime()
1703 substream->stream)); in dpcm_set_fe_runtime()
1715 /* Set FE's runtime_update state; the state is protected via PCM stream lock
1721 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
1724 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1727 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1729 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1730 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1732 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1737 int stream) in dpcm_apply_symmetry() argument
1750 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1759 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1762 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1778 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1795 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1797 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1799 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1814 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1819 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1826 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1828 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1832 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1837 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_shutdown()
1841 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_shutdown()
1844 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1847 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1849 stream ? "capture" : "playback", in dpcm_be_dai_shutdown()
1850 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1852 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1855 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1856 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { in dpcm_be_dai_shutdown()
1858 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_shutdown()
1867 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1875 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1877 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1880 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1887 /* run the stream event for each BE */ in dpcm_fe_dai_shutdown()
1888 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1890 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1891 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1895 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1901 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1905 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1908 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1912 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1916 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1919 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1920 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1921 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1922 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1923 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1924 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1932 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1941 int err, stream = substream->stream; in dpcm_fe_dai_hw_free() local
1944 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1956 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1958 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1959 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1965 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1970 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1974 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1977 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1981 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1990 memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, in dpcm_be_dai_hw_params()
1994 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
1997 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1998 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1999 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2012 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2018 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2021 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2023 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2027 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2030 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2031 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2032 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2033 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2046 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2049 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2051 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2053 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2067 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2069 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2072 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2092 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2098 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2102 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2105 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2110 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2111 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2112 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2119 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2122 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2129 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2132 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2139 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2142 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2143 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2146 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2153 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2156 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2159 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2166 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2169 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2172 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2179 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2203 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2208 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2223 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2225 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2227 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2291 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2295 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2298 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2303 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2310 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2315 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2316 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2324 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2329 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2333 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2336 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2339 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2340 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2341 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2342 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2355 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2363 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2369 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2372 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2379 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2391 /* run the stream event for each BE */ in dpcm_fe_dai_prepare()
2392 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2393 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2396 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2402 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2405 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2406 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2410 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2424 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2429 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2433 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2437 /* run the stream event for each BE */ in dpcm_run_update_shutdown()
2438 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2443 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2446 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2448 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2453 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2456 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2457 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2461 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2466 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2469 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2474 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2478 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2482 /* run the stream event for each BE */ in dpcm_run_update_startup()
2483 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2486 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2487 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2504 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2515 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2517 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2521 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2523 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2534 int stream; in soc_dpcm_fe_runtime_update() local
2555 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2558 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2559 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2563 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2564 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2567 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2571 stream == SNDRV_PCM_STREAM_PLAYBACK ? in soc_dpcm_fe_runtime_update()
2577 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2579 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2581 ret = dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2583 ret = dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2586 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2588 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2589 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2631 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2634 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2637 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2639 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_cleanup()
2661 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2664 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2666 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2671 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2675 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2681 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2697 int stream; in soc_new_pcm() local
2708 stream = SNDRV_PCM_STREAM_PLAYBACK; in soc_new_pcm()
2711 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_new_pcm()
2719 "No CPU DAIs support playback for stream %s\n", in soc_new_pcm()
2725 stream = SNDRV_PCM_STREAM_CAPTURE; in soc_new_pcm()
2728 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_new_pcm()
2736 "No CPU DAIs support capture for stream %s\n", in soc_new_pcm()
2742 /* Adapt stream for codec2codec links */ in soc_new_pcm()
2811 /* DAPM dai link stream work */ in soc_new_pcm()
2887 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2889 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2897 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
2899 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2900 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2901 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2909 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2911 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2917 int stream, in snd_soc_dpcm_check_state() argument
2928 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
2933 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
2949 * are not running, paused or suspended for the specified stream direction.
2952 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
2960 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
2966 * running, paused or suspended for the specified stream direction.
2969 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
2978 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()