Lines Matching refs:fe
62 static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, in dpcm_show_state() argument
65 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
72 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
76 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
78 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
79 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
90 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
96 spin_lock_irqsave(&fe->card->dpcm_lock, flags); in dpcm_show_state()
97 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
117 spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); in dpcm_show_state()
125 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file() local
130 if (fe->num_cpus > 1) { in dpcm_state_read_file()
131 dev_err(fe->dev, in dpcm_state_read_file()
141 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
142 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
184 name, dpcm->fe->debugfs_dpcm_root); in dpcm_create_debugfs_state()
281 int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, in dpcm_dapm_stream_event() argument
286 for_each_dpcm_be(fe, dir, dpcm) { in dpcm_dapm_stream_event()
300 snd_soc_dapm_stream_event(fe, dir, event); in dpcm_dapm_stream_event()
1112 static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, in dpcm_be_connect() argument
1119 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1120 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1129 dpcm->fe = fe; in dpcm_be_connect()
1130 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1132 spin_lock_irqsave(&fe->card->dpcm_lock, flags); in dpcm_be_connect()
1133 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1135 spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); in dpcm_be_connect()
1137 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1138 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1147 static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, in dpcm_be_reparent() argument
1162 if (dpcm->fe == fe) in dpcm_be_reparent()
1165 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1167 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1170 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1177 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1182 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1183 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1190 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1191 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1195 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1199 spin_lock_irqsave(&fe->card->dpcm_lock, flags); in dpcm_be_disconnect()
1202 spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); in dpcm_be_disconnect()
1271 int dpcm_path_get(struct snd_soc_pcm_runtime *fe, in dpcm_path_get() argument
1274 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0); in dpcm_path_get()
1278 if (fe->num_cpus > 1) { in dpcm_path_get()
1279 dev_err(fe->dev, in dpcm_path_get()
1290 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1323 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1330 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1334 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1336 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1342 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1346 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1349 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1374 dev_err(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1380 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1384 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1386 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1397 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1405 int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, in dpcm_process_paths() argument
1409 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1411 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1414 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1419 spin_lock_irqsave(&fe->card->dpcm_lock, flags); in dpcm_clear_pending_state()
1420 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1423 spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); in dpcm_clear_pending_state()
1426 static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, in dpcm_be_dai_startup_unwind() argument
1432 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup_unwind()
1455 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1461 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1474 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1515 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_startup()
1520 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1559 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_merge_format() local
1564 if (!fe->dai_link->dpcm_merged_format) in dpcm_runtime_merge_format()
1572 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_format()
1596 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_merge_chan() local
1600 if (!fe->dai_link->dpcm_merged_chan) in dpcm_runtime_merge_chan()
1608 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_chan()
1651 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_merge_rate() local
1655 if (!fe->dai_link->dpcm_merged_rate) in dpcm_runtime_merge_rate()
1663 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_merge_rate()
1720 static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, in dpcm_set_fe_update_state() argument
1724 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
1727 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
1729 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
1730 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
1732 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
1740 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_apply_symmetry() local
1749 for_each_rtd_cpu_dais (fe, i, fe_cpu_dai) { in dpcm_apply_symmetry()
1759 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1793 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_startup() local
1797 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1799 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1801 dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret); in dpcm_fe_dai_startup()
1805 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
1810 dev_err(fe->dev,"ASoC: failed to start FE %d\n", ret); in dpcm_fe_dai_startup()
1814 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1821 dev_err(fe->dev, "ASoC: failed to apply dpcm symmetry %d\n", in dpcm_fe_dai_startup()
1826 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1828 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1832 int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_shutdown() argument
1837 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_shutdown()
1844 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_shutdown()
1874 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_shutdown() local
1877 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1880 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1882 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
1888 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1890 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1891 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1895 int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1901 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1908 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1912 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1940 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_hw_free() local
1943 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_hw_free()
1944 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1946 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
1951 dev_err(fe->dev,"ASoC: hw_free FE %s failed\n", in dpcm_fe_dai_hw_free()
1952 fe->dai_link->name); in dpcm_fe_dai_hw_free()
1956 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1958 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1959 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1961 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_hw_free()
1965 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1970 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1977 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
1981 memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
1994 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2018 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2023 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2027 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2045 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_hw_params() local
2048 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_hw_params()
2049 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2051 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2053 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2055 dev_err(fe->dev,"ASoC: hw_params BE failed %d\n", ret); in dpcm_fe_dai_hw_params()
2059 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
2060 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
2066 dev_err(fe->dev,"ASoC: hw_params FE failed %d\n", ret); in dpcm_fe_dai_hw_params()
2067 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2069 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2072 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2073 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_hw_params()
2092 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2098 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2105 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2146 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2159 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2172 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_trigger()
2191 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_dai_trigger_fe_be() local
2196 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2197 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2203 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2208 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2212 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2213 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2222 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_do_trigger() local
2225 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2227 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2269 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
2270 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
2275 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
2276 fe->dai_link->name); in dpcm_fe_dai_do_trigger()
2282 dev_err(fe->dev, "ASoC: trigger FE cmd: %d failed: %d\n", in dpcm_fe_dai_do_trigger()
2291 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2295 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2298 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2303 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2309 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_trigger() local
2315 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2316 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2324 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2329 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2336 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2339 if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) in dpcm_be_dai_prepare()
2365 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_prepare() local
2368 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_prepare()
2370 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2372 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2375 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2376 dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2377 fe->dai_link->name); in dpcm_fe_dai_prepare()
2382 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2389 dev_err(fe->dev,"ASoC: prepare FE %s failed\n", in dpcm_fe_dai_prepare()
2390 fe->dai_link->name); in dpcm_fe_dai_prepare()
2395 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); in dpcm_fe_dai_prepare()
2396 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2399 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2400 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_prepare()
2405 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2408 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2409 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2412 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2413 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2417 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2418 fe->dai_link->name); in dpcm_run_update_shutdown()
2422 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); in dpcm_run_update_shutdown()
2424 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2425 fe->dai_link->name); in dpcm_run_update_shutdown()
2427 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2429 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); in dpcm_run_update_shutdown()
2432 err = dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2434 dev_err(fe->dev,"ASoC: hw_free FE failed %d\n", err); in dpcm_run_update_shutdown()
2436 err = dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2438 dev_err(fe->dev,"ASoC: shutdown FE failed %d\n", err); in dpcm_run_update_shutdown()
2441 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2446 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2449 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2451 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2455 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2456 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2459 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2460 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) in dpcm_run_update_startup()
2464 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2469 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2472 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2477 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2481 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2486 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2489 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2490 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2495 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", in dpcm_run_update_startup()
2496 fe->dai_link->name); in dpcm_run_update_startup()
2500 dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret); in dpcm_run_update_startup()
2504 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n", in dpcm_run_update_startup()
2505 fe->dai_link->name); in dpcm_run_update_startup()
2507 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2510 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); in dpcm_run_update_startup()
2518 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2520 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2523 spin_lock_irqsave(&fe->card->dpcm_lock, flags); in dpcm_run_update_startup()
2524 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2529 spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); in dpcm_run_update_startup()
2534 static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) in soc_dpcm_fe_runtime_update() argument
2541 if (!fe->dai_link->dynamic) in soc_dpcm_fe_runtime_update()
2544 if (fe->num_cpus > 1) { in soc_dpcm_fe_runtime_update()
2545 dev_err(fe->dev, in soc_dpcm_fe_runtime_update()
2551 if (!snd_soc_dai_active(asoc_rtd_to_cpu(fe, 0))) in soc_dpcm_fe_runtime_update()
2555 dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n", in soc_dpcm_fe_runtime_update()
2556 new ? "new" : "old", fe->dai_link->name); in soc_dpcm_fe_runtime_update()
2561 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2562 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2566 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2567 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2570 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2572 dev_warn(fe->dev, "ASoC: %s no valid %s path\n", in soc_dpcm_fe_runtime_update()
2573 fe->dai_link->name, in soc_dpcm_fe_runtime_update()
2580 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2582 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2584 ret = dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2586 ret = dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2588 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); in soc_dpcm_fe_runtime_update()
2589 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2591 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2592 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2606 struct snd_soc_pcm_runtime *fe; in snd_soc_dpcm_runtime_update() local
2611 for_each_card_rtds(card, fe) { in snd_soc_dpcm_runtime_update()
2612 ret = soc_dpcm_fe_runtime_update(fe, 0); in snd_soc_dpcm_runtime_update()
2618 for_each_card_rtds(card, fe) { in snd_soc_dpcm_runtime_update()
2619 ret = soc_dpcm_fe_runtime_update(fe, 1); in snd_soc_dpcm_runtime_update()
2632 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_cleanup() local
2637 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2640 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2642 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_cleanup()
2647 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_close() local
2650 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_close()
2655 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_close()
2661 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_open() local
2666 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); in dpcm_fe_dai_open()
2667 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2669 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2673 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", in dpcm_fe_dai_open()
2674 fe->dai_link->name, stream ? "capture" : "playback"); in dpcm_fe_dai_open()
2678 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2684 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2687 mutex_unlock(&fe->card->mutex); in dpcm_fe_dai_open()
2890 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2892 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2899 int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_be_can_update() argument
2902 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2903 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2918 static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_check_state() argument
2930 spin_lock_irqsave(&fe->card->dpcm_lock, flags); in snd_soc_dpcm_check_state()
2933 if (dpcm->fe == fe) in snd_soc_dpcm_check_state()
2936 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
2944 spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); in snd_soc_dpcm_check_state()
2954 int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_free_stop() argument
2963 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
2971 int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_params() argument
2981 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()
2989 int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_prepared() argument
2998 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_prepared()