Skip to contentSkip to conversation

drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id

PATCH In review John Stultz 2 participants 6 messages Jun 13, 2017 – Jun 30, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Mark Brown <[email protected]>
Cc Rob Herring <[email protected]>
Cc David Airlie <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Linux-ALSA <[email protected]>
---
 .../bindings/display/bridge/adi,adv7511.txt        |  8 ++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c     | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt +8 -0
index 00ea670..06668bc 100644
@@ -78,6 +78,7 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
   remote endpoint phandle should be a reference to a valid mipi_dsi_host device
   node.
 - Video port 1 for the HDMI output
+- Audio port 2 for the HDMI audio input
 
 
 Example
@@ -112,5 +113,12 @@ Example
 					remote-endpoint = <&hdmi_connector_in>;
 				};
 			};
+
+			port@2 {
+				reg = <2>;
+				codec_endpoint: endpoint {
+					remote-endpoint = <&i2s0_cpu_endpoint>;
+				};
+			};
 		};
 	};
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +22 -0
index cf92ebf..67469c2 100644
@@ -11,6 +11,7 @@
 #include <sound/hdmi-codec.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
+#include <linux/of_graph.h>
 
 #include "adv7511.h"
 
@@ -182,10 +183,31 @@ static void audio_shutdown(struct device *dev, void *data)
 {
 }
 
+static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
+					struct device_node *endpoint)
+{
+	struct of_endpoint of_ep;
+	int ret;
+
+	ret = of_graph_parse_endpoint(endpoint, &of_ep);
+	if (ret < 0)
+		return ret;
+
+	/*
+	 * HDMI sound should be located as reg = <2>
+	 * Then, it is sound port 0
+	 */
+	if (of_ep.port == 2)
+		return 0;
+
+	return -EINVAL;
+}
+
 static const struct hdmi_codec_ops adv7511_codec_ops = {
 	.hw_params	= adv7511_hdmi_hw_params,
 	.audio_shutdown = audio_shutdown,
 	.audio_startup	= audio_startup,
+	.get_dai_id	= adv7511_hdmi_i2s_get_dai_id,
 };
 
 static struct hdmi_codec_pdata codec_data = {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · John Stultz

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.

Quoted 7 lines

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.

Forgot to note this has dependencies on patches in the ASoC tree in -next, so it probably should go in via that tree.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to John Stultz
Quoted 3 lines · John Stultz

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

Unless someone objects in the next week or so I intend to apply this.

#3 lore raw
Quoted 6 lines · Mark Brown
Quoted 3 lines · John Stultz

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

Unless someone objects in the next week or so I intend to apply this.

Hey Mark,
Just wanted to check on this to make sure it didn't slip by. I've
not seen it show up in -next yet.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 3 lines · John Stultz

Hey Mark,
Just wanted to check on this to make sure it didn't slip by. I've
not seen it show up in -next yet.

Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed. Sending content free pings just adds to the mail volume (if they are seen at all) and if something has gone wrong you'll have to resend the patches anyway.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Applied "drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id" to the asoc tree

In reply to John Stultz

The patch

drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From 7204e97685634813d8456f1900b7f38fa7701e60 Mon Sep 17 00:00:00 2001
From: John Stultz <[email protected]>
Date: Tue, 13 Jun 2017 14:59:49 -0700
Subject: [PATCH] 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 <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Mark Brown <[email protected]>
Cc Rob Herring <[email protected]>
Cc David Airlie <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Linux-ALSA <[email protected]>
---
 .../bindings/display/bridge/adi,adv7511.txt        |  8 ++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c     | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt +8 -0
index 00ea670b8c4d..06668bca7ffc 100644
@@ -78,6 +78,7 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
   remote endpoint phandle should be a reference to a valid mipi_dsi_host device
   node.
 - Video port 1 for the HDMI output
+- Audio port 2 for the HDMI audio input
 
 
 Example
@@ -112,5 +113,12 @@ Example
 					remote-endpoint = <&hdmi_connector_in>;
 				};
 			};
+
+			port@2 {
+				reg = <2>;
+				codec_endpoint: endpoint {
+					remote-endpoint = <&i2s0_cpu_endpoint>;
+				};
+			};
 		};
 	};
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +22 -0
index cf92ebfe6ab7..67469c26bae8 100644
@@ -11,6 +11,7 @@
 #include <sound/hdmi-codec.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
+#include <linux/of_graph.h>
 
 #include "adv7511.h"
 
@@ -182,10 +183,31 @@ static void audio_shutdown(struct device *dev, void *data)
 {
 }
 
+static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
+					struct device_node *endpoint)
+{
+	struct of_endpoint of_ep;
+	int ret;
+
+	ret = of_graph_parse_endpoint(endpoint, &of_ep);
+	if (ret < 0)
+		return ret;
+
+	/*
+	 * HDMI sound should be located as reg = <2>
+	 * Then, it is sound port 0
+	 */
+	if (of_ep.port == 2)
+		return 0;
+
+	return -EINVAL;
+}
+
 static const struct hdmi_codec_ops adv7511_codec_ops = {
 	.hw_params	= adv7511_hdmi_hw_params,
 	.audio_shutdown = audio_shutdown,
 	.audio_startup	= audio_startup,
+	.get_dai_id	= adv7511_hdmi_i2s_get_dai_id,
 };
 
 static struct hdmi_codec_pdata codec_data = {
Signature · 6 lines
2.13.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel