summaryrefslogtreecommitdiff
path: root/sound/soc/generic/simple-card.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-04-01 13:15:23 +0900
committerMark Brown <broonie@kernel.org>2021-04-08 15:18:02 +0100
commitf2138aed231c88d5c4fa8d06aa15ad19685087c2 (patch)
treee3e81874d7635687fc1cb67b99c5bbcf7bcb0ac1 /sound/soc/generic/simple-card.c
parent8361c6da77b7d267707da9ff3b94458e018dd3da (diff)
ASoC: simple-card-utils: enable flexible CPU/Codec/Platform
Current simple-card / audio-graph are assuming fixed single-CPU/Codec/Platform. This patch prepares multi-CPU/Codec/Platform support. Note is that it is not yet full-multi-support. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v996od2c.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic/simple-card.c')
-rw-r--r--sound/soc/generic/simple-card.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9a05f44fc3a9..1fad570338b3 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -499,6 +499,17 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
struct device_node *codec,
struct link_info *li, bool is_top)
{
+ if (li->link >= SNDRV_MINOR_DEVICES) {
+ struct device *dev = simple_priv_to_dev(priv);
+
+ dev_err(dev, "too many links\n");
+ return -EINVAL;
+ }
+
+ li->num[li->link].cpus = 1;
+ li->num[li->link].codecs = 1;
+ li->num[li->link].platforms = 1;
+
li->link += 1;
li->dais += 2;
@@ -510,10 +521,25 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv,
struct device_node *codec,
struct link_info *li, bool is_top)
{
+ if (li->link >= SNDRV_MINOR_DEVICES) {
+ struct device *dev = simple_priv_to_dev(priv);
+
+ dev_err(dev, "too many links\n");
+ return -EINVAL;
+ }
+
if (li->cpu) {
+ li->num[li->link].cpus = 1;
+ li->num[li->link].codecs = 1;
+ li->num[li->link].platforms = 1;
+
li->link++; /* CPU-dummy */
li->dais++;
} else {
+ li->num[li->link].cpus = 1;
+ li->num[li->link].codecs = 1;
+ li->num[li->link].platforms = 1;
+
li->link++; /* dummy-Codec */
li->dais++;
li->conf++;
@@ -575,6 +601,10 @@ static void simple_get_dais_count(struct asoc_simple_priv *priv,
* => 1 ccnf = 1xdummy-Codec
*/
if (!top) {
+ li->num[0].cpus = 1;
+ li->num[0].codecs = 1;
+ li->num[0].platforms = 1;
+
li->link = 1;
li->dais = 2;
li->conf = 0;