Lines Matching refs:fe
154 int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, in dpcm_dapm_stream_event() argument
159 list_for_each_entry(dpcm, &fe->dpcm[dir].be_clients, list_be) { in dpcm_dapm_stream_event()
169 snd_soc_dapm_stream_event(fe, dir, event); in dpcm_dapm_stream_event()
1073 static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, in dpcm_be_connect() argument
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()
1089 dpcm->fe = fe; in dpcm_be_connect()
1090 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1092 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1095 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1096 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1100 if (fe->debugfs_dpcm_root) in dpcm_be_connect()
1102 fe->debugfs_dpcm_root, &dpcm->state); in dpcm_be_connect()
1108 static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, in dpcm_be_reparent() argument
1121 if (dpcm->fe == fe) in dpcm_be_reparent()
1124 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1126 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1129 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1136 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1140 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1141 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1148 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1149 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1153 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1233 int dpcm_path_get(struct snd_soc_pcm_runtime *fe, in dpcm_path_get() argument
1236 struct snd_soc_dai *cpu_dai = fe->cpu_dai; in dpcm_path_get()
1248 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1255 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1264 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1284 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1286 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1292 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1296 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1299 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1318 dev_err(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1328 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1332 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1334 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1345 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1353 int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, in dpcm_process_paths() argument
1357 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1359 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1362 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1366 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1371 static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, in dpcm_be_dai_startup_unwind() argument
1377 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1400 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1406 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1419 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) 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()
1465 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1521 static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, in dpcm_set_fe_update_state() argument
1525 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
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()
1539 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; in dpcm_fe_dai_startup() local
1543 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1545 ret = dpcm_be_dai_startup(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1547 dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret); in dpcm_fe_dai_startup()
1551 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
1556 dev_err(fe->dev,"ASoC: failed to start FE %d\n", ret); in dpcm_fe_dai_startup()
1560 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1565 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1569 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1571 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1575 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1580 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1587 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1603 dpcm->fe->dai_link->name); in dpcm_be_dai_shutdown()
1615 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_shutdown() local
1618 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1621 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
1623 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
1629 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1631 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1632 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1636 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1642 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1649 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1653 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1669 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_free()
1681 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_free() local
1684 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_hw_free()
1685 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1687 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
1692 dev_err(fe->dev,"ASoC: hw_free FE %s failed\n", in dpcm_fe_dai_hw_free()
1693 fe->dai_link->name); in dpcm_fe_dai_hw_free()
1697 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1699 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1700 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1702 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_hw_free()
1706 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1711 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1718 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1722 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) 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()
1762 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1767 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1771 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
1789 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_params() local
1792 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_hw_params()
1793 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
1795 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1797 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
1799 dev_err(fe->dev,"ASoC: hw_params BE failed %d\n", ret); in dpcm_fe_dai_hw_params()
1803 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
1804 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
1810 dev_err(fe->dev,"ASoC: hw_params FE failed %d\n", ret); in dpcm_fe_dai_hw_params()
1811 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
1813 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1816 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
1817 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_hw_params()
1827 dpcm->fe->dai_link->name, cmd); in dpcm_do_trigger()
1836 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
1842 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1849 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
1888 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1901 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1914 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1932 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_do_trigger() local
1934 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
1936 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
1942 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
1943 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
1947 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_fe_dai_do_trigger()
1951 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
1956 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
1958 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_fe_dai_do_trigger()
1962 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
1963 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
1970 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
1971 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
1975 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_fe_dai_do_trigger()
1980 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
1981 fe->dai_link->name); 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()
2006 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_trigger() local
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()
2021 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2026 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2033 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2041 dpcm->fe->dai_link->name); in dpcm_be_dai_prepare()
2057 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_prepare() local
2060 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_prepare()
2062 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2064 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2067 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2068 dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2069 fe->dai_link->name); in dpcm_fe_dai_prepare()
2074 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2081 dev_err(fe->dev,"ASoC: prepare FE %s failed\n", in dpcm_fe_dai_prepare()
2082 fe->dai_link->name); in dpcm_fe_dai_prepare()
2087 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2088 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2091 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2092 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_prepare()
2108 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2111 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2112 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2115 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2116 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2120 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2121 fe->dai_link->name); in dpcm_run_update_shutdown()
2125 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); in dpcm_run_update_shutdown()
2127 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2128 fe->dai_link->name); in dpcm_run_update_shutdown()
2130 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2132 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); in dpcm_run_update_shutdown()
2135 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2137 dev_err(fe->dev,"ASoC: hw_free FE failed %d\n", err); in dpcm_run_update_shutdown()
2139 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2141 dev_err(fe->dev,"ASoC: shutdown FE failed %d\n", err); in dpcm_run_update_shutdown()
2144 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2149 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2152 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2154 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2157 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2158 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
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()
2166 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2171 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2174 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2179 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2183 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2188 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); 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()
2197 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", in dpcm_run_update_startup()
2198 fe->dai_link->name); in dpcm_run_update_startup()
2202 dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret); in dpcm_run_update_startup()
2206 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n", in dpcm_run_update_startup()
2207 fe->dai_link->name); in dpcm_run_update_startup()
2209 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2212 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_run_update_startup()
2220 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2222 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2225 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2234 static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_new_update() argument
2238 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_new_update()
2239 ret = dpcm_run_update_startup(fe, stream); in dpcm_run_new_update()
2241 dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); in dpcm_run_new_update()
2242 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_new_update()
2247 static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_old_update() argument
2251 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_old_update()
2252 ret = dpcm_run_update_shutdown(fe, stream); in dpcm_run_old_update()
2254 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); in dpcm_run_old_update()
2255 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_old_update()
2270 struct snd_soc_pcm_runtime *fe = &card->rtd[i]; in soc_dpcm_runtime_update() local
2273 if (!fe->dai_link->dynamic) in soc_dpcm_runtime_update()
2277 if (!fe->cpu_dai->active) in soc_dpcm_runtime_update()
2281 dev_dbg(fe->dev, "ASoC: DPCM runtime update for FE %s\n", in soc_dpcm_runtime_update()
2282 fe->dai_link->name); in soc_dpcm_runtime_update()
2285 if (!fe->cpu_dai->driver->playback.channels_min in soc_dpcm_runtime_update()
2286 || !fe->codec_dai->driver->playback.channels_min) in soc_dpcm_runtime_update()
2290 if (!fe->cpu_dai->playback_active in soc_dpcm_runtime_update()
2291 || !fe->codec_dai->playback_active) in soc_dpcm_runtime_update()
2294 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); in soc_dpcm_runtime_update()
2296 dev_warn(fe->dev, "ASoC: %s no valid %s path\n", in soc_dpcm_runtime_update()
2297 fe->dai_link->name, "playback"); in soc_dpcm_runtime_update()
2303 new = dpcm_process_paths(fe, SNDRV_PCM_STREAM_PLAYBACK, &list, 1); in soc_dpcm_runtime_update()
2305 dpcm_run_new_update(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2306 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2307 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2311 old = dpcm_process_paths(fe, SNDRV_PCM_STREAM_PLAYBACK, &list, 0); in soc_dpcm_runtime_update()
2313 dpcm_run_old_update(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2314 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2315 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2321 if (!fe->cpu_dai->driver->capture.channels_min in soc_dpcm_runtime_update()
2322 || !fe->codec_dai->driver->capture.channels_min) in soc_dpcm_runtime_update()
2326 if (!fe->cpu_dai->capture_active in soc_dpcm_runtime_update()
2327 || !fe->codec_dai->capture_active) in soc_dpcm_runtime_update()
2330 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); in soc_dpcm_runtime_update()
2332 dev_warn(fe->dev, "ASoC: %s no valid %s path\n", in soc_dpcm_runtime_update()
2333 fe->dai_link->name, "capture"); in soc_dpcm_runtime_update()
2339 new = dpcm_process_paths(fe, SNDRV_PCM_STREAM_CAPTURE, &list, 1); in soc_dpcm_runtime_update()
2341 dpcm_run_new_update(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2342 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2343 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2347 old = dpcm_process_paths(fe, SNDRV_PCM_STREAM_CAPTURE, &list, 0); in soc_dpcm_runtime_update()
2349 dpcm_run_old_update(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2350 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2351 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2360 int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute) in soc_dpcm_be_digital_mute() argument
2364 &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients; in soc_dpcm_be_digital_mute()
2392 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; in dpcm_fe_dai_open() local
2398 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_open()
2399 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2401 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2403 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_open()
2406 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", in dpcm_fe_dai_open()
2407 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2411 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2416 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2419 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_open()
2420 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2423 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2425 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_open()
2431 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; in dpcm_fe_dai_close() local
2435 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_close()
2439 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2442 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_close()
2444 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2445 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_close()
2582 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2584 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2591 int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_be_can_update() argument
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()
2630 int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_free_stop() argument
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()
2657 int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_params() argument
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()
2719 static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, in dpcm_show_state() argument
2722 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2728 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
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()
2780 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file() local
2788 if (fe->cpu_dai->driver->playback.channels_min) in dpcm_state_read_file()
2789 offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_PLAYBACK, in dpcm_state_read_file()
2792 if (fe->cpu_dai->driver->capture.channels_min) in dpcm_state_read_file()
2793 offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_CAPTURE, in dpcm_state_read_file()