UPSTREAM: drm/exynos: dp: add of_graph dt binding support for panel
authorInki Dae <inki.dae@samsung.com>
Thu, 26 Nov 2015 12:34:18 +0000 (21:34 +0900)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 21 Mar 2016 09:31:07 +0000 (17:31 +0800)
This patch adds of_graph dt binding support for panel device
and also keeps the backward compatibility.

i.e.,
The dts file for Exynos5800 based peach pi board
has a panel property so we need to keep the backward compatibility.

Changelog v3:
- bind only one of two nodes outbound - panel or bridge.

Changelog v2:
- return -EINVAL if getting a port node failed.

(cherry picked from commit a9fa852886fd5a7ccec3b7e9eff75f85072f009c)

Change-Id: Ie300bdc95027269f4a6b0d7fef8d6f0ca4017f06
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
drivers/gpu/drm/exynos/exynos_dp_core.c

index 2223ba985a0f1b058110b0af9fb5c1b96680fb5e..793e4977fcf758ebc03c099c898ebf33c2a564fc 100644 (file)
@@ -1392,7 +1392,7 @@ static const struct component_ops exynos_dp_ops = {
 static int exynos_dp_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct device_node *panel_node, *bridge_node, *endpoint;
+       struct device_node *panel_node = NULL, *bridge_node, *endpoint = NULL;
        struct exynos_dp_device *dp;
        int ret;
 
@@ -1403,14 +1403,32 @@ static int exynos_dp_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, dp);
 
+       /* This is for the backward compatibility. */
        panel_node = of_parse_phandle(dev->of_node, "panel", 0);
        if (panel_node) {
                dp->panel = of_drm_find_panel(panel_node);
                of_node_put(panel_node);
                if (!dp->panel)
                        return -EPROBE_DEFER;
+       } else {
+               endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
+               if (endpoint) {
+                       panel_node = of_graph_get_remote_port_parent(endpoint);
+                       if (panel_node) {
+                               dp->panel = of_drm_find_panel(panel_node);
+                               of_node_put(panel_node);
+                               if (!dp->panel)
+                                       return -EPROBE_DEFER;
+                       } else {
+                               DRM_ERROR("no port node for panel device.\n");
+                               return -EINVAL;
+                       }
+               }
        }
 
+       if (endpoint)
+               goto out;
+
        endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
        if (endpoint) {
                bridge_node = of_graph_get_remote_port_parent(endpoint);
@@ -1423,6 +1441,7 @@ static int exynos_dp_probe(struct platform_device *pdev)
                        return -EPROBE_DEFER;
        }
 
+out:
        pm_runtime_enable(dev);
 
        ret = component_add(&pdev->dev, &exynos_dp_ops);