Lines Matching refs:stream

42 static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream)  in snd_soc_dai_stream_valid()  argument
46 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_soc_dai_stream_valid()
65 void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream) in snd_soc_runtime_activate() argument
72 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_soc_runtime_activate()
100 void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream) in snd_soc_runtime_deactivate() argument
107 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_soc_runtime_deactivate()
342 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_apply_msb()
383 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
401 substream->stream)) in soc_pcm_init_runtime_hw()
405 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
500 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
574 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
659 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_close()
671 snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream); in soc_pcm_close()
688 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_close()
780 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
786 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
791 substream->stream); in soc_pcm_prepare()
792 snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream); in soc_pcm_prepare()
874 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
952 bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in soc_pcm_hw_free()
978 substream->stream); in soc_pcm_hw_free()
1121 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1126 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_connect()
1137 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1139 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1140 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1143 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1144 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1156 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1162 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1165 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1167 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in dpcm_be_reparent()
1172 stream ? "capture" : "playback", in dpcm_be_reparent()
1174 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1176 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1183 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1187 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1189 stream ? "capture" : "playback", in dpcm_be_disconnect()
1196 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1197 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1200 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1213 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1218 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in dpcm_get_be()
1254 stream ? "capture" : "playback", widget->name); in dpcm_get_be()
1259 dai_get_widget(struct snd_soc_dai *dai, int stream) in dai_get_widget() argument
1261 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dai_get_widget()
1281 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1287 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list); in dpcm_path_get()
1290 stream ? "capture" : "playback"); in dpcm_path_get()
1295 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1304 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1308 widget = dai_get_widget(dpcm->be->cpu_dai, stream); in dpcm_prune_paths()
1317 widget = dai_get_widget(dai, stream); in dpcm_prune_paths()
1325 stream ? "capture" : "playback", in dpcm_prune_paths()
1328 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1336 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1349 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1353 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1361 be = dpcm_get_be(card, list->widgets[i], stream); in dpcm_add_paths()
1373 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1377 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1386 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1399 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1402 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1404 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1407 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1411 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1412 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1417 int stream) in dpcm_be_dai_startup_unwind() argument
1422 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1426 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup_unwind()
1428 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1430 stream ? "capture" : "playback", in dpcm_be_dai_startup_unwind()
1431 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1433 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1436 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1441 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1445 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1451 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1455 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1459 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1464 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1468 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1470 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1471 be->dpcm[stream].state); in dpcm_be_dai_startup()
1473 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1476 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1477 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1481 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1483 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1487 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1488 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1490 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1491 be->dpcm[stream].state); in dpcm_be_dai_startup()
1493 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1497 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1505 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1508 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1510 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1513 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1515 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1516 be->dpcm[stream].state); in dpcm_be_dai_startup()
1518 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1521 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1526 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1533 struct snd_soc_pcm_stream *stream, in dpcm_init_runtime_hw() argument
1536 runtime->hw.rate_min = stream->rate_min; in dpcm_init_runtime_hw()
1537 runtime->hw.rate_max = stream->rate_max; in dpcm_init_runtime_hw()
1538 runtime->hw.channels_min = stream->channels_min; in dpcm_init_runtime_hw()
1539 runtime->hw.channels_max = stream->channels_max; in dpcm_init_runtime_hw()
1541 runtime->hw.formats &= formats & stream->formats; in dpcm_init_runtime_hw()
1543 runtime->hw.formats = formats & stream->formats; in dpcm_init_runtime_hw()
1544 runtime->hw.rates = stream->rates; in dpcm_init_runtime_hw()
1552 int stream = substream->stream; in dpcm_runtime_base_format() local
1562 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_runtime_base_format()
1570 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_runtime_base_format()
1590 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_set_fe_runtime()
1604 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
1607 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1610 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1612 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1613 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1615 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1623 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1625 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1627 ret = dpcm_be_dai_startup(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1642 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1647 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1651 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1653 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1657 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1662 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1666 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_shutdown()
1669 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1672 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1674 stream ? "capture" : "playback", in dpcm_be_dai_shutdown()
1675 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1677 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1680 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1681 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) in dpcm_be_dai_shutdown()
1690 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1698 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1700 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1703 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
1711 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1713 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1714 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1718 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1724 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1728 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1731 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1735 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1739 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1742 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1743 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1744 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1745 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1746 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1747 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1755 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1764 int err, stream = substream->stream; in dpcm_fe_dai_hw_free() local
1767 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1779 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1781 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1782 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1788 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1793 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1797 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1800 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1804 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
1807 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1808 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1809 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
1816 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1838 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
1844 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1847 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1849 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1853 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
1856 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1857 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1858 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
1859 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
1872 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
1875 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
1877 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1879 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
1893 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
1895 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1898 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
1918 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
1924 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1928 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
1931 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
1936 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
1937 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_trigger()
1944 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1947 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
1954 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1957 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
1964 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1967 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1970 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1977 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
1980 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1983 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1990 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
1993 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1996 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2003 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2015 int stream = substream->stream, ret; in dpcm_fe_dai_do_trigger() local
2016 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2018 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2033 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2038 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2072 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2077 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2082 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2089 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2094 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2095 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2103 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2108 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2112 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2115 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2118 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2119 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_prepare()
2132 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2140 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2146 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2149 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2156 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2169 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2170 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2173 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2190 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2193 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2194 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2198 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2212 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2217 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2221 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2226 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2231 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2234 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2236 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2240 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2243 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2244 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2248 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2253 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2256 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2261 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2265 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2270 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2273 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2274 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2291 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2302 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2304 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2307 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2309 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_run_update_startup()
2316 static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_new_update() argument
2320 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_new_update()
2321 ret = dpcm_run_update_startup(fe, stream); in dpcm_run_new_update()
2324 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_new_update()
2329 static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_old_update() argument
2333 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_old_update()
2334 ret = dpcm_run_update_shutdown(fe, stream); in dpcm_run_old_update()
2337 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_old_update()
2478 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2481 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2483 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2489 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2493 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2498 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2501 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_open()
2502 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2505 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2515 int stream = fe_substream->stream, ret; in dpcm_fe_dai_close() local
2521 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2524 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_close()
2526 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2664 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2666 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2674 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
2676 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2677 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2678 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2686 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2688 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2694 snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_get_state() argument
2696 return be->dpcm[stream].state; in snd_soc_dpcm_be_get_state()
2702 int stream, enum snd_soc_dpcm_state state) in snd_soc_dpcm_be_set_state() argument
2704 be->dpcm[stream].state = state; in snd_soc_dpcm_be_set_state()
2713 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
2718 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_free_stop()
2723 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_free_stop()
2740 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
2745 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_params()
2750 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_params()
2802 int stream, char *buf, size_t size) in dpcm_show_state() argument
2804 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2811 stream ? "Capture" : "Playback"); in dpcm_show_state()
2814 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
2816 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2817 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
2828 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
2834 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_show_state()
2843 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
2845 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2846 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()