aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-05-25 20:22:11 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-03 08:06:41 -0400
commitbc92657a11c0982783979bbb84ceaf58ba222124 (patch)
tree473fa6b2b4624dc255a1db98ddcfac9fd1bc9bd6 /include/sound
parent210cb67cb5b9f9a23b7ce91de50bab357440ba9d (diff)
ASoC: make snd_soc_dai_link more symmetrical
Prior to this patch, the CPU side of a DAI link was specified using a single name. Often, this was the result of calling dev_name() on the device providing the DAI, but in the case of a CPU DAI driver that provided multiple DAIs, it needed to mix together both the device name and some device-relative name, in order to form a single globally unique name. However, the CODEC side of the DAI link was specified using separate fields for device (name or OF node) and device-relative DAI name. This patch allows the CPU side of a DAI link to be specified in the same way as the CODEC side, separating concepts of device and device-relative DAI name. I believe this will be important in multi-codec and/or dynamic PCM scenarios, where a single CPU driver provides multiple DAIs, while also booting using device tree, with accompanying desire not to hard-code the CPU side device's name into the original .cpu_dai_name field. Ideally, both the CPU DAI and CODEC DAI loops in soc_bind_dai_link() would now be identical. However, two things prevent that at present: 1) The need to save rtd->codec for the CODEC side, which means we have to search for the CODEC explicitly, and not just the CODEC side DAI. 2) Since we know the CODEC side DAI is part of a codec, and not just a standalone DAI, it's slightly more efficient to convert .codec_name/ .codec_of_node into a codec first, and then compare each DAI's .codec field, since this avoids strcmp() on each DAI's CODEC's name within the loop. However, the two loops are essentially semantically equivalent. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index c703871f5f6..23c4efbe13a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -785,13 +785,36 @@ struct snd_soc_dai_link {
785 /* config - must be set by machine driver */ 785 /* config - must be set by machine driver */
786 const char *name; /* Codec name */ 786 const char *name; /* Codec name */
787 const char *stream_name; /* Stream name */ 787 const char *stream_name; /* Stream name */
788 const char *codec_name; /* for multi-codec */ 788 /*
789 const struct device_node *codec_of_node; 789 * You MAY specify the link's CPU-side device, either by device name,
790 const char *platform_name; /* for multi-platform */ 790 * or by DT/OF node, but not both. If this information is omitted,
791 const struct device_node *platform_of_node; 791 * the CPU-side DAI is matched using .cpu_dai_name only, which hence
792 * must be globally unique. These fields are currently typically used
793 * only for codec to codec links, or systems using device tree.
794 */
795 const char *cpu_name;
796 const struct device_node *cpu_of_node;
797 /*
798 * You MAY specify the DAI name of the CPU DAI. If this information is
799 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node
800 * only, which only works well when that device exposes a single DAI.
801 */
792 const char *cpu_dai_name; 802 const char *cpu_dai_name;
793 const struct device_node *cpu_dai_of_node; 803 /*
804 * You MUST specify the link's codec, either by device name, or by
805 * DT/OF node, but not both.
806 */
807 const char *codec_name;
808 const struct device_node *codec_of_node;
809 /* You MUST specify the DAI name within the codec */
794 const char *codec_dai_name; 810 const char *codec_dai_name;
811 /*
812 * You MAY specify the link's platform/PCM/DMA driver, either by
813 * device name, or by DT/OF node, but not both. Some forms of link
814 * do not need a platform.
815 */
816 const char *platform_name;
817 const struct device_node *platform_of_node;
795 int be_id; /* optional ID for machine driver BE identification */ 818 int be_id; /* optional ID for machine driver BE identification */
796 819
797 const struct snd_soc_pcm_stream *params; 820 const struct snd_soc_pcm_stream *params;