mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
ASoC: rsnd: cleanup rsnd_dai_of_node()
It calls rsnd_dai_of_node() to know it was called from Audio Graph Card/Card2, or from Simple Audio Card. And after that, it gets number of related DAIs. To be more simple code, this patch merges these. This is prepare for multi Component support. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v8eab1md.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
8897a1475f
commit
6328489c13
@ -1261,7 +1261,7 @@ int rsnd_node_count(struct rsnd_priv *priv, struct device_node *node, char *name
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv,
|
static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv,
|
||||||
int *is_graph)
|
int *nr, int *is_graph)
|
||||||
{
|
{
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
struct device_node *np = dev->of_node;
|
struct device_node *np = dev->of_node;
|
||||||
@ -1274,22 +1274,30 @@ static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv,
|
|||||||
* parse both previous dai (= rcar_sound,dai), and
|
* parse both previous dai (= rcar_sound,dai), and
|
||||||
* graph dai (= ports/port)
|
* graph dai (= ports/port)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Simple-Card
|
||||||
|
*/
|
||||||
dai_node = of_get_child_by_name(np, RSND_NODE_DAI);
|
dai_node = of_get_child_by_name(np, RSND_NODE_DAI);
|
||||||
if (dai_node) {
|
if (dai_node) {
|
||||||
|
*nr = of_get_child_count(dai_node);
|
||||||
ret = dai_node;
|
ret = dai_node;
|
||||||
goto of_node_compatible;
|
goto of_node_compatible;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = np;
|
/*
|
||||||
|
* Audio-Graph-Card
|
||||||
|
*/
|
||||||
dai_node = of_graph_get_next_endpoint(np, NULL);
|
dai_node = of_graph_get_next_endpoint(np, NULL);
|
||||||
if (dai_node)
|
if (dai_node) {
|
||||||
goto of_node_graph;
|
*nr = of_graph_get_endpoint_count(np);
|
||||||
|
*is_graph = 1;
|
||||||
|
ret = np;
|
||||||
|
goto of_node_compatible;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
of_node_graph:
|
|
||||||
*is_graph = 1;
|
|
||||||
of_node_compatible:
|
of_node_compatible:
|
||||||
of_node_put(dai_node);
|
of_node_put(dai_node);
|
||||||
|
|
||||||
@ -1447,16 +1455,11 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
|
|||||||
struct snd_soc_dai_driver *rdrv;
|
struct snd_soc_dai_driver *rdrv;
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
struct rsnd_dai *rdai;
|
struct rsnd_dai *rdai;
|
||||||
int nr;
|
int nr = 0;
|
||||||
int is_graph;
|
int is_graph;
|
||||||
int dai_i;
|
int dai_i;
|
||||||
|
|
||||||
dai_node = rsnd_dai_of_node(priv, &is_graph);
|
dai_node = rsnd_dai_of_node(priv, &nr, &is_graph);
|
||||||
if (is_graph)
|
|
||||||
nr = of_graph_get_endpoint_count(dai_node);
|
|
||||||
else
|
|
||||||
nr = of_get_child_count(dai_node);
|
|
||||||
|
|
||||||
if (!nr)
|
if (!nr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user