Lines Matching refs:dpcm
175 struct snd_soc_dpcm *dpcm; in dpcm_dapm_stream_event() local
177 list_for_each_entry(dpcm, &fe->dpcm[dir].be_clients, list_be) { in dpcm_dapm_stream_event()
179 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_dapm_stream_event()
1123 struct snd_soc_dpcm *dpcm; in dpcm_be_connect() local
1126 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_connect()
1127 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1131 dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_KERNEL); in dpcm_be_connect()
1132 if (!dpcm) in dpcm_be_connect()
1135 dpcm->be = be; in dpcm_be_connect()
1136 dpcm->fe = fe; in dpcm_be_connect()
1137 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1138 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; in dpcm_be_connect()
1139 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1140 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1148 dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644, in dpcm_be_connect()
1149 fe->debugfs_dpcm_root, &dpcm->state); in dpcm_be_connect()
1158 struct snd_soc_dpcm *dpcm; in dpcm_be_reparent() local
1162 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1167 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in dpcm_be_reparent()
1168 if (dpcm->fe == fe) in dpcm_be_reparent()
1173 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1174 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1176 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1185 struct snd_soc_dpcm *dpcm, *d; in dpcm_be_disconnect() local
1187 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1190 dpcm->be->dai_link->name); in dpcm_be_disconnect()
1192 if (dpcm->state != SND_SOC_DPCM_LINK_STATE_FREE) in dpcm_be_disconnect()
1197 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1200 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1203 debugfs_remove(dpcm->debugfs_state); in dpcm_be_disconnect()
1205 list_del(&dpcm->list_be); in dpcm_be_disconnect()
1206 list_del(&dpcm->list_fe); in dpcm_be_disconnect()
1207 kfree(dpcm); in dpcm_be_disconnect()
1298 struct snd_soc_dpcm *dpcm; in dpcm_prune_paths() local
1304 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1308 widget = dai_get_widget(dpcm->be->cpu_dai, stream); in dpcm_prune_paths()
1315 for (i = 0; i < dpcm->be->num_codecs; i++) { in dpcm_prune_paths()
1316 struct snd_soc_dai *dai = dpcm->be->codec_dais[i]; in dpcm_prune_paths()
1326 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1327 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_prune_paths()
1328 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1373 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1386 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1409 struct snd_soc_dpcm *dpcm; in dpcm_clear_pending_state() local
1411 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1412 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1419 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_startup_unwind() local
1422 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1424 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup_unwind()
1428 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1431 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1433 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1436 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1441 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1447 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_startup() local
1451 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1453 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup()
1468 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1471 be->dpcm[stream].state); in dpcm_be_dai_startup()
1473 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1476 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1477 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1483 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1487 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1488 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1491 be->dpcm[stream].state); in dpcm_be_dai_startup()
1493 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1497 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1505 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1506 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup()
1513 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1516 be->dpcm[stream].state); in dpcm_be_dai_startup()
1518 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1521 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1526 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1550 struct snd_soc_dpcm *dpcm; in dpcm_runtime_base_format() local
1562 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_runtime_base_format()
1563 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_base_format()
1610 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1612 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1613 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1615 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1642 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1659 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_shutdown() local
1662 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1664 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_shutdown()
1672 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1675 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1677 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1680 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1681 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) in dpcm_be_dai_shutdown()
1685 dpcm->fe->dai_link->name); in dpcm_be_dai_shutdown()
1690 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1713 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1720 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_hw_free() local
1724 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1726 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_free()
1739 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
1742 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1743 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1744 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1745 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1746 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1747 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1751 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_free()
1755 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1781 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1790 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_hw_params() local
1793 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1795 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_params()
1807 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1808 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1809 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
1813 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_params()
1816 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1822 &dpcm->hw_params); in dpcm_be_dai_hw_params()
1831 ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params); in dpcm_be_dai_hw_params()
1833 dev_err(dpcm->be->dev, in dpcm_be_dai_hw_params()
1838 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
1844 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1845 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_params()
1856 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1857 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1858 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
1859 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
1877 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1895 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1903 static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm, in dpcm_do_trigger() argument
1908 dev_dbg(dpcm->be->dev, "ASoC: trigger BE %s cmd %d\n", in dpcm_do_trigger()
1909 dpcm->fe->dai_link->name, cmd); in dpcm_do_trigger()
1913 dev_err(dpcm->be->dev,"ASoC: trigger BE failed %d\n", ret); in dpcm_do_trigger()
1921 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_trigger() local
1924 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1926 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_trigger()
1936 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
1937 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_trigger()
1940 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1944 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1947 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
1950 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1954 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1957 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
1960 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1964 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1967 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1973 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1977 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
1980 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1986 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1990 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
1993 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1999 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
2003 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2018 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2072 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2077 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2082 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2094 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2095 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2105 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_prepare() local
2108 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2110 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_prepare()
2118 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2119 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_prepare()
2123 dpcm->fe->dai_link->name); in dpcm_be_dai_prepare()
2132 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2149 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2170 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2235 struct snd_soc_dpcm *dpcm; in dpcm_run_update_startup() local
2243 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2244 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2253 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2261 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2273 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2274 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2307 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2308 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_run_update_startup()
2309 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_run_update_startup()
2310 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_run_update_startup()
2444 struct snd_soc_dpcm *dpcm; in soc_dpcm_be_digital_mute() local
2446 &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients; in soc_dpcm_be_digital_mute()
2448 list_for_each_entry(dpcm, clients, list_be) { in soc_dpcm_be_digital_mute()
2450 struct snd_soc_pcm_runtime *be = dpcm->be; in soc_dpcm_be_digital_mute()
2475 struct snd_soc_dpcm *dpcm; in dpcm_fe_dai_open() local
2481 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2498 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2499 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_open()
2502 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2514 struct snd_soc_dpcm *dpcm; in dpcm_fe_dai_close() local
2521 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2522 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_close()
2526 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2666 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2676 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2677 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2678 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2696 return be->dpcm[stream].state; in snd_soc_dpcm_be_get_state()
2704 be->dpcm[stream].state = state; in snd_soc_dpcm_be_set_state()
2715 struct snd_soc_dpcm *dpcm; in snd_soc_dpcm_can_be_free_stop() local
2718 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_free_stop()
2720 if (dpcm->fe == fe) in snd_soc_dpcm_can_be_free_stop()
2723 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_free_stop()
2742 struct snd_soc_dpcm *dpcm; in snd_soc_dpcm_can_be_params() local
2745 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_params()
2747 if (dpcm->fe == fe) in snd_soc_dpcm_can_be_params()
2750 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_params()
2804 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2805 struct snd_soc_dpcm *dpcm; in dpcm_show_state() local
2814 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
2816 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2817 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
2828 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
2834 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_show_state()
2835 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_show_state()
2836 params = &dpcm->hw_params; in dpcm_show_state()
2843 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
2845 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2846 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()