1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2013 Texas Instruments
4 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 #include <linux/device.h>
9 #include <linux/module.h>
11 #include <linux/of_graph.h>
12 #include <linux/seq_file.h>
14 #include <video/omapfb_dss.h>
18 struct device_node
*dss_of_port_get_parent_device(struct device_node
*port
)
20 struct device_node
*np
;
26 np
= of_get_parent(port
);
28 for (i
= 0; i
< 2 && np
; ++i
) {
29 struct property
*prop
;
31 prop
= of_find_property(np
, "compatible", NULL
);
36 np
= of_get_next_parent(np
);
42 u32
dss_of_port_get_port_number(struct device_node
*port
)
47 r
= of_property_read_u32(port
, "reg", ®
);
54 struct omap_dss_device
*
55 omapdss_of_find_source_for_first_ep(struct device_node
*node
)
57 struct device_node
*ep
;
58 struct device_node
*src_port
;
59 struct omap_dss_device
*src
;
61 ep
= of_graph_get_endpoint_by_regs(node
, 0, -1);
63 return ERR_PTR(-EINVAL
);
65 src_port
= of_graph_get_remote_port(ep
);
68 return ERR_PTR(-EINVAL
);
70 src
= omap_dss_find_output_by_port_node(src_port
);
72 of_node_put(src_port
);
74 return src
? src
: ERR_PTR(-EPROBE_DEFER
);
76 EXPORT_SYMBOL_GPL(omapdss_of_find_source_for_first_ep
);