diff options
author | Ajay Kumar <ajaykumar.rs@samsung.com> | 2015-01-20 11:38:46 -0500 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2015-01-28 02:47:29 -0500 |
commit | 801855671ad1dc751aa5aa66047cfe314170a566 (patch) | |
tree | 77f171577e2be2cd8df7e937322be14784863018 /drivers/gpu/drm/exynos | |
parent | 6a1688ae8794ac62667ac231d20ac697bf7967fc (diff) |
drm/exynos: dp: support drm_bridge
Modify driver to support drm_bridge.
Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Rahul Sharma <rahul.sharma@samsung.com>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Tested-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/exynos')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_dp_core.c | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_dp_core.h | 1 |
2 files changed, 32 insertions, 6 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 27e3d272ca2d..46f149737bc8 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | #include <linux/of_gpio.h> | 20 | #include <linux/of_gpio.h> |
21 | #include <linux/of_graph.h> | ||
21 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
22 | #include <linux/component.h> | 23 | #include <linux/component.h> |
23 | #include <linux/phy/phy.h> | 24 | #include <linux/phy/phy.h> |
@@ -994,9 +995,19 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { | |||
994 | }; | 995 | }; |
995 | 996 | ||
996 | /* returns the number of bridges attached */ | 997 | /* returns the number of bridges attached */ |
997 | static int exynos_drm_attach_lcd_bridge(struct drm_device *dev, | 998 | static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, |
998 | struct drm_encoder *encoder) | 999 | struct drm_encoder *encoder) |
999 | { | 1000 | { |
1001 | int ret; | ||
1002 | |||
1003 | encoder->bridge = dp->bridge; | ||
1004 | dp->bridge->encoder = encoder; | ||
1005 | ret = drm_bridge_attach(encoder->dev, dp->bridge); | ||
1006 | if (ret) { | ||
1007 | DRM_ERROR("Failed to attach bridge to drm\n"); | ||
1008 | return ret; | ||
1009 | } | ||
1010 | |||
1000 | return 0; | 1011 | return 0; |
1001 | } | 1012 | } |
1002 | 1013 | ||
@@ -1010,9 +1021,11 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, | |||
1010 | dp->encoder = encoder; | 1021 | dp->encoder = encoder; |
1011 | 1022 | ||
1012 | /* Pre-empt DP connector creation if there's a bridge */ | 1023 | /* Pre-empt DP connector creation if there's a bridge */ |
1013 | ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder); | 1024 | if (dp->bridge) { |
1014 | if (ret) | 1025 | ret = exynos_drm_attach_lcd_bridge(dp, encoder); |
1015 | return 0; | 1026 | if (!ret) |
1027 | return 0; | ||
1028 | } | ||
1016 | 1029 | ||
1017 | connector->polled = DRM_CONNECTOR_POLL_HPD; | 1030 | connector->polled = DRM_CONNECTOR_POLL_HPD; |
1018 | 1031 | ||
@@ -1219,7 +1232,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) | |||
1219 | } | 1232 | } |
1220 | } | 1233 | } |
1221 | 1234 | ||
1222 | if (!dp->panel) { | 1235 | if (!dp->panel && !dp->bridge) { |
1223 | ret = exynos_dp_dt_parse_panel(dp); | 1236 | ret = exynos_dp_dt_parse_panel(dp); |
1224 | if (ret) | 1237 | if (ret) |
1225 | return ret; | 1238 | return ret; |
@@ -1303,7 +1316,7 @@ static const struct component_ops exynos_dp_ops = { | |||
1303 | static int exynos_dp_probe(struct platform_device *pdev) | 1316 | static int exynos_dp_probe(struct platform_device *pdev) |
1304 | { | 1317 | { |
1305 | struct device *dev = &pdev->dev; | 1318 | struct device *dev = &pdev->dev; |
1306 | struct device_node *panel_node; | 1319 | struct device_node *panel_node, *bridge_node, *endpoint; |
1307 | struct exynos_dp_device *dp; | 1320 | struct exynos_dp_device *dp; |
1308 | int ret; | 1321 | int ret; |
1309 | 1322 | ||
@@ -1329,6 +1342,18 @@ static int exynos_dp_probe(struct platform_device *pdev) | |||
1329 | return -EPROBE_DEFER; | 1342 | return -EPROBE_DEFER; |
1330 | } | 1343 | } |
1331 | 1344 | ||
1345 | endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); | ||
1346 | if (endpoint) { | ||
1347 | bridge_node = of_graph_get_remote_port_parent(endpoint); | ||
1348 | if (bridge_node) { | ||
1349 | dp->bridge = of_drm_find_bridge(bridge_node); | ||
1350 | of_node_put(bridge_node); | ||
1351 | if (!dp->bridge) | ||
1352 | return -EPROBE_DEFER; | ||
1353 | } else | ||
1354 | return -EPROBE_DEFER; | ||
1355 | } | ||
1356 | |||
1332 | ret = component_add(&pdev->dev, &exynos_dp_ops); | 1357 | ret = component_add(&pdev->dev, &exynos_dp_ops); |
1333 | if (ret) | 1358 | if (ret) |
1334 | exynos_drm_component_del(&pdev->dev, | 1359 | exynos_drm_component_del(&pdev->dev, |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index 164f171168e7..a4e799679669 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h | |||
@@ -153,6 +153,7 @@ struct exynos_dp_device { | |||
153 | struct drm_connector connector; | 153 | struct drm_connector connector; |
154 | struct drm_encoder *encoder; | 154 | struct drm_encoder *encoder; |
155 | struct drm_panel *panel; | 155 | struct drm_panel *panel; |
156 | struct drm_bridge *bridge; | ||
156 | struct clk *clock; | 157 | struct clk *clock; |
157 | unsigned int irq; | 158 | unsigned int irq; |
158 | void __iomem *reg_base; | 159 | void __iomem *reg_base; |