diff options
author | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2015-01-18 18:16:23 +0900 |
---|---|---|
committer | Inki Dae <daeinki@gmail.com> | 2015-01-25 21:28:07 +0900 |
commit | 93bca243ec96f0acb949d4aa2306f07467e89985 (patch) | |
tree | a93ec737fee887d2b73999d229273b191813276f /drivers/gpu/drm/exynos/exynos_drm_vidi.c | |
parent | eb88e422c502a7a1628cc919020e2ebf59450d4d (diff) | |
download | lwn-93bca243ec96f0acb949d4aa2306f07467e89985.tar.gz lwn-93bca243ec96f0acb949d4aa2306f07467e89985.zip |
drm/exynos: remove struct exynos_drm_manager
exynos_drm_manager was just a redundant struct to represent the crtc as
well. In this commit we merge exynos_drm_manager into exynos_drm_crtc to
remove an unnecessary level of indirection easing the understand of the
flow on exynos.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_vidi.c')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_vidi.c | 79 |
1 files changed, 35 insertions, 44 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 03687db8f565..9c8300edd348 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -47,11 +47,10 @@ struct vidi_win_data { }; struct vidi_context { - struct exynos_drm_manager manager; struct exynos_drm_display display; struct platform_device *pdev; struct drm_device *drm_dev; - struct drm_crtc *crtc; + struct exynos_drm_crtc *crtc; struct drm_encoder *encoder; struct drm_connector connector; struct vidi_win_data win_data[WINDOWS_NR]; @@ -68,11 +67,6 @@ struct vidi_context { int pipe; }; -static inline struct vidi_context *manager_to_vidi(struct exynos_drm_manager *m) -{ - return container_of(m, struct vidi_context, manager); -} - static inline struct vidi_context *display_to_vidi(struct exynos_drm_display *d) { return container_of(d, struct vidi_context, display); @@ -103,23 +97,23 @@ static const char fake_edid_info[] = { 0x00, 0x00, 0x00, 0x06 }; -static void vidi_apply(struct exynos_drm_manager *mgr) +static void vidi_apply(struct exynos_drm_crtc *crtc) { - struct vidi_context *ctx = manager_to_vidi(mgr); - struct exynos_drm_manager_ops *mgr_ops = mgr->ops; + struct vidi_context *ctx = crtc->ctx; + struct exynos_drm_crtc_ops *crtc_ops = crtc->ops; struct vidi_win_data *win_data; int i; for (i = 0; i < WINDOWS_NR; i++) { win_data = &ctx->win_data[i]; - if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit(mgr, i); + if (win_data->enabled && (crtc_ops && crtc_ops->win_commit)) + crtc_ops->win_commit(crtc, i); } } -static int vidi_enable_vblank(struct exynos_drm_manager *mgr) +static int vidi_enable_vblank(struct exynos_drm_crtc *crtc) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; if (ctx->suspended) return -EPERM; @@ -132,16 +126,16 @@ static int vidi_enable_vblank(struct exynos_drm_manager *mgr) /* * in case of page flip request, vidi_finish_pageflip function * will not be called because direct_vblank is true and then - * that function will be called by manager_ops->win_commit callback + * that function will be called by crtc_ops->win_commit callback */ schedule_work(&ctx->work); return 0; } -static void vidi_disable_vblank(struct exynos_drm_manager *mgr) +static void vidi_disable_vblank(struct exynos_drm_crtc *crtc) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; if (ctx->suspended) return; @@ -150,10 +144,10 @@ static void vidi_disable_vblank(struct exynos_drm_manager *mgr) ctx->vblank_on = false; } -static void vidi_win_mode_set(struct exynos_drm_manager *mgr, +static void vidi_win_mode_set(struct exynos_drm_crtc *crtc, struct exynos_drm_plane *plane) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; struct vidi_win_data *win_data; int win; unsigned long offset; @@ -203,9 +197,9 @@ static void vidi_win_mode_set(struct exynos_drm_manager *mgr, plane->fb_width, plane->crtc_width); } -static void vidi_win_commit(struct exynos_drm_manager *mgr, int zpos) +static void vidi_win_commit(struct exynos_drm_crtc *crtc, int zpos) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; struct vidi_win_data *win_data; int win = zpos; @@ -228,9 +222,9 @@ static void vidi_win_commit(struct exynos_drm_manager *mgr, int zpos) schedule_work(&ctx->work); } -static void vidi_win_disable(struct exynos_drm_manager *mgr, int zpos) +static void vidi_win_disable(struct exynos_drm_crtc *crtc, int zpos) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; struct vidi_win_data *win_data; int win = zpos; @@ -246,9 +240,9 @@ static void vidi_win_disable(struct exynos_drm_manager *mgr, int zpos) /* TODO. */ } -static int vidi_power_on(struct exynos_drm_manager *mgr, bool enable) +static int vidi_power_on(struct exynos_drm_crtc *crtc, bool enable) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -260,9 +254,9 @@ static int vidi_power_on(struct exynos_drm_manager *mgr, bool enable) /* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) - vidi_enable_vblank(mgr); + vidi_enable_vblank(crtc); - vidi_apply(mgr); + vidi_apply(crtc); } else { ctx->suspended = true; } @@ -270,9 +264,9 @@ static int vidi_power_on(struct exynos_drm_manager *mgr, bool enable) return 0; } -static void vidi_dpms(struct exynos_drm_manager *mgr, int mode) +static void vidi_dpms(struct exynos_drm_crtc *crtc, int mode) { - struct vidi_context *ctx = manager_to_vidi(mgr); + struct vidi_context *ctx = crtc->ctx; DRM_DEBUG_KMS("%d\n", mode); @@ -280,12 +274,12 @@ static void vidi_dpms(struct exynos_drm_manager *mgr, int mode) switch (mode) { case DRM_MODE_DPMS_ON: - vidi_power_on(mgr, true); + vidi_power_on(crtc, true); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - vidi_power_on(mgr, false); + vidi_power_on(crtc, false); break; default: DRM_DEBUG_KMS("unspecified mode %d\n", mode); @@ -295,10 +289,9 @@ static void vidi_dpms(struct exynos_drm_manager *mgr, int mode) mutex_unlock(&ctx->lock); } -static int vidi_mgr_initialize(struct exynos_drm_manager *mgr, +static int vidi_ctx_initialize(struct vidi_context *ctx, struct drm_device *drm_dev) { - struct vidi_context *ctx = manager_to_vidi(mgr); struct exynos_drm_private *priv = drm_dev->dev_private; ctx->drm_dev = drm_dev; @@ -307,7 +300,7 @@ static int vidi_mgr_initialize(struct exynos_drm_manager *mgr, return 0; } -static struct exynos_drm_manager_ops vidi_manager_ops = { +static struct exynos_drm_crtc_ops vidi_crtc_ops = { .dpms = vidi_dpms, .enable_vblank = vidi_enable_vblank, .disable_vblank = vidi_disable_vblank, @@ -553,22 +546,21 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) { struct vidi_context *ctx = dev_get_drvdata(dev); struct drm_device *drm_dev = data; - struct drm_crtc *crtc = ctx->crtc; int ret; - vidi_mgr_initialize(&ctx->manager, drm_dev); - - ret = exynos_drm_crtc_create(&ctx->manager, drm_dev, ctx->pipe, - EXYNOS_DISPLAY_TYPE_VIDI); - if (ret) { + ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, + EXYNOS_DISPLAY_TYPE_VIDI, + &vidi_crtc_ops, ctx); + if (IS_ERR(ctx->crtc)) { DRM_ERROR("failed to create crtc.\n"); - return ret; + return PTR_ERR(ctx->crtc); } + vidi_ctx_initialize(ctx, drm_dev); + ret = exynos_drm_create_enc_conn(drm_dev, &ctx->display); if (ret) { - crtc->funcs->destroy(crtc); - DRM_ERROR("failed to create encoder and connector.\n"); + ctx->crtc->base.funcs->destroy(&ctx->crtc->base); return ret; } @@ -594,7 +586,6 @@ static int vidi_probe(struct platform_device *pdev) if (!ctx) return -ENOMEM; - ctx->manager.ops = &vidi_manager_ops; ctx->display.type = EXYNOS_DISPLAY_TYPE_VIDI; ctx->display.ops = &vidi_display_ops; ctx->default_win = 0; |