Lines Matching full:rtd
73 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); in pmdown_time_show() local
75 return sysfs_emit(buf, "%ld\n", rtd->pmdown_time); in pmdown_time_show()
82 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); in pmdown_time_store() local
85 ret = kstrtol(buf, 10, &rtd->pmdown_time); in pmdown_time_store()
103 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); in soc_dev_attr_is_visible() local
105 if (!rtd) in soc_dev_attr_is_visible()
110 return rtd->dai_link->num_codecs ? attr->mode : 0; /* enabled only with codec */ in soc_dev_attr_is_visible()
241 static int snd_soc_rtd_add_component(struct snd_soc_pcm_runtime *rtd, in snd_soc_rtd_add_component() argument
247 for_each_rtd_components(rtd, i, comp) { in snd_soc_rtd_add_component()
254 rtd->components[rtd->num_components] = component; in snd_soc_rtd_add_component()
255 rtd->num_components++; in snd_soc_rtd_add_component()
260 struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, in snd_soc_rtdcom_lookup() argument
272 * snd_soc_rtdcom_lookup() will find component from rtd by using in snd_soc_rtdcom_lookup()
275 * to 1 rtd, this function will return 1st found component. in snd_soc_rtdcom_lookup()
277 for_each_rtd_components(rtd, i, component) { in snd_soc_rtdcom_lookup()
330 struct snd_soc_pcm_runtime *rtd; in snd_soc_get_pcm_runtime() local
332 for_each_card_rtds(card, rtd) { in snd_soc_get_pcm_runtime()
333 if (rtd->dai_link == dai_link) in snd_soc_get_pcm_runtime()
334 return rtd; in snd_soc_get_pcm_runtime()
336 dev_dbg(card->dev, "ASoC: failed to find rtd %s\n", dai_link->name); in snd_soc_get_pcm_runtime()
346 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd) in snd_soc_close_delayed_work() argument
348 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); in snd_soc_close_delayed_work()
351 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); in snd_soc_close_delayed_work()
353 dev_dbg(rtd->dev, in snd_soc_close_delayed_work()
358 rtd->pop_wait ? "yes" : "no"); in snd_soc_close_delayed_work()
361 if (rtd->pop_wait == 1) { in snd_soc_close_delayed_work()
362 rtd->pop_wait = 0; in snd_soc_close_delayed_work()
363 snd_soc_dapm_stream_event(rtd, playback, in snd_soc_close_delayed_work()
367 mutex_unlock(&rtd->card->pcm_mutex); in snd_soc_close_delayed_work()
373 /* "dev" means "rtd->dev" */ in soc_release_rtd_dev()
377 static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd) in soc_free_pcm_runtime() argument
379 if (!rtd) in soc_free_pcm_runtime()
382 list_del(&rtd->list); in soc_free_pcm_runtime()
384 if (delayed_work_pending(&rtd->delayed_work)) in soc_free_pcm_runtime()
385 flush_delayed_work(&rtd->delayed_work); in soc_free_pcm_runtime()
386 snd_soc_pcm_component_free(rtd); in soc_free_pcm_runtime()
389 * we don't need to call kfree() for rtd->dev in soc_free_pcm_runtime()
393 * We don't need rtd->dev NULL check, because in soc_free_pcm_runtime()
394 * it is alloced *before* rtd. in soc_free_pcm_runtime()
398 * We don't need to mind freeing for rtd, in soc_free_pcm_runtime()
399 * because it was created from dev (= rtd->dev) in soc_free_pcm_runtime()
403 * rtd = devm_kzalloc(dev, ...); in soc_free_pcm_runtime()
404 * rtd->dev = dev in soc_free_pcm_runtime()
406 device_unregister(rtd->dev); in soc_free_pcm_runtime()
410 struct snd_soc_pcm_runtime *rtd = in close_delayed_work() local
414 if (rtd->close_delayed_work_func) in close_delayed_work()
415 rtd->close_delayed_work_func(rtd); in close_delayed_work()
421 struct snd_soc_pcm_runtime *rtd; in soc_new_pcm_runtime() local
428 * for rtd->dev in soc_new_pcm_runtime()
446 * for rtd in soc_new_pcm_runtime()
448 rtd = devm_kzalloc(dev, in soc_new_pcm_runtime()
449 sizeof(*rtd) + in soc_new_pcm_runtime()
454 if (!rtd) { in soc_new_pcm_runtime()
459 rtd->dev = dev; in soc_new_pcm_runtime()
460 INIT_LIST_HEAD(&rtd->list); in soc_new_pcm_runtime()
462 INIT_LIST_HEAD(&rtd->dpcm[stream].be_clients); in soc_new_pcm_runtime()
463 INIT_LIST_HEAD(&rtd->dpcm[stream].fe_clients); in soc_new_pcm_runtime()
465 dev_set_drvdata(dev, rtd); in soc_new_pcm_runtime()
466 INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); in soc_new_pcm_runtime()
469 * for rtd->dais in soc_new_pcm_runtime()
471 rtd->dais = devm_kcalloc(dev, dai_link->num_cpus + dai_link->num_codecs, in soc_new_pcm_runtime()
474 if (!rtd->dais) in soc_new_pcm_runtime()
485 rtd->card = card; in soc_new_pcm_runtime()
486 rtd->dai_link = dai_link; in soc_new_pcm_runtime()
487 rtd->num = card->num_rtd++; in soc_new_pcm_runtime()
488 rtd->pmdown_time = pmdown_time; /* default power off timeout */ in soc_new_pcm_runtime()
491 list_add_tail(&rtd->list, &card->rtd_list); in soc_new_pcm_runtime()
497 return rtd; in soc_new_pcm_runtime()
500 soc_free_pcm_runtime(rtd); in soc_new_pcm_runtime()
506 struct snd_soc_pcm_runtime *rtd; in snd_soc_flush_all_delayed_work() local
508 for_each_card_rtds(card, rtd) in snd_soc_flush_all_delayed_work()
509 flush_delayed_work(&rtd->delayed_work); in snd_soc_flush_all_delayed_work()
515 struct snd_soc_pcm_runtime *rtd; in soc_playback_digital_mute() local
520 for_each_card_rtds(card, rtd) { in soc_playback_digital_mute()
522 if (rtd->dai_link->ignore_suspend) in soc_playback_digital_mute()
525 for_each_rtd_dais(rtd, i, dai) { in soc_playback_digital_mute()
534 struct snd_soc_pcm_runtime *rtd; in soc_dapm_suspend_resume() local
537 for_each_card_rtds(card, rtd) { in soc_dapm_suspend_resume()
539 if (rtd->dai_link->ignore_suspend) in soc_dapm_suspend_resume()
543 snd_soc_dapm_stream_event(rtd, stream, event); in soc_dapm_suspend_resume()
552 struct snd_soc_pcm_runtime *rtd; in snd_soc_suspend() local
572 for_each_card_rtds(card, rtd) { in snd_soc_suspend()
573 if (rtd->dai_link->ignore_suspend) in snd_soc_suspend()
576 snd_pcm_suspend_all(rtd->pcm); in snd_soc_suspend()
591 for_each_card_rtds(card, rtd) { in snd_soc_suspend()
593 if (rtd->dai_link->ignore_suspend) in snd_soc_suspend()
596 for_each_rtd_components(rtd, i, component) { in snd_soc_suspend()
933 * @rtd: The pcm_runtime to remove
938 struct snd_soc_pcm_runtime *rtd) in snd_soc_remove_pcm_runtime() argument
943 snd_soc_link_exit(rtd); in snd_soc_remove_pcm_runtime()
948 snd_soc_card_remove_dai_link(card, rtd->dai_link); in snd_soc_remove_pcm_runtime()
950 soc_free_pcm_runtime(rtd); in snd_soc_remove_pcm_runtime()
968 struct snd_soc_pcm_runtime *rtd; in snd_soc_add_pcm_runtime() local
991 rtd = soc_new_pcm_runtime(card, dai_link); in snd_soc_add_pcm_runtime()
992 if (!rtd) in snd_soc_add_pcm_runtime()
996 asoc_rtd_to_cpu(rtd, i) = snd_soc_find_dai(cpu); in snd_soc_add_pcm_runtime()
997 if (!asoc_rtd_to_cpu(rtd, i)) { in snd_soc_add_pcm_runtime()
1002 snd_soc_rtd_add_component(rtd, asoc_rtd_to_cpu(rtd, i)->component); in snd_soc_add_pcm_runtime()
1007 asoc_rtd_to_codec(rtd, i) = snd_soc_find_dai(codec); in snd_soc_add_pcm_runtime()
1008 if (!asoc_rtd_to_codec(rtd, i)) { in snd_soc_add_pcm_runtime()
1014 snd_soc_rtd_add_component(rtd, asoc_rtd_to_codec(rtd, i)->component); in snd_soc_add_pcm_runtime()
1023 snd_soc_rtd_add_component(rtd, component); in snd_soc_add_pcm_runtime()
1030 snd_soc_remove_pcm_runtime(card, rtd); in snd_soc_add_pcm_runtime()
1035 static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd) in snd_soc_runtime_get_dai_fmt() argument
1037 struct snd_soc_dai_link *dai_link = rtd->dai_link; in snd_soc_runtime_get_dai_fmt()
1039 struct device *dev = rtd->dev; in snd_soc_runtime_get_dai_fmt()
1079 until = snd_soc_dai_get_fmt_max_priority(rtd); in snd_soc_runtime_get_dai_fmt()
1083 for_each_rtd_dais(rtd, j, not_used) { in snd_soc_runtime_get_dai_fmt()
1086 for_each_rtd_dais(rtd, i, dai) { in snd_soc_runtime_get_dai_fmt()
1200 * @rtd: The runtime for which the DAI link format should be changed
1211 int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, in snd_soc_runtime_set_dai_fmt() argument
1222 for_each_rtd_codec_dais(rtd, i, codec_dai) { in snd_soc_runtime_set_dai_fmt()
1231 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { in snd_soc_runtime_set_dai_fmt()
1242 struct snd_soc_pcm_runtime *rtd) in soc_init_pcm_runtime() argument
1244 struct snd_soc_dai_link *dai_link = rtd->dai_link; in soc_init_pcm_runtime()
1245 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); in soc_init_pcm_runtime()
1250 ret = snd_soc_link_init(rtd); in soc_init_pcm_runtime()
1254 snd_soc_runtime_get_dai_fmt(rtd); in soc_init_pcm_runtime()
1255 ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); in soc_init_pcm_runtime()
1260 soc_dpcm_debugfs_add(rtd); in soc_init_pcm_runtime()
1262 num = rtd->num; in soc_init_pcm_runtime()
1267 * device number and then use rtd + a base offset of the BEs. in soc_init_pcm_runtime()
1269 for_each_rtd_components(rtd, i, component) { in soc_init_pcm_runtime()
1273 if (rtd->dai_link->no_pcm) in soc_init_pcm_runtime()
1276 num = rtd->dai_link->id; in soc_init_pcm_runtime()
1280 ret = snd_soc_dai_compress_new(cpu_dai, rtd, num); in soc_init_pcm_runtime()
1285 ret = soc_new_pcm(rtd, num); in soc_init_pcm_runtime()
1292 return snd_soc_pcm_dai_new(rtd); in soc_init_pcm_runtime()
1445 struct snd_soc_pcm_runtime *rtd; in soc_remove_link_dais() local
1449 for_each_card_rtds(card, rtd) { in soc_remove_link_dais()
1450 /* remove all rtd connected DAIs in good order */ in soc_remove_link_dais()
1451 snd_soc_pcm_dai_remove(rtd, order); in soc_remove_link_dais()
1458 struct snd_soc_pcm_runtime *rtd; in soc_probe_link_dais() local
1462 for_each_card_rtds(card, rtd) { in soc_probe_link_dais()
1466 card->name, rtd->num, order); in soc_probe_link_dais()
1468 /* probe all rtd connected DAIs in good order */ in soc_probe_link_dais()
1469 ret = snd_soc_pcm_dai_probe(rtd, order); in soc_probe_link_dais()
1481 struct snd_soc_pcm_runtime *rtd; in soc_remove_link_components() local
1485 for_each_card_rtds(card, rtd) { in soc_remove_link_components()
1486 for_each_rtd_components(rtd, i, component) { in soc_remove_link_components()
1499 struct snd_soc_pcm_runtime *rtd; in soc_probe_link_components() local
1503 for_each_card_rtds(card, rtd) { in soc_probe_link_components()
1504 for_each_rtd_components(rtd, i, component) { in soc_probe_link_components()
1760 /* machine matches, so override the rtd data */ in soc_check_tplg_fes()
1886 struct snd_soc_pcm_runtime *rtd, *n; in soc_cleanup_card_resources() local
1897 for_each_card_rtds_safe(card, rtd, n) in soc_cleanup_card_resources()
1898 snd_soc_remove_pcm_runtime(card, rtd); in soc_cleanup_card_resources()
1933 struct snd_soc_pcm_runtime *rtd; in snd_soc_bind_card() local
2012 for_each_card_rtds(card, rtd) { in snd_soc_bind_card()
2013 ret = soc_init_pcm_runtime(card, rtd); in snd_soc_bind_card()