Lines Matching refs:fe
123 static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, in dpcm_show_state() argument
126 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
132 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
136 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
138 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
139 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
150 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
156 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
183 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file() local
188 if (fe->dai_link->num_cpus > 1) { in dpcm_state_read_file()
189 dev_err(fe->dev, in dpcm_state_read_file()
198 snd_soc_dpcm_mutex_lock(fe); in dpcm_state_read_file()
200 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
201 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
204 snd_soc_dpcm_mutex_unlock(fe); in dpcm_state_read_file()
241 name, dpcm->fe->debugfs_dpcm_root); in dpcm_create_debugfs_state()
270 static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, in dpcm_set_fe_update_state() argument
274 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
276 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_set_fe_update_state()
277 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
279 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
280 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
282 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
283 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_set_fe_update_state()
359 int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, in dpcm_dapm_stream_event() argument
364 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_dapm_stream_event()
366 for_each_dpcm_be(fe, dir, dpcm) { in dpcm_dapm_stream_event()
380 snd_soc_dapm_stream_event(fe, dir, event); in dpcm_dapm_stream_event()
1199 static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, in dpcm_be_connect() argument
1206 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_be_connect()
1209 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1210 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1214 fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_connect()
1232 dpcm->fe = fe; in dpcm_be_connect()
1233 be->dpcm[stream].runtime = fe->dpcm[stream].runtime; in dpcm_be_connect()
1235 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_be_connect()
1236 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1238 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_be_connect()
1240 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1241 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1250 static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, in dpcm_be_reparent() argument
1265 if (dpcm->fe == fe) in dpcm_be_reparent()
1268 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1270 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1273 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1280 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1285 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_be_disconnect()
1287 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_be_disconnect()
1288 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1289 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1296 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1297 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1301 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1306 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_be_disconnect()
1385 int dpcm_path_get(struct snd_soc_pcm_runtime *fe, in dpcm_path_get() argument
1388 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0); in dpcm_path_get()
1391 if (fe->dai_link->num_cpus > 1) { in dpcm_path_get()
1392 dev_err(fe->dev, in dpcm_path_get()
1399 fe->card->component_chaining ? in dpcm_path_get()
1403 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1406 dev_dbg(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name, in dpcm_path_get()
1438 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1445 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1449 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1451 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1457 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1461 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1464 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1471 if (!fe->dpcm[stream].runtime && !fe->fe_compr) in dpcm_add_paths()
1493 dev_dbg(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1503 if (fe->card->component_chaining && in dpcm_add_paths()
1509 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1511 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1522 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1530 int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, in dpcm_process_paths() argument
1534 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1536 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1539 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1543 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1547 void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_stop() argument
1553 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_stop()
1562 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_stop()
1591 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1598 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1611 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1652 dpcm_be_dai_startup_rollback(fe, stream, dpcm); in dpcm_be_dai_startup()
1654 return soc_pcm_ret(fe, err); in dpcm_be_dai_startup()
1659 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_fe() local
1668 for_each_rtd_cpu_dais(fe, i, dai) { in dpcm_runtime_setup_fe()
1689 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_be_format() local
1696 if (!fe->dai_link->dpcm_merged_format) in dpcm_runtime_setup_be_format()
1704 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_format()
1726 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_be_chan() local
1732 if (!fe->dai_link->dpcm_merged_chan) in dpcm_runtime_setup_be_chan()
1740 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_chan()
1774 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_be_rate() local
1780 if (!fe->dai_link->dpcm_merged_rate) in dpcm_runtime_setup_be_rate()
1788 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_rate()
1813 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_apply_symmetry() local
1821 for_each_rtd_cpu_dais (fe, i, fe_cpu_dai) { in dpcm_apply_symmetry()
1829 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1854 return soc_pcm_ret(fe, err); in dpcm_apply_symmetry()
1859 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_startup() local
1862 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1864 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1868 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
1871 ret = __soc_pcm_open(fe, fe_substream); in dpcm_fe_dai_startup()
1875 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1887 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1889 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1891 return soc_pcm_ret(fe, ret); in dpcm_fe_dai_startup()
1896 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_shutdown() local
1899 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_fe_dai_shutdown()
1901 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1904 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1906 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
1909 __soc_pcm_close(fe, substream); in dpcm_fe_dai_shutdown()
1912 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1914 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1915 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1919 void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1925 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1932 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1936 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1962 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_hw_free() local
1965 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_hw_free()
1966 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1968 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
1971 soc_pcm_hw_clean(fe, substream, 0); in dpcm_fe_dai_hw_free()
1975 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
1977 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
1978 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
1980 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_hw_free()
1984 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
1991 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
1998 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2002 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2015 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2035 dev_dbg(fe->dev, "ASoC: %s() failed at %s (%d)\n", in dpcm_be_dai_hw_params()
2039 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2043 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2047 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2065 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_hw_params() local
2068 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_hw_params()
2069 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2071 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2073 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2077 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
2078 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
2082 ret = __soc_pcm_hw_params(fe, substream, params); in dpcm_fe_dai_hw_params()
2084 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2086 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2089 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2090 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_hw_params()
2092 return soc_pcm_ret(fe, ret); in dpcm_fe_dai_hw_params()
2095 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2104 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2113 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2166 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2193 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2195 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2208 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2240 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2261 return soc_pcm_ret(fe, ret); in dpcm_be_dai_trigger()
2268 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_dai_trigger_fe_be() local
2273 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2274 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2280 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2285 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2289 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2290 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2299 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_do_trigger() local
2302 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2304 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2346 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
2347 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
2352 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
2353 fe->dai_link->name); in dpcm_fe_dai_do_trigger()
2359 dev_err(fe->dev, "ASoC: trigger FE cmd: %d failed: %d\n", in dpcm_fe_dai_do_trigger()
2368 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2372 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2375 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2380 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2386 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_trigger() local
2392 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2393 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2401 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2406 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2413 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2432 return soc_pcm_ret(fe, ret); in dpcm_be_dai_prepare()
2437 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_prepare() local
2440 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_prepare()
2442 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2444 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2447 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2448 dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2449 fe->dai_link->name); in dpcm_fe_dai_prepare()
2454 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2459 ret = __soc_pcm_prepare(fe, substream); in dpcm_fe_dai_prepare()
2463 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2466 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2467 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_prepare()
2469 return soc_pcm_ret(fe, ret); in dpcm_fe_dai_prepare()
2472 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2475 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2476 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2479 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2480 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2484 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2485 fe->dai_link->name); in dpcm_run_update_shutdown()
2489 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2490 fe->dai_link->name); in dpcm_run_update_shutdown()
2492 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2495 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2497 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2500 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2502 return soc_pcm_ret(fe, err); in dpcm_run_update_shutdown()
2505 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2508 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2510 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2513 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2514 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2517 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2518 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2519 dev_err(fe->dev, "ASoC: FE %s is not ready %d\n", in dpcm_run_update_startup()
2520 fe->dai_link->name, fe->dpcm[stream].state); in dpcm_run_update_startup()
2526 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2531 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2534 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2539 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2542 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2547 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2550 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2551 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2556 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", in dpcm_run_update_startup()
2557 fe->dai_link->name); in dpcm_run_update_startup()
2563 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n", in dpcm_run_update_startup()
2564 fe->dai_link->name); in dpcm_run_update_startup()
2566 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2575 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2577 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2580 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2584 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_run_update_startup()
2592 return soc_pcm_ret(fe, ret); in dpcm_run_update_startup()
2595 static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) in soc_dpcm_fe_runtime_update() argument
2601 if (!fe->dai_link->dynamic) in soc_dpcm_fe_runtime_update()
2604 if (fe->dai_link->num_cpus > 1) { in soc_dpcm_fe_runtime_update()
2605 dev_err(fe->dev, in soc_dpcm_fe_runtime_update()
2611 if (!snd_soc_dai_active(asoc_rtd_to_cpu(fe, 0))) in soc_dpcm_fe_runtime_update()
2615 dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n", in soc_dpcm_fe_runtime_update()
2616 new ? "new" : "old", fe->dai_link->name); in soc_dpcm_fe_runtime_update()
2621 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2622 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2626 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2627 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2630 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2635 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2637 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2639 dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2641 dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2642 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2644 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2645 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2659 struct snd_soc_pcm_runtime *fe; in snd_soc_dpcm_runtime_update() local
2664 for_each_card_rtds(card, fe) { in snd_soc_dpcm_runtime_update()
2665 ret = soc_dpcm_fe_runtime_update(fe, 0); in snd_soc_dpcm_runtime_update()
2671 for_each_card_rtds(card, fe) { in snd_soc_dpcm_runtime_update()
2672 ret = soc_dpcm_fe_runtime_update(fe, 1); in snd_soc_dpcm_runtime_update()
2685 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_cleanup() local
2689 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_fe_dai_cleanup()
2692 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2695 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2697 fe->dpcm[stream].runtime = NULL; in dpcm_fe_dai_cleanup()
2702 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_close() local
2705 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_close()
2710 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_close()
2716 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_open() local
2721 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_open()
2722 fe->dpcm[stream].runtime = fe_substream->runtime; in dpcm_fe_dai_open()
2724 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2729 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2735 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2738 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_open()
2965 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
2967 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
2974 int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_be_can_update() argument
2977 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
2978 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
2993 static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_check_state() argument
3006 if (dpcm->fe == fe) in snd_soc_dpcm_check_state()
3009 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
3026 int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_free_stop() argument
3035 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
3043 int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_params() argument
3053 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()