summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Nie <jun.nie@linaro.org>2015-04-29 18:11:07 +0800
committerMark Brown <broonie@kernel.org>2015-05-04 14:59:04 +0100
commite0ae225b7e96e50daaa3ca8d3cd2c944ce48e007 (patch)
tree68841c9603d99739b644f2ed20f02c61aeffa397
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
ASoC: simple-card: support platform in dts parse
Support platform in dts parse so that dma pcm component can be added in dts. Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/generic/simple-card.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 33feee9ca8c3..c87e58504a62 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -307,6 +307,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
struct device_node *cpu = NULL;
+ struct device_node *plat = NULL;
struct device_node *codec = NULL;
char *name;
char prop[128];
@@ -320,6 +321,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
snprintf(prop, sizeof(prop), "%scpu", prefix);
cpu = of_get_child_by_name(node, prop);
+ snprintf(prop, sizeof(prop), "%splat", prefix);
+ plat = of_get_child_by_name(node, prop);
+
snprintf(prop, sizeof(prop), "%scodec", prefix);
codec = of_get_child_by_name(node, prop);
@@ -352,8 +356,16 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
goto dai_link_of_err;
}
- /* Simple Card assumes platform == cpu */
- dai_link->platform_of_node = dai_link->cpu_of_node;
+ if (plat) {
+ struct of_phandle_args args;
+
+ ret = of_parse_phandle_with_args(plat, "sound-dai",
+ "#sound-dai-cells", 0, &args);
+ dai_link->platform_of_node = args.np;
+ } else {
+ /* Assumes platform == cpu */
+ dai_link->platform_of_node = dai_link->cpu_of_node;
+ }
/* DAI link name is created from CPU/CODEC dai name */
name = devm_kzalloc(dev,