Lines Matching refs:stream
54 static int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream)
56 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE)
64 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
66 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
67 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
68 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
75 int stream, in snd_soc_dpcm_check_state() argument
84 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
89 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
107 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
115 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
123 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
132 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()
140 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_prepared() argument
148 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_prepared()
192 int stream, char *buf, size_t size) in dpcm_show_state() argument
194 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
201 stream ? "Capture" : "Playback"); in dpcm_show_state()
204 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
206 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
207 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
218 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
224 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
226 params = &be->dpcm[stream].hw_params; in dpcm_show_state()
233 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
235 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
236 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
253 int stream; in dpcm_state_read_file() local
267 for_each_pcm_streams(stream) in dpcm_state_read_file()
268 if (snd_soc_dai_stream_valid(snd_soc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
269 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
301 static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) in dpcm_create_debugfs_state() argument
306 snd_pcm_direction_name(stream)); in dpcm_create_debugfs_state()
323 int stream) in dpcm_create_debugfs_state() argument
339 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
342 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
345 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
347 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
348 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
350 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
355 int stream, enum snd_soc_dpcm_update state) in dpcm_set_be_update_state() argument
357 be->dpcm[stream].runtime_update = state; in dpcm_set_be_update_state()
374 int stream, int action) in snd_soc_runtime_action() argument
383 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
583 int stream = substream->stream; in soc_pcm_apply_msb() local
588 const struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); in soc_pcm_apply_msb()
598 const struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in soc_pcm_apply_msb()
663 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
683 if (!snd_soc_dai_stream_valid(cpu_dai, stream)) in snd_soc_runtime_calc_hw()
686 cpu_stream = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in snd_soc_runtime_calc_hw()
705 if (!snd_soc_dai_stream_valid(codec_dai, stream)) in snd_soc_runtime_calc_hw()
708 codec_stream = snd_soc_dai_get_pcm_stream(codec_dai, stream); in snd_soc_runtime_calc_hw()
745 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
798 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
942 snd_soc_runtime_activate(rtd, substream->stream); in __soc_pcm_open()
989 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in __soc_pcm_prepare()
995 snd_soc_dapm_stream_event(rtd, substream->stream, in __soc_pcm_prepare()
1000 snd_soc_dai_digital_mute(dai, 0, substream->stream); in __soc_pcm_prepare()
1043 if (snd_soc_dai_stream_active(dai, substream->stream) == 1) { in soc_pcm_hw_clean()
1045 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_clean()
1050 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
1060 if (snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_clean()
1112 unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream); in __soc_pcm_hw_params()
1128 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in __soc_pcm_hw_params()
1156 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in __soc_pcm_hw_params()
1322 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1331 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1336 fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_connect()
1337 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_connect()
1357 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1358 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1362 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_connect()
1363 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1365 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1372 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1378 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1381 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1385 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1390 snd_pcm_direction_name(stream), in dpcm_be_reparent()
1392 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1394 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1401 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1404 struct snd_pcm_substream *substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_disconnect()
1410 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1412 snd_pcm_direction_name(stream), in dpcm_be_disconnect()
1419 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_disconnect()
1420 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1423 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1441 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1455 if (!snd_soc_dpcm_get_substream(be, stream)) in dpcm_get_be()
1459 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1491 int stream; in dpcm_end_walk_at_be() local
1495 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1497 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1499 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1508 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1520 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1526 snd_pcm_direction_name(stream)); in dpcm_path_get()
1529 snd_pcm_direction_name(stream)); in dpcm_path_get()
1539 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1547 struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1560 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1567 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1568 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1572 snd_pcm_direction_name(stream), in dpcm_prune_paths()
1575 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_prune_paths()
1583 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1590 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_add_paths()
1602 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1606 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1614 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1627 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_add_paths()
1628 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_add_paths()
1632 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1641 dpcm_set_be_update_state(be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_add_paths()
1654 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1657 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1659 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1662 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1666 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1667 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_clear_pending_state()
1670 void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_stop() argument
1676 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_stop()
1679 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_stop()
1685 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_stop()
1688 if (be->dpcm[stream].users == 0) { in dpcm_be_dai_stop()
1690 snd_pcm_direction_name(stream), in dpcm_be_dai_stop()
1691 be->dpcm[stream].state); in dpcm_be_dai_stop()
1695 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_stop()
1698 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) { in dpcm_be_dai_stop()
1702 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) { in dpcm_be_dai_stop()
1704 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_stop()
1710 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_stop()
1714 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1716 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_dai_startup()
1722 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1726 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1730 snd_pcm_direction_name(stream)); in dpcm_be_dai_startup()
1735 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1739 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) { in dpcm_be_dai_startup()
1741 snd_pcm_direction_name(stream), in dpcm_be_dai_startup()
1742 be->dpcm[stream].state); in dpcm_be_dai_startup()
1746 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1749 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1750 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1754 snd_pcm_direction_name(stream), be->dai_link->name); in dpcm_be_dai_startup()
1759 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1760 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1762 snd_pcm_direction_name(stream), in dpcm_be_dai_startup()
1763 be->dpcm[stream].state); in dpcm_be_dai_startup()
1765 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1768 be->dpcm[stream].be_start = 0; in dpcm_be_dai_startup()
1769 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1776 dpcm_be_dai_startup_rollback(fe, stream, dpcm); in dpcm_be_dai_startup()
1787 int stream = substream->stream; in dpcm_runtime_setup_fe() local
1803 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_fe()
1806 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_fe()
1823 int stream = substream->stream; in dpcm_runtime_setup_be_format() local
1833 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_format()
1843 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_format()
1846 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_format()
1860 int stream = substream->stream; in dpcm_runtime_setup_be_chan() local
1870 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_chan()
1881 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_chan()
1884 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_chan()
1895 snd_soc_rtd_to_codec(be, 0), stream); in dpcm_runtime_setup_be_chan()
1908 int stream = substream->stream; in dpcm_runtime_setup_be_rate() local
1918 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_rate()
1929 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_rate()
1932 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_rate()
1940 int stream) in dpcm_apply_symmetry() argument
1959 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1962 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1990 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1992 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1994 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
2005 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
2013 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
2017 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
2019 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
2027 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
2031 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
2034 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
2042 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
2044 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
2045 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
2049 void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
2055 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
2059 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
2062 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
2066 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
2070 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
2073 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
2074 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
2075 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
2076 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
2077 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
2078 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
2086 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
2093 int stream = substream->stream; in dpcm_fe_dai_hw_free() local
2096 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
2105 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
2107 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2108 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
2114 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
2121 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2125 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2128 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2132 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2141 memcpy(&be->dpcm[stream].hw_params, &hw_params, in dpcm_be_dai_hw_params()
2145 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2148 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2149 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2150 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2160 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2169 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2171 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2173 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2177 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2180 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2181 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2182 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2183 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2196 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2199 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2201 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2203 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2214 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2216 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2219 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2225 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2234 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2238 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2243 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2251 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2252 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2253 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2254 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2257 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2258 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2261 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_PAUSED) in dpcm_be_dai_trigger()
2268 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2272 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2275 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2278 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2279 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2284 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2288 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2291 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2292 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2293 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2296 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2297 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2299 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2300 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2305 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2309 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2312 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2313 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2316 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2317 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2319 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2323 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2325 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2326 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2329 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2335 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2336 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2338 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2339 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2344 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2345 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2347 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2351 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2354 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2355 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2360 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2364 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2367 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2370 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2371 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2373 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2374 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2379 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2383 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2410 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2415 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2430 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2432 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2434 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2490 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2494 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2497 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2502 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2509 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2514 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2515 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2523 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2528 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2532 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2535 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2538 if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) in dpcm_be_dai_prepare()
2541 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2542 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2543 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2544 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2554 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2563 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2569 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2572 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2582 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2591 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2594 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2600 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2605 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_shutdown()
2607 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2609 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2611 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2614 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2619 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2625 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_startup()
2628 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2629 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2631 fe->dai_link->name, fe->dpcm[stream].state); in dpcm_run_update_startup()
2637 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2642 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2645 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2650 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2653 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2658 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2661 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2662 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2665 ret = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_START); in dpcm_run_update_startup()
2672 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2674 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2677 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2681 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_run_update_startup()
2684 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE || in dpcm_run_update_startup()
2685 be->dpcm[stream].state == SND_SOC_DPCM_STATE_NEW) in dpcm_run_update_startup()
2695 int stream; in soc_dpcm_fe_runtime_update() local
2715 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2718 if (!snd_soc_dai_stream_valid(snd_soc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2719 !snd_soc_dai_stream_valid(snd_soc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2723 if (!snd_soc_dai_stream_active(snd_soc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2724 !snd_soc_dai_stream_active(snd_soc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2727 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2732 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2734 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2736 dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2738 dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2739 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2741 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2742 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2784 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2789 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2792 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2814 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2818 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2823 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2829 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
3073 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
3075 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()