2 * Copyright (C) 2013 Texas Instruments
3 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include <linux/device.h>
16 #include <linux/err.h>
17 #include <linux/module.h>
19 #include <linux/of_graph.h>
20 #include <linux/seq_file.h>
24 struct device_node *dss_of_port_get_parent_device(struct device_node *port)
26 struct device_node *np;
32 np = of_get_parent(port);
34 for (i = 0; i < 2 && np; ++i) {
35 struct property *prop;
37 prop = of_find_property(np, "compatible", NULL);
42 np = of_get_next_parent(np);
47 EXPORT_SYMBOL_GPL(dss_of_port_get_parent_device);
49 u32 dss_of_port_get_port_number(struct device_node *port)
54 r = of_property_read_u32(port, "reg", ®);
60 EXPORT_SYMBOL_GPL(dss_of_port_get_port_number);
62 struct omap_dss_device *
63 omapdss_of_find_source_for_first_ep(struct device_node *node)
65 struct device_node *ep;
66 struct device_node *src_port;
67 struct omap_dss_device *src;
69 ep = of_graph_get_endpoint_by_regs(node, 0, 0);
71 return ERR_PTR(-EINVAL);
73 src_port = of_graph_get_remote_port(ep);
76 return ERR_PTR(-EINVAL);
81 src = omap_dss_find_output_by_port_node(src_port);
83 of_node_put(src_port);
85 return src ? src : ERR_PTR(-EPROBE_DEFER);
87 EXPORT_SYMBOL_GPL(omapdss_of_find_source_for_first_ep);