Lines Matching refs:fe

172 int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,  in dpcm_dapm_stream_event()  argument
177 list_for_each_entry(dpcm, &fe->dpcm[dir].be_clients, list_be) { in dpcm_dapm_stream_event()
187 snd_soc_dapm_stream_event(fe, dir, event); in dpcm_dapm_stream_event()
1120 static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, in dpcm_be_connect() argument
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()
1136 dpcm->fe = fe; in dpcm_be_connect()
1137 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1139 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1142 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1143 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1147 if (fe->debugfs_dpcm_root) in dpcm_be_connect()
1149 fe->debugfs_dpcm_root, &dpcm->state); in dpcm_be_connect()
1155 static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, in dpcm_be_reparent() argument
1168 if (dpcm->fe == fe) in dpcm_be_reparent()
1171 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1173 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1176 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1183 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1187 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_disconnect()
1188 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1195 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1196 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1200 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1280 int dpcm_path_get(struct snd_soc_pcm_runtime *fe, in dpcm_path_get() argument
1283 struct snd_soc_dai *cpu_dai = fe->cpu_dai; in dpcm_path_get()
1289 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1295 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1304 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_prune_paths()
1324 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1326 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1332 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1336 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1339 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1363 dev_err(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1373 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1377 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1379 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1390 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1398 int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, in dpcm_process_paths() argument
1402 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1404 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1407 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1411 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_clear_pending_state()
1416 static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, in dpcm_be_dai_startup_unwind() argument
1422 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup_unwind()
1445 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1451 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_startup()
1464 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) 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()
1510 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1549 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_runtime_base_format() local
1554 if (!fe->dai_link->dpcm_merged_format) in dpcm_runtime_base_format()
1562 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_runtime_base_format()
1603 static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, in dpcm_set_fe_update_state() argument
1607 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
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()
1621 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; in dpcm_fe_dai_startup() local
1625 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1627 ret = dpcm_be_dai_startup(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1629 dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret); in dpcm_fe_dai_startup()
1633 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
1638 dev_err(fe->dev,"ASoC: failed to start FE %d\n", ret); in dpcm_fe_dai_startup()
1642 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1647 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1651 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); in dpcm_fe_dai_startup()
1653 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1657 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1662 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_shutdown()
1669 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1685 dpcm->fe->dai_link->name); in dpcm_be_dai_shutdown()
1697 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_shutdown() local
1700 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1703 dpcm_be_dai_shutdown(fe, substream->stream); in dpcm_fe_dai_shutdown()
1705 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
1711 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1713 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1714 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1718 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1724 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_free()
1731 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1735 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1751 dpcm->fe->dai_link->name); in dpcm_be_dai_hw_free()
1763 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_free() local
1766 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_hw_free()
1767 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1769 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
1774 dev_err(fe->dev,"ASoC: hw_free FE %s failed\n", in dpcm_fe_dai_hw_free()
1775 fe->dai_link->name); in dpcm_fe_dai_hw_free()
1779 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1781 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1782 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1784 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_hw_free()
1788 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1793 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1800 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1804 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) 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()
1844 list_for_each_entry_continue_reverse(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_hw_params()
1849 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1853 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
1871 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_hw_params() local
1874 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_hw_params()
1875 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
1877 memcpy(&fe->dpcm[substream->stream].hw_params, params, in dpcm_fe_dai_hw_params()
1879 ret = dpcm_be_dai_hw_params(fe, substream->stream); in dpcm_fe_dai_hw_params()
1881 dev_err(fe->dev,"ASoC: hw_params BE failed %d\n", ret); in dpcm_fe_dai_hw_params()
1885 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
1886 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
1892 dev_err(fe->dev,"ASoC: hw_params FE failed %d\n", ret); in dpcm_fe_dai_hw_params()
1893 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
1895 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
1898 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
1899 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_hw_params()
1909 dpcm->fe->dai_link->name, cmd); in dpcm_do_trigger()
1918 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
1924 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_trigger()
1931 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
1970 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1983 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
1996 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2014 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_do_trigger() local
2016 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2018 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2024 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
2025 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
2029 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_fe_dai_do_trigger()
2033 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2038 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_fe_dai_do_trigger()
2040 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_fe_dai_do_trigger()
2044 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
2045 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
2052 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
2053 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
2057 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_fe_dai_do_trigger()
2062 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
2063 fe->dai_link->name); 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()
2088 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_trigger() local
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()
2103 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2108 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_be_dai_prepare()
2115 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2123 dpcm->fe->dai_link->name); in dpcm_be_dai_prepare()
2139 struct snd_soc_pcm_runtime *fe = substream->private_data; in dpcm_fe_dai_prepare() local
2142 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_prepare()
2144 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2146 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2149 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2150 dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2151 fe->dai_link->name); in dpcm_fe_dai_prepare()
2156 ret = dpcm_be_dai_prepare(fe, substream->stream); in dpcm_fe_dai_prepare()
2163 dev_err(fe->dev,"ASoC: prepare FE %s failed\n", in dpcm_fe_dai_prepare()
2164 fe->dai_link->name); in dpcm_fe_dai_prepare()
2169 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2170 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2173 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2174 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_prepare()
2190 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2193 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2194 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2197 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2198 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2202 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2203 fe->dai_link->name); in dpcm_run_update_shutdown()
2207 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); in dpcm_run_update_shutdown()
2209 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2210 fe->dai_link->name); in dpcm_run_update_shutdown()
2212 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2214 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); in dpcm_run_update_shutdown()
2217 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2219 dev_err(fe->dev,"ASoC: hw_free FE failed %d\n", err); in dpcm_run_update_shutdown()
2221 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2223 dev_err(fe->dev,"ASoC: shutdown FE failed %d\n", err); in dpcm_run_update_shutdown()
2226 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2231 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2234 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2236 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2239 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2240 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
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()
2248 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2253 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2256 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2261 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2265 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2270 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); 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()
2279 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", in dpcm_run_update_startup()
2280 fe->dai_link->name); in dpcm_run_update_startup()
2284 dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret); in dpcm_run_update_startup()
2288 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n", in dpcm_run_update_startup()
2289 fe->dai_link->name); in dpcm_run_update_startup()
2291 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2294 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_run_update_startup()
2302 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2304 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2307 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { in dpcm_run_update_startup()
2316 static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_new_update() argument
2320 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_new_update()
2321 ret = dpcm_run_update_startup(fe, stream); in dpcm_run_new_update()
2323 dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); in dpcm_run_new_update()
2324 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_new_update()
2329 static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_old_update() argument
2333 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_run_old_update()
2334 ret = dpcm_run_update_shutdown(fe, stream); in dpcm_run_old_update()
2336 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); in dpcm_run_old_update()
2337 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_run_old_update()
2352 struct snd_soc_pcm_runtime *fe = &card->rtd[i]; in soc_dpcm_runtime_update() local
2355 if (!fe->dai_link->dynamic) in soc_dpcm_runtime_update()
2359 if (!fe->cpu_dai->active) in soc_dpcm_runtime_update()
2363 dev_dbg(fe->dev, "ASoC: DPCM runtime update for FE %s\n", in soc_dpcm_runtime_update()
2364 fe->dai_link->name); in soc_dpcm_runtime_update()
2367 if (!fe->cpu_dai->driver->playback.channels_min in soc_dpcm_runtime_update()
2368 || !fe->codec_dai->driver->playback.channels_min) in soc_dpcm_runtime_update()
2372 if (!fe->cpu_dai->playback_active in soc_dpcm_runtime_update()
2373 || !fe->codec_dai->playback_active) in soc_dpcm_runtime_update()
2376 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); in soc_dpcm_runtime_update()
2378 dev_warn(fe->dev, "ASoC: %s no valid %s path\n", in soc_dpcm_runtime_update()
2379 fe->dai_link->name, "playback"); in soc_dpcm_runtime_update()
2385 new = dpcm_process_paths(fe, SNDRV_PCM_STREAM_PLAYBACK, &list, 1); in soc_dpcm_runtime_update()
2387 dpcm_run_new_update(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2388 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2389 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2393 old = dpcm_process_paths(fe, SNDRV_PCM_STREAM_PLAYBACK, &list, 0); in soc_dpcm_runtime_update()
2395 dpcm_run_old_update(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2396 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2397 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_PLAYBACK); in soc_dpcm_runtime_update()
2403 if (!fe->cpu_dai->driver->capture.channels_min in soc_dpcm_runtime_update()
2404 || !fe->codec_dai->driver->capture.channels_min) in soc_dpcm_runtime_update()
2408 if (!fe->cpu_dai->capture_active in soc_dpcm_runtime_update()
2409 || !fe->codec_dai->capture_active) in soc_dpcm_runtime_update()
2412 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); in soc_dpcm_runtime_update()
2414 dev_warn(fe->dev, "ASoC: %s no valid %s path\n", in soc_dpcm_runtime_update()
2415 fe->dai_link->name, "capture"); in soc_dpcm_runtime_update()
2421 new = dpcm_process_paths(fe, SNDRV_PCM_STREAM_CAPTURE, &list, 1); in soc_dpcm_runtime_update()
2423 dpcm_run_new_update(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2424 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2425 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2429 old = dpcm_process_paths(fe, SNDRV_PCM_STREAM_CAPTURE, &list, 0); in soc_dpcm_runtime_update()
2431 dpcm_run_old_update(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2432 dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2433 dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_CAPTURE); in soc_dpcm_runtime_update()
2442 int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute) in soc_dpcm_be_digital_mute() argument
2446 &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients; in soc_dpcm_be_digital_mute()
2474 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; in dpcm_fe_dai_open() local
2480 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_open()
2481 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2483 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2485 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_open()
2488 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", in dpcm_fe_dai_open()
2489 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2493 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2498 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_open()
2501 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_open()
2502 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_open()
2505 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2507 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_open()
2513 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; in dpcm_fe_dai_close() local
2517 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_close()
2521 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) in dpcm_fe_dai_close()
2524 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_close()
2526 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_close()
2527 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_close()
2664 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2666 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2673 int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_be_can_update() argument
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()
2712 int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_free_stop() argument
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()
2739 int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_params() argument
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()
2801 static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, in dpcm_show_state() argument
2804 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
2810 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
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()
2862 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file() local
2870 if (fe->cpu_dai->driver->playback.channels_min) in dpcm_state_read_file()
2871 offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_PLAYBACK, in dpcm_state_read_file()
2874 if (fe->cpu_dai->driver->capture.channels_min) in dpcm_state_read_file()
2875 offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_CAPTURE, in dpcm_state_read_file()