diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2017-05-17 21:39:44 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-05-24 13:44:11 -0400 |
commit | 73b17f1a65c881fcf97109d77056006da2d40152 (patch) | |
tree | 78e67c16a6324716cc6982375f214e2bdee356af | |
parent | 7932787f03f33493455360df936d10d0d04fc7c5 (diff) |
ASoC: simple-card-utils: support snd_soc_get_dai_id()
ALSA SoC needs to know connected DAI ID for detecting.
It is not a big problem if device/driver was only for sound,
but getting DAI ID will be difficult if device includes both
Video/Sound, like HDMI.
To solve this issue, this patch adds new snd_soc_get_dai_id() and
its related .of_xlate_dai_id callback on component driver.
In below case, we can handle Sound port (= port@2) as ID = 0
if .of_xlate_dai_id has its support.
hdmi {
port@0 { /* VIDEO */ };
port@1 { /* VIDEO */ };
port@2 { /* SOUND */ };
};
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/generic/simple-card-utils.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 5a3d51e45938..fe726e83d0bd 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -177,9 +177,18 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep) | |||
177 | struct device_node *node; | 177 | struct device_node *node; |
178 | struct device_node *endpoint; | 178 | struct device_node *endpoint; |
179 | int i, id; | 179 | int i, id; |
180 | int ret; | ||
181 | |||
182 | ret = snd_soc_get_dai_id(ep); | ||
183 | if (ret != -ENOTSUPP) | ||
184 | return ret; | ||
180 | 185 | ||
181 | node = of_graph_get_port_parent(ep); | 186 | node = of_graph_get_port_parent(ep); |
182 | 187 | ||
188 | /* | ||
189 | * Non HDMI sound case, counting port/endpoint on its DT | ||
190 | * is enough. Let's count it. | ||
191 | */ | ||
183 | i = 0; | 192 | i = 0; |
184 | id = -1; | 193 | id = -1; |
185 | for_each_endpoint_of_node(node, endpoint) { | 194 | for_each_endpoint_of_node(node, endpoint) { |