aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2017-06-13 17:59:49 -0400
committerMark Brown <broonie@kernel.org>2017-06-28 16:00:08 -0400
commit7204e97685634813d8456f1900b7f38fa7701e60 (patch)
treef442222210631b50bec4b4c47a117319dbaf9878
parente3839bd6f56a291f00a4c3737eb15ca0344a82a9 (diff)
drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id
ALSA SoC needs to know connected DAI ID for probing. Using the new audio-card-graph approach, ports/endpoints are used to describe how the links are connected. Unfortunately, since ports/endpoints are used as well for video linkages, there are some issues mixing the port ids to the two (video and audio) namespaces. To solve this issue, this patch adds new .get_dai_id callback on hdmi_codec_ops. The will assume that HDMI audio out will be connected to reg = <2>. This will then be remapped to the ALSA SoC side will as DAI 0. Allowing the adv7511's hdmi audio support to be used with the audio-card-graph. Credit to Kuninori Morimoto who's patch to dw-hdmi-i2s-audio.c was what this was mostly copy-pasted from. Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: Mark Brown <broonie@kernel.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: David Airlie <airlied@linux.ie> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Linux-ALSA <alsa-devel@alsa-project.org> Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt8
-rw-r--r--drivers/gpu/drm/bridge/adv7511/adv7511_audio.c22
2 files changed, 30 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
index 00ea670b8c4d..06668bca7ffc 100644
--- a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
+++ b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
@@ -78,6 +78,7 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
78 remote endpoint phandle should be a reference to a valid mipi_dsi_host device 78 remote endpoint phandle should be a reference to a valid mipi_dsi_host device
79 node. 79 node.
80- Video port 1 for the HDMI output 80- Video port 1 for the HDMI output
81- Audio port 2 for the HDMI audio input
81 82
82 83
83Example 84Example
@@ -112,5 +113,12 @@ Example
112 remote-endpoint = <&hdmi_connector_in>; 113 remote-endpoint = <&hdmi_connector_in>;
113 }; 114 };
114 }; 115 };
116
117 port@2 {
118 reg = <2>;
119 codec_endpoint: endpoint {
120 remote-endpoint = <&i2s0_cpu_endpoint>;
121 };
122 };
115 }; 123 };
116 }; 124 };
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index cf92ebfe6ab7..67469c26bae8 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -11,6 +11,7 @@
11#include <sound/hdmi-codec.h> 11#include <sound/hdmi-codec.h>
12#include <sound/pcm.h> 12#include <sound/pcm.h>
13#include <sound/soc.h> 13#include <sound/soc.h>
14#include <linux/of_graph.h>
14 15
15#include "adv7511.h" 16#include "adv7511.h"
16 17
@@ -182,10 +183,31 @@ static void audio_shutdown(struct device *dev, void *data)
182{ 183{
183} 184}
184 185
186static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
187 struct device_node *endpoint)
188{
189 struct of_endpoint of_ep;
190 int ret;
191
192 ret = of_graph_parse_endpoint(endpoint, &of_ep);
193 if (ret < 0)
194 return ret;
195
196 /*
197 * HDMI sound should be located as reg = <2>
198 * Then, it is sound port 0
199 */
200 if (of_ep.port == 2)
201 return 0;
202
203 return -EINVAL;
204}
205
185static const struct hdmi_codec_ops adv7511_codec_ops = { 206static const struct hdmi_codec_ops adv7511_codec_ops = {
186 .hw_params = adv7511_hdmi_hw_params, 207 .hw_params = adv7511_hdmi_hw_params,
187 .audio_shutdown = audio_shutdown, 208 .audio_shutdown = audio_shutdown,
188 .audio_startup = audio_startup, 209 .audio_startup = audio_startup,
210 .get_dai_id = adv7511_hdmi_i2s_get_dai_id,
189}; 211};
190 212
191static struct hdmi_codec_pdata codec_data = { 213static struct hdmi_codec_pdata codec_data = {