Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jun Nie and committed by
Mark Brown
e0ae225b b787f68c

+14 -2
+14 -2
sound/soc/generic/simple-card.c
··· 307 307 struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); 308 308 struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); 309 309 struct device_node *cpu = NULL; 310 + struct device_node *plat = NULL; 310 311 struct device_node *codec = NULL; 311 312 char *name; 312 313 char prop[128]; ··· 320 319 321 320 snprintf(prop, sizeof(prop), "%scpu", prefix); 322 321 cpu = of_get_child_by_name(node, prop); 322 + 323 + snprintf(prop, sizeof(prop), "%splat", prefix); 324 + plat = of_get_child_by_name(node, prop); 323 325 324 326 snprintf(prop, sizeof(prop), "%scodec", prefix); 325 327 codec = of_get_child_by_name(node, prop); ··· 356 352 goto dai_link_of_err; 357 353 } 358 354 359 - /* Simple Card assumes platform == cpu */ 360 - dai_link->platform_of_node = dai_link->cpu_of_node; 355 + if (plat) { 356 + struct of_phandle_args args; 357 + 358 + ret = of_parse_phandle_with_args(plat, "sound-dai", 359 + "#sound-dai-cells", 0, &args); 360 + dai_link->platform_of_node = args.np; 361 + } else { 362 + /* Assumes platform == cpu */ 363 + dai_link->platform_of_node = dai_link->cpu_of_node; 364 + } 361 365 362 366 /* DAI link name is created from CPU/CODEC dai name */ 363 367 name = devm_kzalloc(dev,