Lines Matching refs:stream

53 						int stream)  in snd_soc_dpcm_stream_lock_irq()  argument
55 snd_pcm_stream_lock_irq(snd_soc_dpcm_get_substream(rtd, stream)); in snd_soc_dpcm_stream_lock_irq()
58 #define snd_soc_dpcm_stream_lock_irqsave_nested(rtd, stream, flags) \ argument
59 snd_pcm_stream_lock_irqsave_nested(snd_soc_dpcm_get_substream(rtd, stream), flags)
62 int stream) in snd_soc_dpcm_stream_unlock_irq() argument
64 snd_pcm_stream_unlock_irq(snd_soc_dpcm_get_substream(rtd, stream)); in snd_soc_dpcm_stream_unlock_irq()
67 #define snd_soc_dpcm_stream_unlock_irqrestore(rtd, stream, flags) \ argument
68 snd_pcm_stream_unlock_irqrestore(snd_soc_dpcm_get_substream(rtd, stream), flags)
111 int stream, char *buf, size_t size) in dpcm_show_state() argument
113 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
120 stream ? "Capture" : "Playback"); in dpcm_show_state()
123 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
125 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
126 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
137 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
143 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
145 params = &be->dpcm[stream].hw_params; in dpcm_show_state()
152 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
154 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
155 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
172 int stream; in dpcm_state_read_file() local
186 for_each_pcm_streams(stream) in dpcm_state_read_file()
187 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
188 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
220 static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) in dpcm_create_debugfs_state() argument
225 stream ? "capture" : "playback"); in dpcm_create_debugfs_state()
242 int stream) in dpcm_create_debugfs_state() argument
258 int stream, enum snd_soc_dpcm_update state) in dpcm_set_fe_update_state() argument
261 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
263 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_set_fe_update_state()
264 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
266 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
267 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
269 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
270 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_set_fe_update_state()
274 int stream, enum snd_soc_dpcm_update state) in dpcm_set_be_update_state() argument
276 be->dpcm[stream].runtime_update = state; in dpcm_set_be_update_state()
293 int stream, int action) in snd_soc_runtime_action() argument
301 snd_soc_dai_action(dai, stream, action); in snd_soc_runtime_action()
493 int stream = substream->stream; in soc_pcm_apply_msb() local
498 struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); in soc_pcm_apply_msb()
508 struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in soc_pcm_apply_msb()
567 struct snd_pcm_hardware *hw, int stream) in snd_soc_runtime_calc_hw() argument
587 if (!snd_soc_dai_stream_valid(cpu_dai, stream)) in snd_soc_runtime_calc_hw()
590 cpu_stream = snd_soc_dai_get_pcm_stream(cpu_dai, stream); in snd_soc_runtime_calc_hw()
608 if (!snd_soc_dai_stream_valid(codec_dai, stream)) in snd_soc_runtime_calc_hw()
611 codec_stream = snd_soc_dai_get_pcm_stream(codec_dai, stream); in snd_soc_runtime_calc_hw()
647 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
700 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
843 snd_soc_runtime_activate(rtd, substream->stream); in __soc_pcm_open()
890 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in __soc_pcm_prepare()
896 snd_soc_dapm_stream_event(rtd, substream->stream, in __soc_pcm_prepare()
901 snd_soc_dai_digital_mute(dai, 0, substream->stream); in __soc_pcm_prepare()
944 if (snd_soc_dai_stream_active(dai, substream->stream) == 1) { in soc_pcm_hw_clean()
946 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_clean()
951 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
961 if (snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_clean()
1013 unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream); in __soc_pcm_hw_params()
1029 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in __soc_pcm_hw_params()
1056 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in __soc_pcm_hw_params()
1224 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_connect() argument
1233 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1238 fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_connect()
1239 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_connect()
1258 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_be_connect()
1259 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1260 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1261 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_be_connect()
1264 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1265 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1267 dpcm_create_debugfs_state(dpcm, stream); in dpcm_be_connect()
1274 struct snd_soc_pcm_runtime *be, int stream) in dpcm_be_reparent() argument
1280 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1283 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_reparent()
1287 for_each_dpcm_fe(be, stream, dpcm) { in dpcm_be_reparent()
1292 stream ? "capture" : "playback", in dpcm_be_reparent()
1294 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1296 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1303 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1310 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_be_disconnect()
1311 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1313 stream ? "capture" : "playback", in dpcm_be_disconnect()
1320 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1321 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1324 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1329 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_be_disconnect()
1342 struct snd_soc_dapm_widget *widget, int stream) in dpcm_get_be() argument
1356 if (!snd_soc_dpcm_get_substream(be, stream)) in dpcm_get_be()
1360 w = snd_soc_dai_get_widget(dai, stream); in dpcm_get_be()
1392 int stream; in dpcm_end_walk_at_be() local
1396 stream = SNDRV_PCM_STREAM_PLAYBACK; in dpcm_end_walk_at_be()
1398 stream = SNDRV_PCM_STREAM_CAPTURE; in dpcm_end_walk_at_be()
1400 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1409 int stream, struct snd_soc_dapm_widget_list **list) in dpcm_path_get() argument
1421 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, in dpcm_path_get()
1427 stream ? "capture" : "playback"); in dpcm_path_get()
1430 stream ? "capture" : "playback"); in dpcm_path_get()
1440 static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream, in dpcm_be_is_active() argument
1448 struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(dai, stream); in dpcm_be_is_active()
1461 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1468 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1469 if (dpcm_be_is_active(dpcm, stream, *list_)) in dpcm_prune_paths()
1473 stream ? "capture" : "playback", in dpcm_prune_paths()
1476 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_prune_paths()
1484 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1491 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_add_paths()
1503 if (stream != SNDRV_PCM_STREAM_PLAYBACK) in dpcm_add_paths()
1507 if (stream != SNDRV_PCM_STREAM_CAPTURE) in dpcm_add_paths()
1515 be = dpcm_get_be(card, widget, stream); in dpcm_add_paths()
1528 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_add_paths()
1529 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_add_paths()
1533 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1542 dpcm_set_be_update_state(be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_add_paths()
1555 int stream, struct snd_soc_dapm_widget_list **list, int new) in dpcm_process_paths() argument
1558 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1560 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1563 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1567 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1568 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_clear_pending_state()
1571 void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_stop() argument
1577 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_stop()
1580 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_stop()
1586 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_stop()
1589 if (be->dpcm[stream].users == 0) { in dpcm_be_dai_stop()
1591 stream ? "capture" : "playback", in dpcm_be_dai_stop()
1592 be->dpcm[stream].state); in dpcm_be_dai_stop()
1596 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_stop()
1599 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) { in dpcm_be_dai_stop()
1603 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) { in dpcm_be_dai_stop()
1605 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_stop()
1611 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_stop()
1615 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1617 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_dai_startup()
1623 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1627 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_startup()
1631 stream ? "capture" : "playback"); in dpcm_be_dai_startup()
1636 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1640 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) { in dpcm_be_dai_startup()
1642 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1643 be->dpcm[stream].state); in dpcm_be_dai_startup()
1647 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1650 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1651 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1655 stream ? "capture" : "playback", be->dai_link->name); in dpcm_be_dai_startup()
1660 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1661 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1663 stream ? "capture" : "playback", in dpcm_be_dai_startup()
1664 be->dpcm[stream].state); in dpcm_be_dai_startup()
1666 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1669 be->dpcm[stream].be_start = 0; in dpcm_be_dai_startup()
1670 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1677 dpcm_be_dai_startup_rollback(fe, stream, dpcm); in dpcm_be_dai_startup()
1688 int stream = substream->stream; in dpcm_runtime_setup_fe() local
1704 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_fe()
1707 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_fe()
1723 int stream = substream->stream; in dpcm_runtime_setup_be_format() local
1733 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_format()
1743 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_format()
1746 codec_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_format()
1759 int stream = substream->stream; in dpcm_runtime_setup_be_chan() local
1769 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_chan()
1780 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_chan()
1783 cpu_stream = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_chan()
1794 asoc_rtd_to_codec(be, 0), stream); in dpcm_runtime_setup_be_chan()
1807 int stream = substream->stream; in dpcm_runtime_setup_be_rate() local
1817 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_rate()
1828 if (!snd_soc_dai_stream_valid(dai, stream)) in dpcm_runtime_setup_be_rate()
1831 pcm = snd_soc_dai_get_pcm_stream(dai, stream); in dpcm_runtime_setup_be_rate()
1839 int stream) in dpcm_apply_symmetry() argument
1858 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1861 snd_soc_dpcm_get_substream(be, stream); in dpcm_apply_symmetry()
1889 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup() local
1891 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1893 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1904 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1912 ret = dpcm_apply_symmetry(fe_substream, stream); in dpcm_fe_dai_startup()
1916 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1918 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1926 int stream = substream->stream; in dpcm_fe_dai_shutdown() local
1930 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1933 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1941 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1943 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1944 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1948 void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1954 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1958 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_free()
1961 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1965 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1969 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1972 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1973 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1974 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1975 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1976 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1977 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1985 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1992 int stream = substream->stream; in dpcm_fe_dai_hw_free() local
1995 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
2004 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
2006 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2007 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
2013 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
2020 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2024 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2027 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2031 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2040 memcpy(&be->dpcm[stream].hw_params, &hw_params, in dpcm_be_dai_hw_params()
2044 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2047 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2048 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2049 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2059 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2068 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2070 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_hw_params()
2072 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2076 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2079 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2080 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2081 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2082 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2095 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params() local
2098 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2100 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2102 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2113 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2115 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2118 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2124 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2133 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2137 be_substream = snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_trigger()
2139 snd_soc_dpcm_stream_lock_irqsave_nested(be, stream, flags); in dpcm_be_dai_trigger()
2142 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2150 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2151 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2152 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2153 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2156 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2157 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2160 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_PAUSED) in dpcm_be_dai_trigger()
2167 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2171 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2174 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2177 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2178 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2183 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2187 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2190 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2191 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2192 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2195 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2196 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2198 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2199 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2204 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2208 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2211 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2212 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2215 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2216 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2218 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2222 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2224 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2225 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2228 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2234 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2235 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2237 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2238 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2243 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2244 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2246 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2250 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2253 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2254 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2259 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2263 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2266 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2269 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2270 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2272 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2273 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2278 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2282 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2286 snd_soc_dpcm_stream_unlock_irqrestore(be, stream, flags); in dpcm_be_dai_trigger()
2309 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2314 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2329 int stream = substream->stream; in dpcm_fe_dai_do_trigger() local
2331 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2333 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2397 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2401 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2404 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2409 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2416 int stream = substream->stream; in dpcm_fe_dai_trigger() local
2421 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2422 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2430 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2435 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2439 snd_soc_dpcm_get_substream(be, stream); in dpcm_be_dai_prepare()
2442 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2445 if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) in dpcm_be_dai_prepare()
2448 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2449 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2450 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2451 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2461 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2470 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare() local
2476 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2479 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2489 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2498 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2501 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2507 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2510 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2511 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2515 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2527 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2530 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2532 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2535 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2540 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2543 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2545 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2549 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2552 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2553 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2555 fe->dai_link->name, fe->dpcm[stream].state); in dpcm_run_update_startup()
2561 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2566 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2569 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2574 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2577 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2582 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2585 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2586 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2601 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2610 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2612 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2615 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2619 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_run_update_startup()
2622 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE || in dpcm_run_update_startup()
2623 be->dpcm[stream].state == SND_SOC_DPCM_STATE_NEW) in dpcm_run_update_startup()
2633 int stream; in soc_dpcm_fe_runtime_update() local
2653 for_each_pcm_streams(stream) { in soc_dpcm_fe_runtime_update()
2656 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2657 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2661 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2662 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2665 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2670 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2672 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2674 dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2676 dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2677 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2679 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2680 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2722 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup() local
2727 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2730 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2752 int stream = fe_substream->stream; in dpcm_fe_dai_open() local
2756 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2761 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2767 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2789 int stream; in soc_get_playback_capture() local
2792 stream = SNDRV_PCM_STREAM_PLAYBACK; in soc_get_playback_capture()
2795 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_get_playback_capture()
2808 stream = SNDRV_PCM_STREAM_CAPTURE; in soc_get_playback_capture()
2811 if (snd_soc_dai_stream_valid(cpu_dai, stream)) { in soc_get_playback_capture()
3016 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
3018 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
3026 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_be_can_update() argument
3028 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
3029 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
3030 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
3038 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_get_substream() argument
3040 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()
3046 int stream, in snd_soc_dpcm_check_state() argument
3055 for_each_dpcm_fe(be, stream, dpcm) { in snd_soc_dpcm_check_state()
3060 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
3078 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_free_stop() argument
3086 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
3095 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_params() argument
3104 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()
3113 struct snd_soc_pcm_runtime *be, int stream) in snd_soc_dpcm_can_be_prepared() argument
3121 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_prepared()