Linux-libre 5.4.49-gnu
[librecmc/linux-libre.git] / drivers / gpu / drm / omapdrm / dss / dss-of.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
4  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
5  */
6
7 #include <linux/err.h>
8 #include <linux/of.h>
9 #include <linux/of_graph.h>
10
11 #include "omapdss.h"
12
13 struct omap_dss_device *
14 omapdss_of_find_connected_device(struct device_node *node, unsigned int port)
15 {
16         struct device_node *remote_node;
17         struct omap_dss_device *dssdev;
18
19         remote_node = of_graph_get_remote_node(node, port, 0);
20         if (!remote_node)
21                 return NULL;
22
23         dssdev = omapdss_find_device_by_node(remote_node);
24         of_node_put(remote_node);
25
26         return dssdev ? dssdev : ERR_PTR(-EPROBE_DEFER);
27 }
28 EXPORT_SYMBOL_GPL(omapdss_of_find_connected_device);