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()
167 (be->dpcm[dir].users >= 1)) in dpcm_dapm_stream_event()
1092 struct snd_soc_dpcm *dpcm; in dpcm_be_connect() local
1095 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_connect()
1096 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1100 dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_KERNEL); in dpcm_be_connect()
1101 if (!dpcm) in dpcm_be_connect()
1104 dpcm->be = be; in dpcm_be_connect()
1105 dpcm->fe = fe; in dpcm_be_connect()
1106 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1107 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; in dpcm_be_connect()
1108 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1109 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1116 dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644, in dpcm_be_connect()
1117 fe->debugfs_dpcm_root, &dpcm->state); in dpcm_be_connect()
1126 struct snd_soc_dpcm *dpcm; in dpcm_be_reparent() local
1130 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1135 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in dpcm_be_reparent()
1136 if (dpcm->fe == fe) in dpcm_be_reparent()
1141 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1142 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1144 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1153 struct snd_soc_dpcm *dpcm, *d; in dpcm_be_disconnect() local
1155 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1158 dpcm->be->dai_link->name); in dpcm_be_disconnect()
1160 if (dpcm->state != SND_SOC_DPCM_LINK_STATE_FREE) in dpcm_be_disconnect()
1165 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1168 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1171 debugfs_remove(dpcm->debugfs_state); in dpcm_be_disconnect()
1173 list_del(&dpcm->list_be); in dpcm_be_disconnect()
1174 list_del(&dpcm->list_fe); in dpcm_be_disconnect()
1175 kfree(dpcm); in dpcm_be_disconnect()
1273 struct snd_soc_dpcm *dpcm; in dpcm_prune_paths() local
1279 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1283 widget = dai_get_widget(dpcm->be->cpu_dai, stream); in dpcm_prune_paths()
1290 for (i = 0; i < dpcm->be->num_codecs; i++) { in dpcm_prune_paths()
1291 struct snd_soc_dai *dai = dpcm->be->codec_dais[i]; in dpcm_prune_paths()
1301 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1302 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_prune_paths()
1303 dpcm->be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_prune_paths()
1343 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1356 be->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; in dpcm_add_paths()
1379 struct snd_soc_dpcm *dpcm; in dpcm_clear_pending_state() local
1381 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1382 dpcm->be->dpcm[stream].runtime_update = in dpcm_clear_pending_state()
1389 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_startup_unwind() local
1392 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1394 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup_unwind()
1398 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup_unwind()
1401 be->dpcm[stream].state); in dpcm_be_dai_startup_unwind()
1403 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup_unwind()
1406 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup_unwind()
1411 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup_unwind()
1417 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_startup() local
1421 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1423 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup()
1438 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) in dpcm_be_dai_startup()
1441 be->dpcm[stream].state); in dpcm_be_dai_startup()
1443 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1446 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1447 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1453 be_substream->runtime = be->dpcm[stream].runtime; in dpcm_be_dai_startup()
1457 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1458 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1461 be->dpcm[stream].state); in dpcm_be_dai_startup()
1463 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1467 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1475 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1476 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_startup()
1483 if (be->dpcm[stream].users == 0) in dpcm_be_dai_startup()
1486 be->dpcm[stream].state); in dpcm_be_dai_startup()
1488 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_startup()
1491 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) in dpcm_be_dai_startup()
1496 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1543 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1545 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1546 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1548 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1575 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1592 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_shutdown() local
1595 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1597 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_shutdown()
1605 if (be->dpcm[stream].users == 0) in dpcm_be_dai_shutdown()
1608 be->dpcm[stream].state); in dpcm_be_dai_shutdown()
1610 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_shutdown()
1613 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_shutdown()
1614 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) in dpcm_be_dai_shutdown()
1618 dpcm->fe->dai_link->name); in dpcm_be_dai_shutdown()
1623 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_shutdown()
1646 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1653 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_hw_free() local
1657 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1659 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_free()
1671 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
1672 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
1673 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
1674 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
1675 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
1676 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
1680 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_free()
1684 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
1710 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1719 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_hw_params() local
1722 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1724 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_params()
1736 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1737 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1738 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
1742 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_params()
1745 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1751 &dpcm->hw_params); in dpcm_be_dai_hw_params()
1760 ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params); in dpcm_be_dai_hw_params()
1762 dev_err(dpcm->be->dev, in dpcm_be_dai_hw_params()
1767 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
1773 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1774 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_params()
1785 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
1786 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
1787 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
1788 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
1806 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1824 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1832 static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm, in dpcm_do_trigger() argument
1837 dev_dbg(dpcm->be->dev, "ASoC: trigger BE %s cmd %d\n", in dpcm_do_trigger()
1838 dpcm->fe->dai_link->name, cmd); in dpcm_do_trigger()
1842 dev_err(dpcm->be->dev,"ASoC: trigger BE failed %d\n", ret); in dpcm_do_trigger()
1850 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_trigger() local
1853 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1855 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_trigger()
1865 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
1866 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_trigger()
1869 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1873 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1876 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
1879 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1883 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1886 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
1889 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1893 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
1896 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1902 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1906 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
1909 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1915 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1919 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
1922 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
1928 ret = dpcm_do_trigger(dpcm, be_substream, cmd); in dpcm_be_dai_trigger()
1932 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
1947 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2001 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2006 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2011 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2023 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2024 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2034 struct snd_soc_dpcm *dpcm; in dpcm_be_dai_prepare() local
2037 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2039 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_prepare()
2047 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2048 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_prepare()
2052 dpcm->fe->dai_link->name); in dpcm_be_dai_prepare()
2061 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2078 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2099 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2164 struct snd_soc_dpcm *dpcm; in dpcm_run_update_startup() local
2172 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2173 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2182 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2190 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2202 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2203 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2236 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2237 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_run_update_startup()
2238 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_run_update_startup()
2239 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_run_update_startup()
2361 struct snd_soc_dpcm *dpcm; in soc_dpcm_be_digital_mute() local
2363 &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients; in soc_dpcm_be_digital_mute()
2365 list_for_each_entry(dpcm, clients, list_be) { in soc_dpcm_be_digital_mute()
2367 struct snd_soc_pcm_runtime *be = dpcm->be; in soc_dpcm_be_digital_mute()
2392 struct snd_soc_dpcm *dpcm; in dpcm_fe_dai_open() local
2398 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2415 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2416 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_open()
2419 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2431 struct snd_soc_dpcm *dpcm; in dpcm_fe_dai_close() local
2438 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2439 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_close()
2443 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2582 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2592 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2593 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2594 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
2612 return be->dpcm[stream].state; in snd_soc_dpcm_be_get_state()
2620 be->dpcm[stream].state = state; in snd_soc_dpcm_be_set_state()
2631 struct snd_soc_dpcm *dpcm; in snd_soc_dpcm_can_be_free_stop() local
2634 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_free_stop()
2636 if (dpcm->fe == fe) in snd_soc_dpcm_can_be_free_stop()
2639 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_free_stop()
2658 struct snd_soc_dpcm *dpcm; in snd_soc_dpcm_can_be_params() local
2661 list_for_each_entry(dpcm, &be->dpcm[stream].fe_clients, list_fe) { in snd_soc_dpcm_can_be_params()
2663 if (dpcm->fe == fe) in snd_soc_dpcm_can_be_params()
2666 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_can_be_params()
2720 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2721 struct snd_soc_dpcm *dpcm; in dpcm_show_state() local
2730 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
2732 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2733 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
2744 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
2750 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_show_state()
2751 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_show_state()
2752 params = &dpcm->hw_params; in dpcm_show_state()
2759 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
2761 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
2762 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()