linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id
@ 2017-06-13 21:59 John Stultz
  2017-06-13 22:01 ` John Stultz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: John Stultz @ 2017-06-13 21:59 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Kuninori Morimoto, Archit Taneja, Mark Brown,
	Rob Herring, David Airlie, Lars-Peter Clausen, Linux-ALSA,
	dri-devel

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>
---
 .../bindings/display/bridge/adi,adv7511.txt        |  8 ++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c     | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
index 00ea670..06668bc 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.
   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>;
+				};
+			};
 		};
 	};
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index cf92ebf..67469c2 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -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 = {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id
  2017-06-13 21:59 [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id John Stultz
@ 2017-06-13 22:01 ` John Stultz
  2017-06-14  0:05 ` Mark Brown
  2017-06-30 11:59 ` Applied "drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id" to the asoc tree Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: John Stultz @ 2017-06-13 22:01 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Kuninori Morimoto, Archit Taneja, Mark Brown,
	Rob Herring, David Airlie, Lars-Peter Clausen, Linux-ALSA,
	dri-devel

On Tue, Jun 13, 2017 at 2:59 PM, John Stultz <john.stultz@linaro.org> wrote:
> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id
  2017-06-13 21:59 [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id John Stultz
  2017-06-13 22:01 ` John Stultz
@ 2017-06-14  0:05 ` Mark Brown
  2017-06-26 16:31   ` John Stultz
  2017-06-30 11:59 ` Applied "drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id" to the asoc tree Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2017-06-14  0:05 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Kuninori Morimoto, Archit Taneja, Rob Herring,
	David Airlie, Lars-Peter Clausen, Linux-ALSA, dri-devel

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

On Tue, Jun 13, 2017 at 02:59:49PM -0700, John Stultz wrote:
> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id
  2017-06-14  0:05 ` Mark Brown
@ 2017-06-26 16:31   ` John Stultz
  2017-06-28 18:50     ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: John Stultz @ 2017-06-26 16:31 UTC (permalink / raw)
  To: Mark Brown
  Cc: lkml, Kuninori Morimoto, Archit Taneja, Rob Herring,
	David Airlie, Lars-Peter Clausen, Linux-ALSA, dri-devel

On Tue, Jun 13, 2017 at 5:05 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Jun 13, 2017 at 02:59:49PM -0700, John Stultz wrote:
>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id
  2017-06-26 16:31   ` John Stultz
@ 2017-06-28 18:50     ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2017-06-28 18:50 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Kuninori Morimoto, Archit Taneja, Rob Herring,
	David Airlie, Lars-Peter Clausen, Linux-ALSA, dri-devel

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

On Mon, Jun 26, 2017 at 09:31:34AM -0700, John Stultz wrote:

> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Applied "drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id" to the asoc tree
  2017-06-13 21:59 [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id John Stultz
  2017-06-13 22:01 ` John Stultz
  2017-06-14  0:05 ` Mark Brown
@ 2017-06-30 11:59 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2017-06-30 11:59 UTC (permalink / raw)
  To: John Stultz
  Cc: Kuninori Morimoto, Archit Taneja, Mark Brown, Rob Herring,
	David Airlie, Lars-Peter Clausen, Linux-ALSA, dri-devel,
	Mark Brown, lkml, Archit Taneja, Lars-Peter Clausen,
	Kuninori Morimoto, David Airlie, Mark Brown, Linux-ALSA,
	dri-devel, Rob Herring, alsa-devel

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 <john.stultz@linaro.org>
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 <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>
---
 .../bindings/display/bridge/adi,adv7511.txt        |  8 ++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c     | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)

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.
   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>;
+				};
+			};
 		};
 	};
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 @@
 #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 = {
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-30 12:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13 21:59 [PATCH] drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id John Stultz
2017-06-13 22:01 ` John Stultz
2017-06-14  0:05 ` Mark Brown
2017-06-26 16:31   ` John Stultz
2017-06-28 18:50     ` Mark Brown
2017-06-30 11:59 ` Applied "drm: adv7511_audio: Add .get_dai_id callback to map port number to dai id" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).