Lines Matching full:rtd
74 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); in pmdown_time_show() local
76 return sprintf(buf, "%ld\n", rtd->pmdown_time); in pmdown_time_show()
83 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); in pmdown_time_set() local
86 ret = kstrtol(buf, 10, &rtd->pmdown_time); in pmdown_time_set()
104 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); in soc_dev_attr_is_visible() local
106 if (!rtd) in soc_dev_attr_is_visible()
111 return rtd->num_codecs ? attr->mode : 0; /* enabled only with codec */ in soc_dev_attr_is_visible()
261 static int snd_soc_rtd_add_component(struct snd_soc_pcm_runtime *rtd, in snd_soc_rtd_add_component() argument
267 for_each_rtd_components(rtd, i, comp) { in snd_soc_rtd_add_component()
274 rtd->components[rtd->num_components] = component; in snd_soc_rtd_add_component()
275 rtd->num_components++; in snd_soc_rtd_add_component()
280 struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, in snd_soc_rtdcom_lookup() argument
292 * snd_soc_rtdcom_lookup() will find component from rtd by using in snd_soc_rtdcom_lookup()
295 * to 1 rtd, this function will return 1st found component. in snd_soc_rtdcom_lookup()
297 for_each_rtd_components(rtd, i, component) { in snd_soc_rtdcom_lookup()
350 struct snd_soc_pcm_runtime *rtd; in snd_soc_get_pcm_runtime() local
352 for_each_card_rtds(card, rtd) { in snd_soc_get_pcm_runtime()
353 if (rtd->dai_link == dai_link) in snd_soc_get_pcm_runtime()
354 return rtd; in snd_soc_get_pcm_runtime()
356 dev_dbg(card->dev, "ASoC: failed to find rtd %s\n", dai_link->name); in snd_soc_get_pcm_runtime()
366 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd) in snd_soc_close_delayed_work() argument
368 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); in snd_soc_close_delayed_work()
371 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); in snd_soc_close_delayed_work()
373 dev_dbg(rtd->dev, in snd_soc_close_delayed_work()
378 rtd->pop_wait ? "yes" : "no"); in snd_soc_close_delayed_work()
381 if (rtd->pop_wait == 1) { in snd_soc_close_delayed_work()
382 rtd->pop_wait = 0; in snd_soc_close_delayed_work()
383 snd_soc_dapm_stream_event(rtd, playback, in snd_soc_close_delayed_work()
387 mutex_unlock(&rtd->card->pcm_mutex); in snd_soc_close_delayed_work()
393 /* "dev" means "rtd->dev" */ in soc_release_rtd_dev()
397 static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd) in soc_free_pcm_runtime() argument
399 if (!rtd) in soc_free_pcm_runtime()
402 list_del(&rtd->list); in soc_free_pcm_runtime()
404 if (delayed_work_pending(&rtd->delayed_work)) in soc_free_pcm_runtime()
405 flush_delayed_work(&rtd->delayed_work); in soc_free_pcm_runtime()
406 snd_soc_pcm_component_free(rtd); in soc_free_pcm_runtime()
409 * we don't need to call kfree() for rtd->dev in soc_free_pcm_runtime()
413 * We don't need rtd->dev NULL check, because in soc_free_pcm_runtime()
414 * it is alloced *before* rtd. in soc_free_pcm_runtime()
418 device_unregister(rtd->dev); in soc_free_pcm_runtime()
422 struct snd_soc_pcm_runtime *rtd = in close_delayed_work() local
426 if (rtd->close_delayed_work_func) in close_delayed_work()
427 rtd->close_delayed_work_func(rtd); in close_delayed_work()
433 struct snd_soc_pcm_runtime *rtd; in soc_new_pcm_runtime() local
440 * for rtd->dev in soc_new_pcm_runtime()
458 * for rtd in soc_new_pcm_runtime()
460 rtd = devm_kzalloc(dev, in soc_new_pcm_runtime()
461 sizeof(*rtd) + in soc_new_pcm_runtime()
466 if (!rtd) in soc_new_pcm_runtime()
469 rtd->dev = dev; in soc_new_pcm_runtime()
470 INIT_LIST_HEAD(&rtd->list); in soc_new_pcm_runtime()
472 INIT_LIST_HEAD(&rtd->dpcm[stream].be_clients); in soc_new_pcm_runtime()
473 INIT_LIST_HEAD(&rtd->dpcm[stream].fe_clients); in soc_new_pcm_runtime()
475 dev_set_drvdata(dev, rtd); in soc_new_pcm_runtime()
476 INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); in soc_new_pcm_runtime()
479 * for rtd->dais in soc_new_pcm_runtime()
481 rtd->dais = devm_kcalloc(dev, dai_link->num_cpus + dai_link->num_codecs, in soc_new_pcm_runtime()
484 if (!rtd->dais) in soc_new_pcm_runtime()
495 rtd->num_cpus = dai_link->num_cpus; in soc_new_pcm_runtime()
496 rtd->num_codecs = dai_link->num_codecs; in soc_new_pcm_runtime()
497 rtd->card = card; in soc_new_pcm_runtime()
498 rtd->dai_link = dai_link; in soc_new_pcm_runtime()
499 rtd->num = card->num_rtd++; in soc_new_pcm_runtime()
502 list_add_tail(&rtd->list, &card->rtd_list); in soc_new_pcm_runtime()
508 return rtd; in soc_new_pcm_runtime()
511 soc_free_pcm_runtime(rtd); in soc_new_pcm_runtime()
517 struct snd_soc_pcm_runtime *rtd; in snd_soc_flush_all_delayed_work() local
519 for_each_card_rtds(card, rtd) in snd_soc_flush_all_delayed_work()
520 flush_delayed_work(&rtd->delayed_work); in snd_soc_flush_all_delayed_work()
529 struct snd_soc_pcm_runtime *rtd; in snd_soc_suspend() local
547 for_each_card_rtds(card, rtd) { in snd_soc_suspend()
550 if (rtd->dai_link->ignore_suspend) in snd_soc_suspend()
553 for_each_rtd_dais(rtd, i, dai) { in snd_soc_suspend()
560 for_each_card_rtds(card, rtd) { in snd_soc_suspend()
561 if (rtd->dai_link->ignore_suspend) in snd_soc_suspend()
564 snd_pcm_suspend_all(rtd->pcm); in snd_soc_suspend()
572 for_each_card_rtds(card, rtd) { in snd_soc_suspend()
575 if (rtd->dai_link->ignore_suspend) in snd_soc_suspend()
579 snd_soc_dapm_stream_event(rtd, stream, in snd_soc_suspend()
588 for_each_card_rtds(card, rtd) { in snd_soc_suspend()
590 if (rtd->dai_link->ignore_suspend) in snd_soc_suspend()
593 for_each_rtd_components(rtd, i, component) { in snd_soc_suspend()
652 struct snd_soc_pcm_runtime *rtd; in soc_resume_deferred() local
673 for_each_card_rtds(card, rtd) { in soc_resume_deferred()
676 if (rtd->dai_link->ignore_suspend) in soc_resume_deferred()
680 snd_soc_dapm_stream_event(rtd, stream, in soc_resume_deferred()
685 for_each_card_rtds(card, rtd) { in soc_resume_deferred()
689 if (rtd->dai_link->ignore_suspend) in soc_resume_deferred()
692 for_each_rtd_dais(rtd, i, dai) { in soc_resume_deferred()
954 * @rtd: The pcm_runtime to remove
959 struct snd_soc_pcm_runtime *rtd) in snd_soc_remove_pcm_runtime() argument
964 snd_soc_link_exit(rtd); in snd_soc_remove_pcm_runtime()
969 snd_soc_card_remove_dai_link(card, rtd->dai_link); in snd_soc_remove_pcm_runtime()
971 soc_free_pcm_runtime(rtd); in snd_soc_remove_pcm_runtime()
989 struct snd_soc_pcm_runtime *rtd; in snd_soc_add_pcm_runtime() local
1012 rtd = soc_new_pcm_runtime(card, dai_link); in snd_soc_add_pcm_runtime()
1013 if (!rtd) in snd_soc_add_pcm_runtime()
1017 asoc_rtd_to_cpu(rtd, i) = snd_soc_find_dai(cpu); in snd_soc_add_pcm_runtime()
1018 if (!asoc_rtd_to_cpu(rtd, i)) { in snd_soc_add_pcm_runtime()
1023 snd_soc_rtd_add_component(rtd, asoc_rtd_to_cpu(rtd, i)->component); in snd_soc_add_pcm_runtime()
1028 asoc_rtd_to_codec(rtd, i) = snd_soc_find_dai(codec); in snd_soc_add_pcm_runtime()
1029 if (!asoc_rtd_to_codec(rtd, i)) { in snd_soc_add_pcm_runtime()
1035 snd_soc_rtd_add_component(rtd, asoc_rtd_to_codec(rtd, i)->component); in snd_soc_add_pcm_runtime()
1044 snd_soc_rtd_add_component(rtd, component); in snd_soc_add_pcm_runtime()
1051 snd_soc_remove_pcm_runtime(card, rtd); in snd_soc_add_pcm_runtime()
1057 struct snd_soc_pcm_runtime *rtd) in soc_init_pcm_runtime() argument
1059 struct snd_soc_dai_link *dai_link = rtd->dai_link; in soc_init_pcm_runtime()
1060 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); in soc_init_pcm_runtime()
1065 rtd->pmdown_time = pmdown_time; in soc_init_pcm_runtime()
1068 ret = snd_soc_link_init(rtd); in soc_init_pcm_runtime()
1073 ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); in soc_init_pcm_runtime()
1079 soc_dpcm_debugfs_add(rtd); in soc_init_pcm_runtime()
1081 num = rtd->num; in soc_init_pcm_runtime()
1086 * device number and then use rtd + a base offset of the BEs. in soc_init_pcm_runtime()
1088 for_each_rtd_components(rtd, i, component) { in soc_init_pcm_runtime()
1092 if (rtd->dai_link->no_pcm) in soc_init_pcm_runtime()
1095 num = rtd->dai_link->id; in soc_init_pcm_runtime()
1099 ret = snd_soc_dai_compress_new(cpu_dai, rtd, num); in soc_init_pcm_runtime()
1108 ret = soc_new_pcm(rtd, num); in soc_init_pcm_runtime()
1115 return snd_soc_pcm_dai_new(rtd); in soc_init_pcm_runtime()
1272 struct snd_soc_pcm_runtime *rtd; in soc_remove_link_dais() local
1276 for_each_card_rtds(card, rtd) { in soc_remove_link_dais()
1277 /* remove all rtd connected DAIs in good order */ in soc_remove_link_dais()
1278 snd_soc_pcm_dai_remove(rtd, order); in soc_remove_link_dais()
1285 struct snd_soc_pcm_runtime *rtd; in soc_probe_link_dais() local
1289 for_each_card_rtds(card, rtd) { in soc_probe_link_dais()
1293 card->name, rtd->num, order); in soc_probe_link_dais()
1295 /* probe all rtd connected DAIs in good order */ in soc_probe_link_dais()
1296 ret = snd_soc_pcm_dai_probe(rtd, order); in soc_probe_link_dais()
1308 struct snd_soc_pcm_runtime *rtd; in soc_remove_link_components() local
1312 for_each_card_rtds(card, rtd) { in soc_remove_link_components()
1313 for_each_rtd_components(rtd, i, component) { in soc_remove_link_components()
1326 struct snd_soc_pcm_runtime *rtd; in soc_probe_link_components() local
1330 for_each_card_rtds(card, rtd) { in soc_probe_link_components()
1331 for_each_rtd_components(rtd, i, component) { in soc_probe_link_components()
1411 * @rtd: The runtime for which the DAI link format should be changed
1422 int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, in snd_soc_runtime_set_dai_fmt() argument
1431 for_each_rtd_codec_dais(rtd, i, codec_dai) { in snd_soc_runtime_set_dai_fmt()
1459 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { in snd_soc_runtime_set_dai_fmt()
1654 /* machine matches, so override the rtd data */ in soc_check_tplg_fes()
1767 struct snd_soc_pcm_runtime *rtd, *n; in soc_cleanup_card_resources() local
1778 for_each_card_rtds_safe(card, rtd, n) in soc_cleanup_card_resources()
1779 snd_soc_remove_pcm_runtime(card, rtd); in soc_cleanup_card_resources()
1814 struct snd_soc_pcm_runtime *rtd; in snd_soc_bind_card() local
1893 for_each_card_rtds(card, rtd) { in snd_soc_bind_card()
1894 ret = soc_init_pcm_runtime(card, rtd); in snd_soc_bind_card()