summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-06-22 06:22:49 +0000
committerMark Brown <broonie@kernel.org>2017-06-23 13:03:02 +0100
commitf1f940490d3ccff96da9cc81d57c2c083c398a18 (patch)
tree75b4fd85ba539b6301b3ee5028bc102cd39cc7e3 /sound
parent32f2bcce3ed10b93236d747701a9c04d51626cc2 (diff)
downloadlinux-f1f940490d3ccff96da9cc81d57c2c083c398a18.tar.gz
linux-f1f940490d3ccff96da9cc81d57c2c083c398a18.tar.bz2
linux-f1f940490d3ccff96da9cc81d57c2c083c398a18.zip
ASoC: audio-graph-scu-card: support 2nd codec endpoint on DT
audio-graph-scu-card can handle below connection which is mainly for sound mixing purpose. +----------+ +-------+ | CPU0--+--|-->| Codec | | | | +-------+ | CPU1--+ | +----------+ >From OF-graph point of view, it should have CPU0 <-> Codec, and CPU1 <-> Codec on DT. But current driver doesn't care about 2nd connection of Codec, because it is dummy from DPCM point of view. This patch can care 2nd Codec connection, and it should be supported from OF-graph point of view. It still have backward compatibility. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/audio-graph-scu-card.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index 061c7a60d6b4..dcd2df37bc3b 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -183,6 +183,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
struct device_node *cpu_ep;
struct device_node *codec_ep;
struct device_node *rcpu_ep;
+ struct device_node *codec_port;
+ struct device_node *codec_port_old;
unsigned int daifmt = 0;
int dai_idx, ret;
int rc, codec;
@@ -235,6 +237,7 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
}
dai_idx = 0;
+ codec_port_old = NULL;
for (codec = 0; codec < 2; codec++) {
/*
* To listup valid sounds continuously,
@@ -245,15 +248,22 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
cpu_port = it.node;
cpu_ep = of_get_next_child(cpu_port, NULL);
codec_ep = of_graph_get_remote_endpoint(cpu_ep);
+ codec_port = of_graph_get_port_parent(codec_ep);
of_node_put(cpu_port);
of_node_put(cpu_ep);
of_node_put(codec_ep);
+ of_node_put(codec_port);
if (codec) {
- if (!codec_ep)
+ if (!codec_port)
continue;
+ if (codec_port_old == codec_port)
+ continue;
+
+ codec_port_old = codec_port;
+
/* Back-End (= Codec) */
ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0);
if (ret < 0)
@@ -284,22 +294,34 @@ static int asoc_graph_get_dais_count(struct device *dev)
struct device_node *cpu_port;
struct device_node *cpu_ep;
struct device_node *codec_ep;
+ struct device_node *codec_port;
+ struct device_node *codec_port_old;
int count = 0;
int rc;
+ codec_port_old = NULL;
of_for_each_phandle(&it, rc, node, "dais", NULL, 0) {
cpu_port = it.node;
cpu_ep = of_get_next_child(cpu_port, NULL);
codec_ep = of_graph_get_remote_endpoint(cpu_ep);
+ codec_port = of_graph_get_port_parent(codec_ep);
of_node_put(cpu_port);
of_node_put(cpu_ep);
of_node_put(codec_ep);
+ of_node_put(codec_port);
if (cpu_ep)
count++;
- if (codec_ep)
- count++;
+
+ if (!codec_port)
+ continue;
+
+ if (codec_port_old == codec_port)
+ continue;
+
+ count++;
+ codec_port_old = codec_port;
}
return count;