Lines Matching +full:ignore +full:- +full:suspend +full:- +full:widgets

1 // SPDX-License-Identifier: GPL-2.0+
3 // soc-pcm.c -- ALSA SoC PCM
25 #include <sound/soc-dpcm.h>
26 #include <sound/soc-link.h>
33 return snd_soc_ret(rtd->dev, ret, in _soc_pcm_ret()
34 "at %s() on %s\n", func, rtd->dai_link->name); in _soc_pcm_ret()
41 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE)
51 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_can_be_update()
52 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_can_be_update()
53 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_can_be_update()
71 if (dpcm->fe == fe) in snd_soc_dpcm_check_state()
74 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
88 * We can only hw_free, stop, pause or suspend a BE DAI if any of it's FE
140 return (rtd)->dai_link->num_cpus == 1 ? snd_soc_rtd_to_cpu(rtd, 0)->name : "multicpu"; in soc_cpu_dai_name()
144 return (rtd)->dai_link->num_codecs == 1 ? snd_soc_rtd_to_codec(rtd, 0)->name : "multicodec"; in soc_codec_dai_name()
163 return "suspend"; in dpcm_state_string()
179 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
184 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
185 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
188 offset += scnprintf(buf + offset, size - offset, "State: %s\n", in dpcm_show_state()
189 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
191 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
192 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
193 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
201 offset += scnprintf(buf + offset, size - offset, "Backends:\n"); in dpcm_show_state()
203 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
204 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
210 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_show_state()
211 params = &be->dpcm[stream].hw_params; in dpcm_show_state()
213 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
214 "- %s\n", be->dai_link->name); in dpcm_show_state()
216 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
218 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
220 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
221 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
222 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
236 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file()
241 if (fe->dai_link->num_cpus > 1) in dpcm_state_read_file()
242 return snd_soc_ret(fe->dev, -EINVAL, in dpcm_state_read_file()
247 return -ENOMEM; in dpcm_state_read_file()
254 out_count - offset); in dpcm_state_read_file()
271 if (!rtd->dai_link->dynamic) in soc_dpcm_debugfs_add()
274 if (!rtd->card->debugfs_card_root) in soc_dpcm_debugfs_add()
277 rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name, in soc_dpcm_debugfs_add()
278 rtd->card->debugfs_card_root); in soc_dpcm_debugfs_add()
280 debugfs_create_file("state", 0444, rtd->debugfs_dpcm_root, in soc_dpcm_debugfs_add()
288 name = kasprintf(GFP_KERNEL, "%s:%s", dpcm->be->dai_link->name, in dpcm_create_debugfs_state()
291 dpcm->debugfs_state = debugfs_create_dir( in dpcm_create_debugfs_state()
292 name, dpcm->fe->debugfs_dpcm_root); in dpcm_create_debugfs_state()
293 debugfs_create_u32("state", 0644, dpcm->debugfs_state, in dpcm_create_debugfs_state()
294 &dpcm->state); in dpcm_create_debugfs_state()
301 debugfs_remove_recursive(dpcm->debugfs_state); in dpcm_remove_debugfs_state()
328 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
330 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
331 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
333 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
340 be->dpcm[stream].runtime_update = state; in dpcm_set_be_update_state()
344 * snd_soc_runtime_action() - Increment/Decrement active count for
348 * @action: Activate stream if 1. Deactivate if -1.
354 * Must be called with the rtd->card->pcm_mutex being held
370 if (component->num_dai) in snd_soc_runtime_action()
372 component->active += action; in snd_soc_runtime_action()
378 * snd_soc_runtime_ignore_pmdown_time() - Check whether to ignore the power down delay
383 * been configured to ignore the delay, or if none of the components benefits
391 if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) in snd_soc_runtime_ignore_pmdown_time()
395 if (component->driver->use_pmdown_time) in snd_soc_runtime_ignore_pmdown_time()
411 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_dapm_stream_event()
413 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", in dpcm_dapm_stream_event()
414 be->dai_link->name, event, dir); in dpcm_dapm_stream_event()
417 (be->dpcm[dir].users >= 1)) in dpcm_dapm_stream_event()
430 dai->symmetric_rate = params_rate(params); in soc_pcm_set_dai_params()
431 dai->symmetric_channels = params_channels(params); in soc_pcm_set_dai_params()
432 dai->symmetric_sample_bits = snd_pcm_format_physical_width(params_format(params)); in soc_pcm_set_dai_params()
434 dai->symmetric_rate = 0; in soc_pcm_set_dai_params()
435 dai->symmetric_channels = 0; in soc_pcm_set_dai_params()
436 dai->symmetric_sample_bits = 0; in soc_pcm_set_dai_params()
450 if (soc_dai->symmetric_##name && \ in soc_pcm_apply_symmetry()
451 (soc_dai->driver->symmetric_##name || rtd->dai_link->symmetric_##name)) { \ in soc_pcm_apply_symmetry()
452 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %s to %d\n",\ in soc_pcm_apply_symmetry()
453 #name, soc_dai->symmetric_##name); \ in soc_pcm_apply_symmetry()
455 ret = snd_pcm_hw_constraint_single(substream->runtime, \ in soc_pcm_apply_symmetry()
457 soc_dai->symmetric_##name); \ in soc_pcm_apply_symmetry()
459 return snd_soc_ret(soc_dai->dev, ret, \ in soc_pcm_apply_symmetry()
483 symmetry = rtd->dai_link->symmetric_##xxx; \ in soc_pcm_params_symmetry()
485 symmetry |= dai->driver->symmetric_##xxx; \ in soc_pcm_params_symmetry()
490 cpu_dai->symmetric_##xxx && \ in soc_pcm_params_symmetry()
491 cpu_dai->symmetric_##xxx != d.symmetric_##xxx) \ in soc_pcm_params_symmetry()
492 return snd_soc_ret(rtd->dev, -EINVAL, \ in soc_pcm_params_symmetry()
493 "unmatched %s symmetry: %s:%d - %s:%d\n", \ in soc_pcm_params_symmetry()
494 #xxx, cpu_dai->name, cpu_dai->symmetric_##xxx, \ in soc_pcm_params_symmetry()
508 struct snd_soc_dai_link *link = rtd->dai_link; in soc_pcm_update_symmetry()
512 symmetry = link->symmetric_rate || in soc_pcm_update_symmetry()
513 link->symmetric_channels || in soc_pcm_update_symmetry()
514 link->symmetric_sample_bits; in soc_pcm_update_symmetry()
518 dai->driver->symmetric_rate || in soc_pcm_update_symmetry()
519 dai->driver->symmetric_channels || in soc_pcm_update_symmetry()
520 dai->driver->symmetric_sample_bits; in soc_pcm_update_symmetry()
523 substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX; in soc_pcm_update_symmetry()
534 ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 0, bits); in soc_pcm_set_msb()
536 dev_warn(rtd->dev, "ASoC: Failed to set MSB %d: %d\n", in soc_pcm_set_msb()
545 int stream = substream->stream; in soc_pcm_apply_msb()
552 if (pcm_codec->sig_bits == 0) { in soc_pcm_apply_msb()
556 bits = max(pcm_codec->sig_bits, bits); in soc_pcm_apply_msb()
562 if (pcm_cpu->sig_bits == 0) { in soc_pcm_apply_msb()
566 cpu_bits = max(pcm_cpu->sig_bits, cpu_bits); in soc_pcm_apply_msb()
575 hw->rates = UINT_MAX; in soc_pcm_hw_init()
576 hw->rate_min = 0; in soc_pcm_hw_init()
577 hw->rate_max = UINT_MAX; in soc_pcm_hw_init()
578 hw->channels_min = 0; in soc_pcm_hw_init()
579 hw->channels_max = UINT_MAX; in soc_pcm_hw_init()
580 hw->formats = ULLONG_MAX; in soc_pcm_hw_init()
586 hw->rates = snd_pcm_rate_mask_intersect(hw->rates, p->rates); in soc_pcm_hw_update_rate()
588 /* setup hw->rate_min/max via hw->rates first */ in soc_pcm_hw_update_rate()
591 /* update hw->rate_min/max by snd_soc_pcm_stream */ in soc_pcm_hw_update_rate()
592 hw->rate_min = max(hw->rate_min, p->rate_min); in soc_pcm_hw_update_rate()
593 hw->rate_max = min_not_zero(hw->rate_max, p->rate_max); in soc_pcm_hw_update_rate()
599 hw->channels_min = max(hw->channels_min, p->channels_min); in soc_pcm_hw_update_chan()
600 hw->channels_max = min(hw->channels_max, p->channels_max); in soc_pcm_hw_update_chan()
606 hw->formats &= p->formats; in soc_pcm_hw_update_format()
607 hw->subformats &= p->subformats; in soc_pcm_hw_update_format()
611 * snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
649 cpu_chan_min = hw->channels_min; in snd_soc_runtime_calc_hw()
650 cpu_chan_max = hw->channels_max; in snd_soc_runtime_calc_hw()
672 if (!hw->channels_min) in snd_soc_runtime_calc_hw()
673 return -EINVAL; in snd_soc_runtime_calc_hw()
680 if (rtd->dai_link->num_codecs > 1) { in snd_soc_runtime_calc_hw()
681 hw->channels_min = cpu_chan_min; in snd_soc_runtime_calc_hw()
682 hw->channels_max = cpu_chan_max; in snd_soc_runtime_calc_hw()
691 struct snd_pcm_hardware *hw = &substream->runtime->hw; in soc_pcm_init_runtime_hw()
693 u64 formats = hw->formats; in soc_pcm_init_runtime_hw()
700 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
703 hw->formats &= formats; in soc_pcm_init_runtime_hw()
753 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
773 pinctrl_pm_select_sleep_state(component->dev); in soc_pcm_clean()
789 /* PCM close ops for non-DPCM streams */
803 struct snd_pcm_hardware *hw = &substream->runtime->hw; in soc_hw_sanity_check()
807 struct device *dev = rtd->dev; in soc_hw_sanity_check()
810 if (!hw->rates) in soc_hw_sanity_check()
814 if (!hw->formats) in soc_hw_sanity_check()
818 if (!hw->channels_min || !hw->channels_max || in soc_hw_sanity_check()
819 hw->channels_min > hw->channels_max) in soc_hw_sanity_check()
822 dev_dbg(dev, "ASoC: %s <-> %s info:\n", name_codec, in soc_hw_sanity_check()
824 dev_dbg(dev, "ASoC: rate mask 0x%x\n", hw->rates); in soc_hw_sanity_check()
825 dev_dbg(dev, "ASoC: ch min %d max %d\n", hw->channels_min, in soc_hw_sanity_check()
826 hw->channels_max); in soc_hw_sanity_check()
827 dev_dbg(dev, "ASoC: rate min %d max %d\n", hw->rate_min, in soc_hw_sanity_check()
828 hw->rate_max); in soc_hw_sanity_check()
833 return snd_soc_ret(dev, -EINVAL, in soc_hw_sanity_check()
834 "%s <-> %s No matching %s\n", name_codec, name_cpu, err_msg); in soc_hw_sanity_check()
838 * Called by ALSA when a PCM substream is opened, the runtime->hw record is
852 pinctrl_pm_select_default_state(component->dev); in __soc_pcm_open()
874 if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) in __soc_pcm_open()
895 snd_soc_runtime_activate(rtd, substream->stream); in __soc_pcm_open()
904 /* PCM open ops for non-DPCM streams */
942 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in __soc_pcm_prepare()
943 rtd->pop_wait) { in __soc_pcm_prepare()
944 rtd->pop_wait = 0; in __soc_pcm_prepare()
945 cancel_delayed_work(&rtd->delayed_work); in __soc_pcm_prepare()
948 snd_soc_dapm_stream_event(rtd, substream->stream, in __soc_pcm_prepare()
953 snd_soc_dai_digital_mute(dai, 0, substream->stream); in __soc_pcm_prepare()
961 * denial-of-service attack on the syslog / diskspace. in __soc_pcm_prepare()
966 /* PCM prepare ops for non-DPCM streams */
980 * denial-of-service attack on the syslog / diskspace. in soc_pcm_prepare()
992 interval->min = channels; in soc_pcm_codec_params_fixup()
993 interval->max = channels; in soc_pcm_codec_params_fixup()
1009 if (snd_soc_dai_stream_active(dai, substream->stream) == 1) { in soc_pcm_hw_clean()
1011 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_clean()
1016 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
1026 if (snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_clean()
1041 /* hw_free PCM ops for non-DPCM streams */
1056 * (using snd_pcm_lib_* ). It's non-atomic.
1078 unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream); in __soc_pcm_hw_params()
1088 * capture-only CODEC is acting as an LRCLK and/or BCLK master in __soc_pcm_hw_params()
1089 * for the DAI link including a playback-only CODEC. in __soc_pcm_hw_params()
1094 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in __soc_pcm_hw_params()
1122 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in __soc_pcm_hw_params()
1132 * soc.h :: [dai_link->ch_maps Image sample] in __soc_pcm_hw_params()
1135 if (ch_maps->cpu == i) in __soc_pcm_hw_params()
1136 ch_mask |= ch_maps->ch_mask; in __soc_pcm_hw_params()
1159 /* hw_params PCM ops for non-DPCM streams */
1198 if (component->driver->trigger_start) in soc_pcm_trigger()
1199 start = component->driver->trigger_start; in soc_pcm_trigger()
1200 if (component->driver->trigger_stop) in soc_pcm_trigger()
1201 stop = component->driver->trigger_stop; in soc_pcm_trigger()
1203 if (rtd->dai_link->trigger_start) in soc_pcm_trigger()
1204 start = rtd->dai_link->trigger_start; in soc_pcm_trigger()
1205 if (rtd->dai_link->trigger_stop) in soc_pcm_trigger()
1206 stop = rtd->dai_link->trigger_stop; in soc_pcm_trigger()
1210 return -EINVAL; in soc_pcm_trigger()
1253 for (i = TRIGGER_MAX; i > 0; i--) { in soc_pcm_trigger()
1254 r = trigger[stop][i - 1](substream, cmd, rollback); in soc_pcm_trigger()
1266 * the runtime->delay will be updated via snd_soc_pcm_component/dai_delay().
1270 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_pointer()
1281 runtime->delay = cpu_delay + codec_delay; in soc_pcm_pointer()
1298 if (dpcm->be == be) in dpcm_be_connect()
1304 if (!fe_substream->pcm->nonatomic && be_substream->pcm->nonatomic) in dpcm_be_connect()
1305 return snd_soc_ret(be->dev, -EINVAL, in dpcm_be_connect()
1307 __func__, fe->dai_link->name, be->dai_link->name); in dpcm_be_connect()
1309 if (fe_substream->pcm->nonatomic && !be_substream->pcm->nonatomic) { in dpcm_be_connect()
1310 dev_dbg(be->dev, "FE is nonatomic but BE is not, forcing BE as nonatomic\n"); in dpcm_be_connect()
1311 be_substream->pcm->nonatomic = 1; in dpcm_be_connect()
1316 return -ENOMEM; in dpcm_be_connect()
1318 dpcm->be = be; in dpcm_be_connect()
1319 dpcm->fe = fe; in dpcm_be_connect()
1320 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; in dpcm_be_connect()
1322 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1323 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1326 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1327 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_connect()
1328 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1343 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1351 if (dpcm->fe == fe) in dpcm_be_reparent()
1354 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1356 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1357 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1359 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1360 be_substream->runtime = fe_substream->runtime; in dpcm_be_reparent()
1376 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1378 dpcm->be->dai_link->name); in dpcm_be_disconnect()
1380 if (dpcm->state != SND_SOC_DPCM_LINK_STATE_FREE) in dpcm_be_disconnect()
1383 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1384 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_disconnect()
1385 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1388 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1390 list_del(&dpcm->list_be); in dpcm_be_disconnect()
1391 list_move(&dpcm->list_fe, &deleted_dpcms); in dpcm_be_disconnect()
1398 list_del(&dpcm->list_fe); in dpcm_be_disconnect()
1413 dev_dbg(card->dev, "ASoC: find BE for widget %s\n", widget->name); in dpcm_get_be()
1417 if (!be->dai_link->no_pcm) in dpcm_get_be()
1426 dev_dbg(card->dev, "ASoC: try BE : %s\n", in dpcm_get_be()
1427 w ? w->name : "(not set)"); in dpcm_get_be()
1454 struct snd_soc_card *card = widget->dapm->card; in dpcm_end_walk_at_be()
1478 if (fe->dai_link->num_cpus > 1) in dpcm_path_get()
1479 return snd_soc_ret(fe->dev, -EINVAL, in dpcm_path_get()
1482 /* get number of valid DAI paths and their widgets */ in dpcm_path_get()
1484 fe->card->component_chaining ? in dpcm_path_get()
1488 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1491 dev_dbg(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name, in dpcm_path_get()
1509 for_each_rtd_dais(dpcm->be, i, dai) { in dpcm_be_is_active()
1514 * widgets are in the active list. in dpcm_be_is_active()
1529 /* Destroy any old FE <--> BE connections */ in dpcm_prune_paths()
1534 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1536 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1537 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_prune_paths()
1538 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_prune_paths()
1542 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1549 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1557 if (!fe_substream->runtime && !fe->fe_compr) in dpcm_add_paths()
1560 /* Create any new FE <--> BE connections */ in dpcm_add_paths()
1563 switch (widget->id) { in dpcm_add_paths()
1579 dev_dbg(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1580 widget->name); in dpcm_add_paths()
1586 * This helps to avoid unnecessary re-configuration of an in dpcm_add_paths()
1590 if (fe->card->component_chaining && in dpcm_add_paths()
1591 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_add_paths()
1592 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_add_paths()
1593 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_add_paths()
1594 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_add_paths()
1600 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1601 widget->name); in dpcm_add_paths()
1611 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1620 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_clear_pending_state()
1630 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_stop()
1641 if (be->dpcm[stream].users == 0) { in dpcm_be_dai_stop()
1642 dev_err(be->dev, "ASoC: no users %s at close - state %s\n", in dpcm_be_dai_stop()
1644 dpcm_state_string(be->dpcm[stream].state)); in dpcm_be_dai_stop()
1648 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_stop()
1651 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) { in dpcm_be_dai_stop()
1655 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) { in dpcm_be_dai_stop()
1657 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_stop()
1662 be_substream->runtime = NULL; in dpcm_be_dai_stop()
1663 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_stop()
1678 be = dpcm->be; in dpcm_be_dai_startup()
1682 dev_err(be->dev, "ASoC: no backend %s stream\n", in dpcm_be_dai_startup()
1692 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) { in dpcm_be_dai_startup()
1693 dev_err(be->dev, "ASoC: too many users %s at open %s\n", in dpcm_be_dai_startup()
1695 dpcm_state_string(be->dpcm[stream].state)); in dpcm_be_dai_startup()
1699 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1702 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1703 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1706 dev_dbg(be->dev, "ASoC: open %s BE %s\n", in dpcm_be_dai_startup()
1707 snd_pcm_direction_name(stream), be->dai_link->name); in dpcm_be_dai_startup()
1709 be_substream->runtime = fe_substream->runtime; in dpcm_be_dai_startup()
1712 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1713 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1714 dev_err(be->dev, "ASoC: no users %s at unwind %s\n", in dpcm_be_dai_startup()
1716 dpcm_state_string(be->dpcm[stream].state)); in dpcm_be_dai_startup()
1718 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1721 be->dpcm[stream].be_start = 0; in dpcm_be_dai_startup()
1722 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1737 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_fe()
1738 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_fe()
1740 int stream = substream->stream; in dpcm_runtime_setup_fe()
1741 u64 formats = hw->formats; in dpcm_runtime_setup_fe()
1747 hw->formats &= formats; in dpcm_runtime_setup_fe()
1771 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_be_format()
1772 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_be_format()
1775 int stream = substream->stream; in dpcm_runtime_setup_be_format()
1777 if (!fe->dai_link->dpcm_merged_format) in dpcm_runtime_setup_be_format()
1786 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_setup_be_format()
1808 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_be_chan()
1809 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_be_chan()
1811 int stream = substream->stream; in dpcm_runtime_setup_be_chan()
1813 if (!fe->dai_link->dpcm_merged_chan) in dpcm_runtime_setup_be_chan()
1822 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_setup_be_chan()
1844 if (be->dai_link->num_codecs == 1) { in dpcm_runtime_setup_be_chan()
1856 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_be_rate()
1857 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_be_rate()
1859 int stream = substream->stream; in dpcm_runtime_setup_be_rate()
1861 if (!fe->dai_link->dpcm_merged_rate) in dpcm_runtime_setup_be_rate()
1870 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_setup_be_rate()
1911 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_apply_symmetry()
1922 if (rtd->dai_link->be_hw_params_fixup) in dpcm_apply_symmetry()
1941 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup()
1949 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
1956 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
1978 int stream = substream->stream; in dpcm_fe_dai_shutdown()
1987 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
1995 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
2008 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_free()
2016 /* only free hw when no longer used - check all FEs */ in dpcm_be_dai_hw_free()
2021 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
2024 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
2025 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
2026 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
2027 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
2028 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
2029 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
2032 dev_dbg(be->dev, "ASoC: hw_free BE %s\n", in dpcm_be_dai_hw_free()
2033 be->dai_link->name); in dpcm_be_dai_hw_free()
2037 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
2044 int stream = substream->stream; in dpcm_fe_dai_hw_free()
2049 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
2058 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2075 be = dpcm->be; in dpcm_be_dai_hw_params()
2083 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2091 /* copy the fixed-up hw params for BE dai */ in dpcm_be_dai_hw_params()
2092 memcpy(&be->dpcm[stream].hw_params, &hw_params, in dpcm_be_dai_hw_params()
2099 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2100 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2101 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2104 dev_dbg(be->dev, "ASoC: hw_params BE %s\n", in dpcm_be_dai_hw_params()
2105 be->dai_link->name); in dpcm_be_dai_hw_params()
2111 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2116 dev_dbg(fe->dev, "ASoC: %s() failed at %s (%d)\n", in dpcm_be_dai_hw_params()
2117 __func__, be->dai_link->name, ret); in dpcm_be_dai_hw_params()
2121 be = dpcm->be; in dpcm_be_dai_hw_params()
2131 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2132 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2133 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2134 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2147 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params()
2152 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2158 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
2159 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
2167 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2188 be = dpcm->be; in dpcm_be_dai_trigger()
2197 dev_dbg(be->dev, "ASoC: trigger BE %s cmd %d\n", in dpcm_be_dai_trigger()
2198 be->dai_link->name, cmd); in dpcm_be_dai_trigger()
2202 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2203 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2204 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2205 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2208 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2209 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2212 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_PAUSED) in dpcm_be_dai_trigger()
2219 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2223 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2226 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2229 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2230 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2235 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2239 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2242 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2243 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2247 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2248 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2250 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2251 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2256 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2260 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2263 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2264 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2267 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2268 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2270 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2274 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2276 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2277 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2280 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2286 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2287 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2289 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2290 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2295 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2296 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2298 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2302 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2305 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2306 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2311 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2315 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2318 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2321 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2322 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2324 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2325 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2330 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2334 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2354 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2355 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2361 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2365 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2369 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2370 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2375 return snd_soc_ret(fe->dev, ret, "trigger FE cmd: %d failed\n", cmd); in dpcm_dai_trigger_fe_be()
2381 int stream = substream->stream; in dpcm_fe_dai_do_trigger()
2384 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2386 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2396 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
2397 fe->dai_link->name); in dpcm_fe_dai_do_trigger()
2398 ret = -EINVAL; in dpcm_fe_dai_do_trigger()
2415 ret = -EINVAL; in dpcm_fe_dai_do_trigger()
2426 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2430 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2433 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2438 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2445 int stream = substream->stream; in dpcm_fe_dai_trigger()
2450 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2451 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2466 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_prepare()
2477 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2478 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2479 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2480 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2483 dev_dbg(be->dev, "ASoC: prepare BE %s\n", in dpcm_be_dai_prepare()
2484 be->dai_link->name); in dpcm_be_dai_prepare()
2490 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2497 * denial-of-service attack on the syslog / diskspace. in dpcm_be_dai_prepare()
2505 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare()
2509 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2514 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2516 …dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based rou… in dpcm_fe_dai_prepare()
2517 fe->dai_link->name); in dpcm_fe_dai_prepare()
2518 dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2519 fe->dai_link->name); in dpcm_fe_dai_prepare()
2520 ret = -EINVAL; in dpcm_fe_dai_prepare()
2533 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2543 * denial-of-service attack on the syslog / diskspace. in dpcm_fe_dai_prepare()
2552 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2553 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_shutdown()
2572 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2573 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_startup()
2576 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2577 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2578 dev_err(fe->dev, "ASoC: FE %s is not ready %s\n", in dpcm_run_update_startup()
2579 fe->dai_link->name, dpcm_state_string(fe->dpcm[stream].state)); in dpcm_run_update_startup()
2580 ret = -EINVAL; in dpcm_run_update_startup()
2590 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2598 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2609 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2610 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2626 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_run_update_startup()
2632 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE || in dpcm_run_update_startup()
2633 be->dpcm[stream].state == SND_SOC_DPCM_STATE_NEW) in dpcm_run_update_startup()
2634 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_run_update_startup()
2646 if (!fe->dai_link->dynamic) in soc_dpcm_fe_runtime_update()
2649 if (fe->dai_link->num_cpus > 1) in soc_dpcm_fe_runtime_update()
2650 return snd_soc_ret(fe->dev, -EINVAL, in soc_dpcm_fe_runtime_update()
2658 dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n", in soc_dpcm_fe_runtime_update()
2659 new ? "new" : "old", fe->dai_link->name); in soc_dpcm_fe_runtime_update()
2730 return snd_soc_ret(card->dev, ret, "%s() failed\n", __func__); in snd_soc_dpcm_runtime_update()
2738 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup()
2744 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_cleanup()
2768 int stream = fe_substream->stream; in dpcm_fe_dai_open()
2776 /* calculate valid and active FE <-> BE dpcms */ in dpcm_fe_dai_open()
2793 struct snd_soc_dai_link *dai_link = rtd->dai_link; in soc_get_playback_capture()
2804 if (dai_link->dynamic && dai_link->num_cpus > 1) in soc_get_playback_capture()
2805 return snd_soc_ret(rtd->dev, -EINVAL, in soc_get_playback_capture()
2806 "DPCM doesn't support Multi CPU for Front-Ends yet\n"); in soc_get_playback_capture()
2814 * soc.h :: [dai_link->ch_maps Image sample] in soc_get_playback_capture()
2817 cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); in soc_get_playback_capture()
2818 codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); in soc_get_playback_capture()
2831 if (dai_link->dynamic || dai_link->no_pcm) in soc_get_playback_capture()
2842 if (dai_link->playback_only) in soc_get_playback_capture()
2845 if (dai_link->capture_only) in soc_get_playback_capture()
2849 return snd_soc_ret(rtd->dev, -EINVAL, in soc_get_playback_capture()
2850 "substream %s has no playback, no capture\n", dai_link->stream_name); in soc_get_playback_capture()
2866 if (rtd->dai_link->c2c_params) { in soc_create_pcm()
2868 rtd->dai_link->stream_name); in soc_create_pcm()
2870 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id, in soc_create_pcm()
2872 } else if (rtd->dai_link->no_pcm) { in soc_create_pcm()
2874 rtd->dai_link->stream_name); in soc_create_pcm()
2876 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id, in soc_create_pcm()
2879 if (rtd->dai_link->dynamic) in soc_create_pcm()
2881 rtd->dai_link->stream_name); in soc_create_pcm()
2883 snprintf(new_name, sizeof(new_name), "%s %s-%d", in soc_create_pcm()
2884 rtd->dai_link->stream_name, in soc_create_pcm()
2885 soc_codec_dai_name(rtd), rtd->id); in soc_create_pcm()
2887 ret = snd_pcm_new(rtd->card->snd_card, new_name, rtd->id, playback, in soc_create_pcm()
2891 return snd_soc_ret(rtd->dev, ret, in soc_create_pcm()
2892 "can't create pcm %s for dailink %s\n", new_name, rtd->dai_link->name); in soc_create_pcm()
2894 dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", rtd->id, new_name); in soc_create_pcm()
2922 if (!rtd->dai_link->c2c_params) in soc_new_pcm()
2923 rtd->close_delayed_work_func = snd_soc_close_delayed_work; in soc_new_pcm()
2925 rtd->pcm = pcm; in soc_new_pcm()
2926 pcm->nonatomic = rtd->dai_link->nonatomic; in soc_new_pcm()
2927 pcm->private_data = rtd; in soc_new_pcm()
2928 pcm->no_device_suspend = true; in soc_new_pcm()
2930 if (rtd->dai_link->no_pcm || rtd->dai_link->c2c_params) { in soc_new_pcm()
2932 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; in soc_new_pcm()
2934 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; in soc_new_pcm()
2939 if (rtd->dai_link->dynamic) { in soc_new_pcm()
2940 rtd->ops.open = dpcm_fe_dai_open; in soc_new_pcm()
2941 rtd->ops.hw_params = dpcm_fe_dai_hw_params; in soc_new_pcm()
2942 rtd->ops.prepare = dpcm_fe_dai_prepare; in soc_new_pcm()
2943 rtd->ops.trigger = dpcm_fe_dai_trigger; in soc_new_pcm()
2944 rtd->ops.hw_free = dpcm_fe_dai_hw_free; in soc_new_pcm()
2945 rtd->ops.close = dpcm_fe_dai_close; in soc_new_pcm()
2946 rtd->ops.pointer = soc_pcm_pointer; in soc_new_pcm()
2948 rtd->ops.open = soc_pcm_open; in soc_new_pcm()
2949 rtd->ops.hw_params = soc_pcm_hw_params; in soc_new_pcm()
2950 rtd->ops.prepare = soc_pcm_prepare; in soc_new_pcm()
2951 rtd->ops.trigger = soc_pcm_trigger; in soc_new_pcm()
2952 rtd->ops.hw_free = soc_pcm_hw_free; in soc_new_pcm()
2953 rtd->ops.close = soc_pcm_close; in soc_new_pcm()
2954 rtd->ops.pointer = soc_pcm_pointer; in soc_new_pcm()
2958 const struct snd_soc_component_driver *drv = component->driver; in soc_new_pcm()
2960 if (drv->ioctl) in soc_new_pcm()
2961 rtd->ops.ioctl = snd_soc_pcm_component_ioctl; in soc_new_pcm()
2962 if (drv->sync_stop) in soc_new_pcm()
2963 rtd->ops.sync_stop = snd_soc_pcm_component_sync_stop; in soc_new_pcm()
2964 if (drv->copy) in soc_new_pcm()
2965 rtd->ops.copy = snd_soc_pcm_component_copy; in soc_new_pcm()
2966 if (drv->page) in soc_new_pcm()
2967 rtd->ops.page = snd_soc_pcm_component_page; in soc_new_pcm()
2968 if (drv->mmap) in soc_new_pcm()
2969 rtd->ops.mmap = snd_soc_pcm_component_mmap; in soc_new_pcm()
2970 if (drv->ack) in soc_new_pcm()
2971 rtd->ops.ack = snd_soc_pcm_component_ack; in soc_new_pcm()
2975 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &rtd->ops); in soc_new_pcm()
2978 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops); in soc_new_pcm()
2984 dev_dbg(rtd->card->dev, "%s <-> %s mapping ok\n", in soc_new_pcm()
2993 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()