drm/rockchip: analogix_dp: make panel detect to an optional action
authorYakir Yang <ykk@rock-chips.com>
Tue, 5 Apr 2016 07:38:45 +0000 (15:38 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 14 Apr 2016 06:38:38 +0000 (14:38 +0800)
Some boards don't need to declare a panel device node, like the
display interface is DP monitors, so it's necessary to make the
panel detect to an optional action.

Change-Id: I0146e9f9fb2e35b5878ab114e8aa1df35ba4843d
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c

index c04c986e620d10bedcd6f08b3a902b34e2b36526..8245e8dd6385bf76d02fb4239b571997f5231bd5 100644 (file)
@@ -289,38 +289,34 @@ static int rockchip_dp_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct device_node *panel_node, *port, *endpoint;
+       struct drm_panel *panel = NULL;
        struct rockchip_dp_device *dp;
-       struct drm_panel *panel;
 
        port = of_graph_get_port_by_id(dev->of_node, 1);
-       if (!port) {
-               dev_err(dev, "can't find output port\n");
-               return -EINVAL;
-       }
-
-       endpoint = of_get_child_by_name(port, "endpoint");
-       of_node_put(port);
-       if (!endpoint) {
-               dev_err(dev, "no output endpoint found\n");
-               return -EINVAL;
-       }
-
-       panel_node = of_graph_get_remote_port_parent(endpoint);
-       of_node_put(endpoint);
-       if (!panel_node) {
-               dev_err(dev, "no output node found\n");
-               return -EINVAL;
-       }
-
-       panel = of_drm_find_panel(panel_node);
-       if (!panel) {
-               DRM_ERROR("failed to find panel\n");
+       if (port) {
+               endpoint = of_get_child_by_name(port, "endpoint");
+               of_node_put(port);
+               if (!endpoint) {
+                       dev_err(dev, "no output endpoint found\n");
+                       return -EINVAL;
+               }
+
+               panel_node = of_graph_get_remote_port_parent(endpoint);
+               of_node_put(endpoint);
+               if (!panel_node) {
+                       dev_err(dev, "no output node found\n");
+                       return -EINVAL;
+               }
+
+               panel = of_drm_find_panel(panel_node);
+               if (!panel) {
+                       DRM_ERROR("failed to find panel\n");
+                       of_node_put(panel_node);
+                       return -EPROBE_DEFER;
+               }
                of_node_put(panel_node);
-               return -EPROBE_DEFER;
        }
 
-       of_node_put(panel_node);
-
        dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
        if (!dp)
                return -ENOMEM;