diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2014-11-17 03:54:24 -0500 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2014-11-24 04:02:56 -0500 |
commit | 1df6e5fb79f614141f4358587b18695d7acda024 (patch) | |
tree | 18bd58517a00a1fd29782e5c2b55ffbbb94467db /drivers | |
parent | 2f26bd7227b80d002dfcd3f60e71bfad168e6517 (diff) |
drm/exynos/dp: embed display into private context
exynos_drm_display is used by internal Exynos DRM framework for
representing encoder:connector pair. As it should be mapped 1:1 to dp
private context it seems more reasonable to embed it directly in that context.
As a result further code simplification will be possible.
Moreover it will be possible to handle multiple dp devices in the system.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_dp_core.c | 42 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_dp_core.h | 3 |
2 files changed, 21 insertions, 24 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index ed818b9a615a..47c6e4798baf 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <drm/drm_panel.h> | 30 | #include <drm/drm_panel.h> |
31 | #include <drm/bridge/ptn3460.h> | 31 | #include <drm/bridge/ptn3460.h> |
32 | 32 | ||
33 | #include "exynos_drm_drv.h" | ||
34 | #include "exynos_dp_core.h" | 33 | #include "exynos_dp_core.h" |
35 | 34 | ||
36 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ | 35 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ |
@@ -1133,11 +1132,6 @@ static struct exynos_drm_display_ops exynos_dp_display_ops = { | |||
1133 | .commit = exynos_dp_commit, | 1132 | .commit = exynos_dp_commit, |
1134 | }; | 1133 | }; |
1135 | 1134 | ||
1136 | static struct exynos_drm_display exynos_dp_display = { | ||
1137 | .type = EXYNOS_DISPLAY_TYPE_LCD, | ||
1138 | .ops = &exynos_dp_display_ops, | ||
1139 | }; | ||
1140 | |||
1141 | static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev) | 1135 | static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev) |
1142 | { | 1136 | { |
1143 | struct device_node *dp_node = dev->of_node; | 1137 | struct device_node *dp_node = dev->of_node; |
@@ -1211,10 +1205,10 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp) | |||
1211 | 1205 | ||
1212 | static int exynos_dp_bind(struct device *dev, struct device *master, void *data) | 1206 | static int exynos_dp_bind(struct device *dev, struct device *master, void *data) |
1213 | { | 1207 | { |
1208 | struct exynos_dp_device *dp = dev_get_drvdata(dev); | ||
1214 | struct platform_device *pdev = to_platform_device(dev); | 1209 | struct platform_device *pdev = to_platform_device(dev); |
1215 | struct drm_device *drm_dev = data; | 1210 | struct drm_device *drm_dev = data; |
1216 | struct resource *res; | 1211 | struct resource *res; |
1217 | struct exynos_dp_device *dp = exynos_dp_display.ctx; | ||
1218 | unsigned int irq_flags; | 1212 | unsigned int irq_flags; |
1219 | int ret = 0; | 1213 | int ret = 0; |
1220 | 1214 | ||
@@ -1306,17 +1300,15 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) | |||
1306 | 1300 | ||
1307 | dp->drm_dev = drm_dev; | 1301 | dp->drm_dev = drm_dev; |
1308 | 1302 | ||
1309 | platform_set_drvdata(pdev, &exynos_dp_display); | 1303 | return exynos_drm_create_enc_conn(drm_dev, &dp->display); |
1310 | |||
1311 | return exynos_drm_create_enc_conn(drm_dev, &exynos_dp_display); | ||
1312 | } | 1304 | } |
1313 | 1305 | ||
1314 | static void exynos_dp_unbind(struct device *dev, struct device *master, | 1306 | static void exynos_dp_unbind(struct device *dev, struct device *master, |
1315 | void *data) | 1307 | void *data) |
1316 | { | 1308 | { |
1317 | struct exynos_drm_display *display = dev_get_drvdata(dev); | 1309 | struct exynos_dp_device *dp = dev_get_drvdata(dev); |
1318 | 1310 | ||
1319 | exynos_dp_dpms(display, DRM_MODE_DPMS_OFF); | 1311 | exynos_dp_dpms(&dp->display, DRM_MODE_DPMS_OFF); |
1320 | } | 1312 | } |
1321 | 1313 | ||
1322 | static const struct component_ops exynos_dp_ops = { | 1314 | static const struct component_ops exynos_dp_ops = { |
@@ -1331,16 +1323,20 @@ static int exynos_dp_probe(struct platform_device *pdev) | |||
1331 | struct exynos_dp_device *dp; | 1323 | struct exynos_dp_device *dp; |
1332 | int ret; | 1324 | int ret; |
1333 | 1325 | ||
1334 | ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, | ||
1335 | exynos_dp_display.type); | ||
1336 | if (ret) | ||
1337 | return ret; | ||
1338 | |||
1339 | dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), | 1326 | dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), |
1340 | GFP_KERNEL); | 1327 | GFP_KERNEL); |
1341 | if (!dp) | 1328 | if (!dp) |
1342 | return -ENOMEM; | 1329 | return -ENOMEM; |
1343 | 1330 | ||
1331 | dp->display.type = EXYNOS_DISPLAY_TYPE_LCD; | ||
1332 | dp->display.ops = &exynos_dp_display_ops; | ||
1333 | platform_set_drvdata(pdev, dp); | ||
1334 | |||
1335 | ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, | ||
1336 | dp->display.type); | ||
1337 | if (ret) | ||
1338 | return ret; | ||
1339 | |||
1344 | panel_node = of_parse_phandle(dev->of_node, "panel", 0); | 1340 | panel_node = of_parse_phandle(dev->of_node, "panel", 0); |
1345 | if (panel_node) { | 1341 | if (panel_node) { |
1346 | dp->panel = of_drm_find_panel(panel_node); | 1342 | dp->panel = of_drm_find_panel(panel_node); |
@@ -1349,7 +1345,7 @@ static int exynos_dp_probe(struct platform_device *pdev) | |||
1349 | return -EPROBE_DEFER; | 1345 | return -EPROBE_DEFER; |
1350 | } | 1346 | } |
1351 | 1347 | ||
1352 | exynos_dp_display.ctx = dp; | 1348 | dp->display.ctx = dp; |
1353 | 1349 | ||
1354 | ret = component_add(&pdev->dev, &exynos_dp_ops); | 1350 | ret = component_add(&pdev->dev, &exynos_dp_ops); |
1355 | if (ret) | 1351 | if (ret) |
@@ -1370,19 +1366,17 @@ static int exynos_dp_remove(struct platform_device *pdev) | |||
1370 | #ifdef CONFIG_PM_SLEEP | 1366 | #ifdef CONFIG_PM_SLEEP |
1371 | static int exynos_dp_suspend(struct device *dev) | 1367 | static int exynos_dp_suspend(struct device *dev) |
1372 | { | 1368 | { |
1373 | struct platform_device *pdev = to_platform_device(dev); | 1369 | struct exynos_dp_device *dp = dev_get_drvdata(dev); |
1374 | struct exynos_drm_display *display = platform_get_drvdata(pdev); | ||
1375 | 1370 | ||
1376 | exynos_dp_dpms(display, DRM_MODE_DPMS_OFF); | 1371 | exynos_dp_dpms(&dp->display, DRM_MODE_DPMS_OFF); |
1377 | return 0; | 1372 | return 0; |
1378 | } | 1373 | } |
1379 | 1374 | ||
1380 | static int exynos_dp_resume(struct device *dev) | 1375 | static int exynos_dp_resume(struct device *dev) |
1381 | { | 1376 | { |
1382 | struct platform_device *pdev = to_platform_device(dev); | 1377 | struct exynos_dp_device *dp = dev_get_drvdata(dev); |
1383 | struct exynos_drm_display *display = platform_get_drvdata(pdev); | ||
1384 | 1378 | ||
1385 | exynos_dp_dpms(display, DRM_MODE_DPMS_ON); | 1379 | exynos_dp_dpms(&dp->display, DRM_MODE_DPMS_ON); |
1386 | return 0; | 1380 | return 0; |
1387 | } | 1381 | } |
1388 | #endif | 1382 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index 6426201667bc..164f171168e7 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <drm/drm_dp_helper.h> | 17 | #include <drm/drm_dp_helper.h> |
18 | #include <drm/exynos_drm.h> | 18 | #include <drm/exynos_drm.h> |
19 | 19 | ||
20 | #include "exynos_drm_drv.h" | ||
21 | |||
20 | #define DP_TIMEOUT_LOOP_COUNT 100 | 22 | #define DP_TIMEOUT_LOOP_COUNT 100 |
21 | #define MAX_CR_LOOP 5 | 23 | #define MAX_CR_LOOP 5 |
22 | #define MAX_EQ_LOOP 5 | 24 | #define MAX_EQ_LOOP 5 |
@@ -145,6 +147,7 @@ struct link_train { | |||
145 | }; | 147 | }; |
146 | 148 | ||
147 | struct exynos_dp_device { | 149 | struct exynos_dp_device { |
150 | struct exynos_drm_display display; | ||
148 | struct device *dev; | 151 | struct device *dev; |
149 | struct drm_device *drm_dev; | 152 | struct drm_device *drm_dev; |
150 | struct drm_connector connector; | 153 | struct drm_connector connector; |