drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data
authorXu YiPing <xuyiping@hisilicon.com>
Tue, 20 Aug 2019 23:06:24 +0000 (23:06 +0000)
committerSam Ravnborg <sam@ravnborg.org>
Wed, 21 Aug 2019 17:15:45 +0000 (19:15 +0200)
As part of refactoring the kirin driver to better support
different hardware revisions, this patch changes the
alloc/clean_hw_ctx functions to be called via driver_data
specific funciton pointers.

This will allow the ade_drm_init to later be made generic and
moved to kirin_drm_drv.c

Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Xinliang Liu <z.liuxinliang@hisilicon.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Xu YiPing <xuyiping@hisilicon.com>
[jstultz: Reworded commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190820230626.23253-24-john.stultz@linaro.org
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h

index d8e40fcff386dc5ec6bf3983b5c534df4f9ed4af..a2bb2b75be4b15b02d9e5fd6455614346157923b 100644 (file)
@@ -1000,7 +1000,7 @@ static int ade_drm_init(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base);
+       ctx = ade_driver_data.alloc_hw_ctx(pdev, &ade->crtc.base);
        if (IS_ERR(ctx)) {
                DRM_ERROR("failed to initialize kirin_priv hw ctx\n");
                return -EINVAL;
@@ -1040,6 +1040,10 @@ static int ade_drm_init(struct platform_device *pdev)
        return 0;
 }
 
+static void ade_hw_ctx_cleanup(void *hw_ctx)
+{
+}
+
 static void ade_drm_cleanup(struct platform_device *pdev)
 {
 }
@@ -1089,6 +1093,9 @@ struct kirin_drm_data ade_driver_data = {
        .plane_funcs = &ade_plane_funcs,
        .mode_config_funcs = &ade_mode_config_funcs,
 
+       .alloc_hw_ctx = ade_hw_ctx_alloc,
+       .cleanup_hw_ctx = ade_hw_ctx_cleanup,
+
        .init = ade_drm_init,
        .cleanup = ade_drm_cleanup
 };
index 95f56c9960d59c0d1a3a93e27b4feac631dc72d0..1663610d2cd862366a3c829c08227155d625a508 100644 (file)
@@ -49,6 +49,11 @@ struct kirin_drm_data {
        const struct drm_plane_helper_funcs *plane_helper_funcs;
        const struct drm_plane_funcs  *plane_funcs;
        const struct drm_mode_config_funcs *mode_config_funcs;
+
+       void *(*alloc_hw_ctx)(struct platform_device *pdev,
+                             struct drm_crtc *crtc);
+       void (*cleanup_hw_ctx)(void *hw_ctx);
+
        int (*init)(struct platform_device *pdev);
        void (*cleanup)(struct platform_device *pdev);
 };