All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>, Mark Brown <broonie@kernel.org>,
	Archit Taneja <architt@codeaurora.org>,
	Jose Abreu <joabreu@synopsys.com>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-renesas-soc@vger.kernel.org,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Simon <horms@verge.net.au>,
	alsa-devel@alsa-project.org
Subject: Applied "ASoC: add snd_soc_get_dai_id() function" to the asoc tree
Date: Wed, 24 May 2017 18:41:09 +0100	[thread overview]
Message-ID: <E1dDaHV-0002eM-Q6@debutante> (raw)
In-Reply-To: <87d1b7oslu.wl%kuninori.morimoto.gx@renesas.com>

The patch

   ASoC: add snd_soc_get_dai_id() function

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 a180e8b988437b3e84a1b501ac4d073467602ca6 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 18 May 2017 01:39:25 +0000
Subject: [PATCH] ASoC: add snd_soc_get_dai_id() function

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>
---
 include/sound/soc.h  |  3 +++
 sound/soc/soc-core.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5170fd81e1fd..9c94b97c17f8 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -803,6 +803,8 @@ struct snd_soc_component_driver {
 	int (*of_xlate_dai_name)(struct snd_soc_component *component,
 				 struct of_phandle_args *args,
 				 const char **dai_name);
+	int (*of_xlate_dai_id)(struct snd_soc_component *comment,
+			       struct device_node *endpoint);
 	void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
 		int subseq);
 	int (*stream_event)(struct snd_soc_component *, int event);
@@ -1676,6 +1678,7 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 				     const char *prefix,
 				     struct device_node **bitclkmaster,
 				     struct device_node **framemaster);
