ASoC: simple-card-utils: Increase maximum number of links to 128
authorThierry Reding <treding@nvidia.com>
Fri, 16 Apr 2021 07:11:47 +0000 (09:11 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 16 Apr 2021 15:54:48 +0000 (16:54 +0100)
On Tegra186 and later, the number of links can go up to 72, so bump the
maximum number of links to the next power of two (128).

Fixes: f2138aed231c ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210416071147.2149109-2-thierry.reding@gmail.com
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/simple_card_utils.h
sound/soc/generic/audio-graph-card.c
sound/soc/generic/simple-card.c

index fac3b832d982e4fdf19180c3cb30364e4e7c375f..e318a2d4ac44df0030f1b853d2e4a0943cb25e06 100644 (file)
@@ -115,10 +115,12 @@ struct asoc_simple_priv {
                     ((codec) = simple_props_to_dai_codec(props, i));   \
             (i)++)
 
+#define SNDRV_MAX_LINKS 128
+
 struct link_info {
        int link; /* number of link */
        int cpu;  /* turn for CPU / Codec */
-       struct prop_nums num[SNDRV_MINOR_DEVICES];
+       struct prop_nums num[SNDRV_MAX_LINKS];
 };
 
 int asoc_simple_parse_daifmt(struct device *dev,
index 080c1a22bfc2fc1af3b0d1a3dfb5a247749f576c..c7369beee805c5ef80d0870e5a17d75e4faf8b50 100644 (file)
@@ -619,7 +619,7 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
 {
        struct device *dev = simple_priv_to_dev(priv);
 
-       if (li->link >= SNDRV_MINOR_DEVICES) {
+       if (li->link >= SNDRV_MAX_LINKS) {
                dev_err(dev, "too many links\n");
                return -EINVAL;
        }
@@ -642,7 +642,7 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
 {
        struct device *dev = simple_priv_to_dev(priv);
 
-       if (li->link >= SNDRV_MINOR_DEVICES) {
+       if (li->link >= SNDRV_MAX_LINKS) {
                dev_err(dev, "too many links\n");
                return -EINVAL;
        }
index e05539b5f997b9c9c08547b1ffa4bb4aad85a668..8b9964d257578c0dd44230174654e4463943dabb 100644 (file)
@@ -482,7 +482,7 @@ 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) {
+       if (li->link >= SNDRV_MAX_LINKS) {
                struct device *dev = simple_priv_to_dev(priv);
 
                dev_err(dev, "too many links\n");
@@ -503,7 +503,7 @@ 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) {
+       if (li->link >= SNDRV_MAX_LINKS) {
                struct device *dev = simple_priv_to_dev(priv);
 
                dev_err(dev, "too many links\n");