diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2014-11-17 03:54:26 -0500 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2014-11-24 04:02:56 -0500 |
commit | 4cfde1f2af076547ebe86f8632e65119f28438b8 (patch) | |
tree | 8c9f3c9f17fe434d886733194ed7f6575e8828ac | |
parent | 63b3be327048402a39068f188726e3729e061fda (diff) |
drm/exynos/dpi: 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 dpi
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 dpi devices in the system.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_dpi.c | 39 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 |
3 files changed, 23 insertions, 20 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 3dc678ed9949..3acfc288d17c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "exynos_drm_drv.h" | 22 | #include "exynos_drm_drv.h" |
23 | 23 | ||
24 | struct exynos_dpi { | 24 | struct exynos_dpi { |
25 | struct exynos_drm_display display; | ||
25 | struct device *dev; | 26 | struct device *dev; |
26 | struct device_node *panel_node; | 27 | struct device_node *panel_node; |
27 | 28 | ||
@@ -35,6 +36,11 @@ struct exynos_dpi { | |||
35 | 36 | ||
36 | #define connector_to_dpi(c) container_of(c, struct exynos_dpi, connector) | 37 | #define connector_to_dpi(c) container_of(c, struct exynos_dpi, connector) |
37 | 38 | ||
39 | static inline struct exynos_dpi *display_to_dpi(struct exynos_drm_display *d) | ||
40 | { | ||
41 | return container_of(d, struct exynos_dpi, display); | ||
42 | } | ||
43 | |||
38 | static enum drm_connector_status | 44 | static enum drm_connector_status |
39 | exynos_dpi_detect(struct drm_connector *connector, bool force) | 45 | exynos_dpi_detect(struct drm_connector *connector, bool force) |
40 | { | 46 | { |
@@ -165,11 +171,6 @@ static struct exynos_drm_display_ops exynos_dpi_display_ops = { | |||
165 | .dpms = exynos_dpi_dpms | 171 | .dpms = exynos_dpi_dpms |
166 | }; | 172 | }; |
167 | 173 | ||
168 | static struct exynos_drm_display exynos_dpi_display = { | ||
169 | .type = EXYNOS_DISPLAY_TYPE_LCD, | ||
170 | .ops = &exynos_dpi_display_ops, | ||
171 | }; | ||
172 | |||
173 | /* of_* functions will be removed after merge of of_graph patches */ | 174 | /* of_* functions will be removed after merge of of_graph patches */ |
174 | static struct device_node * | 175 | static struct device_node * |
175 | of_get_child_by_name_reg(struct device_node *parent, const char *name, u32 reg) | 176 | of_get_child_by_name_reg(struct device_node *parent, const char *name, u32 reg) |
@@ -299,20 +300,22 @@ struct exynos_drm_display *exynos_dpi_probe(struct device *dev) | |||
299 | struct exynos_dpi *ctx; | 300 | struct exynos_dpi *ctx; |
300 | int ret; | 301 | int ret; |
301 | 302 | ||
302 | ret = exynos_drm_component_add(dev, | ||
303 | EXYNOS_DEVICE_TYPE_CONNECTOR, | ||
304 | exynos_dpi_display.type); | ||
305 | if (ret) | ||
306 | return ERR_PTR(ret); | ||
307 | |||
308 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); | 303 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
309 | if (!ctx) | 304 | if (!ctx) |
310 | goto err_del_component; | 305 | return ERR_PTR(-ENOMEM); |
311 | 306 | ||
307 | ctx->display.type = EXYNOS_DISPLAY_TYPE_LCD; | ||
308 | ctx->display.ops = &exynos_dpi_display_ops; | ||
312 | ctx->dev = dev; | 309 | ctx->dev = dev; |
313 | exynos_dpi_display.ctx = ctx; | 310 | ctx->display.ctx = ctx; |
314 | ctx->dpms_mode = DRM_MODE_DPMS_OFF; | 311 | ctx->dpms_mode = DRM_MODE_DPMS_OFF; |
315 | 312 | ||
313 | ret = exynos_drm_component_add(dev, | ||
314 | EXYNOS_DEVICE_TYPE_CONNECTOR, | ||
315 | ctx->display.type); | ||
316 | if (ret) | ||
317 | return ERR_PTR(ret); | ||
318 | |||
316 | ret = exynos_dpi_parse_dt(ctx); | 319 | ret = exynos_dpi_parse_dt(ctx); |
317 | if (ret < 0) { | 320 | if (ret < 0) { |
318 | devm_kfree(dev, ctx); | 321 | devm_kfree(dev, ctx); |
@@ -328,7 +331,7 @@ struct exynos_drm_display *exynos_dpi_probe(struct device *dev) | |||
328 | } | 331 | } |
329 | } | 332 | } |
330 | 333 | ||
331 | return &exynos_dpi_display; | 334 | return &ctx->display; |
332 | 335 | ||
333 | err_del_component: | 336 | err_del_component: |
334 | exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CONNECTOR); | 337 | exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CONNECTOR); |
@@ -336,16 +339,16 @@ err_del_component: | |||
336 | return NULL; | 339 | return NULL; |
337 | } | 340 | } |
338 | 341 | ||
339 | int exynos_dpi_remove(struct device *dev) | 342 | int exynos_dpi_remove(struct exynos_drm_display *display) |
340 | { | 343 | { |
341 | struct exynos_dpi *ctx = exynos_dpi_display.ctx; | 344 | struct exynos_dpi *ctx = display_to_dpi(display); |
342 | 345 | ||
343 | exynos_dpi_dpms(&exynos_dpi_display, DRM_MODE_DPMS_OFF); | 346 | exynos_dpi_dpms(&ctx->display, DRM_MODE_DPMS_OFF); |
344 | 347 | ||
345 | if (ctx->panel) | 348 | if (ctx->panel) |
346 | drm_panel_detach(ctx->panel); | 349 | drm_panel_detach(ctx->panel); |
347 | 350 | ||
348 | exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CONNECTOR); | 351 | exynos_drm_component_del(ctx->dev, EXYNOS_DEVICE_TYPE_CONNECTOR); |
349 | 352 | ||
350 | return 0; | 353 | return 0; |
351 | } | 354 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index f408e49cf0b4..b023f5fea25f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -304,7 +304,7 @@ static inline void exynos_platform_device_ipp_unregister(void) {} | |||
304 | 304 | ||
305 | #ifdef CONFIG_DRM_EXYNOS_DPI | 305 | #ifdef CONFIG_DRM_EXYNOS_DPI |
306 | struct exynos_drm_display * exynos_dpi_probe(struct device *dev); | 306 | struct exynos_drm_display * exynos_dpi_probe(struct device *dev); |
307 | int exynos_dpi_remove(struct device *dev); | 307 | int exynos_dpi_remove(struct exynos_drm_display *display); |
308 | #else | 308 | #else |
309 | static inline struct exynos_drm_display * | 309 | static inline struct exynos_drm_display * |
310 | exynos_dpi_probe(struct device *dev) { return NULL; } | 310 | exynos_dpi_probe(struct device *dev) { return NULL; } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index b94466146090..ef80a3537f35 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -1092,7 +1092,7 @@ static void fimd_unbind(struct device *dev, struct device *master, | |||
1092 | fimd_dpms(&ctx->manager, DRM_MODE_DPMS_OFF); | 1092 | fimd_dpms(&ctx->manager, DRM_MODE_DPMS_OFF); |
1093 | 1093 | ||
1094 | if (ctx->display) | 1094 | if (ctx->display) |
1095 | exynos_dpi_remove(dev); | 1095 | exynos_dpi_remove(ctx->display); |
1096 | 1096 | ||
1097 | fimd_mgr_remove(&ctx->manager); | 1097 | fimd_mgr_remove(&ctx->manager); |
1098 | } | 1098 | } |