Lines Matching full:stream
39 static int snd_soc_dpcm_can_fe_update(struct snd_soc_pcm_runtime *fe, int stream)
41 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE)
49 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_update() argument
51 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_can_be_update()
52 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_can_be_update()
53 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_can_be_update()
60 int stream, in snd_soc_dpcm_check_state() argument
69 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
74 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
89 * are not running, paused or suspended for the specified stream direction.
92 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
100 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
105 * running, paused or suspended for the specified stream direction.
108 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
117 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()
122 * running or paused for the specified stream direction.
125 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_prepared() argument
133 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_prepared()
177 int stream, char *buf, size_t size) in dpcm_show_state() argument
179 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
186 stream ? "Capture" : "Playback"); in dpcm_show_state()
189 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
191 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
192 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
203 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
209 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
211 params = &be->dpcm[stream].hw_params; in dpcm_show_state()
218 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
220 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
221 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
238 int stream; in dpcm_state_read_file() local
250 for_each_pcm_streams(stream) in dpcm_state_read_file()
251 if (snd_soc_dai_stream_valid(snd_soc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
252 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
284 static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) in dpcm_create_debugfs_state() argument
289 snd_pcm_direction_name(stream)); in dpcm_create_debugfs_state()
306 int stream) in dpcm_create_debugfs_state() argument
315 /* Set FE's runtime_update state; the state is protected via PCM stream lock
322 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
325 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
328 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
330 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
331 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
333 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
338 int stream, enum snd_soc_dpcm_update state) in dpcm_set_be_update_state() argument
340 be->dpcm[stream].runtime_update = state; in dpcm_set_be_update_state()
347 * @stream: Direction of the PCM stream
348 * @action: Activate stream if 1. Deactivate if -1.
352 * Should typically be called when a stream is opened.
357 int stream, int action) in snd_soc_runtime_action() argument
366 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
402 /* DPCM stream event, send event to FE and all active BEs. */
545 int stream = substream->stream; in soc_pcm_apply_msb() local
550 const struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); in soc_pcm_apply_msb()
560 const struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in soc_pcm_apply_msb()
611 * snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
614 * @stream: Direction of the PCM stream
616 * Calculates the subset of stream parameters supported by all DAIs
617 * associated with the PCM stream.
620 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
635 * Skip CPUs which don't support the current stream type. in snd_soc_runtime_calc_hw()
640 if (!snd_soc_dai_stream_valid(cpu_dai, stream)) in snd_soc_runtime_calc_hw()
643 cpu_stream = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in snd_soc_runtime_calc_hw()
656 * Skip CODECs which don't support the current stream type. in snd_soc_runtime_calc_hw()
661 if (!snd_soc_dai_stream_valid(codec_dai, stream)) in snd_soc_runtime_calc_hw()
664 codec_stream = snd_soc_dai_get_pcm_stream(codec_dai, stream); in snd_soc_runtime_calc_hw()
700 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
753 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
888 /* Symmetry only applies if we've already got an active stream. */ in __soc_pcm_open()
895 snd_soc_runtime_activate(rtd, substream->stream); in __soc_pcm_open()
941 /* cancel any delayed stream shutdown that is pending */ in __soc_pcm_prepare()
942 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in __soc_pcm_prepare()
948 snd_soc_dapm_stream_event(rtd, substream->stream, in __soc_pcm_prepare()
953 snd_soc_dai_digital_mute(dai, 0, substream->stream); in __soc_pcm_prepare()
1009 if (snd_soc_dai_stream_active(dai, substream->stream) == 1) { in soc_pcm_hw_clean()
1011 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_clean()
1015 /* run the stream event */ in soc_pcm_hw_clean()
1016 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
1026 if (snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_clean()
1078 unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream); in __soc_pcm_hw_params()
1081 * Skip CODECs which don't support the current stream type, in __soc_pcm_hw_params()
1094 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in __soc_pcm_hw_params()
1119 * Skip CPUs which don't support the current stream in __soc_pcm_hw_params()
1122 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in __soc_pcm_hw_params()
1288 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1297 for_each_dpcm_be(fe, stream, dpcm) in dpcm_be_connect()
1301 fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_connect()
1302 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_connect()
1322 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1323 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1327 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_connect()
1328 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1330 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1337 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1343 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1346 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1350 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1355 snd_pcm_direction_name(stream), in dpcm_be_reparent()
1357 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1359 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1366 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1369 struct snd_pcm_substream *substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_disconnect()
1375 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1377 snd_pcm_direction_name(stream), in dpcm_be_disconnect()
1384 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_disconnect()
1385 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1388 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1404 /* get BE for DAI widget and stream */
1406 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1420 if (!snd_soc_dpcm_get_substream(be, stream)) in dpcm_get_be()
1424 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1456 int stream; in dpcm_end_walk_at_be() local
1458 /* adjust dir to stream */ in dpcm_end_walk_at_be()
1460 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1462 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1464 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1473 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1483 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1489 snd_pcm_direction_name(stream)); in dpcm_path_get()
1492 snd_pcm_direction_name(stream)); in dpcm_path_get()
1502 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1510 struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1523 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1530 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1531 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1535 snd_pcm_direction_name(stream), in dpcm_prune_paths()
1538 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_prune_paths()
1546 int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1553 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_add_paths()
1565 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1569 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1577 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1591 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_add_paths()
1592 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_add_paths()
1593 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_add_paths()
1594 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_add_paths()
1598 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1607 dpcm_set_be_update_state(be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_add_paths()
1615 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1619 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1620 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_clear_pending_state()
1623 void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_stop() argument
1629 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_stop()
1632 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_stop()
1638 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_stop()
1641 if (be->dpcm[stream].users == 0) { in dpcm_be_dai_stop()
1643 snd_pcm_direction_name(stream), in dpcm_be_dai_stop()
1644 dpcm_state_string(be->dpcm[stream].state)); in dpcm_be_dai_stop()
1648 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_stop()
1651 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) { in dpcm_be_dai_stop()
1655 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) { in dpcm_be_dai_stop()
1657 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_stop()
1663 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_stop()
1667 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1669 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_dai_startup()
1675 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1679 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1682 dev_err(be->dev, "ASoC: no backend %s stream\n", in dpcm_be_dai_startup()
1683 snd_pcm_direction_name(stream)); in dpcm_be_dai_startup()
1688 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_startup()
1692 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) { in dpcm_be_dai_startup()
1694 snd_pcm_direction_name(stream), in dpcm_be_dai_startup()
1695 dpcm_state_string(be->dpcm[stream].state)); in dpcm_be_dai_startup()
1699 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1702 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1703 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1707 snd_pcm_direction_name(stream), be->dai_link->name); in dpcm_be_dai_startup()
1712 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1713 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1715 snd_pcm_direction_name(stream), in dpcm_be_dai_startup()
1716 dpcm_state_string(be->dpcm[stream].state)); in dpcm_be_dai_startup()
1718 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1721 be->dpcm[stream].be_start = 0; in dpcm_be_dai_startup()
1722 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1729 dpcm_be_dai_startup_rollback(fe, stream, dpcm); in dpcm_be_dai_startup()
1740 int stream = substream->stream; in dpcm_runtime_setup_fe() local
1753 * Skip CPUs which don't support the current stream in dpcm_runtime_setup_fe()
1756 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_fe()
1759 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_fe()
1775 int stream = substream->stream; in dpcm_runtime_setup_be_format() local
1785 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_format()
1792 * Skip CODECs which don't support the current stream in dpcm_runtime_setup_be_format()
1795 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_format()
1798 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_format()
1811 int stream = substream->stream; in dpcm_runtime_setup_be_chan() local
1821 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_chan()
1829 * Skip CPUs which don't support the current stream in dpcm_runtime_setup_be_chan()
1832 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_chan()
1835 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_chan()
1846 snd_soc_rtd_to_codec(be, 0), stream); in dpcm_runtime_setup_be_chan()
1859 int stream = substream->stream; in dpcm_runtime_setup_be_rate() local
1869 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_rate()
1877 * Skip DAIs which don't support the current stream in dpcm_runtime_setup_be_rate()
1880 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_rate()
1883 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_rate()
1891 int stream) in dpcm_apply_symmetry() argument
1903 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1910 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1913 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1927 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1941 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1943 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1945 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1956 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1964 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1968 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1970 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1978 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1982 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1985 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1992 /* run the stream stop event */ in dpcm_fe_dai_shutdown()
1993 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1995 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1996 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
2000 void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
2006 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
2010 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
2013 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_hw_free()
2017 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
2021 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
2024 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
2025 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
2026 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
2027 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
2028 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
2029 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
2037 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
2044 int stream = substream->stream; in dpcm_fe_dai_hw_free() local
2047 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
2056 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
2058 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2059 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
2065 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
2072 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2076 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2079 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2083 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2092 memcpy(&be->dpcm[stream].hw_params, &hw_params, in dpcm_be_dai_hw_params()
2096 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2099 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2100 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2101 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2111 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2120 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2122 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2124 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2128 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2131 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2132 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2133 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2134 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2147 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2150 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2152 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2154 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2165 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2167 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2170 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2176 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2185 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2189 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2194 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_trigger()
2202 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2203 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2204 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2205 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2208 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2209 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2212 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_PAUSED) in dpcm_be_dai_trigger()
2219 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2223 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2226 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2229 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2230 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2235 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2239 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2242 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2243 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2247 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2248 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2250 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2251 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2256 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2260 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2263 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2264 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2267 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2268 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2270 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2274 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2276 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2277 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2280 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2286 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2287 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2289 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2290 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2295 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2296 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2298 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2302 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2305 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2306 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2311 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2315 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2318 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2321 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2322 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2324 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2325 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2330 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2334 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2361 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2365 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2381 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2384 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2386 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2426 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2430 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2433 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2438 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2445 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2450 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2451 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2459 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2464 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2468 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2471 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_be_dai_prepare()
2474 if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) in dpcm_be_dai_prepare()
2477 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2478 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2479 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2480 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2490 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2505 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2511 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2513 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2522 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2525 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2537 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2542 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_shutdown()
2544 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2546 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2548 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2550 /* run the stream event for each BE */ in dpcm_run_update_shutdown()
2551 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2556 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2562 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_startup()
2565 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2566 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2568 fe->dai_link->name, dpcm_state_string(fe->dpcm[stream].state)); in dpcm_run_update_startup()
2574 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2579 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2582 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2587 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2590 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2594 /* run the stream event for each BE */ in dpcm_run_update_startup()
2595 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2598 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2599 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2602 ret = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_START); in dpcm_run_update_startup()
2609 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2611 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2614 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2618 if (!snd_soc_dpcm_can_be_update(fe, be, stream)) in dpcm_run_update_startup()
2621 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE || in dpcm_run_update_startup()
2622 be->dpcm[stream].state == SND_SOC_DPCM_STATE_NEW) in dpcm_run_update_startup()
2632 int stream; in soc_dpcm_fe_runtime_update() local
2650 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2653 if (!snd_soc_dai_stream_valid(snd_soc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2654 !snd_soc_dai_stream_valid(snd_soc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2658 if (!snd_soc_dai_stream_active(snd_soc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2659 !snd_soc_dai_stream_active(snd_soc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2662 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2672 count = dpcm_add_paths(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2674 count = dpcm_prune_paths(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2676 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2678 dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2680 dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2681 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2683 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2684 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2727 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2732 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2735 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2757 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2761 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2766 dpcm_add_paths(fe, stream, &list); in dpcm_fe_dai_open()
2769 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_open()
2783 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2809 /* Adapt stream for codec2codec links */ in soc_get_playback_capture()
2916 /* DAPM dai link stream work */ in soc_new_pcm()
2992 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2994 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()