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>
39 case -EPROBE_DEFER: in _soc_pcm_ret()
40 case -ENOTSUPP: in _soc_pcm_ret()
43 dev_err(rtd->dev, in _soc_pcm_ret()
45 func, rtd->dai_link->name, ret); in _soc_pcm_ret()
55 if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE)
65 if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || in snd_soc_dpcm_be_can_update()
66 ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && in snd_soc_dpcm_be_can_update()
67 be->dpcm[stream].runtime_update)) in snd_soc_dpcm_be_can_update()
85 if (dpcm->fe == fe) in snd_soc_dpcm_check_state()
88 state = dpcm->fe->dpcm[stream].state; in snd_soc_dpcm_check_state()
102 * We can only hw_free, stop, pause or suspend a BE DAI if any of it's FE
154 return (rtd)->dai_link->num_cpus == 1 ? snd_soc_rtd_to_cpu(rtd, 0)->name : "multicpu"; in soc_cpu_dai_name()
158 return (rtd)->dai_link->num_codecs == 1 ? snd_soc_rtd_to_codec(rtd, 0)->name : "multicodec"; in soc_codec_dai_name()
178 return "suspend"; in dpcm_state_string()
193 struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; in dpcm_show_state()
198 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
199 "[%s - %s]\n", fe->dai_link->name, in dpcm_show_state()
202 offset += scnprintf(buf + offset, size - offset, "State: %s\n", in dpcm_show_state()
203 dpcm_state_string(fe->dpcm[stream].state)); in dpcm_show_state()
205 if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
206 (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
207 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
215 offset += scnprintf(buf + offset, size - offset, "Backends:\n"); in dpcm_show_state()
217 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_show_state()
218 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
224 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_show_state()
225 params = &be->dpcm[stream].hw_params; in dpcm_show_state()
227 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
228 "- %s\n", be->dai_link->name); in dpcm_show_state()
230 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
232 dpcm_state_string(be->dpcm[stream].state)); in dpcm_show_state()
234 if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_show_state()
235 (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP)) in dpcm_show_state()
236 offset += scnprintf(buf + offset, size - offset, in dpcm_show_state()
250 struct snd_soc_pcm_runtime *fe = file->private_data; in dpcm_state_read_file()
255 if (fe->dai_link->num_cpus > 1) { in dpcm_state_read_file()
256 dev_err(fe->dev, in dpcm_state_read_file()
258 return -EINVAL; in dpcm_state_read_file()
263 return -ENOMEM; in dpcm_state_read_file()
270 out_count - offset); in dpcm_state_read_file()
287 if (!rtd->dai_link->dynamic) in soc_dpcm_debugfs_add()
290 if (!rtd->card->debugfs_card_root) in soc_dpcm_debugfs_add()
293 rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name, in soc_dpcm_debugfs_add()
294 rtd->card->debugfs_card_root); in soc_dpcm_debugfs_add()
296 debugfs_create_file("state", 0444, rtd->debugfs_dpcm_root, in soc_dpcm_debugfs_add()
304 name = kasprintf(GFP_KERNEL, "%s:%s", dpcm->be->dai_link->name, in dpcm_create_debugfs_state()
307 dpcm->debugfs_state = debugfs_create_dir( in dpcm_create_debugfs_state()
308 name, dpcm->fe->debugfs_dpcm_root); in dpcm_create_debugfs_state()
309 debugfs_create_u32("state", 0644, dpcm->debugfs_state, in dpcm_create_debugfs_state()
310 &dpcm->state); in dpcm_create_debugfs_state()
317 debugfs_remove_recursive(dpcm->debugfs_state); in dpcm_remove_debugfs_state()
344 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { in dpcm_set_fe_update_state()
346 fe->dpcm[stream].trigger_pending - 1); in dpcm_set_fe_update_state()
347 fe->dpcm[stream].trigger_pending = 0; in dpcm_set_fe_update_state()
349 fe->dpcm[stream].runtime_update = state; in dpcm_set_fe_update_state()
356 be->dpcm[stream].runtime_update = state; in dpcm_set_be_update_state()
360 * snd_soc_runtime_action() - Increment/Decrement active count for
364 * @action: Activate stream if 1. Deactivate if -1.
370 * Must be called with the rtd->card->pcm_mutex being held
386 if (component->num_dai) in snd_soc_runtime_action()
388 component->active += action; in snd_soc_runtime_action()
394 * snd_soc_runtime_ignore_pmdown_time() - Check whether to ignore the power down delay
399 * been configured to ignore the delay, or if none of the components benefits
407 if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) in snd_soc_runtime_ignore_pmdown_time()
411 if (component->driver->use_pmdown_time) in snd_soc_runtime_ignore_pmdown_time()
428 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_dapm_stream_event()
430 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", in dpcm_dapm_stream_event()
431 be->dai_link->name, event, dir); in dpcm_dapm_stream_event()
434 (be->dpcm[dir].users >= 1)) in dpcm_dapm_stream_event()
449 dai->symmetric_rate = params_rate(params); in soc_pcm_set_dai_params()
450 dai->symmetric_channels = params_channels(params); in soc_pcm_set_dai_params()
451 dai->symmetric_sample_bits = snd_pcm_format_physical_width(params_format(params)); in soc_pcm_set_dai_params()
453 dai->symmetric_rate = 0; in soc_pcm_set_dai_params()
454 dai->symmetric_channels = 0; in soc_pcm_set_dai_params()
455 dai->symmetric_sample_bits = 0; in soc_pcm_set_dai_params()
469 if (soc_dai->symmetric_##name && \ in soc_pcm_apply_symmetry()
470 (soc_dai->driver->symmetric_##name || rtd->dai_link->symmetric_##name)) { \ in soc_pcm_apply_symmetry()
471 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %s to %d\n",\ in soc_pcm_apply_symmetry()
472 #name, soc_dai->symmetric_##name); \ in soc_pcm_apply_symmetry()
474 ret = snd_pcm_hw_constraint_single(substream->runtime, \ in soc_pcm_apply_symmetry()
476 soc_dai->symmetric_##name); \ in soc_pcm_apply_symmetry()
478 dev_err(soc_dai->dev, \ in soc_pcm_apply_symmetry()
505 symmetry = rtd->dai_link->symmetric_##xxx; \ in soc_pcm_params_symmetry()
507 symmetry |= dai->driver->symmetric_##xxx; \ in soc_pcm_params_symmetry()
512 cpu_dai->symmetric_##xxx && \ in soc_pcm_params_symmetry()
513 cpu_dai->symmetric_##xxx != d.symmetric_##xxx) { \ in soc_pcm_params_symmetry()
514 dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %s:%d - %s:%d\n", \ in soc_pcm_params_symmetry()
515 #xxx, cpu_dai->name, cpu_dai->symmetric_##xxx, \ in soc_pcm_params_symmetry()
517 return -EINVAL; \ in soc_pcm_params_symmetry()
531 struct snd_soc_dai_link *link = rtd->dai_link; in soc_pcm_update_symmetry()
535 symmetry = link->symmetric_rate || in soc_pcm_update_symmetry()
536 link->symmetric_channels || in soc_pcm_update_symmetry()
537 link->symmetric_sample_bits; in soc_pcm_update_symmetry()
541 dai->driver->symmetric_rate || in soc_pcm_update_symmetry()
542 dai->driver->symmetric_channels || in soc_pcm_update_symmetry()
543 dai->driver->symmetric_sample_bits; in soc_pcm_update_symmetry()
546 substream->runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX; in soc_pcm_update_symmetry()
557 ret = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 0, bits); in soc_pcm_set_msb()
559 dev_warn(rtd->dev, "ASoC: Failed to set MSB %d: %d\n", in soc_pcm_set_msb()
568 int stream = substream->stream; in soc_pcm_apply_msb()
575 if (pcm_codec->sig_bits == 0) { in soc_pcm_apply_msb()
579 bits = max(pcm_codec->sig_bits, bits); in soc_pcm_apply_msb()
585 if (pcm_cpu->sig_bits == 0) { in soc_pcm_apply_msb()
589 cpu_bits = max(pcm_cpu->sig_bits, cpu_bits); in soc_pcm_apply_msb()
598 hw->rates = UINT_MAX; in soc_pcm_hw_init()
599 hw->rate_min = 0; in soc_pcm_hw_init()
600 hw->rate_max = UINT_MAX; in soc_pcm_hw_init()
601 hw->channels_min = 0; in soc_pcm_hw_init()
602 hw->channels_max = UINT_MAX; in soc_pcm_hw_init()
603 hw->formats = ULLONG_MAX; in soc_pcm_hw_init()
609 hw->rates = snd_pcm_rate_mask_intersect(hw->rates, p->rates); in soc_pcm_hw_update_rate()
611 /* setup hw->rate_min/max via hw->rates first */ in soc_pcm_hw_update_rate()
614 /* update hw->rate_min/max by snd_soc_pcm_stream */ in soc_pcm_hw_update_rate()
615 hw->rate_min = max(hw->rate_min, p->rate_min); in soc_pcm_hw_update_rate()
616 hw->rate_max = min_not_zero(hw->rate_max, p->rate_max); in soc_pcm_hw_update_rate()
622 hw->channels_min = max(hw->channels_min, p->channels_min); in soc_pcm_hw_update_chan()
623 hw->channels_max = min(hw->channels_max, p->channels_max); in soc_pcm_hw_update_chan()
629 hw->formats &= p->formats; in soc_pcm_hw_update_format()
635 hw->subformats &= p->subformats; in soc_pcm_hw_update_subformat()
639 * snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
678 cpu_chan_min = hw->channels_min; in snd_soc_runtime_calc_hw()
679 cpu_chan_max = hw->channels_max; in snd_soc_runtime_calc_hw()
702 if (!hw->channels_min) in snd_soc_runtime_calc_hw()
703 return -EINVAL; in snd_soc_runtime_calc_hw()
710 if (rtd->dai_link->num_codecs > 1) { in snd_soc_runtime_calc_hw()
711 hw->channels_min = cpu_chan_min; in snd_soc_runtime_calc_hw()
712 hw->channels_max = cpu_chan_max; in snd_soc_runtime_calc_hw()
721 struct snd_pcm_hardware *hw = &substream->runtime->hw; in soc_pcm_init_runtime_hw()
723 u64 formats = hw->formats; in soc_pcm_init_runtime_hw()
730 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
733 hw->formats &= formats; in soc_pcm_init_runtime_hw()
783 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
803 pinctrl_pm_select_sleep_state(component->dev); in soc_pcm_clean()
819 /* PCM close ops for non-DPCM streams */
833 struct snd_pcm_hardware *hw = &substream->runtime->hw; in soc_hw_sanity_check()
837 struct device *dev = rtd->dev; in soc_hw_sanity_check()
840 if (!hw->rates) in soc_hw_sanity_check()
844 if (!hw->formats) in soc_hw_sanity_check()
848 if (!hw->channels_min || !hw->channels_max || in soc_hw_sanity_check()
849 hw->channels_min > hw->channels_max) in soc_hw_sanity_check()
852 dev_dbg(dev, "ASoC: %s <-> %s info:\n", name_codec, in soc_hw_sanity_check()
854 dev_dbg(dev, "ASoC: rate mask 0x%x\n", hw->rates); in soc_hw_sanity_check()
855 dev_dbg(dev, "ASoC: ch min %d max %d\n", hw->channels_min, in soc_hw_sanity_check()
856 hw->channels_max); in soc_hw_sanity_check()
857 dev_dbg(dev, "ASoC: rate min %d max %d\n", hw->rate_min, in soc_hw_sanity_check()
858 hw->rate_max); in soc_hw_sanity_check()
863 dev_err(dev, "ASoC: %s <-> %s No matching %s\n", in soc_hw_sanity_check()
865 return -EINVAL; in soc_hw_sanity_check()
869 * Called by ALSA when a PCM substream is opened, the runtime->hw record is
883 pinctrl_pm_select_default_state(component->dev); in __soc_pcm_open()
905 if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) in __soc_pcm_open()
926 snd_soc_runtime_activate(rtd, substream->stream); in __soc_pcm_open()
935 /* PCM open ops for non-DPCM streams */
973 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in __soc_pcm_prepare()
974 rtd->pop_wait) { in __soc_pcm_prepare()
975 rtd->pop_wait = 0; in __soc_pcm_prepare()
976 cancel_delayed_work(&rtd->delayed_work); in __soc_pcm_prepare()
979 snd_soc_dapm_stream_event(rtd, substream->stream, in __soc_pcm_prepare()
983 if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger) in __soc_pcm_prepare()
984 snd_soc_dai_digital_mute(dai, 0, substream->stream); in __soc_pcm_prepare()
992 * denial-of-service attack on the syslog / diskspace. in __soc_pcm_prepare()
997 /* PCM prepare ops for non-DPCM streams */
1011 * denial-of-service attack on the syslog / diskspace. in soc_pcm_prepare()
1023 interval->min = channels; in soc_pcm_codec_params_fixup()
1024 interval->max = channels; in soc_pcm_codec_params_fixup()
1040 if (snd_soc_dai_stream_active(dai, substream->stream) == 1) { in soc_pcm_hw_clean()
1041 if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger) in soc_pcm_hw_clean()
1042 snd_soc_dai_digital_mute(dai, 1, substream->stream); in soc_pcm_hw_clean()
1047 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
1057 if (snd_soc_dai_stream_valid(dai, substream->stream)) in soc_pcm_hw_clean()
1072 /* hw_free PCM ops for non-DPCM streams */
1087 * (using snd_pcm_lib_* ). It's non-atomic.
1109 unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream); in __soc_pcm_hw_params()
1119 * capture-only CODEC is acting as an LRCLK and/or BCLK master in __soc_pcm_hw_params()
1120 * for the DAI link including a playback-only CODEC. in __soc_pcm_hw_params()
1125 if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) in __soc_pcm_hw_params()
1153 if (!snd_soc_dai_stream_valid(cpu_dai, substream->stream)) in __soc_pcm_hw_params()
1163 * soc.h :: [dai_link->ch_maps Image sample] in __soc_pcm_hw_params()
1166 if (ch_maps->cpu == i) in __soc_pcm_hw_params()
1167 ch_mask |= ch_maps->ch_mask; in __soc_pcm_hw_params()
1190 /* hw_params PCM ops for non-DPCM streams */
1229 if (component->driver->trigger_start) in soc_pcm_trigger()
1230 start = component->driver->trigger_start; in soc_pcm_trigger()
1231 if (component->driver->trigger_stop) in soc_pcm_trigger()
1232 stop = component->driver->trigger_stop; in soc_pcm_trigger()
1234 if (rtd->dai_link->trigger_start) in soc_pcm_trigger()
1235 start = rtd->dai_link->trigger_start; in soc_pcm_trigger()
1236 if (rtd->dai_link->trigger_stop) in soc_pcm_trigger()
1237 stop = rtd->dai_link->trigger_stop; in soc_pcm_trigger()
1241 return -EINVAL; in soc_pcm_trigger()
1284 for (i = TRIGGER_MAX; i > 0; i--) { in soc_pcm_trigger()
1285 r = trigger[stop][i - 1](substream, cmd, rollback); in soc_pcm_trigger()
1297 * the runtime->delay will be updated via snd_soc_pcm_component/dai_delay().
1301 struct snd_pcm_runtime *runtime = substream->runtime; in soc_pcm_pointer()
1312 runtime->delay = cpu_delay + codec_delay; in soc_pcm_pointer()
1329 if (dpcm->be == be && dpcm->fe == fe) in dpcm_be_connect()
1336 if (!fe_substream->pcm->nonatomic && be_substream->pcm->nonatomic) { in dpcm_be_connect()
1337 dev_err(be->dev, "%s: FE is atomic but BE is nonatomic, invalid configuration\n", in dpcm_be_connect()
1339 return -EINVAL; in dpcm_be_connect()
1341 if (fe_substream->pcm->nonatomic && !be_substream->pcm->nonatomic) { in dpcm_be_connect()
1342 dev_dbg(be->dev, "FE is nonatomic but BE is not, forcing BE as nonatomic\n"); in dpcm_be_connect()
1343 be_substream->pcm->nonatomic = 1; in dpcm_be_connect()
1348 return -ENOMEM; in dpcm_be_connect()
1350 dpcm->be = be; in dpcm_be_connect()
1351 dpcm->fe = fe; in dpcm_be_connect()
1352 dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; in dpcm_be_connect()
1354 list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); in dpcm_be_connect()
1355 list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); in dpcm_be_connect()
1358 dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", in dpcm_be_connect()
1359 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_connect()
1360 stream ? "<-" : "->", be->dai_link->name); in dpcm_be_connect()
1375 if (!be->dpcm[stream].users) in dpcm_be_reparent()
1383 if (dpcm->fe == fe) in dpcm_be_reparent()
1386 dev_dbg(fe->dev, "reparent %s path %s %s %s\n", in dpcm_be_reparent()
1388 dpcm->fe->dai_link->name, in dpcm_be_reparent()
1389 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_reparent()
1391 fe_substream = snd_soc_dpcm_get_substream(dpcm->fe, stream); in dpcm_be_reparent()
1392 be_substream->runtime = fe_substream->runtime; in dpcm_be_reparent()
1408 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", in dpcm_be_disconnect()
1410 dpcm->be->dai_link->name); in dpcm_be_disconnect()
1412 if (dpcm->state != SND_SOC_DPCM_LINK_STATE_FREE) in dpcm_be_disconnect()
1415 dev_dbg(fe->dev, "freed DSP %s path %s %s %s\n", in dpcm_be_disconnect()
1416 snd_pcm_direction_name(stream), fe->dai_link->name, in dpcm_be_disconnect()
1417 stream ? "<-" : "->", dpcm->be->dai_link->name); in dpcm_be_disconnect()
1420 dpcm_be_reparent(fe, dpcm->be, stream); in dpcm_be_disconnect()
1422 list_del(&dpcm->list_be); in dpcm_be_disconnect()
1423 list_move(&dpcm->list_fe, &deleted_dpcms); in dpcm_be_disconnect()
1430 list_del(&dpcm->list_fe); in dpcm_be_disconnect()
1445 dev_dbg(card->dev, "ASoC: find BE for widget %s\n", widget->name); in dpcm_get_be()
1449 if (!be->dai_link->no_pcm) in dpcm_get_be()
1458 dev_dbg(card->dev, "ASoC: try BE : %s\n", in dpcm_get_be()
1459 w ? w->name : "(not set)"); in dpcm_get_be()
1486 struct snd_soc_card *card = widget->dapm->card; in dpcm_end_walk_at_be()
1510 if (fe->dai_link->num_cpus > 1) { in dpcm_path_get()
1511 dev_err(fe->dev, in dpcm_path_get()
1513 return -EINVAL; in dpcm_path_get()
1516 /* get number of valid DAI paths and their widgets */ in dpcm_path_get()
1518 fe->card->component_chaining ? in dpcm_path_get()
1522 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, in dpcm_path_get()
1525 dev_dbg(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name, in dpcm_path_get()
1543 for_each_rtd_dais(dpcm->be, i, dai) { in dpcm_be_is_active()
1548 * widgets are in the active list. in dpcm_be_is_active()
1563 /* Destroy any old FE <--> BE connections */ in dpcm_prune_paths()
1568 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", in dpcm_prune_paths()
1570 dpcm->be->dai_link->name, fe->dai_link->name); in dpcm_prune_paths()
1571 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_prune_paths()
1572 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_BE); in dpcm_prune_paths()
1576 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); in dpcm_prune_paths()
1583 struct snd_soc_card *card = fe->card; in dpcm_add_paths()
1591 if (!fe_substream->runtime && !fe->fe_compr) in dpcm_add_paths()
1594 /* Create any new FE <--> BE connections */ in dpcm_add_paths()
1597 switch (widget->id) { in dpcm_add_paths()
1613 dev_dbg(fe->dev, "ASoC: no BE found for %s\n", in dpcm_add_paths()
1614 widget->name); in dpcm_add_paths()
1620 * This helps to avoid unnecessary re-configuration of an in dpcm_add_paths()
1623 if (fe->card->component_chaining && in dpcm_add_paths()
1624 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_add_paths()
1625 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_add_paths()
1631 dev_err(fe->dev, "ASoC: can't connect %s\n", in dpcm_add_paths()
1632 widget->name); in dpcm_add_paths()
1642 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); in dpcm_add_paths()
1664 dpcm_set_be_update_state(dpcm->be, stream, SND_SOC_DPCM_UPDATE_NO); in dpcm_clear_pending_state()
1674 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_stop()
1685 if (be->dpcm[stream].users == 0) { in dpcm_be_dai_stop()
1686 dev_err(be->dev, "ASoC: no users %s at close - state %d\n", in dpcm_be_dai_stop()
1688 be->dpcm[stream].state); in dpcm_be_dai_stop()
1692 if (--be->dpcm[stream].users != 0) in dpcm_be_dai_stop()
1695 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) { in dpcm_be_dai_stop()
1699 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) { in dpcm_be_dai_stop()
1701 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_stop()
1706 be_substream->runtime = NULL; in dpcm_be_dai_stop()
1707 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_stop()
1722 be = dpcm->be; in dpcm_be_dai_startup()
1726 dev_err(be->dev, "ASoC: no backend %s stream\n", in dpcm_be_dai_startup()
1736 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) { in dpcm_be_dai_startup()
1737 dev_err(be->dev, "ASoC: too many users %s at open %d\n", in dpcm_be_dai_startup()
1739 be->dpcm[stream].state); in dpcm_be_dai_startup()
1743 if (be->dpcm[stream].users++ != 0) in dpcm_be_dai_startup()
1746 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) && in dpcm_be_dai_startup()
1747 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) in dpcm_be_dai_startup()
1750 dev_dbg(be->dev, "ASoC: open %s BE %s\n", in dpcm_be_dai_startup()
1751 snd_pcm_direction_name(stream), be->dai_link->name); in dpcm_be_dai_startup()
1753 be_substream->runtime = fe_substream->runtime; in dpcm_be_dai_startup()
1756 be->dpcm[stream].users--; in dpcm_be_dai_startup()
1757 if (be->dpcm[stream].users < 0) in dpcm_be_dai_startup()
1758 dev_err(be->dev, "ASoC: no users %s at unwind %d\n", in dpcm_be_dai_startup()
1760 be->dpcm[stream].state); in dpcm_be_dai_startup()
1762 be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_be_dai_startup()
1765 be->dpcm[stream].be_start = 0; in dpcm_be_dai_startup()
1766 be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_be_dai_startup()
1781 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_fe()
1782 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_fe()
1784 int stream = substream->stream; in dpcm_runtime_setup_fe()
1785 u64 formats = hw->formats; in dpcm_runtime_setup_fe()
1791 hw->formats &= formats; in dpcm_runtime_setup_fe()
1816 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_be_format()
1817 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_be_format()
1820 int stream = substream->stream; in dpcm_runtime_setup_be_format()
1822 if (!fe->dai_link->dpcm_merged_format) in dpcm_runtime_setup_be_format()
1831 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_setup_be_format()
1854 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_be_chan()
1855 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_be_chan()
1857 int stream = substream->stream; in dpcm_runtime_setup_be_chan()
1859 if (!fe->dai_link->dpcm_merged_chan) in dpcm_runtime_setup_be_chan()
1868 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_setup_be_chan()
1890 if (be->dai_link->num_codecs == 1) { in dpcm_runtime_setup_be_chan()
1902 struct snd_pcm_runtime *runtime = substream->runtime; in dpcm_runtime_setup_be_rate()
1903 struct snd_pcm_hardware *hw = &runtime->hw; in dpcm_runtime_setup_be_rate()
1905 int stream = substream->stream; in dpcm_runtime_setup_be_rate()
1907 if (!fe->dai_link->dpcm_merged_rate) in dpcm_runtime_setup_be_rate()
1916 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_runtime_setup_be_rate()
1957 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_apply_symmetry()
1968 if (rtd->dai_link->be_hw_params_fixup) in dpcm_apply_symmetry()
1987 int stream = fe_substream->stream, ret = 0; in dpcm_fe_dai_startup()
1995 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); in dpcm_fe_dai_startup()
2002 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN; in dpcm_fe_dai_startup()
2024 int stream = substream->stream; in dpcm_fe_dai_shutdown()
2033 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); in dpcm_fe_dai_shutdown()
2041 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; in dpcm_fe_dai_shutdown()
2054 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_hw_free()
2062 /* only free hw when no longer used - check all FEs */ in dpcm_be_dai_hw_free()
2067 if (be->dpcm[stream].users > 1) in dpcm_be_dai_hw_free()
2070 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_free()
2071 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_hw_free()
2072 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_free()
2073 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && in dpcm_be_dai_hw_free()
2074 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_hw_free()
2075 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_hw_free()
2078 dev_dbg(be->dev, "ASoC: hw_free BE %s\n", in dpcm_be_dai_hw_free()
2079 be->dai_link->name); in dpcm_be_dai_hw_free()
2083 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_be_dai_hw_free()
2090 int stream = substream->stream; in dpcm_fe_dai_hw_free()
2095 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); in dpcm_fe_dai_hw_free()
2104 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; in dpcm_fe_dai_hw_free()
2121 be = dpcm->be; in dpcm_be_dai_hw_params()
2129 memcpy(&hw_params, &fe->dpcm[stream].hw_params, in dpcm_be_dai_hw_params()
2137 /* copy the fixed-up hw params for BE dai */ in dpcm_be_dai_hw_params()
2138 memcpy(&be->dpcm[stream].hw_params, &hw_params, in dpcm_be_dai_hw_params()
2145 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2146 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2147 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) in dpcm_be_dai_hw_params()
2150 dev_dbg(be->dev, "ASoC: hw_params BE %s\n", in dpcm_be_dai_hw_params()
2151 be->dai_link->name); in dpcm_be_dai_hw_params()
2157 be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_be_dai_hw_params()
2162 dev_dbg(fe->dev, "ASoC: %s() failed at %s (%d)\n", in dpcm_be_dai_hw_params()
2163 __func__, be->dai_link->name, ret); in dpcm_be_dai_hw_params()
2167 be = dpcm->be; in dpcm_be_dai_hw_params()
2177 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) && in dpcm_be_dai_hw_params()
2178 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_hw_params()
2179 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && in dpcm_be_dai_hw_params()
2180 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) in dpcm_be_dai_hw_params()
2193 int ret, stream = substream->stream; in dpcm_fe_dai_hw_params()
2198 memcpy(&fe->dpcm[stream].hw_params, params, in dpcm_fe_dai_hw_params()
2204 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", in dpcm_fe_dai_hw_params()
2205 fe->dai_link->name, params_rate(params), in dpcm_fe_dai_hw_params()
2213 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; in dpcm_fe_dai_hw_params()
2234 be = dpcm->be; in dpcm_be_dai_trigger()
2243 dev_dbg(be->dev, "ASoC: trigger BE %s cmd %d\n", in dpcm_be_dai_trigger()
2244 be->dai_link->name, cmd); in dpcm_be_dai_trigger()
2248 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2249 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && in dpcm_be_dai_trigger()
2250 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_trigger()
2251 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2254 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2255 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2258 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_PAUSED) in dpcm_be_dai_trigger()
2265 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2269 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2272 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) in dpcm_be_dai_trigger()
2275 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2276 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2281 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2285 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2288 if (!be->dpcm[stream].be_start && in dpcm_be_dai_trigger()
2289 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2290 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2293 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2294 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2296 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2297 if (be->dpcm[stream].be_start != 1) in dpcm_be_dai_trigger()
2302 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2306 be->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_be_dai_trigger()
2309 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) && in dpcm_be_dai_trigger()
2310 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_trigger()
2313 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2314 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2316 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2320 if (fe->dpcm[stream].fe_pause) { in dpcm_be_dai_trigger()
2322 fe->dpcm[stream].fe_pause = false; in dpcm_be_dai_trigger()
2323 be->dpcm[stream].be_pause--; in dpcm_be_dai_trigger()
2326 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2332 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2333 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2335 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2336 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2341 if (be->dpcm[stream].be_pause != 0) in dpcm_be_dai_trigger()
2342 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2344 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_be_dai_trigger()
2348 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2351 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2352 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2357 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2361 be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND; in dpcm_be_dai_trigger()
2364 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) in dpcm_be_dai_trigger()
2367 fe->dpcm[stream].fe_pause = true; in dpcm_be_dai_trigger()
2368 be->dpcm[stream].be_pause++; in dpcm_be_dai_trigger()
2370 be->dpcm[stream].be_start--; in dpcm_be_dai_trigger()
2371 if (be->dpcm[stream].be_start != 0) in dpcm_be_dai_trigger()
2376 be->dpcm[stream].be_start++; in dpcm_be_dai_trigger()
2380 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_be_dai_trigger()
2400 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2401 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2407 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2412 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); in dpcm_dai_trigger_fe_be()
2416 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", in dpcm_dai_trigger_fe_be()
2417 fe->dai_link->name, cmd); in dpcm_dai_trigger_fe_be()
2427 int stream = substream->stream; in dpcm_fe_dai_do_trigger()
2429 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; in dpcm_fe_dai_do_trigger()
2431 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; in dpcm_fe_dai_do_trigger()
2448 ret = -EINVAL; in dpcm_fe_dai_do_trigger()
2466 ret = -EINVAL; in dpcm_fe_dai_do_trigger()
2471 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, in dpcm_fe_dai_do_trigger()
2472 fe->dai_link->name); in dpcm_fe_dai_do_trigger()
2473 ret = -EINVAL; in dpcm_fe_dai_do_trigger()
2478 dev_err(fe->dev, "ASoC: trigger FE cmd: %d failed: %d\n", in dpcm_fe_dai_do_trigger()
2487 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START; in dpcm_fe_dai_do_trigger()
2491 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; in dpcm_fe_dai_do_trigger()
2494 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED; in dpcm_fe_dai_do_trigger()
2499 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; in dpcm_fe_dai_do_trigger()
2506 int stream = substream->stream; in dpcm_fe_dai_trigger()
2511 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { in dpcm_fe_dai_trigger()
2512 fe->dpcm[stream].trigger_pending = cmd + 1; in dpcm_fe_dai_trigger()
2527 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_be_dai_prepare()
2538 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && in dpcm_be_dai_prepare()
2539 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && in dpcm_be_dai_prepare()
2540 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && in dpcm_be_dai_prepare()
2541 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) in dpcm_be_dai_prepare()
2544 dev_dbg(be->dev, "ASoC: prepare BE %s\n", in dpcm_be_dai_prepare()
2545 be->dai_link->name); in dpcm_be_dai_prepare()
2551 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_be_dai_prepare()
2558 * denial-of-service attack on the syslog / diskspace. in dpcm_be_dai_prepare()
2566 int stream = substream->stream, ret = 0; in dpcm_fe_dai_prepare()
2570 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); in dpcm_fe_dai_prepare()
2575 if (list_empty(&fe->dpcm[stream].be_clients)) { in dpcm_fe_dai_prepare()
2577 …dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based rou… in dpcm_fe_dai_prepare()
2578 fe->dai_link->name); in dpcm_fe_dai_prepare()
2579 dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n", in dpcm_fe_dai_prepare()
2580 fe->dai_link->name); in dpcm_fe_dai_prepare()
2581 ret = -EINVAL; in dpcm_fe_dai_prepare()
2594 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; in dpcm_fe_dai_prepare()
2604 * denial-of-service attack on the syslog / diskspace. in dpcm_fe_dai_prepare()
2613 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", in dpcm_run_update_shutdown()
2614 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_shutdown()
2633 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", in dpcm_run_update_startup()
2634 snd_pcm_direction_name(stream), fe->dai_link->name); in dpcm_run_update_startup()
2637 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_FREE || in dpcm_run_update_startup()
2638 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE) { in dpcm_run_update_startup()
2639 dev_err(fe->dev, "ASoC: FE %s is not ready %d\n", in dpcm_run_update_startup()
2640 fe->dai_link->name, fe->dpcm[stream].state); in dpcm_run_update_startup()
2641 ret = -EINVAL; in dpcm_run_update_startup()
2651 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) in dpcm_run_update_startup()
2659 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) in dpcm_run_update_startup()
2670 if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_PREPARE || in dpcm_run_update_startup()
2671 fe->dpcm[stream].state == SND_SOC_DPCM_STATE_STOP) in dpcm_run_update_startup()
2687 struct snd_soc_pcm_runtime *be = dpcm->be; in dpcm_run_update_startup()
2693 if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE || in dpcm_run_update_startup()
2694 be->dpcm[stream].state == SND_SOC_DPCM_STATE_NEW) in dpcm_run_update_startup()
2695 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_run_update_startup()
2707 if (!fe->dai_link->dynamic) in soc_dpcm_fe_runtime_update()
2710 if (fe->dai_link->num_cpus > 1) { in soc_dpcm_fe_runtime_update()
2711 dev_err(fe->dev, in soc_dpcm_fe_runtime_update()
2713 return -EINVAL; in soc_dpcm_fe_runtime_update()
2721 dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n", in soc_dpcm_fe_runtime_update()
2722 new ? "new" : "old", fe->dai_link->name); in soc_dpcm_fe_runtime_update()
2793 int stream = fe_substream->stream; in dpcm_fe_dai_cleanup()
2799 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; in dpcm_fe_dai_cleanup()
2823 int stream = fe_substream->stream; in dpcm_fe_dai_open()
2831 /* calculate valid and active FE <-> BE dpcms */ in dpcm_fe_dai_open()
2848 struct snd_soc_dai_link *dai_link = rtd->dai_link; in soc_get_playback_capture()
2859 if (dai_link->dynamic && dai_link->num_cpus > 1) { in soc_get_playback_capture()
2860 dev_err(rtd->dev, "DPCM doesn't support Multi CPU for Front-Ends yet\n"); in soc_get_playback_capture()
2861 return -EINVAL; in soc_get_playback_capture()
2870 * soc.h :: [dai_link->ch_maps Image sample] in soc_get_playback_capture()
2873 cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); in soc_get_playback_capture()
2874 codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); in soc_get_playback_capture()
2887 if (dai_link->dynamic || dai_link->no_pcm) in soc_get_playback_capture()
2898 if (dai_link->playback_only) in soc_get_playback_capture()
2901 if (dai_link->capture_only) in soc_get_playback_capture()
2905 dev_err(rtd->dev, "substream %s has no playback, no capture\n", in soc_get_playback_capture()
2906 dai_link->stream_name); in soc_get_playback_capture()
2908 return -EINVAL; in soc_get_playback_capture()
2925 if (rtd->dai_link->c2c_params) { in soc_create_pcm()
2927 rtd->dai_link->stream_name); in soc_create_pcm()
2929 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id, in soc_create_pcm()
2931 } else if (rtd->dai_link->no_pcm) { in soc_create_pcm()
2933 rtd->dai_link->stream_name); in soc_create_pcm()
2935 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id, in soc_create_pcm()
2938 if (rtd->dai_link->dynamic) in soc_create_pcm()
2940 rtd->dai_link->stream_name); in soc_create_pcm()
2942 snprintf(new_name, sizeof(new_name), "%s %s-%d", in soc_create_pcm()
2943 rtd->dai_link->stream_name, in soc_create_pcm()
2944 soc_codec_dai_name(rtd), rtd->id); in soc_create_pcm()
2946 ret = snd_pcm_new(rtd->card->snd_card, new_name, rtd->id, playback, in soc_create_pcm()
2950 dev_err(rtd->card->dev, "ASoC: can't create pcm %s for dailink %s: %d\n", in soc_create_pcm()
2951 new_name, rtd->dai_link->name, ret); in soc_create_pcm()
2954 dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", rtd->id, new_name); in soc_create_pcm()
2982 if (!rtd->dai_link->c2c_params) in soc_new_pcm()
2983 rtd->close_delayed_work_func = snd_soc_close_delayed_work; in soc_new_pcm()
2985 rtd->pcm = pcm; in soc_new_pcm()
2986 pcm->nonatomic = rtd->dai_link->nonatomic; in soc_new_pcm()
2987 pcm->private_data = rtd; in soc_new_pcm()
2988 pcm->no_device_suspend = true; in soc_new_pcm()
2990 if (rtd->dai_link->no_pcm || rtd->dai_link->c2c_params) { in soc_new_pcm()
2992 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; in soc_new_pcm()
2994 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; in soc_new_pcm()
2999 if (rtd->dai_link->dynamic) { in soc_new_pcm()
3000 rtd->ops.open = dpcm_fe_dai_open; in soc_new_pcm()
3001 rtd->ops.hw_params = dpcm_fe_dai_hw_params; in soc_new_pcm()
3002 rtd->ops.prepare = dpcm_fe_dai_prepare; in soc_new_pcm()
3003 rtd->ops.trigger = dpcm_fe_dai_trigger; in soc_new_pcm()
3004 rtd->ops.hw_free = dpcm_fe_dai_hw_free; in soc_new_pcm()
3005 rtd->ops.close = dpcm_fe_dai_close; in soc_new_pcm()
3006 rtd->ops.pointer = soc_pcm_pointer; in soc_new_pcm()
3008 rtd->ops.open = soc_pcm_open; in soc_new_pcm()
3009 rtd->ops.hw_params = soc_pcm_hw_params; in soc_new_pcm()
3010 rtd->ops.prepare = soc_pcm_prepare; in soc_new_pcm()
3011 rtd->ops.trigger = soc_pcm_trigger; in soc_new_pcm()
3012 rtd->ops.hw_free = soc_pcm_hw_free; in soc_new_pcm()
3013 rtd->ops.close = soc_pcm_close; in soc_new_pcm()
3014 rtd->ops.pointer = soc_pcm_pointer; in soc_new_pcm()
3018 const struct snd_soc_component_driver *drv = component->driver; in soc_new_pcm()
3020 if (drv->ioctl) in soc_new_pcm()
3021 rtd->ops.ioctl = snd_soc_pcm_component_ioctl; in soc_new_pcm()
3022 if (drv->sync_stop) in soc_new_pcm()
3023 rtd->ops.sync_stop = snd_soc_pcm_component_sync_stop; in soc_new_pcm()
3024 if (drv->copy) in soc_new_pcm()
3025 rtd->ops.copy = snd_soc_pcm_component_copy; in soc_new_pcm()
3026 if (drv->page) in soc_new_pcm()
3027 rtd->ops.page = snd_soc_pcm_component_page; in soc_new_pcm()
3028 if (drv->mmap) in soc_new_pcm()
3029 rtd->ops.mmap = snd_soc_pcm_component_mmap; in soc_new_pcm()
3030 if (drv->ack) in soc_new_pcm()
3031 rtd->ops.ack = snd_soc_pcm_component_ack; in soc_new_pcm()
3035 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &rtd->ops); in soc_new_pcm()
3038 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops); in soc_new_pcm()
3044 dev_dbg(rtd->card->dev, "%s <-> %s mapping ok\n", in soc_new_pcm()
3053 return be->pcm->streams[stream].substream; in snd_soc_dpcm_get_substream()