Lines Matching refs:stream
36 static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream) in snd_soc_dai_stream_valid() argument
40 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_soc_dai_stream_valid()
59 void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream) in snd_soc_runtime_activate() argument
66 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_soc_runtime_activate()
94 void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream) in snd_soc_runtime_deactivate() argument
101 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_soc_runtime_deactivate()
344 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_apply_msb()
385 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
403 substream->stream)) in soc_pcm_init_runtime_hw()
407 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_init_runtime_hw()
536 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in soc_pcm_open()
610 snd_soc_runtime_activate(rtd, substream->stream); in soc_pcm_open()
698 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_close()
710 snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream); in soc_pcm_close()
726 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in soc_pcm_close()
828 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in soc_pcm_prepare()
834 snd_soc_dapm_stream_event(rtd, substream->stream, in soc_pcm_prepare()
839 substream->stream); in soc_pcm_prepare()
840 snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream); in soc_pcm_prepare()
953 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in soc_pcm_hw_params()
1043 bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in soc_pcm_hw_free()
1069 substream->stream); in soc_pcm_hw_free()
1218 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1223 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_connect()
1234 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1236 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1237 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1240 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1241 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1253 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1259 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1262 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1264 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in dpcm_be_reparent()
1269 stream ? "capture" : "playback", in dpcm_be_reparent()
1271 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1273 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1280 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1284 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1286 stream ? "capture" : "playback", in dpcm_be_disconnect()
1293 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1294 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1297 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1310 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1317 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { in dpcm_get_be()
1360 stream ? "capture" : "playback", widget->name); in dpcm_get_be()
1365 dai_get_widget(struct snd_soc_dai *dai, int stream) in dai_get_widget() argument
1367 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dai_get_widget()
1427 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1433 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1437 stream ? "capture" : "playback"); in dpcm_path_get()
1442 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1451 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1455 widget = dai_get_widget(dpcm->be->cpu_dai, stream); in dpcm_prune_paths()
1464 widget = dai_get_widget(dai, stream); in dpcm_prune_paths()
1472 stream ? "capture" : "playback", in dpcm_prune_paths()
1475 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1483 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1496 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1500 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1508 be = dpcm_get_be(card, list->widgets[i], stream); in dpcm_add_paths()
1520 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1524 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1533 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1546 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1549 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1551 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1554 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1558 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1559 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1564 int stream) in dpcm_be_dai_startup_unwind() argument
1569 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1573 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup_unwind()
1575 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1577 stream ? "capture" : "playback", in dpcm_be_dai_startup_unwind()
1578 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1580 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1583 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1588 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1592 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1598 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1602 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1606 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1611 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1615 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1617 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1618 be->dpcm[stream].state); in dpcm_be_dai_startup()
1620 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1623 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1624 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1628 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1630 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1634 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1635 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1637 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1638 be->dpcm[stream].state); in dpcm_be_dai_startup()
1640 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1644 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1652 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1655 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1657 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1660 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1662 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1663 be->dpcm[stream].state); in dpcm_be_dai_startup()
1665 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1668 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1673 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1680 struct snd_soc_pcm_stream *stream) in dpcm_init_runtime_hw() argument
1682 runtime->hw.rate_min = stream->rate_min; in dpcm_init_runtime_hw()
1683 runtime->hw.rate_max = stream->rate_max; in dpcm_init_runtime_hw()
1684 runtime->hw.channels_min = stream->channels_min; in dpcm_init_runtime_hw()
1685 runtime->hw.channels_max = stream->channels_max; in dpcm_init_runtime_hw()
1687 runtime->hw.formats &= stream->formats; in dpcm_init_runtime_hw()
1689 runtime->hw.formats = stream->formats; in dpcm_init_runtime_hw()
1690 runtime->hw.rates = stream->rates; in dpcm_init_runtime_hw()
1698 int stream = substream->stream; in dpcm_runtime_merge_format() local
1708 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_runtime_merge_format()
1720 stream)) in dpcm_runtime_merge_format()
1724 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_runtime_merge_format()
1740 int stream = substream->stream; in dpcm_runtime_merge_chan() local
1750 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_runtime_merge_chan()
1757 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_runtime_merge_chan()
1772 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_runtime_merge_chan()
1792 int stream = substream->stream; in dpcm_runtime_merge_rate() local
1802 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_runtime_merge_rate()
1810 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_runtime_merge_rate()
1825 stream)) in dpcm_runtime_merge_rate()
1829 if (stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_runtime_merge_rate()
1850 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in dpcm_set_fe_runtime()
1870 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
1873 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1876 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1878 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1879 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1881 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1886 int stream) in dpcm_apply_symmetry() argument
1905 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_apply_symmetry()
1908 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1943 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1945 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1947 ret = dpcm_be_dai_startup(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1962 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1967 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1974 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1978 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1980 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1984 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1989 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1993 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_shutdown()
1996 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1999 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
2001 stream ? "capture" : "playback", in dpcm_be_dai_shutdown()
2002 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
2004 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
2007 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
2008 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { in dpcm_be_dai_shutdown()
2010 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_shutdown()
2019 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
2027 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
2029 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
2032 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
2040 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
2042 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
2043 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
2047 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
2053 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
2057 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
2060 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
2064 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
2068 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
2071 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
2072 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
2073 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
2074 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
2075 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
2076 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
2084 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
2093 int err, stream = substream->stream; in dpcm_fe_dai_hw_free() local
2096 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
2108 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
2110 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2111 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
2117 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
2122 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
2126 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2129 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2133 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2149 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2152 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2153 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2154 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2167 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2173 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
2176 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2178 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2182 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2185 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2186 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2187 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2188 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2201 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2204 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2206 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
2208 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
2222 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2224 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2227 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2247 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2253 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
2257 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2260 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2265 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2266 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_trigger()
2273 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2276 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2283 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2286 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2293 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2296 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2299 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2306 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2309 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2312 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2319 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2322 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2325 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2332 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2344 int stream = substream->stream, ret; in dpcm_fe_dai_do_trigger() local
2345 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2347 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2362 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2367 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2401 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2405 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2408 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2413 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2420 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2425 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2426 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2434 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2439 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2443 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2446 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2449 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2450 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2451 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_prepare()
2464 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2472 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2478 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2481 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2488 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2501 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2502 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2505 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2532 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2535 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2536 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2540 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2554 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2559 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2563 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2568 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2573 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2576 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2578 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2582 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2585 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2586 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2590 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2595 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2598 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2603 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2607 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2612 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2615 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2616 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2633 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2644 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2646 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2649 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2651 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_run_update_startup()
2658 static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_new_update() argument
2662 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_new_update()
2663 ret = dpcm_run_update_startup(fe, stream); in dpcm_run_new_update()
2666 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_new_update()
2671 static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_old_update() argument
2675 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_old_update()
2676 ret = dpcm_run_update_shutdown(fe, stream); in dpcm_run_old_update()
2679 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_old_update()
2827 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2830 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2832 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2838 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2842 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2847 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2850 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_open()
2851 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2854 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2864 int stream = fe_substream->stream, ret; in dpcm_fe_dai_close() local
2870 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2873 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_close()
2875 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
3179 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
3181 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
3189 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
3191 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
3192 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
3193 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
3201 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
3203 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
3209 snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_get_state() argument
3211 return be->dpcm[stream].state; in snd_soc_dpcm_be_get_state()
3217 int stream, enum snd_soc_dpcm_state state) in snd_soc_dpcm_be_set_state() argument
3219 be->dpcm[stream].state = state; in snd_soc_dpcm_be_set_state()
3228 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
3233 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_free_stop()
3238 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_free_stop()
3255 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
3260 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_params()
3265 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_params()
3308 int stream, char *buf, size_t size) in dpcm_show_state() argument
3310 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
3317 stream ? "Capture" : "Playback"); in dpcm_show_state()
3320 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
3322 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
3323 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
3334 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
3340 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_show_state()
3349 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
3351 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
3352 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()