Lines Matching refs:dpcm
157 struct snd_soc_dpcm *dpcm; in dpcm_dapm_stream_event() local
159 list_for_each_entry(dpcm, &fe->dpcm[dir].be_clients, list_be) { in dpcm_dapm_stream_event()
161 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_dapm_stream_event()
1076 struct snd_soc_dpcm *dpcm; in dpcm_be_connect() local
1079 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_connect()
1080 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1084 dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_KERNEL); in dpcm_be_connect()
1085 if (!dpcm) in dpcm_be_connect()
1088 dpcm->be = be; in dpcm_be_connect()
1089 dpcm->fe = fe; in dpcm_be_connect()
1090 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1091 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; 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()
1101 dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644, in dpcm_be_connect()
1102 fe->debugfs_dpcm_root, &dpcm->state); in dpcm_be_connect()
1111 struct snd_soc_dpcm *dpcm; in dpcm_be_reparent() local
1115 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1120 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in dpcm_be_reparent()
1121 if (dpcm->fe == fe) in dpcm_be_reparent()
1126 dpcm->fe->dai_link->name, 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()
1138 struct snd_soc_dpcm *dpcm, *d; in dpcm_be_disconnect() local
1140 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1143 dpcm->be->dai_link->name); in dpcm_be_disconnect()
1145 if (dpcm->state != SND_SOC_DPCM_LINK_STATE_FREE) 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()
1156 debugfs_remove(dpcm->debugfs_state); in dpcm_be_disconnect()
1158 list_del(&dpcm->list_be); in dpcm_be_disconnect()
1159 list_del(&dpcm->list_fe); in dpcm_be_disconnect()
1160 kfree(dpcm); in dpcm_be_disconnect()
1258 struct snd_soc_dpcm *dpcm; in dpcm_prune_paths() local
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()
1275 for (i = 0; i < dpcm->be->num_codecs; i++) { in dpcm_prune_paths()
1276 struct snd_soc_dai *dai = dpcm->be->codec_dais[i]; in dpcm_prune_paths()
1286 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1287 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_prune_paths()
1288 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1328 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1341 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1364 struct snd_soc_dpcm *dpcm; in dpcm_clear_pending_state() local
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()
1374 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_startup_unwind() local
1377 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1379 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup_unwind()
1383 if (be->dpcm[stream].users == 0) 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()
1402 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_startup() local
1406 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1408 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup()
1423 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) 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()
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()
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()
1461 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup()
1468 if (be->dpcm[stream].users == 0) 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()
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()
1560 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1577 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_shutdown() local
1580 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1582 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_shutdown()
1590 if (be->dpcm[stream].users == 0) 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()
1603 dpcm->fe->dai_link->name); in dpcm_be_dai_shutdown()
1608 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1631 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1638 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_hw_free() local
1642 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1644 struct snd_soc_pcm_runtime *be = dpcm->be; 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()
1669 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_free()
1673 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1699 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1708 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_hw_params() local
1711 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1713 struct snd_soc_pcm_runtime *be = dpcm->be; 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()
1731 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_params()
1734 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1740 &dpcm->hw_params); in dpcm_be_dai_hw_params()
1749 ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params); in dpcm_be_dai_hw_params()
1751 dev_err(dpcm->be->dev, 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()
1763 struct snd_soc_pcm_runtime *be = dpcm->be; 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()
1795 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1813 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1821 static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm, in dpcm_do_trigger() argument
1826 dev_dbg(dpcm->be->dev, "ASoC: trigger BE %s cmd %d\n", in dpcm_do_trigger()
1827 dpcm->fe->dai_link->name, cmd); in dpcm_do_trigger()
1831 dev_err(dpcm->be->dev,"ASoC: trigger BE failed %d\n", ret); in dpcm_do_trigger()
1839 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_trigger() local
1842 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1844 struct snd_soc_pcm_runtime *be = dpcm->be; 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()
1858 ret = dpcm_do_trigger(dpcm, be_substream, cmd); 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()
1868 ret = dpcm_do_trigger(dpcm, be_substream, cmd); 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()
1878 ret = dpcm_do_trigger(dpcm, be_substream, cmd); 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()
1891 ret = dpcm_do_trigger(dpcm, be_substream, cmd); 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()
1904 ret = dpcm_do_trigger(dpcm, be_substream, cmd); 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()
1917 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1921 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
1936 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 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()
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()
2023 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_prepare() local
2026 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2028 struct snd_soc_pcm_runtime *be = dpcm->be; 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()
2041 dpcm->fe->dai_link->name); in dpcm_be_dai_prepare()
2050 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2067 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2088 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2153 struct snd_soc_dpcm *dpcm; in dpcm_run_update_startup() local
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()
2171 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2179 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) 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()
2225 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2226 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_run_update_startup()
2227 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_run_update_startup()
2228 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_run_update_startup()
2362 struct snd_soc_dpcm *dpcm; in soc_dpcm_be_digital_mute() local
2364 &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients; in soc_dpcm_be_digital_mute()
2366 list_for_each_entry(dpcm, clients, list_be) { in soc_dpcm_be_digital_mute()
2368 struct snd_soc_pcm_runtime *be = dpcm->be; in soc_dpcm_be_digital_mute()
2393 struct snd_soc_dpcm *dpcm; in dpcm_fe_dai_open() local
2399 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2416 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2417 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_open()
2420 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2432 struct snd_soc_dpcm *dpcm; in dpcm_fe_dai_close() local
2439 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2440 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_close()
2444 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2584 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
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()
2614 return be->dpcm[stream].state; in snd_soc_dpcm_be_get_state()
2622 be->dpcm[stream].state = state; in snd_soc_dpcm_be_set_state()
2633 struct snd_soc_dpcm *dpcm; in snd_soc_dpcm_can_be_free_stop() local
2636 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_free_stop()
2638 if (dpcm->fe == fe) in snd_soc_dpcm_can_be_free_stop()
2641 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_free_stop()
2660 struct snd_soc_dpcm *dpcm; in snd_soc_dpcm_can_be_params() local
2663 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_params()
2665 if (dpcm->fe == fe) in snd_soc_dpcm_can_be_params()
2668 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_params()
2722 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2723 struct snd_soc_dpcm *dpcm; in dpcm_show_state() local
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()
2753 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_show_state()
2754 params = &dpcm->hw_params; 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()