Lines Matching refs:rtd
29 #define soc_pcm_ret(rtd, ret) _soc_pcm_ret(rtd, __func__, ret) argument
30 static inline int _soc_pcm_ret(struct snd_soc_pcm_runtime *rtd, in _soc_pcm_ret() argument
44 dev_err(rtd->dev, in _soc_pcm_ret()
46 func, rtd->dai_link->name, ret); in _soc_pcm_ret()
153 static inline const char *soc_cpu_dai_name(struct snd_soc_pcm_runtime *rtd) in soc_cpu_dai_name() argument
155 return (rtd)->dai_link->num_cpus == 1 ? snd_soc_rtd_to_cpu(rtd, 0)->name : "multicpu"; in soc_cpu_dai_name()
157 static inline const char *soc_codec_dai_name(struct snd_soc_pcm_runtime *rtd) in soc_codec_dai_name() argument
159 return (rtd)->dai_link->num_codecs == 1 ? snd_soc_rtd_to_codec(rtd, 0)->name : "multicodec"; in soc_codec_dai_name()
286 void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd) in soc_dpcm_debugfs_add() argument
288 if (!rtd->dai_link->dynamic) in soc_dpcm_debugfs_add()
291 if (!rtd->card->debugfs_card_root) in soc_dpcm_debugfs_add()
294 rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name, in soc_dpcm_debugfs_add()
295 rtd->card->debugfs_card_root); in soc_dpcm_debugfs_add()
297 debugfs_create_file("state", 0444, rtd->debugfs_dpcm_root, in soc_dpcm_debugfs_add()
298 rtd, &dpcm_state_fops); in soc_dpcm_debugfs_add()
373 void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd, in snd_soc_runtime_action() argument
380 snd_soc_dpcm_mutex_assert_held(rtd); in snd_soc_runtime_action()
382 for_each_rtd_dais(rtd, i, dai) in snd_soc_runtime_action()
386 for_each_rtd_components(rtd, i, component) { in snd_soc_runtime_action()
403 bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd) in snd_soc_runtime_ignore_pmdown_time() argument
408 if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) in snd_soc_runtime_ignore_pmdown_time()
411 for_each_rtd_components(rtd, i, component) in snd_soc_runtime_ignore_pmdown_time()
479 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_apply_symmetry() local
487 rtd->dai_link->symmetric_##name)) { \ in soc_pcm_apply_symmetry()
512 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_params_symmetry() local
522 symmetry = rtd->dai_link->symmetric_##xxx; \ in soc_pcm_params_symmetry()
523 for_each_rtd_dais(rtd, i, dai) \ in soc_pcm_params_symmetry()
527 for_each_rtd_cpu_dais(rtd, i, cpu_dai) \ in soc_pcm_params_symmetry()
530 dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %s:%d - %s:%d\n", \ in soc_pcm_params_symmetry()
545 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_update_symmetry() local
546 struct snd_soc_dai_link *link = rtd->dai_link; in soc_pcm_update_symmetry()
554 for_each_rtd_dais(rtd, i, dai) in soc_pcm_update_symmetry()
566 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_set_msb() local
574 dev_warn(rtd->dev, "ASoC: Failed to set MSB %d: %d\n", in soc_pcm_set_msb()
580 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_apply_msb() local
587 for_each_rtd_codec_dais(rtd, i, codec_dai) { in soc_pcm_apply_msb()
597 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { in soc_pcm_apply_msb()
662 int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd, in snd_soc_runtime_calc_hw() argument
675 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { in snd_soc_runtime_calc_hw()
697 for_each_rtd_codec_dais(rtd, i, codec_dai) { in snd_soc_runtime_calc_hw()
725 if (rtd->dai_link->num_codecs > 1) { in snd_soc_runtime_calc_hw()
737 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_init_runtime_hw() local
745 snd_soc_runtime_calc_hw(rtd, hw, substream->stream); in soc_pcm_init_runtime_hw()
753 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_components_open() local
757 for_each_rtd_components(rtd, i, component) { in soc_pcm_components_open()
773 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_components_close() local
777 for_each_rtd_components(rtd, i, component) { in soc_pcm_components_close()
788 static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd, in soc_pcm_clean() argument
795 snd_soc_dpcm_mutex_assert_held(rtd); in soc_pcm_clean()
798 snd_soc_runtime_deactivate(rtd, substream->stream); in soc_pcm_clean()
801 for_each_rtd_dais(rtd, i, dai) { in soc_pcm_clean()
808 for_each_rtd_dais_reverse(rtd, i, dai) in soc_pcm_clean()
815 snd_soc_pcm_component_pm_runtime_put(rtd, substream, rollback); in soc_pcm_clean()
817 for_each_rtd_components(rtd, i, component) in soc_pcm_clean()
829 static int __soc_pcm_close(struct snd_soc_pcm_runtime *rtd, in __soc_pcm_close() argument
832 return soc_pcm_clean(rtd, substream, 0); in __soc_pcm_close()
838 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_close() local
840 snd_soc_dpcm_mutex_lock(rtd); in soc_pcm_close()
841 __soc_pcm_close(rtd, substream); in soc_pcm_close()
842 snd_soc_dpcm_mutex_unlock(rtd); in soc_pcm_close()
848 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_hw_sanity_check() local
850 const char *name_cpu = soc_cpu_dai_name(rtd); in soc_hw_sanity_check()
851 const char *name_codec = soc_codec_dai_name(rtd); in soc_hw_sanity_check()
853 struct device *dev = rtd->dev; in soc_hw_sanity_check()
889 static int __soc_pcm_open(struct snd_soc_pcm_runtime *rtd, in __soc_pcm_open() argument
896 snd_soc_dpcm_mutex_assert_held(rtd); in __soc_pcm_open()
898 for_each_rtd_components(rtd, i, component) in __soc_pcm_open()
901 ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream); in __soc_pcm_open()
914 for_each_rtd_dais(rtd, i, dai) { in __soc_pcm_open()
921 if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) in __soc_pcm_open()
936 for_each_rtd_dais(rtd, i, dai) { in __soc_pcm_open()
942 snd_soc_runtime_activate(rtd, substream->stream); in __soc_pcm_open()
946 soc_pcm_clean(rtd, substream, 1); in __soc_pcm_open()
948 return soc_pcm_ret(rtd, ret); in __soc_pcm_open()
954 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_open() local
957 snd_soc_dpcm_mutex_lock(rtd); in soc_pcm_open()
958 ret = __soc_pcm_open(rtd, substream); in soc_pcm_open()
959 snd_soc_dpcm_mutex_unlock(rtd); in soc_pcm_open()
968 static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd, in __soc_pcm_prepare() argument
974 snd_soc_dpcm_mutex_assert_held(rtd); in __soc_pcm_prepare()
990 rtd->pop_wait) { in __soc_pcm_prepare()
991 rtd->pop_wait = 0; in __soc_pcm_prepare()
992 cancel_delayed_work(&rtd->delayed_work); in __soc_pcm_prepare()
995 snd_soc_dapm_stream_event(rtd, substream->stream, in __soc_pcm_prepare()
998 for_each_rtd_dais(rtd, i, dai) { in __soc_pcm_prepare()
1004 return soc_pcm_ret(rtd, ret); in __soc_pcm_prepare()
1010 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_prepare() local
1013 snd_soc_dpcm_mutex_lock(rtd); in soc_pcm_prepare()
1014 ret = __soc_pcm_prepare(rtd, substream); in soc_pcm_prepare()
1015 snd_soc_dpcm_mutex_unlock(rtd); in soc_pcm_prepare()
1030 static int soc_pcm_hw_clean(struct snd_soc_pcm_runtime *rtd, in soc_pcm_hw_clean() argument
1036 snd_soc_dpcm_mutex_assert_held(rtd); in soc_pcm_hw_clean()
1039 for_each_rtd_dais(rtd, i, dai) { in soc_pcm_hw_clean()
1050 snd_soc_dapm_stream_stop(rtd, substream->stream); in soc_pcm_hw_clean()
1059 for_each_rtd_dais(rtd, i, dai) in soc_pcm_hw_clean()
1069 static int __soc_pcm_hw_free(struct snd_soc_pcm_runtime *rtd, in __soc_pcm_hw_free() argument
1072 return soc_pcm_hw_clean(rtd, substream, 0); in __soc_pcm_hw_free()
1078 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_hw_free() local
1081 snd_soc_dpcm_mutex_lock(rtd); in soc_pcm_hw_free()
1082 ret = __soc_pcm_hw_free(rtd, substream); in soc_pcm_hw_free()
1083 snd_soc_dpcm_mutex_unlock(rtd); in soc_pcm_hw_free()
1092 static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd, in __soc_pcm_hw_params() argument
1101 snd_soc_dpcm_mutex_assert_held(rtd); in __soc_pcm_hw_params()
1111 for_each_rtd_codec_dais(rtd, i, codec_dai) { in __soc_pcm_hw_params()
1147 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { in __soc_pcm_hw_params()
1168 for_each_rtd_ch_maps(rtd, j, ch_maps) in __soc_pcm_hw_params()
1188 soc_pcm_hw_clean(rtd, substream, 1); in __soc_pcm_hw_params()
1190 return soc_pcm_ret(rtd, ret); in __soc_pcm_hw_params()
1197 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_hw_params() local
1200 snd_soc_dpcm_mutex_lock(rtd); in soc_pcm_hw_params()
1201 ret = __soc_pcm_hw_params(rtd, substream, params); in soc_pcm_hw_params()
1202 snd_soc_dpcm_mutex_unlock(rtd); in soc_pcm_hw_params()
1222 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); in soc_pcm_trigger() local
1231 for_each_rtd_components(rtd, i, component) { in soc_pcm_trigger()
1237 if (rtd->dai_link->trigger_start) in soc_pcm_trigger()
1238 start = rtd->dai_link->trigger_start; in soc_pcm_trigger()
1239 if (rtd->dai_link->trigger_stop) in soc_pcm_trigger()
1240 stop = rtd->dai_link->trigger_stop; in soc_pcm_trigger()
1490 struct snd_soc_pcm_runtime *rtd; in dpcm_end_walk_at_be() local
1499 rtd = dpcm_get_be(card, widget, stream); in dpcm_end_walk_at_be()
1500 if (rtd) in dpcm_end_walk_at_be()
1963 struct snd_soc_pcm_runtime *rtd; in dpcm_apply_symmetry() local
1970 rtd = snd_soc_substream_to_rtd(be_substream); in dpcm_apply_symmetry()
1971 if (rtd->dai_link->be_hw_params_fixup) in dpcm_apply_symmetry()
1977 for_each_rtd_dais(rtd, i, dai) { in dpcm_apply_symmetry()
2836 static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, in soc_get_playback_capture() argument
2839 struct snd_soc_dai_link *dai_link = rtd->dai_link; in soc_get_playback_capture()
2847 dev_err(rtd->dev, "DPCM doesn't support Multi CPU for Front-Ends yet\n"); in soc_get_playback_capture()
2853 for_each_rtd_ch_maps(rtd, i, ch_maps) { in soc_get_playback_capture()
2854 cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); in soc_get_playback_capture()
2873 dev_warn(rtd->card->dev, in soc_get_playback_capture()
2877 dev_warn(rtd->card->dev, in soc_get_playback_capture()
2886 dev_warn(rtd->card->dev, in soc_get_playback_capture()
2890 dev_warn(rtd->card->dev, in soc_get_playback_capture()
2907 for_each_rtd_ch_maps(rtd, i, ch_maps) { in soc_get_playback_capture()
2908 cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); in soc_get_playback_capture()
2909 codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); in soc_get_playback_capture()
2927 dev_err(rtd->dev, "substream %s has no playback, no capture\n", in soc_get_playback_capture()
2940 struct snd_soc_pcm_runtime *rtd, in soc_create_pcm() argument
2947 if (rtd->dai_link->c2c_params) { in soc_create_pcm()
2949 rtd->dai_link->stream_name); in soc_create_pcm()
2951 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, in soc_create_pcm()
2953 } else if (rtd->dai_link->no_pcm) { in soc_create_pcm()
2955 rtd->dai_link->stream_name); in soc_create_pcm()
2957 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, in soc_create_pcm()
2960 if (rtd->dai_link->dynamic) in soc_create_pcm()
2962 rtd->dai_link->stream_name); in soc_create_pcm()
2965 rtd->dai_link->stream_name, in soc_create_pcm()
2966 soc_codec_dai_name(rtd), num); in soc_create_pcm()
2968 ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback, in soc_create_pcm()
2972 dev_err(rtd->card->dev, "ASoC: can't create pcm %s for dailink %s: %d\n", in soc_create_pcm()
2973 new_name, rtd->dai_link->name, ret); in soc_create_pcm()
2976 dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n",num, new_name); in soc_create_pcm()
2982 int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) in soc_new_pcm() argument
2989 ret = soc_get_playback_capture(rtd, &playback, &capture); in soc_new_pcm()
2993 ret = soc_create_pcm(&pcm, rtd, playback, capture, num); in soc_new_pcm()
3004 if (!rtd->dai_link->c2c_params) in soc_new_pcm()
3005 rtd->close_delayed_work_func = snd_soc_close_delayed_work; in soc_new_pcm()
3007 rtd->pcm = pcm; in soc_new_pcm()
3008 pcm->nonatomic = rtd->dai_link->nonatomic; in soc_new_pcm()
3009 pcm->private_data = rtd; in soc_new_pcm()
3012 if (rtd->dai_link->no_pcm || rtd->dai_link->c2c_params) { in soc_new_pcm()
3014 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; in soc_new_pcm()
3016 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; in soc_new_pcm()
3021 if (rtd->dai_link->dynamic) { in soc_new_pcm()
3022 rtd->ops.open = dpcm_fe_dai_open; in soc_new_pcm()
3023 rtd->ops.hw_params = dpcm_fe_dai_hw_params; in soc_new_pcm()
3024 rtd->ops.prepare = dpcm_fe_dai_prepare; in soc_new_pcm()
3025 rtd->ops.trigger = dpcm_fe_dai_trigger; in soc_new_pcm()
3026 rtd->ops.hw_free = dpcm_fe_dai_hw_free; in soc_new_pcm()
3027 rtd->ops.close = dpcm_fe_dai_close; in soc_new_pcm()
3028 rtd->ops.pointer = soc_pcm_pointer; in soc_new_pcm()
3030 rtd->ops.open = soc_pcm_open; in soc_new_pcm()
3031 rtd->ops.hw_params = soc_pcm_hw_params; in soc_new_pcm()
3032 rtd->ops.prepare = soc_pcm_prepare; in soc_new_pcm()
3033 rtd->ops.trigger = soc_pcm_trigger; in soc_new_pcm()
3034 rtd->ops.hw_free = soc_pcm_hw_free; in soc_new_pcm()
3035 rtd->ops.close = soc_pcm_close; in soc_new_pcm()
3036 rtd->ops.pointer = soc_pcm_pointer; in soc_new_pcm()
3039 for_each_rtd_components(rtd, i, component) { in soc_new_pcm()
3043 rtd->ops.ioctl = snd_soc_pcm_component_ioctl; in soc_new_pcm()
3045 rtd->ops.sync_stop = snd_soc_pcm_component_sync_stop; in soc_new_pcm()
3047 rtd->ops.copy = snd_soc_pcm_component_copy; in soc_new_pcm()
3049 rtd->ops.page = snd_soc_pcm_component_page; in soc_new_pcm()
3051 rtd->ops.mmap = snd_soc_pcm_component_mmap; in soc_new_pcm()
3053 rtd->ops.ack = snd_soc_pcm_component_ack; in soc_new_pcm()
3057 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &rtd->ops); in soc_new_pcm()
3060 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops); in soc_new_pcm()
3062 ret = snd_soc_pcm_component_new(rtd); in soc_new_pcm()
3066 dev_dbg(rtd->card->dev, "%s <-> %s mapping ok\n", in soc_new_pcm()
3067 soc_codec_dai_name(rtd), soc_cpu_dai_name(rtd)); in soc_new_pcm()