[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fumcwcg1.wl%kuninori.morimoto.gx@renesas.com>
Date: Mon, 28 Nov 2016 02:45:28 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Rob Herring <robh+dt@...nel.org>, Mark Brown <broonie@...nel.org>
CC: Linux-ALSA <alsa-devel@...a-project.org>,
Liam Girdwood <lgirdwood@...il.com>,
Simon <horms@...ge.net.au>,
Laurent <laurent.pinchart@...asonboard.com>,
Guennadi <g.liakhovetski@....de>,
Grant Likely <grant.likely@...aro.org>,
Frank Rowand <frowand.list@...il.com>,
Linux-DT <devicetree@...r.kernel.org>,
Linux-Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH v5 03/14] of_graph: add of_graph_port_type_is()
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
OF graph indicates each devices connection. But it doesn't support type
of each port. For example HDMI case, it has video port and sound port
in one device node.
In this case, current driver can't handle each port correctly.
This patch adds of_graph_port_type_is() for it,
and adds of_graph_port_type_is_sound macro
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
---
drivers/of/base.c | 14 ++++++++++++++
include/linux/of_graph.h | 8 ++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index fed109d..d6237ba 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2480,3 +2480,17 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node)
return of_get_next_parent(np);
}
EXPORT_SYMBOL(of_graph_get_remote_port);
+
+bool of_graph_port_type_is(struct device_node *port, char *type)
+{
+ const char *prop = NULL;
+
+ of_property_read_string(port, "type", &prop);
+
+ if (prop &&
+ strcmp(prop, type) == 0)
+ return true;
+
+ return false;
+}
+EXPORT_SYMBOL(of_graph_port_type_is);
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index d9d6d9c..0a06441 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -40,9 +40,12 @@ struct of_endpoint {
for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
child = of_graph_get_next_endpoint(parent, child))
+#define of_graph_port_type_is_sound(n) of_graph_port_type_is(n, "sound")
+
#ifdef CONFIG_OF
int of_graph_parse_endpoint(const struct device_node *node,
struct of_endpoint *endpoint);
+bool of_graph_port_type_is(struct device_node *port, char *type);
struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
struct device_node *previous);
@@ -61,6 +64,11 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,
return -ENOSYS;
}
+static bool of_graph_port_type_is(struct device_node *port, char *type)
+{
+ return false;
+}
+
static inline struct device_node *of_graph_get_port_by_id(
struct device_node *node, u32 id)
{
--
1.9.1
Powered by blists - more mailing lists