From: Hyungwon Hwang <human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
daniel-rLtY4a/8tF1rovVCs/uTlw@public.gmane.org
Cc: sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
dh09.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
Hyungwon Hwang
<human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH v5 02/12] of: add helper for getting endpoint node of specific identifiers
Date: Fri, 10 Apr 2015 14:55:20 +0900 [thread overview]
Message-ID: <1428645330-1043-3-git-send-email-human.hwang@samsung.com> (raw)
In-Reply-To: <1428645330-1043-1-git-send-email-human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
When there are multiple ports or multiple endpoints in a port, they have to be
distinguished by the value of reg property. It is common. The drivers can get
the specific endpoint in the specific port via this function. Now the drivers
have to implement this code in themselves or have to force the order of dt nodes
to get the right node.
Signed-off-by: Hyungwon Hwang <human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Acked-by: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
Changes for v5:
- None
drivers/of/base.c | 33 +++++++++++++++++++++++++++++++++
include/linux/of_graph.h | 8 ++++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8f165b1..37bc8e0 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2158,6 +2158,39 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
EXPORT_SYMBOL(of_graph_get_next_endpoint);
/**
+ * of_graph_get_endpoint_by_regs() - get endpoint node of specific identifiers
+ * @parent: pointer to the parent device node
+ * @port_reg: identifier (value of reg property) of the parent port node
+ * @reg: identifier (value of reg property) of the endpoint node
+ *
+ * Return: An 'endpoint' node pointer which is identified by reg and at the same
+ * is the child of a port node identified by port_reg. reg and port_reg are
+ * ignored when they are -1.
+ */
+struct device_node *of_graph_get_endpoint_by_regs(
+ const struct device_node *parent, int port_reg, int reg)
+{
+ struct of_endpoint endpoint;
+ struct device_node *node, *prev_node = NULL;
+
+ while (1) {
+ node = of_graph_get_next_endpoint(parent, prev_node);
+ of_node_put(prev_node);
+ if (!node)
+ break;
+
+ of_graph_parse_endpoint(node, &endpoint);
+ if (((port_reg == -1) || (endpoint.port == port_reg)) &&
+ ((reg == -1) || (endpoint.id == reg)))
+ return node;
+
+ prev_node = node;
+ }
+
+ return NULL;
+}
+
+/**
* of_graph_get_remote_port_parent() - get remote port's parent node
* @node: pointer to a local endpoint device_node
*
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index befef42..e859eb7 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -31,6 +31,8 @@ int of_graph_parse_endpoint(const struct device_node *node,
struct of_endpoint *endpoint);
struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
struct device_node *previous);
+struct device_node *of_graph_get_endpoint_by_regs(
+ const struct device_node *parent, int port_reg, int reg);
struct device_node *of_graph_get_remote_port_parent(
const struct device_node *node);
struct device_node *of_graph_get_remote_port(const struct device_node *node);
@@ -49,6 +51,12 @@ static inline struct device_node *of_graph_get_next_endpoint(
return NULL;
}
+struct device_node *of_graph_get_endpoint_by_regs(
+ const struct device_node *parent, int port_reg, int reg)
+{
+ return NULL;
+}
+
static inline struct device_node *of_graph_get_remote_port_parent(
const struct device_node *node)
{
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-04-10 5:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 5:55 [PATCH v5 00/12] Add drivers for Exynos5433 display Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 03/12] drm/exynos: mic: add MIC driver Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 04/12] drm/exynos: dsi: rename pll_clk to sclk_clk Hyungwon Hwang
2015-04-15 1:24 ` Inki Dae
2015-04-10 5:55 ` [PATCH v5 05/12] drm/exynos: dsi: add macros for register access Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 06/12] drm/exynos: dsi: make use of driver data for static values Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 07/12] drm/exynos: dsi: make use of array for clock access Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 08/12] drm/exynos: dsi: add support for Exynos5433 Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 09/12] drm/exynos: dsi: add the backward compatibility for the renamed clock Hyungwon Hwang
[not found] ` <1428645330-1043-1-git-send-email-human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-04-10 5:55 ` [PATCH v5 01/12] drm/exynos: add Exynos5433 decon driver Hyungwon Hwang
[not found] ` <1428645330-1043-2-git-send-email-human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-04-10 6:05 ` Varka Bhadram
2015-04-10 6:38 ` Hyungwon Hwang
2015-04-10 5:55 ` Hyungwon Hwang [this message]
2015-04-10 5:55 ` [PATCH v5 10/12] drm/exynos: dsi: add support for MIC driver as a bridge Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 11/12] drm/exynos: dsi: do not set TE GPIO direction by input Hyungwon Hwang
2015-04-10 5:55 ` [PATCH v5 12/12] ARM: dts: rename the clock of MIPI DSI 'pll_clk' to 'sclk_mipi' Hyungwon Hwang
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=1428645330-1043-3-git-send-email-human.hwang@samsung.com \
--to=human.hwang-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
--cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=daniel-rLtY4a/8tF1rovVCs/uTlw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dh09.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox