History log of /linux-master/include/linux/of_graph.h
Revision Date Author Comments
# 57484905 04-Feb-2024 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

of: property: use unsigned int return on of_graph_get_endpoint_count()

Because of of_graph_get_endpoint_count() doesn't report error,
just return count of endpoint, the return type should be unsigned.
Tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/87plxbcvzb.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Rob Herring <robh@kernel.org>


# 4ec0a44b 01-Jul-2020 Dmitry Osipenko <digetx@gmail.com>

of_graph: add of_graph_is_present()

In some cases it's very useful to silently check whether port node exists
at all in a device-tree before proceeding with parsing the graph. The DRM
bridges code is one example of such case where absence of a graph in a
device-tree is a legit condition.

This patch adds of_graph_is_present() which returns true if given
device-tree node contains OF graph port.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200701074232.13632-2-digetx@gmail.com


# af6074fc 26-Dec-2017 Rob Herring <robh@kernel.org>

of: Use SPDX license tag for DT files

Convert remaining DT files to use SPDX-License-Identifier tags.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# ac1e6958 19-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

of_graph: add of_graph_get_endpoint_count()

OF graph want to count its endpoint number, same as
of_get_child_count(). This patch adds of_graph_get_endpoint_count()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0ef472a9 19-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

of_graph: add of_graph_get_port_parent()

Linux kernel already has of_graph_get_remote_port_parent(),
but, sometimes we want to get own port parent.
This patch adds of_graph_get_port_parent()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4c9c3d59 19-Apr-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

of_graph: add of_graph_get_remote_endpoint()

It should use same method to get same result.
To getting remote-endpoint node,
let's use of_graph_get_remote_endpoint()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b85ad494 02-Feb-2017 Rob Herring <robh@kernel.org>

of: introduce of_graph_get_remote_node

The OF graph API leaves too much of the graph walking to clients when
in many cases the driver doesn't care about accessing the port or
endpoint nodes. The drivers typically just want the device connected via
a particular graph connection. of_graph_get_remote_node provides this
functionality.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>


# 011d6f5c 01-May-2016 Arnd Bergmann <arnd@arndb.de>

of: include errno.h in of_graph.h

When CONFIG_OF is disabled, we have to include linux/errno.h before
including of_graph.h, or get build errors like in the newly added
sun4i drm driver:

In file included from ../drivers/gpu/drm/sun4i/sun4i_drv.c:14:0:
include/linux/of_graph.h: In function 'of_graph_parse_endpoint':
include/linux/of_graph.h:58:10: error: 'ENOSYS' undeclared (first use in this function)

A better solution is to ensure that the header can be included
by itself, so let's include linux/errno.h here to fix the error
we just got, and any similar future error.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Rob Herring <robh@kernel.org>


# ce0bdb84 23-Jun-2015 Inki Dae <inki.dae@samsung.com>

of: fix a build error to of_graph_get_endpoint_by_regs function

This patch fixes the below build error reported by Stephen,

Stephen reported:
After merging the drm-exynos tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/media/i2c/adv7604.o: In function `of_graph_get_endpoint_by_regs':
adv7604.c:(.text+0x586c): multiple definition of `of_graph_get_endpoint_by_regs'
drivers/media/i2c/adv7343.o:adv7343.c:(.text+0xa13): first defined here
drivers/media/platform/soc_camera/atmel-isi.o: In function `of_graph_get_endpoint_by_regs':
atmel-isi.c:(.text+0x1ec9): multiple definition of `of_graph_get_endpoint_by_regs'
drivers/media/platform/soc_camera/soc_camera.o:soc_camera.c:(.text+0x2ce3): first defined here
drivers/media/platform/soc_camera/rcar_vin.o: In function `of_graph_get_endpoint_by_regs':
rcar_vin.c:(.text+0x307c): multiple definition of `of_graph_get_endpoint_by_regs'
drivers/media/platform/soc_camera/soc_camera.o:soc_camera.c:(.text+0x2ce3): first defined here

Caused by commit:
a0f7001c18ca ("of: add helper for getting endpoint node of specific identifiers")

To fix the error, this patch declares of_graph_get_endpoint_by_regs function
with "static inline".

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 8ccd0d0c 12-Jun-2015 Hyungwon Hwang <human.hwang@samsung.com>

of: add helper for getting endpoint node of specific identifiers

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@samsung.com>
Acked-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>


# 01218bf1 26-Mar-2015 Mark Brown <broonie@kernel.org>

of: Explicitly include linux/types.h in of_graph.h

In current -next of_graph.h fails to build due to it relying on
linux/types.h without explicitly including it:

../include/linux/of_graph.h:43:71: error: unknown type name 'u32'

caused by bfe446e37c4e (of: Add of_graph_get_port_by_id function). Add
an explicit inclusion to fix this.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Rob Herring <robh@kernel.org>


# bfe446e3 11-Mar-2014 Philipp Zabel <p.zabel@pengutronix.de>

of: Add of_graph_get_port_by_id function

This patch adds a function to get a port device tree node by port id,
or reg property value.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


# ee890596 14-Apr-2014 Philipp Zabel <p.zabel@pengutronix.de>

of: Add for_each_endpoint_of_node helper macro

Note that while of_graph_get_next_endpoint decrements the reference count
of the child node passed to it, of_node_put(child) still has to be called
manually when breaking out of the loop.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


# 00fd9619 07-Mar-2014 Philipp Zabel <p.zabel@pengutronix.de>

of: Fix of_graph_parse_endpoint stub for !CONFIG_OF builds

This patch fixes the following build error:

In file included from drivers/media/i2c/adv7343.c:29:0:
>> include/linux/of_graph.h:41:1: error: expected identifier or '(' before '{' token
{
^
include/linux/of_graph.h:39:19: warning: 'of_graph_parse_endpoint' declared 'static' but never defined [-Wunused-function]
static inline int of_graph_parse_endpoint(const struct device_node *node,
^

vim +41 include/linux/of_graph.h

35 const struct device_node *node);
36 struct device_node *of_graph_get_remote_port(const struct device_node *node);
37 #else
38
39 static inline int of_graph_parse_endpoint(const struct device_node *node,
40 struct of_endpoint *endpoint);
> 41 {
42 return -ENOSYS;
43 }
44

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>


# f2a575f6 14-Feb-2014 Philipp Zabel <p.zabel@pengutronix.de>

[media] of: move common endpoint parsing to drivers/of

This patch adds a new struct of_endpoint which is then embedded in struct
v4l2_of_endpoint and contains the endpoint properties that are not V4L2
(or even media) specific: the port number, endpoint id, local device tree
node and remote endpoint phandle. of_graph_parse_endpoint parses those
properties and is used by v4l2_of_parse_endpoint, which just adds the
V4L2 MBUS information to the containing v4l2_of_endpoint structure.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>


# fd9fdb78 10-Feb-2014 Philipp Zabel <p.zabel@pengutronix.de>

[media] of: move graph helpers from drivers/media/v4l2-core to drivers/of

This patch moves the parsing helpers used to parse connected graphs
in the device tree, like the video interface bindings documented in
Documentation/devicetree/bindings/media/video-interfaces.txt, from
drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.

This allows to reuse the same parser code from outside the V4L2
framework, most importantly from display drivers.
The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
and v4l2_of_get_remote_port_parent are moved. They are renamed to
of_graph_get_next_endpoint, of_graph_get_remote_port, and
of_graph_get_remote_port_parent, respectively.
Since there are not that many current users yet, switch all of
them to the new functions right away.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>