Lines Matching +full:fe +full:- +full:dai +full:- +full:link
1 /* SPDX-License-Identifier: GPL-2.0
3 * linux/sound/soc.h -- ALSA SoC Layer
238 .mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
440 #include <sound/soc-dapm.h>
441 #include <sound/soc-dpcm.h>
442 #include <sound/soc-topology.h>
516 snd_soc_runtime_action(rtd, stream, -1); in snd_soc_runtime_deactivate()
547 substream->runtime->hw = *hw; in snd_soc_set_runtime_hwparams()
586 int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
640 SND_SOC_TRIGGER_ORDER_DEFAULT = 0, /* Link->Component->DAI DAI->Component->Link */
641 SND_SOC_TRIGGER_ORDER_LDC, /* Link->DAI->Component Component->DAI->Link */
687 * [dai_link->ch_maps Image sample]
689 *-------------------------
690 * CPU0 <---> Codec0
692 * ch-map[0].cpu = 0 ch-map[0].codec = 0
694 *-------------------------
695 * CPU0 <---> Codec0
696 * CPU1 <---> Codec1
697 * CPU2 <---> Codec2
699 * ch-map[0].cpu = 0 ch-map[0].codec = 0
700 * ch-map[1].cpu = 1 ch-map[1].codec = 1
701 * ch-map[2].cpu = 2 ch-map[2].codec = 2
703 *-------------------------
704 * CPU0 <---> Codec0
705 * CPU1 <-+-> Codec1
706 * CPU2 <-/
708 * ch-map[0].cpu = 0 ch-map[0].codec = 0
709 * ch-map[1].cpu = 1 ch-map[1].codec = 1
710 * ch-map[2].cpu = 2 ch-map[2].codec = 1
712 *-------------------------
713 * CPU0 <---> Codec0
714 * CPU1 <-+-> Codec1
715 * \-> Codec2
717 * ch-map[0].cpu = 0 ch-map[0].codec = 0
718 * ch-map[1].cpu = 1 ch-map[1].codec = 1
719 * ch-map[2].cpu = 1 ch-map[2].codec = 2
729 /* config - must be set by machine driver */
734 * You MAY specify the link's CPU-side device, either by device name,
736 * the CPU-side DAI is matched using .cpu_dai_name only, which hence
741 * You MAY specify the DAI name of the CPU DAI. If this information is
742 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node
743 * only, which only works well when that device exposes a single DAI.
749 * You MUST specify the link's codec, either by device name, or by
752 /* You MUST specify the DAI name within the codec */
760 * You MAY specify the link's platform/PCM/DMA driver, either by
761 * device name, or by DT/OF node, but not both. Some forms of link
767 int id; /* optional ID for machine driver link identification */
779 /* codec/machine specific init - e.g. add machine controls */
782 /* codec/machine specific exit - dual of init() */
785 /* optional hw_params re-writing for BE and FE sync */
805 /* For unidirectional dai links */
809 /* Keep DAI active over suspend */
817 /* Do not create a PCM for this DAI link (Backend link) */
820 /* This DAI link can route to other DAI links at runtime (Frontend)*/
823 /* DPCM used FE & BE merged format */
825 /* DPCM used FE & BE merged channel */
827 /* DPCM used FE & BE merged rate */
833 /* Do not create a PCM for this DAI link (Backend link) */
841 static inline int snd_soc_link_num_ch_map(const struct snd_soc_dai_link *link) in snd_soc_link_num_ch_map() argument
843 return max(link->num_cpus, link->num_codecs); in snd_soc_link_num_ch_map()
847 snd_soc_link_to_cpu(struct snd_soc_dai_link *link, int n) { in snd_soc_link_to_cpu() argument
848 return &(link)->cpus[n]; in snd_soc_link_to_cpu()
852 snd_soc_link_to_codec(struct snd_soc_dai_link *link, int n) { in snd_soc_link_to_codec() argument
853 return &(link)->codecs[n]; in snd_soc_link_to_codec()
857 snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) { in snd_soc_link_to_platform() argument
858 return &(link)->platforms[n]; in snd_soc_link_to_platform()
861 #define for_each_link_codecs(link, i, codec) \ argument
863 ((i) < link->num_codecs) && \
864 ((codec) = snd_soc_link_to_codec(link, i)); \
867 #define for_each_link_platforms(link, i, platform) \ argument
869 ((i) < link->num_platforms) && \
870 ((platform) = snd_soc_link_to_platform(link, i)); \
873 #define for_each_link_cpus(link, i, cpu) \ argument
875 ((i) < link->num_cpus) && \
876 ((cpu) = snd_soc_link_to_cpu(link, i)); \
879 #define for_each_link_ch_maps(link, i, ch_map) \ argument
881 ((i) < snd_soc_link_num_ch_map(link) && \
882 ((ch_map) = link->ch_maps + i)); \
893 * struct snd_soc_dai_link link = {
906 * struct snd_soc_dai_link link = {
922 * struct snd_soc_dai_link link = {
931 * struct snd_soc_dai_link link = {
988 * specify multi-codec either by device name, or by
993 /* codec/machine specific init - e.g. add machine controls */
1036 * after the codec and DAI's do any PM work. */
1051 struct snd_soc_dai_link *link);
1053 struct snd_soc_dai_link *link);
1057 /* CPU <--> Codec DAI links */
1069 * optional auxiliary devices such as amplifiers or codecs with DAI
1070 * link unused
1080 * Card-specific routes and widgets.
1081 * Note: of_dapm_xxx for Device Tree; Otherwise for driver build-in.
1127 #define for_each_card_prelinks(card, i, link) \ argument
1129 ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \
1133 ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \
1137 list_for_each_entry(rtd, &(card)->rtd_list, list)
1139 list_for_each_entry_safe(rtd, _rtd, &(card)->rtd_list, list)
1142 list_for_each_entry(component, &card->aux_comp_list, card_aux_list)
1145 &card->aux_comp_list, card_aux_list)
1148 list_for_each_entry(component, &(card)->component_dev_list, card_list)
1151 list_for_each_entry(dapm, &card->dapm_list, list)
1154 list_for_each_entry(w, &card->widgets, list)
1156 list_for_each_entry_safe(w, _w, &card->widgets, list)
1161 return card && card->instantiated; in snd_soc_card_is_instantiated()
1164 /* SoC machine DAI configuration, glues a codec and cpu DAI together */
1171 unsigned int c2c_params_select; /* currently selected c2c_param for dai link */
1198 unsigned int id; /* 0-based and monotonic increasing */
1218 #define snd_soc_rtd_to_cpu(rtd, n) (rtd)->dais[n]
1219 #define snd_soc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->dai_link->num_cpus]
1229 ((i) < rtd->num_components) && ((component) = rtd->components[i]);\
1231 #define for_each_rtd_cpu_dais(rtd, i, dai) \ argument
1233 ((i) < rtd->dai_link->num_cpus) && ((dai) = snd_soc_rtd_to_cpu(rtd, i)); \
1235 #define for_each_rtd_codec_dais(rtd, i, dai) \ argument
1237 ((i) < rtd->dai_link->num_codecs) && ((dai) = snd_soc_rtd_to_codec(rtd, i)); \
1239 #define for_each_rtd_dais(rtd, i, dai) \ argument
1241 ((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \
1242 ((dai) = (rtd)->dais[i]); \
1244 #define for_each_rtd_dais_reverse(rtd, i, dai) \ argument
1245 for ((i) = (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs - 1; \
1246 (i) >= 0 && ((dai) = (rtd)->dais[i]); \
1247 (i)--)
1248 #define for_each_rtd_ch_maps(rtd, i, ch_maps) for_each_link_ch_maps(rtd->dai_link, i, ch_maps)
1306 if (mc->reg == mc->rreg && mc->shift == mc->rshift) in snd_soc_volsw_is_stereo()
1309 * mc->reg == mc->rreg && mc->shift != mc->rshift, or in snd_soc_volsw_is_stereo()
1310 * mc->reg != mc->rreg means that the control is in snd_soc_volsw_is_stereo()
1321 if (!e->values) in snd_soc_enum_val_to_item()
1324 for (i = 0; i < e->items; i++) in snd_soc_enum_val_to_item()
1325 if (val == e->values[i]) in snd_soc_enum_val_to_item()
1334 if (!e->values) in snd_soc_enum_item_to_val()
1337 return e->values[item]; in snd_soc_enum_item_to_val()
1341 * snd_soc_kcontrol_component() - Returns the component that registered the
1382 snd_soc_of_parse_node_prefix(card->dev->of_node, in snd_soc_of_parse_audio_prefix()
1441 void snd_soc_unregister_dai(struct snd_soc_dai *dai);
1448 #include <sound/soc-dai.h>
1464 if (dai_link->num_platforms != 1) in snd_soc_fixup_dai_links_platform_name()
1465 return -EINVAL; in snd_soc_fixup_dai_links_platform_name()
1467 if (!dai_link->platforms) in snd_soc_fixup_dai_links_platform_name()
1468 return -EINVAL; in snd_soc_fixup_dai_links_platform_name()
1470 name = devm_kstrdup(card->dev, platform_name, GFP_KERNEL); in snd_soc_fixup_dai_links_platform_name()
1472 return -ENOMEM; in snd_soc_fixup_dai_links_platform_name()
1475 dai_link->platforms->name = name; in snd_soc_fixup_dai_links_platform_name()
1497 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_ROOT); in _snd_soc_dapm_mutex_lock_root_c()
1502 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); in _snd_soc_dapm_mutex_lock_c()
1507 mutex_unlock(&card->dapm_mutex); in _snd_soc_dapm_mutex_unlock_c()
1512 lockdep_assert_held(&card->dapm_mutex); in _snd_soc_dapm_mutex_assert_held_c()
1517 _snd_soc_dapm_mutex_lock_root_c(dapm->card); in _snd_soc_dapm_mutex_lock_root_d()
1522 _snd_soc_dapm_mutex_lock_c(dapm->card); in _snd_soc_dapm_mutex_lock_d()
1527 _snd_soc_dapm_mutex_unlock_c(dapm->card); in _snd_soc_dapm_mutex_unlock_d()
1532 _snd_soc_dapm_mutex_assert_held_c(dapm->card); in _snd_soc_dapm_mutex_assert_held_d()
1553 mutex_lock_nested(&card->pcm_mutex, card->pcm_subclass); in _snd_soc_dpcm_mutex_lock_c()
1558 mutex_unlock(&card->pcm_mutex); in _snd_soc_dpcm_mutex_unlock_c()
1563 lockdep_assert_held(&card->pcm_mutex); in _snd_soc_dpcm_mutex_assert_held_c()
1568 _snd_soc_dpcm_mutex_lock_c(rtd->card); in _snd_soc_dpcm_mutex_lock_r()
1573 _snd_soc_dpcm_mutex_unlock_c(rtd->card); in _snd_soc_dpcm_mutex_unlock_r()
1578 _snd_soc_dpcm_mutex_assert_held_c(rtd->card); in _snd_soc_dpcm_mutex_assert_held_r()
1593 #include <sound/soc-component.h>
1594 #include <sound/soc-card.h>
1595 #include <sound/soc-jack.h>