+int snd_soc_get_dai_id(struct device_node *ep);
 int snd_soc_get_dai_name(struct of_phandle_args *args,
 			 const char **dai_name);
 int snd_soc_of_get_dai_name(struct device_node *of_node,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index aae099c0e502..b0fb17082691 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -34,6 +34,7 @@
 #include <linux/ctype.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/of_graph.h>
 #include <linux/dmi.h>
 #include <sound/core.h>
 #include <sound/jack.h>
@@ -4044,6 +4045,42 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
 
+int snd_soc_get_dai_id(struct device_node *ep)
+{
+	struct snd_soc_component *pos;
+	struct device_node *node;
+	int ret;
+
+	node = of_graph_get_port_parent(ep);
+
+	/*
+	 * For example HDMI case, HDMI has video/sound port,
+	 * but ALSA SoC needs sound port number only.
+	 * Thus counting HDMI DT port/endpoint doesn't work.
+	 * Then, it should have .of_xlate_dai_id
+	 */
+	ret = -ENOTSUPP;
+	mutex_lock(&client_mutex);
+	list_for_each_entry(pos, &component_list, list) {
+		struct device_node *component_of_node = pos->dev->of_node;
+
+		if (!component_of_node && pos->dev->parent)
+			component_of_node = pos->dev->parent->of_node;
+
+		if (component_of_node != node)
+			continue;
+
+		if (pos->driver->of_xlate_dai_id)
+			ret = pos->driver->of_xlate_dai_id(pos, ep);
+
+		break;
+	}
+	mutex_unlock(&client_mutex);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_get_dai_id);
+
 int snd_soc_get_dai_name(struct of_phandle_args *args,
 				const char **dai_name)
 {
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>Mark Brown <broonie@kernel.org>,
	Archit Taneja <architt@codeaurora.org>,
	Jose Abreu <joabreu@synopsys.com>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-renesas-soc@vger.kernel.org,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Simon <horms@verge.net.au>alsa-devel@alsa-project.org
Subject: Applied "ASoC: add snd_soc_get_dai_id() function" to the asoc tree
Date: Wed, 24 May 2017 18:41:09 +0100	[thread overview]
Message-ID: <E1dDaHV-0002eM-Q6@debutante> (raw)
In-Reply-To: <87d1b7oslu.wl%kuninori.morimoto.gx@renesas.com>

The patch

   ASoC: add snd_soc_get_dai_id() function

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 a180e8b988437b3e84a1b501ac4d073467602ca6 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 18 May 2017 01:39:25 +0000
Subject: [PATCH] ASoC: add snd_soc_get_dai_id() function

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>
---
 include/sound/soc.h  |  3 +++
 sound/soc/soc-core.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5170fd81e1fd..9c94b97c17f8 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -803,6 +803,8 @@ struct snd_soc_component_driver {
 	int (*of_xlate_dai_name)(struct snd_soc_component *component,
 				 struct of_phandle_args *args,
 				 const char **dai_name);
+	int (*of_xlate_dai_id)(struct snd_soc_component *comment,
+			       struct device_node *endpoint);
 	void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
 		int subseq);
 	int (*stream_event)(struct snd_soc_component *, int event);
@@ -1676,6 +1678,7 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 				     const char *prefix,
 				     struct device_node **bitclkmaster,
 				     struct device_node **framemaster);
+int snd_soc_get_dai_id(struct device_node *ep);
 int snd_soc_get_dai_name(struct of_phandle_args *args,
 			 const char **dai_name);
 int snd_soc_of_get_dai_name(struct device_node *of_node,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index aae099c0e502..b0fb17082691 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -34,6 +34,7 @@
 #include <linux/ctype.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/of_graph.h>
 #include <linux/dmi.h>
 #include <sound/core.h>
 #include <sound/jack.h>
@@ -4044,6 +4045,42 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
 
+int snd_soc_get_dai_id(struct device_node *ep)
+{
+	struct snd_soc_component *pos;
+	struct device_node *node;
+	int ret;
+
+	node = of_graph_get_port_parent(ep);
+
+	/*
+	 * For example HDMI case, HDMI has video/sound port,
+	 * but ALSA SoC needs sound port number only.
+	 * Thus counting HDMI DT port/endpoint doesn't work.
+	 * Then, it should have .of_xlate_dai_id
+	 */
+	ret = -ENOTSUPP;
+	mutex_lock(&client_mutex);
+	list_for_each_entry(pos, &component_list, list) {
+		struct device_node *component_of_node = pos->dev->of_node;
+
+		if (!component_of_node && pos->dev->parent)
+			component_of_node = pos->dev->parent->of_node;
+
+		if (component_of_node != node)
+			continue;
+
+		if (pos->driver->of_xlate_dai_id)
+			ret = pos->driver->of_xlate_dai_id(pos, ep);
+
+		break;
+	}
+	mutex_unlock(&client_mutex);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_get_dai_id);
+
 int snd_soc_get_dai_name(struct of_phandle_args *args,
 				const char **dai_name)
 {
-- 
2.11.0

  reply	other threads:[~2017-05-24 17:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18  1:38 [PATCH 0/5] ASoC: add HDMI sound support for Codec Kuninori Morimoto
2017-05-18  1:38 ` Kuninori Morimoto
2017-05-18  1:39 ` [PATCH 1/5] ASoC: add snd_soc_get_dai_id() function Kuninori Morimoto
2017-05-18  1:39   ` Kuninori Morimoto
2017-05-24 17:41   ` Mark Brown [this message]
2017-05-24 17:41     ` Applied "ASoC: add snd_soc_get_dai_id() function" to the asoc tree Mark Brown
2017-05-18  1:39 ` [PATCH 2/5] ASoC: simple-card-utils: support snd_soc_get_dai_id() Kuninori Morimoto
2017-05-18  1:39   ` Kuninori Morimoto
2017-05-24 17:44   ` Applied "ASoC: simple-card-utils: support snd_soc_get_dai_id()" to the asoc tree Mark Brown
2017-05-24 17:44     ` Mark Brown
2017-05-18  1:40 ` [PATCH 3/5] ASoC: hdmi-codec: remove multi detection support Kuninori Morimoto
2017-05-18  1:40   ` Kuninori Morimoto
2017-05-24 17:45   ` Applied "ASoC: hdmi-codec: remove multi detection support" to the asoc tree Mark Brown
2017-05-24 17:45     ` Mark Brown
2017-05-18  1:40 ` [PATCH 4/5] ASoC: hdmi-codec: add .get_dai_id support Kuninori Morimoto
2017-05-18  1:40   ` Kuninori Morimoto
2017-05-24 17:45   ` Applied "ASoC: hdmi-codec: add .get_dai_id support" to the asoc tree Mark Brown
2017-05-24 17:45     ` Mark Brown
2017-05-18  1:40 ` [PATCH 5/5] drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC Kuninori Morimoto
2017-05-18  1:40   ` Kuninori Morimoto
2017-05-24 17:38   ` Mark Brown
2017-05-24 17:38     ` Mark Brown
2017-05-24 23:34     ` Kuninori Morimoto
2017-05-24 23:34       ` Kuninori Morimoto
2017-05-26  4:16       ` Archit Taneja
2017-05-26  4:16         ` Archit Taneja
2017-05-26  4:24         ` Archit Taneja
2017-05-26 17:26       ` Mark Brown
2017-05-26 17:26         ` Mark Brown
2017-06-28 19:48   ` Applied "drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC" to the asoc tree Mark Brown
2017-06-28 19:48     ` Mark Brown
2017-06-19  0:39 ` [PATCH][RESEND] drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC Kuninori Morimoto
2017-06-19  0:39   ` Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1dDaHV-0002eM-Q6@debutante \
    --to=broonie@kernel.org \
    --cc=airlied@linux.ie \
    --cc=alsa-devel@alsa-project.org \
    --cc=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=horms@verge.net.au \
    --cc=joabreu@synopsys.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.