Lines Matching full:stream
62 int stream, char *buf, size_t size) in dpcm_show_state() argument
64 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
72 stream ? "Capture" : "Playback"); in dpcm_show_state()
75 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
77 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
78 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
89 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
96 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
105 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
107 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
108 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
126 int stream; in dpcm_state_read_file() local
139 for_each_pcm_streams(stream) in dpcm_state_read_file()
140 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
141 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
175 static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) in dpcm_create_debugfs_state() argument
180 stream ? "capture" : "playback"); in dpcm_create_debugfs_state()
197 int stream) in dpcm_create_debugfs_state() argument
210 * @stream: Direction of the PCM stream
211 * @action: Activate stream if 1. Deactivate if -1.
215 * Should typically be called when a stream is opened.
220 int stream, int action) in snd_soc_runtime_action() argument
228 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
279 /* DPCM stream event, send event to FE and all active BEs. */
464 int stream = substream->stream; in soc_pcm_apply_msb() local
469 pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); in soc_pcm_apply_msb()
479 pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in soc_pcm_apply_msb()
493 * snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
496 * @stream: Direction of the PCM stream
498 * Calculates the subset of stream parameters supported by all DAIs
499 * associated with the PCM stream.
502 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
520 * Skip CPUs which don't support the current stream type. in snd_soc_runtime_calc_hw()
525 if (!snd_soc_dai_stream_valid(cpu_dai, stream)) in snd_soc_runtime_calc_hw()
528 cpu_stream = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in snd_soc_runtime_calc_hw()
543 * Skip CODECs which don't support the current stream type. in snd_soc_runtime_calc_hw()
548 if (!snd_soc_dai_stream_valid(codec_dai, stream)) in snd_soc_runtime_calc_hw()
551 codec_stream = snd_soc_dai_get_pcm_stream(codec_dai, stream); in snd_soc_runtime_calc_hw()
603 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
656 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
666 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_clean()
764 /* Symmetry only applies if we've already got an active stream. */ in soc_pcm_open()
781 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
829 /* cancel any delayed stream shutdown that is pending */ in soc_pcm_prepare()
830 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
836 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
840 snd_soc_dai_digital_mute(dai, 0, substream->stream); in soc_pcm_prepare()
886 * Skip CODECs which don't support the current stream type, in soc_pcm_hw_params()
899 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
906 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_hw_params()
911 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in soc_pcm_hw_params()
931 * Skip CPUs which don't support the current stream in soc_pcm_hw_params()
934 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
965 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
976 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
1002 int active = snd_soc_dai_stream_active(dai, substream->stream); in soc_pcm_hw_free()
1011 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_free()
1022 if (!snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_free()
1112 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1118 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1129 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1132 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1133 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1137 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1138 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1140 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1147 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1153 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1156 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1160 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1165 stream ? "capture" : "playback", in dpcm_be_reparent()
1167 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1169 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1176 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1181 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1183 stream ? "capture" : "playback", in dpcm_be_disconnect()
1190 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1191 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1194 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1206 /* get BE for DAI widget and stream */
1208 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1223 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1255 int stream; in dpcm_end_walk_at_be() local
1257 /* adjust dir to stream */ in dpcm_end_walk_at_be()
1259 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1261 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1263 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1271 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1283 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1287 stream ? "capture" : "playback"); in dpcm_path_get()
1297 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1306 widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1319 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1326 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1327 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1331 stream ? "capture" : "playback", in dpcm_prune_paths()
1334 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1342 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1356 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1360 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1368 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1376 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1380 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1389 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1402 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1405 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1407 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1410 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1416 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1417 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1423 int stream) in dpcm_be_dai_startup_unwind() argument
1428 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup_unwind()
1432 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup_unwind()
1434 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1436 stream ? "capture" : "playback", in dpcm_be_dai_startup_unwind()
1437 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1439 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1442 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1447 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1451 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1457 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1461 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1464 dev_err(be->dev, "ASoC: no backend %s stream\n", in dpcm_be_dai_startup()
1465 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1470 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1474 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1476 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1477 be->dpcm[stream].state); in dpcm_be_dai_startup()
1479 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1482 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1483 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1487 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1489 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1493 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1494 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1496 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1497 be->dpcm[stream].state); in dpcm_be_dai_startup()
1499 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1503 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1511 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_startup()
1514 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1516 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1519 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1521 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1522 be->dpcm[stream].state); in dpcm_be_dai_startup()
1524 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1527 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1532 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1539 struct snd_soc_pcm_stream *stream) in dpcm_init_runtime_hw() argument
1541 runtime->hw.rate_min = stream->rate_min; in dpcm_init_runtime_hw()
1542 runtime->hw.rate_max = min_not_zero(stream->rate_max, UINT_MAX); in dpcm_init_runtime_hw()
1543 runtime->hw.channels_min = stream->channels_min; in dpcm_init_runtime_hw()
1544 runtime->hw.channels_max = stream->channels_max; in dpcm_init_runtime_hw()
1546 runtime->hw.formats &= stream->formats; in dpcm_init_runtime_hw()
1548 runtime->hw.formats = stream->formats; in dpcm_init_runtime_hw()
1549 runtime->hw.rates = stream->rates; in dpcm_init_runtime_hw()
1558 int stream = substream->stream; in dpcm_runtime_merge_format() local
1568 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_format()
1575 * Skip CODECs which don't support the current stream in dpcm_runtime_merge_format()
1578 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_format()
1581 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_format()
1594 int stream = substream->stream; in dpcm_runtime_merge_chan() local
1604 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_chan()
1613 * Skip CPUs which don't support the current stream in dpcm_runtime_merge_chan()
1616 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_chan()
1619 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_chan()
1632 codec_stream = snd_soc_dai_get_pcm_stream(asoc_rtd_to_codec(be, 0), stream); in dpcm_runtime_merge_chan()
1649 int stream = substream->stream; in dpcm_runtime_merge_rate() local
1659 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_rate()
1667 * Skip DAIs which don't support the current stream in dpcm_runtime_merge_rate()
1670 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_rate()
1673 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_rate()
1691 * Skip CPUs which don't support the current stream in dpcm_set_fe_runtime()
1694 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in dpcm_set_fe_runtime()
1699 substream->stream)); in dpcm_set_fe_runtime()
1711 /* Set FE's runtime_update state; the state is protected via PCM stream lock
1717 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
1720 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1723 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1725 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1726 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1728 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1733 int stream) in dpcm_apply_symmetry() argument
1746 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1755 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1758 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1774 /* Symmetry only applies if we've got an active stream. */ in dpcm_apply_symmetry()
1791 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1793 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1795 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1810 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1815 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1822 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1824 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1828 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1833 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_shutdown()
1837 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_shutdown()
1840 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1843 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1845 stream ? "capture" : "playback", in dpcm_be_dai_shutdown()
1846 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1848 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1851 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1852 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { in dpcm_be_dai_shutdown()
1854 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_shutdown()
1863 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1871 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1873 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1876 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1883 /* run the stream event for each BE */ in dpcm_fe_dai_shutdown()
1884 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1886 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1887 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1891 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1897 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1901 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1904 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1908 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1912 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1915 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1916 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1917 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1918 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1919 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1920 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1928 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1937 int err, stream = substream->stream; in dpcm_fe_dai_hw_free() local
1940 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1952 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1954 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1955 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1961 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1966 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1970 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1973 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1977 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1986 memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, in dpcm_be_dai_hw_params()
1990 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
1993 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1994 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1995 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2008 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2014 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2017 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2019 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2023 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2026 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2027 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2028 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2029 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2042 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2045 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2047 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2049 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2063 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2065 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2068 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2088 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2094 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2098 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2101 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2106 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2107 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2108 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2115 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2118 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2125 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2128 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2135 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2138 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2139 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2142 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2149 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2152 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2155 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2162 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2165 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2168 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2175 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2199 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2204 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2219 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2221 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2223 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2287 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2291 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2294 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2299 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2306 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2311 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2312 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2320 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2325 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2329 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2332 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2335 if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) in dpcm_be_dai_prepare()
2338 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2339 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2340 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2341 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2354 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2362 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2368 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2371 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2378 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2390 /* run the stream event for each BE */ in dpcm_fe_dai_prepare()
2391 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2392 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2395 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2401 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2404 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2405 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2409 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2423 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2428 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2432 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2436 /* run the stream event for each BE */ in dpcm_run_update_shutdown()
2437 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2442 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2445 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2447 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2452 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2455 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2456 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2460 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2465 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2468 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2473 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2477 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2481 /* run the stream event for each BE */ in dpcm_run_update_startup()
2482 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2485 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2486 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2503 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2514 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2516 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2520 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2522 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2533 int stream; in soc_dpcm_fe_runtime_update() local
2554 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2557 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2558 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2562 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2563 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2566 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2570 stream == SNDRV_PCM_STREAM_PLAYBACK ? in soc_dpcm_fe_runtime_update()
2576 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2578 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2580 ret = dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2582 ret = dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2585 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2587 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2588 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2630 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2633 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2636 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2638 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_cleanup()
2660 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2663 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2665 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2670 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2674 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2680 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2696 int stream; in soc_new_pcm() local
2707 stream = SNDRV_PCM_STREAM_PLAYBACK; in soc_new_pcm()
2710 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_new_pcm()
2718 "No CPU DAIs support playback for stream %s\n", in soc_new_pcm()
2724 stream = SNDRV_PCM_STREAM_CAPTURE; in soc_new_pcm()
2727 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_new_pcm()
2735 "No CPU DAIs support capture for stream %s\n", in soc_new_pcm()
2741 /* Adapt stream for codec2codec links */ in soc_new_pcm()
2810 /* DAPM dai link stream work */ in soc_new_pcm()
2884 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2886 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2894 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
2896 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2897 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2898 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2906 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2908 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2914 int stream, in snd_soc_dpcm_check_state() argument
2925 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
2930 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
2946 * are not running, paused or suspended for the specified stream direction.
2949 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
2957 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
2963 * running, paused or suspended for the specified stream direction.
2966 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
2975 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()
2981 * running or paused for the specified stream direction.
2984 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_prepared() argument
2992 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_prepared()