Lines Matching full:stream

71 			       int stream, char *buf, size_t size)  in dpcm_show_state()  argument
73 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
81 stream ? "Capture" : "Playback"); in dpcm_show_state()
84 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
86 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
87 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
98 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
105 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
114 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
116 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
117 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
135 int stream; in dpcm_state_read_file() local
148 for_each_pcm_streams(stream) in dpcm_state_read_file()
149 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
150 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
181 static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) in dpcm_create_debugfs_state() argument
186 stream ? "capture" : "playback"); in dpcm_create_debugfs_state()
203 int stream) in dpcm_create_debugfs_state() argument
212 /* Set FE's runtime_update state; the state is protected via PCM stream lock
219 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
222 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
225 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
227 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
228 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
230 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
235 int stream, enum snd_soc_dpcm_update state) in dpcm_set_be_update_state() argument
237 be->dpcm[stream].runtime_update = state; in dpcm_set_be_update_state()
244 * @stream: Direction of the PCM stream
245 * @action: Activate stream if 1. Deactivate if -1.
249 * Should typically be called when a stream is opened.
254 int stream, int action) in snd_soc_runtime_action() argument
262 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
306 /* DPCM stream event, send event to FE and all active BEs. */
452 int stream = substream->stream; in soc_pcm_apply_msb() local
457 struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); in soc_pcm_apply_msb()
467 struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in soc_pcm_apply_msb()
517 * snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
520 * @stream: Direction of the PCM stream
522 * Calculates the subset of stream parameters supported by all DAIs
523 * associated with the PCM stream.
526 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
541 * Skip CPUs which don't support the current stream type. in snd_soc_runtime_calc_hw()
546 if (!snd_soc_dai_stream_valid(cpu_dai, stream)) in snd_soc_runtime_calc_hw()
549 cpu_stream = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in snd_soc_runtime_calc_hw()
562 * Skip CODECs which don't support the current stream type. in snd_soc_runtime_calc_hw()
567 if (!snd_soc_dai_stream_valid(codec_dai, stream)) in snd_soc_runtime_calc_hw()
570 codec_stream = snd_soc_dai_get_pcm_stream(codec_dai, stream); in snd_soc_runtime_calc_hw()
606 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
659 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
763 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
784 /* Symmetry only applies if we've already got an active stream. */ in soc_pcm_open()
791 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
839 /* cancel any delayed stream shutdown that is pending */ in soc_pcm_prepare()
840 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
846 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
850 snd_soc_dai_digital_mute(dai, 0, substream->stream); in soc_pcm_prepare()
882 int active = snd_soc_dai_stream_active(dai, substream->stream); in soc_pcm_hw_clean()
888 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_clean()
891 /* run the stream event */ in soc_pcm_hw_clean()
892 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
902 if (!snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_clean()
947 * Skip CODECs which don't support the current stream type, in soc_pcm_hw_params()
960 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
967 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_hw_params()
972 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in soc_pcm_hw_params()
988 * Skip CPUs which don't support the current stream in soc_pcm_hw_params()
991 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
1129 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1135 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1146 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1149 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1150 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1154 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1155 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1157 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1164 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1170 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1173 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1175 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1180 stream ? "capture" : "playback", in dpcm_be_reparent()
1182 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1184 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1191 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1196 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1198 stream ? "capture" : "playback", in dpcm_be_disconnect()
1205 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1206 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1209 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1221 /* get BE for DAI widget and stream */
1223 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1238 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1270 int stream; in dpcm_end_walk_at_be() local
1272 /* adjust dir to stream */ in dpcm_end_walk_at_be()
1274 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1276 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1278 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1286 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1298 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1304 stream ? "capture" : "playback"); in dpcm_path_get()
1307 stream ? "capture" : "playback"); in dpcm_path_get()
1317 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1325 struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1338 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1345 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1346 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1350 stream ? "capture" : "playback", in dpcm_prune_paths()
1353 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_prune_paths()
1361 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1375 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1379 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1387 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1395 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1399 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1408 dpcm_set_be_update_state(be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_add_paths()
1421 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1424 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1426 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1429 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1435 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1436 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_clear_pending_state()
1440 void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_stop() argument
1446 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_stop()
1449 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_stop()
1455 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_stop()
1458 if (be->dpcm[stream].users == 0) { in dpcm_be_dai_stop()
1460 stream ? "capture" : "playback", in dpcm_be_dai_stop()
1461 be->dpcm[stream].state); in dpcm_be_dai_stop()
1465 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_stop()
1468 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) { in dpcm_be_dai_stop()
1472 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) { in dpcm_be_dai_stop()
1474 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_stop()
1480 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_stop()
1484 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1491 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1495 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1498 dev_err(be->dev, "ASoC: no backend %s stream\n", in dpcm_be_dai_startup()
1499 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1504 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1508 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) { in dpcm_be_dai_startup()
1510 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1511 be->dpcm[stream].state); in dpcm_be_dai_startup()
1515 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1518 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1519 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1523 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1525 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1528 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1529 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1531 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1532 be->dpcm[stream].state); in dpcm_be_dai_startup()
1534 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1538 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1545 dpcm_be_dai_startup_rollback(fe, stream, dpcm); in dpcm_be_dai_startup()
1559 int stream = substream->stream; in dpcm_runtime_setup_fe() local
1568 * Skip CPUs which don't support the current stream in dpcm_runtime_setup_fe()
1571 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_fe()
1574 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_fe()
1590 int stream = substream->stream; in dpcm_runtime_setup_be_format() local
1600 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_format()
1607 * Skip CODECs which don't support the current stream in dpcm_runtime_setup_be_format()
1610 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_format()
1613 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_format()
1626 int stream = substream->stream; in dpcm_runtime_setup_be_chan() local
1636 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_chan()
1644 * Skip CPUs which don't support the current stream in dpcm_runtime_setup_be_chan()
1647 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_chan()
1650 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_chan()
1661 asoc_rtd_to_codec(be, 0), stream); in dpcm_runtime_setup_be_chan()
1674 int stream = substream->stream; in dpcm_runtime_setup_be_rate() local
1684 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_rate()
1692 * Skip DAIs which don't support the current stream in dpcm_runtime_setup_be_rate()
1695 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_rate()
1698 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_rate()
1706 int stream) in dpcm_apply_symmetry() argument
1718 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1725 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1728 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1742 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1759 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1761 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1763 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1774 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1782 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1786 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1788 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1799 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1801 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1804 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1811 /* run the stream stop event */ in dpcm_fe_dai_shutdown()
1812 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1814 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1815 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1819 void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1825 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1829 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1832 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1836 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1840 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1843 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1844 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1845 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1846 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1847 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1848 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1856 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1863 int stream = substream->stream; in dpcm_fe_dai_hw_free() local
1866 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1875 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1877 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1878 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1884 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1891 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1893 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1896 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1900 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1909 memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, in dpcm_be_dai_hw_params()
1913 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
1916 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1917 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1918 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
1928 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
1937 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1939 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1941 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1945 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
1948 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1949 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1950 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
1951 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
1964 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
1967 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
1969 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
1971 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
1982 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
1984 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1987 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
1996 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2003 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2007 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2010 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2018 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2019 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2020 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2027 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2030 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2037 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2040 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2047 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2050 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2051 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2054 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2061 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2064 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2067 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2074 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2077 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2080 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2087 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2114 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2119 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2134 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2136 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2138 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2202 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2206 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2209 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2214 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2221 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2226 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2227 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2235 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2240 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2244 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2247 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2250 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2251 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2252 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2253 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2263 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2275 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2281 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2284 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2291 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2300 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2303 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2312 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2315 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2316 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2320 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2332 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2335 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2337 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2339 /* run the stream event for each BE */ in dpcm_run_update_shutdown()
2340 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2348 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2351 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2353 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2358 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2361 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2362 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2364 fe->dai_link->name, fe->dpcm[stream].state); in dpcm_run_update_startup()
2370 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2375 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2378 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2383 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2386 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2390 /* run the stream event for each BE */ in dpcm_run_update_startup()
2391 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2394 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2395 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2410 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2419 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2421 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2425 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2429 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_run_update_startup()
2432 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE || in dpcm_run_update_startup()
2433 be->dpcm[stream].state == SND_SOC_DPCM_STATE_NEW) in dpcm_run_update_startup()
2447 int stream; in soc_dpcm_fe_runtime_update() local
2467 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2470 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2471 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2475 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2476 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2479 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2484 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2486 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2488 dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2490 dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2491 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2493 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2494 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2536 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2539 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2542 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2544 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_cleanup()
2566 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2569 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2571 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2576 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2582 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2602 int stream; in soc_get_playback_capture() local
2605 stream = SNDRV_PCM_STREAM_PLAYBACK; in soc_get_playback_capture()
2608 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_get_playback_capture()
2615 "No CPU DAIs support playback for stream %s\n", in soc_get_playback_capture()
2621 stream = SNDRV_PCM_STREAM_CAPTURE; in soc_get_playback_capture()
2624 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_get_playback_capture()
2632 "No CPU DAIs support capture for stream %s\n", in soc_get_playback_capture()
2640 /* Adapt stream for codec2codec links */ in soc_get_playback_capture()
2737 /* DAPM dai link stream work */ in soc_new_pcm()
2809 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2811 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2819 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
2821 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2822 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2823 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2831 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2833 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2839 int stream, in snd_soc_dpcm_check_state() argument
2850 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
2855 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
2871 * are not running, paused or suspended for the specified stream direction.
2874 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
2882 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
2888 * running, paused or suspended for the specified stream direction.
2891 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
2900 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()