Lines Matching refs:stream
47 void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream) in snd_soc_runtime_activate() argument
54 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_soc_runtime_activate()
82 void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream) in snd_soc_runtime_deactivate() argument
89 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_soc_runtime_deactivate()
326 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_apply_msb()
367 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
375 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
470 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
544 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
629 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_close()
641 snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream); in soc_pcm_close()
658 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_close()
750 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
756 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
761 substream->stream); in soc_pcm_prepare()
762 snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream); in soc_pcm_prepare()
905 bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in soc_pcm_hw_free()
931 substream->stream); in soc_pcm_hw_free()
1074 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1079 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_connect()
1090 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1092 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1093 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1096 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1097 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1109 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1115 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1118 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1120 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in dpcm_be_reparent()
1125 stream ? "capture" : "playback", in dpcm_be_reparent()
1127 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1129 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1136 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1140 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1142 stream ? "capture" : "playback", in dpcm_be_disconnect()
1149 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1150 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1153 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1166 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1171 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in dpcm_get_be()
1207 stream ? "capture" : "playback", widget->name); in dpcm_get_be()
1212 dai_get_widget(struct snd_soc_dai *dai, int stream) in dai_get_widget() argument
1214 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dai_get_widget()
1234 int stream, struct snd_soc_dapm_widget_list **list_) in dpcm_path_get() argument
1246 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, &list); in dpcm_path_get()
1249 stream ? "capture" : "playback"); in dpcm_path_get()
1255 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1264 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1268 widget = dai_get_widget(dpcm->be->cpu_dai, stream); in dpcm_prune_paths()
1277 widget = dai_get_widget(dai, stream); in dpcm_prune_paths()
1285 stream ? "capture" : "playback", in dpcm_prune_paths()
1288 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1296 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1316 be = dpcm_get_be(card, list->widgets[i], stream); in dpcm_add_paths()
1328 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1332 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1341 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1354 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1357 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1359 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1362 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1366 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1367 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1372 int stream) in dpcm_be_dai_startup_unwind() argument
1377 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1381 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup_unwind()
1383 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1385 stream ? "capture" : "playback", in dpcm_be_dai_startup_unwind()
1386 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1388 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1391 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1396 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1400 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1406 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1410 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1414 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1419 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1423 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1425 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1426 be->dpcm[stream].state); in dpcm_be_dai_startup()
1428 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1431 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1432 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1436 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1438 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1442 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1443 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1445 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1446 be->dpcm[stream].state); in dpcm_be_dai_startup()
1448 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1452 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1460 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1463 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1465 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1468 if (be->dpcm[stream].users == 0) 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_OPEN) in dpcm_be_dai_startup()
1481 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1488 struct snd_soc_pcm_stream *stream) in dpcm_init_runtime_hw() argument
1490 runtime->hw.rate_min = stream->rate_min; in dpcm_init_runtime_hw()
1491 runtime->hw.rate_max = stream->rate_max; in dpcm_init_runtime_hw()
1492 runtime->hw.channels_min = stream->channels_min; in dpcm_init_runtime_hw()
1493 runtime->hw.channels_max = stream->channels_max; in dpcm_init_runtime_hw()
1495 runtime->hw.formats &= stream->formats; in dpcm_init_runtime_hw()
1497 runtime->hw.formats = stream->formats; in dpcm_init_runtime_hw()
1498 runtime->hw.rates = stream->rates; in dpcm_init_runtime_hw()
1508 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_set_fe_runtime()
1522 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
1525 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1528 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1530 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1531 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1533 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1541 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1543 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1545 ret = dpcm_be_dai_startup(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1560 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1565 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1569 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1571 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1575 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1580 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1584 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_shutdown()
1587 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1590 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1592 stream ? "capture" : "playback", in dpcm_be_dai_shutdown()
1593 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1595 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1598 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1599 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) in dpcm_be_dai_shutdown()
1608 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1616 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1618 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1621 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
1629 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1631 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1632 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1636 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1642 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1646 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1649 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1653 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1657 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1660 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1661 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1662 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1663 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1664 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1665 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1673 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1682 int err, stream = substream->stream; in dpcm_fe_dai_hw_free() local
1685 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1697 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1699 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1700 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1706 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1711 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1715 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1718 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1722 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
1725 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1726 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1727 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
1734 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1756 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
1762 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1765 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
1767 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1771 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
1774 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1775 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1776 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
1777 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
1790 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
1793 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
1795 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1797 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
1811 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
1813 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1816 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
1836 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
1842 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1846 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
1849 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
1854 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
1855 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_trigger()
1862 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1865 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
1872 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1875 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
1882 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1885 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1888 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1895 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
1898 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1901 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1908 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
1911 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1914 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1921 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
1933 int stream = substream->stream, ret; in dpcm_fe_dai_do_trigger() local
1934 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
1936 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
1951 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
1956 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
1990 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
1995 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2000 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2007 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2012 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2013 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2021 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2026 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2030 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2033 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2036 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2037 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_prepare()
2050 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2058 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2064 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2067 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2074 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2087 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2088 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2091 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2108 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2111 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2112 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2116 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2130 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2135 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2139 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2144 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2149 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2152 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2154 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2158 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2161 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2162 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2166 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2171 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2174 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2179 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2183 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2188 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2191 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2192 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2209 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2220 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2222 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2225 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2227 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_run_update_startup()
2234 static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_new_update() argument
2238 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_new_update()
2239 ret = dpcm_run_update_startup(fe, stream); in dpcm_run_new_update()
2242 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_new_update()
2247 static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_old_update() argument
2251 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_old_update()
2252 ret = dpcm_run_update_shutdown(fe, stream); in dpcm_run_old_update()
2255 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_old_update()
2396 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2399 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2401 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2407 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2411 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2416 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2419 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_open()
2420 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2423 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2433 int stream = fe_substream->stream, ret; in dpcm_fe_dai_close() local
2439 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2442 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_close()
2444 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2582 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2584 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2592 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
2594 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2595 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2596 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2604 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
2606 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
2612 snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_get_state() argument
2614 return be->dpcm[stream].state; in snd_soc_dpcm_be_get_state()
2620 int stream, enum snd_soc_dpcm_state state) in snd_soc_dpcm_be_set_state() argument
2622 be->dpcm[stream].state = state; in snd_soc_dpcm_be_set_state()
2631 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
2636 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_free_stop()
2641 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_free_stop()
2658 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
2663 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_params()
2668 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_params()
2720 int stream, char *buf, size_t size) in dpcm_show_state() argument
2722 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2729 stream ? "Capture" : "Playback"); in dpcm_show_state()
2732 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
2734 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2735 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
2746 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
2752 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_show_state()
2761 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
2763 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2764 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()