aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sound/simple_card_utils.h4
-rw-r--r--include/sound/soc-component.h1
-rw-r--r--sound/soc/generic/audio-graph-card.c23
-rw-r--r--sound/soc/generic/simple-card.c21
-rw-r--r--sound/soc/soc-core.c8
-rw-r--r--sound/soc/soc-pcm.c14
-rw-r--r--sound/soc/soc-utils.c6
7 files changed, 49 insertions, 28 deletions
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index fac3b832d982..e318a2d4ac44 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -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,
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 722cfab28d29..8c4d6830597f 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -338,6 +338,7 @@ static inline int snd_soc_component_cache_sync(
void snd_soc_component_set_aux(struct snd_soc_component *component,
struct snd_soc_aux_dev *aux);
int snd_soc_component_init(struct snd_soc_component *component);
+int snd_soc_component_is_dummy(struct snd_soc_component *component);
/* component IO */
unsigned int snd_soc_component_read(struct snd_soc_component *component,
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 36b2ad7dd283..c7369beee805 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -542,8 +542,8 @@ static int graph_for_each_link(struct asoc_simple_priv *priv,
return ret;
}
-static void graph_get_dais_count(struct asoc_simple_priv *priv,
- struct link_info *li);
+static int graph_get_dais_count(struct asoc_simple_priv *priv,
+ struct link_info *li);
int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
{
@@ -555,7 +555,10 @@ int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
card->dev = dev;
memset(&li, 0, sizeof(li));
- graph_get_dais_count(priv, &li);
+ ret = graph_get_dais_count(priv, &li);
+ if (ret < 0)
+ return ret;
+
if (!li.link)
return -EINVAL;
@@ -616,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;
}
@@ -639,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;
}
@@ -660,8 +663,8 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
return 0;
}
-static void graph_get_dais_count(struct asoc_simple_priv *priv,
- struct link_info *li)
+static int graph_get_dais_count(struct asoc_simple_priv *priv,
+ struct link_info *li)
{
/*
* link_num : number of links.
@@ -709,9 +712,9 @@ static void graph_get_dais_count(struct asoc_simple_priv *priv,
* => 4 DAIs = 2xCPU + 2xCodec
* => 1 ccnf = 1xdummy-Codec
*/
- graph_for_each_link(priv, li,
- graph_count_noml,
- graph_count_dpcm);
+ return graph_for_each_link(priv, li,
+ graph_count_noml,
+ graph_count_dpcm);
}
int audio_graph_card_probe(struct snd_soc_card *card)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 5a686f82d1b4..8b9964d25757 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -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");
@@ -524,8 +524,8 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv,
return 0;
}
-static void simple_get_dais_count(struct asoc_simple_priv *priv,
- struct link_info *li)
+static int simple_get_dais_count(struct asoc_simple_priv *priv,
+ struct link_info *li)
{
struct device *dev = simple_priv_to_dev(priv);
struct device_node *top = dev->of_node;
@@ -582,12 +582,12 @@ static void simple_get_dais_count(struct asoc_simple_priv *priv,
li->num[0].platforms = 1;
li->link = 1;
- return;
+ return 0;
}
- simple_for_each_link(priv, li,
- simple_count_noml,
- simple_count_dpcm);
+ return simple_for_each_link(priv, li,
+ simple_count_noml,
+ simple_count_dpcm);
}
static int simple_soc_probe(struct snd_soc_card *card)
@@ -626,7 +626,10 @@ static int asoc_simple_probe(struct platform_device *pdev)
card->probe = simple_soc_probe;
memset(&li, 0, sizeof(li));
- simple_get_dais_count(priv, &li);
+ ret = simple_get_dais_count(priv, &li);
+ if (ret < 0)
+ return ret;
+
if (!li.link)
return -EINVAL;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 236e075b9e57..80374c82c501 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1169,7 +1169,7 @@ static int soc_probe_component(struct snd_soc_card *card,
int probed = 0;
int ret;
- if (!strcmp(component->name, "snd-soc-dummy"))
+ if (snd_soc_component_is_dummy(component))
return 0;
if (component->card) {
@@ -1658,7 +1658,11 @@ match:
dev_err(card->dev, "init platform error");
continue;
}
- dai_link->platforms->name = component->name;
+
+ if (component->dev->of_node)
+ dai_link->platforms->of_node = component->dev->of_node;
+ else
+ dai_link->platforms->name = component->name;
/* convert non BE into BE */
if (!dai_link->no_pcm) {
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 02968a4e52b4..8659089a87a0 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -384,18 +384,20 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai;
unsigned int symmetry, i;
+ d.name = __func__;
soc_pcm_set_dai_params(&d, params);
-#define __soc_pcm_params_symmetry(name) \
- symmetry = rtd->dai_link->symmetric_##name; \
+#define __soc_pcm_params_symmetry(xxx) \
+ symmetry = rtd->dai_link->symmetric_##xxx; \
for_each_rtd_dais(rtd, i, dai) \
- symmetry |= dai->driver->symmetric_##name; \
+ symmetry |= dai->driver->symmetric_##xxx; \
\
if (symmetry) \
for_each_rtd_cpu_dais(rtd, i, cpu_dai) \
- if (cpu_dai->name && cpu_dai->name != d.name) { \
- dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %d - %d\n", \
- #name, cpu_dai->name, d.name); \
+ if (!snd_soc_dai_is_dummy(cpu_dai) && \
+ cpu_dai->xxx && cpu_dai->xxx != d.xxx) { \
+ dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %s:%d - %s:%d\n", \
+ #xxx, cpu_dai->name, cpu_dai->xxx, d.name, d.xxx); \
return -EINVAL; \
}
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index f27f94ca064b..98383fd76224 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -131,6 +131,12 @@ int snd_soc_dai_is_dummy(struct snd_soc_dai *dai)
return 0;
}
+int snd_soc_component_is_dummy(struct snd_soc_component *component)
+{
+ return ((component->driver == &dummy_platform) ||
+ (component->driver == &dummy_codec));
+}
+
static int snd_soc_dummy_probe(struct platform_device *pdev)
{
int ret;