Lines Matching refs:fe

110 static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,  in dpcm_show_state()  argument
113 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
119 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
123 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
125 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
126 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
137 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
143 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_show_state()
170 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file() local
175 if (fe->dai_link->num_cpus > 1) { in dpcm_state_read_file()
176 dev_err(fe->dev, in dpcm_state_read_file()
185 snd_soc_dpcm_mutex_lock(fe); in dpcm_state_read_file()
187 if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) in dpcm_state_read_file()
188 offset += dpcm_show_state(fe, stream, in dpcm_state_read_file()
191 snd_soc_dpcm_mutex_unlock(fe); in dpcm_state_read_file()
228 name, dpcm->fe->debugfs_dpcm_root); in dpcm_create_debugfs_state()
257 static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, in dpcm_set_fe_update_state() argument
261 snd_soc_dpcm_get_substream(fe, stream); in dpcm_set_fe_update_state()
263 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_set_fe_update_state()
264 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
266 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
267 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
269 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
270 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_set_fe_update_state()
346 int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, in dpcm_dapm_stream_event() argument
351 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_dapm_stream_event()
353 for_each_dpcm_be(fe, dir, dpcm) { in dpcm_dapm_stream_event()
367 snd_soc_dapm_stream_event(fe, dir, event); in dpcm_dapm_stream_event()
1223 static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, in dpcm_be_connect() argument
1230 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_be_connect()
1233 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_connect()
1234 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1238 fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_connect()
1256 dpcm->fe = fe; in dpcm_be_connect()
1258 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_be_connect()
1259 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1261 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_be_connect()
1263 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1264 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_connect()
1273 static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, in dpcm_be_reparent() argument
1288 if (dpcm->fe == fe) in dpcm_be_reparent()
1291 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1293 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1296 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1303 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_disconnect() argument
1308 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_be_disconnect()
1310 snd_soc_dpcm_stream_lock_irq(fe, stream); in dpcm_be_disconnect()
1311 for_each_dpcm_be_safe(fe, stream, dpcm, d) { in dpcm_be_disconnect()
1312 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1319 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1320 stream ? "capture" : "playback", fe->dai_link->name, in dpcm_be_disconnect()
1324 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1329 snd_soc_dpcm_stream_unlock_irq(fe, stream); in dpcm_be_disconnect()
1408 int dpcm_path_get(struct snd_soc_pcm_runtime *fe, in dpcm_path_get() argument
1411 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0); in dpcm_path_get()
1414 if (fe->dai_link->num_cpus > 1) { in dpcm_path_get()
1415 dev_err(fe->dev, in dpcm_path_get()
1422 fe->card->component_chaining ? in dpcm_path_get()
1426 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1429 dev_dbg(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name, in dpcm_path_get()
1461 static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_prune_paths() argument
1468 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_prune_paths()
1472 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1474 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1480 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1484 static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_add_paths() argument
1487 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1491 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_add_paths()
1495 if (!fe_substream->runtime && !fe->fe_compr) in dpcm_add_paths()
1517 dev_dbg(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1527 if (fe->card->component_chaining && in dpcm_add_paths()
1533 err = dpcm_be_connect(fe, be, stream); in dpcm_add_paths()
1535 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1546 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1554 int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, in dpcm_process_paths() argument
1558 return dpcm_add_paths(fe, stream, list); in dpcm_process_paths()
1560 return dpcm_prune_paths(fe, stream, list); in dpcm_process_paths()
1563 void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_clear_pending_state() argument
1567 for_each_dpcm_be(fe, stream, dpcm) in dpcm_clear_pending_state()
1571 void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_stop() argument
1577 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_stop()
1586 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_stop()
1615 int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_startup() argument
1617 struct snd_pcm_substream *fe_substream = snd_soc_dpcm_get_substream(fe, stream); in dpcm_be_dai_startup()
1623 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_startup()
1636 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_startup()
1677 dpcm_be_dai_startup_rollback(fe, stream, dpcm); in dpcm_be_dai_startup()
1679 return soc_pcm_ret(fe, err); in dpcm_be_dai_startup()
1684 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_fe() local
1697 for_each_rtd_cpu_dais(fe, i, dai) { in dpcm_runtime_setup_fe()
1718 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_be_format() local
1725 if (!fe->dai_link->dpcm_merged_format) in dpcm_runtime_setup_be_format()
1733 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_format()
1755 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_be_chan() local
1761 if (!fe->dai_link->dpcm_merged_chan) in dpcm_runtime_setup_be_chan()
1769 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_chan()
1803 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_runtime_setup_be_rate() local
1809 if (!fe->dai_link->dpcm_merged_rate) in dpcm_runtime_setup_be_rate()
1817 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_runtime_setup_be_rate()
1842 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_apply_symmetry() local
1850 for_each_rtd_cpu_dais (fe, i, fe_cpu_dai) { in dpcm_apply_symmetry()
1858 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_apply_symmetry()
1883 return soc_pcm_ret(fe, err); in dpcm_apply_symmetry()
1888 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_startup() local
1891 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_startup()
1893 ret = dpcm_be_dai_startup(fe, stream); in dpcm_fe_dai_startup()
1897 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
1900 ret = __soc_pcm_open(fe, fe_substream); in dpcm_fe_dai_startup()
1904 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1916 dpcm_be_dai_startup_unwind(fe, stream); in dpcm_fe_dai_startup()
1918 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_startup()
1920 return soc_pcm_ret(fe, ret); in dpcm_fe_dai_startup()
1925 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_shutdown() local
1928 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_fe_dai_shutdown()
1930 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_shutdown()
1933 dpcm_be_dai_shutdown(fe, stream); in dpcm_fe_dai_shutdown()
1935 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
1938 __soc_pcm_close(fe, substream); in dpcm_fe_dai_shutdown()
1941 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); in dpcm_fe_dai_shutdown()
1943 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
1944 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_shutdown()
1948 void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_free() argument
1954 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_free()
1961 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_free()
1965 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_free()
1991 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_hw_free() local
1994 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_hw_free()
1995 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_free()
1997 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
2000 soc_pcm_hw_clean(fe, substream, 0); in dpcm_fe_dai_hw_free()
2004 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_free()
2006 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2007 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_free()
2009 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_hw_free()
2013 int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_hw_params() argument
2020 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2027 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2031 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2044 if (!snd_soc_dpcm_can_be_params(fe, be, stream)) in dpcm_be_dai_hw_params()
2064 dev_dbg(fe->dev, "ASoC: %s() failed at %s (%d)\n", in dpcm_be_dai_hw_params()
2068 for_each_dpcm_be_rollback(fe, stream, dpcm) { in dpcm_be_dai_hw_params()
2072 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_hw_params()
2076 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) in dpcm_be_dai_hw_params()
2094 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_hw_params() local
2097 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_hw_params()
2098 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_hw_params()
2100 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2102 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_fe_dai_hw_params()
2106 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
2107 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
2111 ret = __soc_pcm_hw_params(fe, substream, params); in dpcm_fe_dai_hw_params()
2113 dpcm_be_dai_hw_free(fe, stream); in dpcm_fe_dai_hw_params()
2115 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2118 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_hw_params()
2119 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_hw_params()
2121 return soc_pcm_ret(fe, ret); in dpcm_fe_dai_hw_params()
2124 int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, in dpcm_be_dai_trigger() argument
2133 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_trigger()
2142 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_trigger()
2195 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2222 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2224 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2237 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2269 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2290 return soc_pcm_ret(fe, ret); in dpcm_be_dai_trigger()
2297 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_dai_trigger_fe_be() local
2302 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2303 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2309 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2314 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2318 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2319 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2328 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_do_trigger() local
2331 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2333 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2375 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", in dpcm_fe_dai_do_trigger()
2376 fe->dai_link->name, cmd); in dpcm_fe_dai_do_trigger()
2381 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
2382 fe->dai_link->name); in dpcm_fe_dai_do_trigger()
2388 dev_err(fe->dev, "ASoC: trigger FE cmd: %d failed: %d\n", in dpcm_fe_dai_do_trigger()
2397 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2401 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2404 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2409 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2415 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_trigger() local
2421 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2422 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2430 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_be_dai_prepare() argument
2435 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_be_dai_prepare()
2442 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_be_dai_prepare()
2445 if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) in dpcm_be_dai_prepare()
2464 return soc_pcm_ret(fe, ret); in dpcm_be_dai_prepare()
2469 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); in dpcm_fe_dai_prepare() local
2472 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_prepare()
2474 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2476 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); in dpcm_fe_dai_prepare()
2479 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2481 …dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based rou… in dpcm_fe_dai_prepare()
2482 fe->dai_link->name); in dpcm_fe_dai_prepare()
2483 dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2484 fe->dai_link->name); in dpcm_fe_dai_prepare()
2489 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_fe_dai_prepare()
2494 ret = __soc_pcm_prepare(fe, substream); in dpcm_fe_dai_prepare()
2498 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2501 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_fe_dai_prepare()
2502 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_prepare()
2504 return soc_pcm_ret(fe, ret); in dpcm_fe_dai_prepare()
2507 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_shutdown() argument
2510 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_shutdown()
2511 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_shutdown()
2514 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2515 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_shutdown()
2519 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2520 fe->dai_link->name); in dpcm_run_update_shutdown()
2524 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n", in dpcm_run_update_shutdown()
2525 fe->dai_link->name); in dpcm_run_update_shutdown()
2527 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); in dpcm_run_update_shutdown()
2530 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_shutdown()
2532 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_shutdown()
2535 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_shutdown()
2537 return soc_pcm_ret(fe, err); in dpcm_run_update_shutdown()
2540 static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) in dpcm_run_update_startup() argument
2543 snd_soc_dpcm_get_substream(fe, stream); in dpcm_run_update_startup()
2545 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_run_update_startup()
2548 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2549 stream ? "capture" : "playback", fe->dai_link->name); in dpcm_run_update_startup()
2552 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2553 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2554 dev_err(fe->dev, "ASoC: FE %s is not ready %d\n", in dpcm_run_update_startup()
2555 fe->dai_link->name, fe->dpcm[stream].state); in dpcm_run_update_startup()
2561 ret = dpcm_be_dai_startup(fe, stream); in dpcm_run_update_startup()
2566 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2569 ret = dpcm_be_dai_hw_params(fe, stream); in dpcm_run_update_startup()
2574 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2577 ret = dpcm_be_dai_prepare(fe, stream); in dpcm_run_update_startup()
2582 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); in dpcm_run_update_startup()
2585 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2586 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2591 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", in dpcm_run_update_startup()
2592 fe->dai_link->name); in dpcm_run_update_startup()
2598 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n", in dpcm_run_update_startup()
2599 fe->dai_link->name); in dpcm_run_update_startup()
2601 ret = dpcm_be_dai_trigger(fe, stream, in dpcm_run_update_startup()
2610 dpcm_be_dai_hw_free(fe, stream); in dpcm_run_update_startup()
2612 dpcm_be_dai_shutdown(fe, stream); in dpcm_run_update_startup()
2615 for_each_dpcm_be(fe, stream, dpcm) { in dpcm_run_update_startup()
2619 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) in dpcm_run_update_startup()
2627 return soc_pcm_ret(fe, ret); in dpcm_run_update_startup()
2630 static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) in soc_dpcm_fe_runtime_update() argument
2636 if (!fe->dai_link->dynamic) in soc_dpcm_fe_runtime_update()
2639 if (fe->dai_link->num_cpus > 1) { in soc_dpcm_fe_runtime_update()
2640 dev_err(fe->dev, in soc_dpcm_fe_runtime_update()
2646 if (!snd_soc_dai_active(asoc_rtd_to_cpu(fe, 0))) in soc_dpcm_fe_runtime_update()
2650 dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n", in soc_dpcm_fe_runtime_update()
2651 new ? "new" : "old", fe->dai_link->name); in soc_dpcm_fe_runtime_update()
2656 if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2657 !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2661 if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || in soc_dpcm_fe_runtime_update()
2662 !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) in soc_dpcm_fe_runtime_update()
2665 paths = dpcm_path_get(fe, stream, &list); in soc_dpcm_fe_runtime_update()
2670 count = dpcm_process_paths(fe, stream, &list, new); in soc_dpcm_fe_runtime_update()
2672 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); in soc_dpcm_fe_runtime_update()
2674 dpcm_run_update_startup(fe, stream); in soc_dpcm_fe_runtime_update()
2676 dpcm_run_update_shutdown(fe, stream); in soc_dpcm_fe_runtime_update()
2677 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); in soc_dpcm_fe_runtime_update()
2679 dpcm_clear_pending_state(fe, stream); in soc_dpcm_fe_runtime_update()
2680 dpcm_be_disconnect(fe, stream); in soc_dpcm_fe_runtime_update()
2694 struct snd_soc_pcm_runtime *fe; in snd_soc_dpcm_runtime_update() local
2699 for_each_card_rtds(card, fe) { in snd_soc_dpcm_runtime_update()
2700 ret = soc_dpcm_fe_runtime_update(fe, 0); in snd_soc_dpcm_runtime_update()
2706 for_each_card_rtds(card, fe) { in snd_soc_dpcm_runtime_update()
2707 ret = soc_dpcm_fe_runtime_update(fe, 1); in snd_soc_dpcm_runtime_update()
2720 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_cleanup() local
2724 snd_soc_dpcm_mutex_assert_held(fe); in dpcm_fe_dai_cleanup()
2727 for_each_dpcm_be(fe, stream, dpcm) in dpcm_fe_dai_cleanup()
2730 dpcm_be_disconnect(fe, stream); in dpcm_fe_dai_cleanup()
2735 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_close() local
2738 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_close()
2743 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_close()
2749 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); in dpcm_fe_dai_open() local
2754 snd_soc_dpcm_mutex_lock(fe); in dpcm_fe_dai_open()
2756 ret = dpcm_path_get(fe, stream, &list); in dpcm_fe_dai_open()
2761 dpcm_process_paths(fe, stream, &list, 1); in dpcm_fe_dai_open()
2767 dpcm_clear_pending_state(fe, stream); in dpcm_fe_dai_open()
2770 snd_soc_dpcm_mutex_unlock(fe); in dpcm_fe_dai_open()
3016 int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) in snd_soc_dpcm_fe_can_update() argument
3018 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) in snd_soc_dpcm_fe_can_update()
3025 int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_be_can_update() argument
3028 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
3029 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
3044 static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_check_state() argument
3057 if (dpcm->fe == fe) in snd_soc_dpcm_check_state()
3060 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
3077 int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_free_stop() argument
3086 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_free_stop()
3094 int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_params() argument
3104 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_params()
3112 int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe, in snd_soc_dpcm_can_be_prepared() argument
3121 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); in snd_soc_dpcm_can_be_prepared()