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

ASoC: simple-card: add comment to indicate don't remove platforms

Basically CPU and Platform are different Component, but if CPU is using
soc-generic-dmaengine-pcm, same dev will be shared between CPU and
Platform, and Simple Card had been supporting it.

When we focus to clean up Simple Card driver, we tend to remove platforms
if no Platform was selected, but it is wrong because of above reasons.

This patch adds comment why we shouldn't remove platforms.

In case of CPU is not using soc-generic-dmaengine-pcm, CPU and Platform
will be duplicated, but it will be ignored by snd_soc_rtd_add_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yattwqv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
dcf08424 3e1a334a

+60 -3
+12 -1
sound/soc/generic/audio-graph-card.c
··· 613 613 return -EINVAL; 614 614 } 615 615 616 + /* 617 + * DON'T REMOVE platforms 618 + * see 619 + * simple-card.c :: simple_count_noml() 620 + */ 616 621 li->num[li->link].cpus = 1; 617 - li->num[li->link].codecs = 1; 618 622 li->num[li->link].platforms = 1; 623 + 624 + li->num[li->link].codecs = 1; 619 625 620 626 li->link += 1; /* 1xCPU-Codec */ 621 627 ··· 643 637 } 644 638 645 639 if (li->cpu) { 640 + /* 641 + * DON'T REMOVE platforms 642 + * see 643 + * simple-card.c :: simple_count_noml() 644 + */ 646 645 li->num[li->link].cpus = 1; 647 646 li->num[li->link].platforms = 1; 648 647
+17
sound/soc/generic/audio-graph-card2.c
··· 1046 1046 * => lnk: port { endpoint { .. }; }; 1047 1047 * }; 1048 1048 */ 1049 + /* 1050 + * DON'T REMOVE platforms 1051 + * see 1052 + * simple-card.c :: simple_count_noml() 1053 + */ 1049 1054 li->num[li->link].cpus = 1050 1055 li->num[li->link].platforms = graph_counter(cpu_port); 1056 + 1051 1057 li->num[li->link].codecs = graph_counter(codec_port); 1052 1058 1053 1059 of_node_put(cpu_ep); ··· 1085 1079 */ 1086 1080 1087 1081 if (asoc_graph_is_ports0(lnk)) { 1082 + /* 1083 + * DON'T REMOVE platforms 1084 + * see 1085 + * simple-card.c :: simple_count_noml() 1086 + */ 1088 1087 li->num[li->link].cpus = graph_counter(rport); /* FE */ 1089 1088 li->num[li->link].platforms = graph_counter(rport); 1090 1089 } else { ··· 1124 1113 * }; 1125 1114 * }; 1126 1115 */ 1116 + /* 1117 + * DON'T REMOVE platforms 1118 + * see 1119 + * simple-card.c :: simple_count_noml() 1120 + */ 1127 1121 li->num[li->link].cpus = 1128 1122 li->num[li->link].platforms = graph_counter(codec0); 1123 + 1129 1124 li->num[li->link].codecs = graph_counter(codec1); 1130 1125 1131 1126 of_node_put(ports);
+10 -1
sound/soc/generic/simple-card-utils.c
··· 638 638 void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, 639 639 struct snd_soc_dai_link_component *cpus) 640 640 { 641 - /* Assumes platform == cpu */ 641 + /* 642 + * Assumes Platform == CPU 643 + * 644 + * Some CPU might be using soc-generic-dmaengine-pcm. This means CPU and Platform 645 + * are different Component, but are sharing same component->dev. 646 + * 647 + * Let's assume Platform is same as CPU if it doesn't identify Platform on DT. 648 + * see 649 + * simple-card.c :: simple_count_noml() 650 + */ 642 651 if (!platforms->of_node) 643 652 platforms->of_node = cpus->of_node; 644 653 }
+21 -1
sound/soc/generic/simple-card.c
··· 509 509 return -EINVAL; 510 510 } 511 511 512 + /* 513 + * DON'T REMOVE platforms 514 + * 515 + * Some CPU might be using soc-generic-dmaengine-pcm. This means CPU and Platform 516 + * are different Component, but are sharing same component->dev. 517 + * Simple Card had been supported it without special Platform selection. 518 + * We need platforms here. 519 + * 520 + * In case of no Platform, it will be Platform == CPU, but Platform will be 521 + * ignored by snd_soc_rtd_add_component(). 522 + * 523 + * see 524 + * simple-card-utils.c :: asoc_simple_canonicalize_platform() 525 + */ 512 526 li->num[li->link].cpus = 1; 513 - li->num[li->link].codecs = 1; 514 527 li->num[li->link].platforms = 1; 528 + 529 + li->num[li->link].codecs = 1; 515 530 516 531 li->link += 1; 517 532 ··· 546 531 } 547 532 548 533 if (li->cpu) { 534 + /* 535 + * DON'T REMOVE platforms 536 + * see 537 + * simple_count_noml() 538 + */ 549 539 li->num[li->link].cpus = 1; 550 540 li->num[li->link].platforms = 1; 551 541