isp {
compatible = "isp";
core@0 {
id = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
isp_chan0_in: endpoint@0 {
remote-endpoint = <&csi0_out0>;
};
};
port@1 {
reg = <1>;
isp_chan1_in: endpoint@1 {
remote-endpoint = <&csi0_out1>;
};
};
};
};
core@1 {
id = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@2 {
reg = <0>;
isp_chan2_in: endpoint@2 {
remote-endpoint = <&csi1_out0>;
};
};
port@3 {
reg = <1>;
isp_chan3_in: endpoint@3 {
remote-endpoint = <&csi1_out1>;
};
};
};
};
}
csi@0 {
compatible = "csi2";
#address-cells = <1>;
#size-cells = <0>;
point-link {
ports {
port@0 {
csi0_in: endpoint@0{
remote-endpoint = <&deser0_out>;
};
};
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
csi0_out0: endpoint@0 {
remote-endpoint = <&isp_chan0_in>;
};
};
port@1 {
reg = <1>;
csi0_out1: endpoint@1 {
remote-endpoint = <&isp_chan1_in>;
};
};
};
};
csi@1 {
compatible = "csi2";
#address-cells = <1>;
#size-cells = <0>;
point-link {
ports {
port@0 {
csi_1_in: endpoint@0{
remote-endpoint = <&deser_1_out>;
};
};
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
csi1_out0: endpoint@0 {
remote-endpoint = <&isp_chan2_in>;
};
};
port@1 {
reg = <1>;
csi1_out1: endpoint@1 {
remote-endpoint = <&isp_chan3_in>;
};
};
};
};
deser0 {
compatible = "deser0";
#address-cells = <1>;
#size-cells = <0>;
point-link {
ports {
port@0 {
deser0_out: endpoint{
remote-endpoint = <&csi0_in>;
};
};
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
deser0_in0: endpoint@0{
remote-endpoint = <&camera0_out>;
};
};
port@1 {
reg = <1>;
deser0_in1: endpoint@1{
remote-endpoint = <&camera1_out>;
};
};
};
};
&i2c0 {
camera0 {
reg = <0x10>;
port {
camera0_out: endpoint@0 {
remote-endpoint = <&deser0_in0>;
};
};
};
/**
* of_graph_get_next_endpoint() - get next endpoint node
* @parent: pointer to the parent device node
* @prev: previous endpoint node, or NULL to get first
*
* Return: An 'endpoint' node pointer with refcount incremented. Refcount
* of the passed @prev node is decremented.
*/
struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
struct device_node *prev)
{
struct device_node *endpoint;
struct device_node *port;
if (!parent)
return NULL;
/*
* Start by locating the port node. If no previous endpoint is specified
* search for the first port node, otherwise get the previous endpoint
* parent port node.
*/
if (!prev) {
struct device_node *node;
node = of_get_child_by_name(parent, "ports");
if (node)
parent = node;
port = of_get_child_by_name(parent, "port");
of_node_put(node);
if (!port) {
pr_err("graph: no port node found in %pOF\n", parent);
return NULL;
}
} else {
port = of_get_parent(prev);
if (WARN_ONCE(!port, "%s(): endpoint %pOF has no parent node\n",
__func__, prev))
return NULL;
}
while (1) {
/*
* Now that we have a port node, get the next endpoint by
* getting the next child. If the previous endpoint is NULL this
* will return the first child.
*/
endpoint = of_get_next_child(port, prev);
if (endpoint) {
of_node_put(port);
return endpoint;
}
/* No more endpoints under this port, try the next one. */
prev = NULL;
do {
port = of_get_next_child(parent, port);
if (!port)
return NULL;
} while (of_node_cmp(port->name, "port"));
}
}
struct device_node *of_graph_get_remote_port(const struct device_node *node)
{
struct device_node *np;
/* Get remote endpoint node. */
np = of_graph_get_remote_endpoint(node);
if (!np)
return NULL;
return of_get_next_parent(np);
}
struct device_node *of_graph_get_remote_endpoint(const struct device_node *node)
{
/* Get remote endpoint node. */
return of_parse_phandle(node, "remote-endpoint", 0);
}