ASoC: simple-card-utils: Increase maximum number of links to 128

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: f2138aed23 ("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>
This commit is contained in:
Thierry Reding 2021-04-16 09:11:47 +02:00 коммит произвёл Mark Brown
Родитель 0f687d8267
Коммит 343e55e718
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
3 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -115,10 +115,12 @@ struct asoc_simple_priv {
((codec) = simple_props_to_dai_codec(props, i)); \ ((codec) = simple_props_to_dai_codec(props, i)); \
(i)++) (i)++)
#define SNDRV_MAX_LINKS 128
struct link_info { struct link_info {
int link; /* number of link */ int link; /* number of link */
int cpu; /* turn for CPU / Codec */ 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, int asoc_simple_parse_daifmt(struct device *dev,

Просмотреть файл

@ -619,7 +619,7 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
{ {
struct device *dev = simple_priv_to_dev(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"); dev_err(dev, "too many links\n");
return -EINVAL; return -EINVAL;
} }
@ -642,7 +642,7 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
{ {
struct device *dev = simple_priv_to_dev(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"); dev_err(dev, "too many links\n");
return -EINVAL; return -EINVAL;
} }

Просмотреть файл

@ -482,7 +482,7 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
struct device_node *codec, struct device_node *codec,
struct link_info *li, bool is_top) 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); struct device *dev = simple_priv_to_dev(priv);
dev_err(dev, "too many links\n"); 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 device_node *codec,
struct link_info *li, bool is_top) 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); struct device *dev = simple_priv_to_dev(priv);
dev_err(dev, "too many links\n"); dev_err(dev, "too many links\n");