]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/gpu/drm/omapdrm/dss/output.c
drm/omap: Add support for drm_bridge
[linux.git] / drivers / gpu / drm / omapdrm / dss / output.c
index f25ecfd26534d0a1ad57c92853ac3441a6006a0b..2a53025c2fde3b395235e291770b6ca01b3c9c5f 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/of_graph.h>
 
 #include "dss.h"
 #include "omapdss.h"
 
 int omapdss_device_init_output(struct omap_dss_device *out)
 {
-       out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
-       if (IS_ERR(out->next)) {
-               if (PTR_ERR(out->next) != -EPROBE_DEFER)
-                       dev_err(out->dev, "failed to find video sink\n");
-               return PTR_ERR(out->next);
+       struct device_node *remote_node;
+
+       remote_node = of_graph_get_remote_node(out->dev->of_node, 0, 0);
+       if (!remote_node) {
+               dev_dbg(out->dev, "failed to find video sink\n");
+               return 0;
        }
 
+       out->next = omapdss_find_device_by_node(remote_node);
+       out->bridge = of_drm_find_bridge(remote_node);
+
+       of_node_put(remote_node);
+
        if (out->next && out->type != out->next->type) {
                dev_err(out->dev, "output type and display type don't match\n");
+               omapdss_device_put(out->next);
+               out->next = NULL;
                return -EINVAL;
        }
 
-       return 0;
+       return out->next || out->bridge ? 0 : -EPROBE_DEFER;
 }
 EXPORT_SYMBOL(omapdss_device_init_output);