Lines Matching refs: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
220 int stream, int action) in snd_soc_runtime_action() argument
228 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
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()
502 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
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()
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()
727 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
786 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
835 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
841 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
845 snd_soc_dai_digital_mute(dai, 0, substream->stream); in soc_pcm_prepare()
904 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
911 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_hw_params()
916 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in soc_pcm_hw_params()
939 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
970 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in soc_pcm_hw_params()
981 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
1007 int active = snd_soc_dai_stream_active(dai, substream->stream); in soc_pcm_hw_free()
1016 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_free()
1027 if (!snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_free()
1117 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1123 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1134 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1137 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1138 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1142 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1143 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1145 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1152 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1158 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1161 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1163 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1168 stream ? "capture" : "playback", in dpcm_be_reparent()
1170 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1172 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1179 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1184 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1186 stream ? "capture" : "playback", in dpcm_be_disconnect()
1193 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1194 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1197 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1211 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1226 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1258 int stream; in dpcm_end_walk_at_be() local
1262 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1264 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1266 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1274 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1286 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1290 stream ? "capture" : "playback"); in dpcm_path_get()
1300 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1309 widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1322 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1329 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1330 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1334 stream ? "capture" : "playback", in dpcm_prune_paths()
1337 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1345 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1359 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1363 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1371 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1379 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1383 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1392 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1405 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1408 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1410 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1413 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1419 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1420 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1426 int stream) in dpcm_be_dai_startup_unwind() argument
1431 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup_unwind()
1435 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup_unwind()
1437 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1439 stream ? "capture" : "playback", in dpcm_be_dai_startup_unwind()
1440 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1442 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1445 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1450 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1454 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1460 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1464 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1468 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1473 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1477 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1479 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1480 be->dpcm[stream].state); in dpcm_be_dai_startup()
1482 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1485 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1486 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1490 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1492 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1496 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1497 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1499 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1500 be->dpcm[stream].state); in dpcm_be_dai_startup()
1502 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1506 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1514 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_startup()
1517 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1519 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1522 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1524 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1525 be->dpcm[stream].state); in dpcm_be_dai_startup()
1527 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1530 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1535 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1542 struct snd_soc_pcm_stream *stream) in dpcm_init_runtime_hw() argument
1544 runtime->hw.rate_min = stream->rate_min; in dpcm_init_runtime_hw()
1545 runtime->hw.rate_max = min_not_zero(stream->rate_max, UINT_MAX); in dpcm_init_runtime_hw()
1546 runtime->hw.channels_min = stream->channels_min; in dpcm_init_runtime_hw()
1547 runtime->hw.channels_max = stream->channels_max; in dpcm_init_runtime_hw()
1549 runtime->hw.formats &= stream->formats; in dpcm_init_runtime_hw()
1551 runtime->hw.formats = stream->formats; in dpcm_init_runtime_hw()
1552 runtime->hw.rates = stream->rates; in dpcm_init_runtime_hw()
1561 int stream = substream->stream; in dpcm_runtime_merge_format() local
1571 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_format()
1581 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_format()
1584 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_format()
1597 int stream = substream->stream; in dpcm_runtime_merge_chan() local
1607 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_chan()
1619 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_chan()
1622 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_chan()
1635 codec_stream = snd_soc_dai_get_pcm_stream(asoc_rtd_to_codec(be, 0), stream); in dpcm_runtime_merge_chan()
1652 int stream = substream->stream; in dpcm_runtime_merge_rate() local
1662 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_rate()
1673 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_merge_rate()
1676 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_merge_rate()
1697 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in dpcm_set_fe_runtime()
1702 substream->stream)); in dpcm_set_fe_runtime()
1720 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
1723 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1726 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1728 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1729 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1731 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1736 int stream) in dpcm_apply_symmetry() argument
1758 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1761 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1794 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1796 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1798 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1813 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1818 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1825 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1827 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1831 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1836 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_shutdown()
1840 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_shutdown()
1843 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1846 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1848 stream ? "capture" : "playback", in dpcm_be_dai_shutdown()
1849 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1851 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1854 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1855 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { in dpcm_be_dai_shutdown()
1857 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_shutdown()
1866 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1874 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1876 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1879 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1887 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1889 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1890 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1894 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1900 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1904 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1907 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1911 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1915 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1918 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1919 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1920 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1921 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1922 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1923 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1931 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1940 int err, stream = substream->stream; in dpcm_fe_dai_hw_free() local
1943 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1955 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1957 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1958 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1964 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1969 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1973 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1976 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1980 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1989 memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, in dpcm_be_dai_hw_params()
1993 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
1996 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1997 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1998 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2011 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2017 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2020 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2022 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2026 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2029 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2030 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2031 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2032 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2045 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2048 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2050 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2052 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2066 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2068 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2071 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2091 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2097 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2101 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2104 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2109 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2110 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2111 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2118 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2121 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2128 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2131 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2138 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2141 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2142 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2145 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2152 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2155 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2158 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2165 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2168 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2171 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2178 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2202 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2207 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2222 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2224 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2226 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2288 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2292 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2295 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2300 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2307 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2312 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2313 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2321 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2326 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2330 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2333 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2336 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2337 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2338 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2339 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2352 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2360 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2366 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2369 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2376 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2389 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2390 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2393 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2399 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2402 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2403 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2407 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2421 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2426 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2430 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2435 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2440 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2443 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2445 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2450 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2453 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2454 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2458 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2463 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2466 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2471 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2475 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2480 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2483 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2484 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2501 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2512 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2514 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2518 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2520 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2531 int stream; in soc_dpcm_fe_runtime_update() local
2552 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2555 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2556 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2560 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2561 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2564 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2568 stream == SNDRV_PCM_STREAM_PLAYBACK ? in soc_dpcm_fe_runtime_update()
2574 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2576 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2578 ret = dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2580 ret = dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2583 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2585 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2586 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2628 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2631 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2634 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2636 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_cleanup()
2658 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2661 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2663 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2668 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2672 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2678 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2694 int stream; in soc_new_pcm() local
2705 stream = SNDRV_PCM_STREAM_PLAYBACK; in soc_new_pcm()
2708 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_new_pcm()
2722 stream = SNDRV_PCM_STREAM_CAPTURE; in soc_new_pcm()
2725 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_new_pcm()
2882 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2884 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2892 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
2894 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2895 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2896 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2904 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2906 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2912 int stream, in snd_soc_dpcm_check_state() argument
2923 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
2928 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
2947 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
2955 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
2964 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
2973 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()