[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190819230321.56480-14-john.stultz@linaro.org>
Date: Mon, 19 Aug 2019 23:03:09 +0000
From: John Stultz <john.stultz@...aro.org>
To: lkml <linux-kernel@...r.kernel.org>
Cc: Xu YiPing <xuyiping@...ilicon.com>,
Rongrong Zou <zourongrong@...il.com>,
Xinliang Liu <z.liuxinliang@...ilicon.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Sam Ravnborg <sam@...nborg.org>,
John Stultz <john.stultz@...aro.org>
Subject: [PATCH v4 13/25] drm: kirin: Move ade crtc/plane help functions to driver_data
From: Xu YiPing <xuyiping@...ilicon.com>
As part of refactoring the kirin driver to better support
different hardware revisions, this patch moves the crtc
and plane funcs/helper_funcs to the struct kirin_drm_data.
This will make it easier to add support for new devices
via a new kirin_drm_data structure.
Cc: Rongrong Zou <zourongrong@...il.com>
Cc: Xinliang Liu <z.liuxinliang@...ilicon.com>
Cc: David Airlie <airlied@...ux.ie>
Cc: Daniel Vetter <daniel@...ll.ch>
Cc: dri-devel <dri-devel@...ts.freedesktop.org>
Cc: Sam Ravnborg <sam@...nborg.org>
Acked-by: Xinliang Liu <z.liuxinliang@...ilicon.com>
Reviewed-by: Sam Ravnborg <sam@...nborg.org>
Signed-off-by: Xu YiPing <xuyiping@...ilicon.com>
[jstultz: reworded commit message]
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 15 ++++++++++-----
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 6ff8417943c6..016a6057c5f6 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -602,13 +602,13 @@ static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
crtc->port = port;
ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
- &ade_crtc_funcs, NULL);
+ ade_driver_data.crtc_funcs, NULL);
if (ret) {
DRM_ERROR("failed to init crtc.\n");
return ret;
}
- drm_crtc_helper_add(crtc, &ade_crtc_helper_funcs);
+ drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs);
return 0;
}
@@ -917,14 +917,15 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane,
if (ret)
return ret;
- ret = drm_universal_plane_init(dev, &kplane->base, 1, &ade_plane_funcs,
- fmts, fmts_cnt, NULL, type, NULL);
+ ret = drm_universal_plane_init(dev, &kplane->base, 1,
+ ade_driver_data.plane_funcs, fmts,
+ fmts_cnt, NULL, type, NULL);
if (ret) {
DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch);
return ret;
}
- drm_plane_helper_add(&kplane->base, &ade_plane_helper_funcs);
+ drm_plane_helper_add(&kplane->base, ade_driver_data.plane_helper_funcs);
return 0;
}
@@ -1056,6 +1057,10 @@ static void ade_drm_cleanup(struct platform_device *pdev)
}
struct kirin_drm_data ade_driver_data = {
+ .crtc_helper_funcs = &ade_crtc_helper_funcs,
+ .crtc_funcs = &ade_crtc_funcs,
+ .plane_helper_funcs = &ade_plane_helper_funcs,
+ .plane_funcs = &ade_plane_funcs,
.init = ade_drm_init,
.cleanup = ade_drm_cleanup
};
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
index cd2eaa653db7..70b04e65789c 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
@@ -35,6 +35,11 @@ struct kirin_plane {
/* display controller init/cleanup ops */
struct kirin_drm_data {
+ const struct drm_crtc_helper_funcs *crtc_helper_funcs;
+ const struct drm_crtc_funcs *crtc_funcs;
+ const struct drm_plane_helper_funcs *plane_helper_funcs;
+ const struct drm_plane_funcs *plane_funcs;
+
int (*init)(struct platform_device *pdev);
void (*cleanup)(struct platform_device *pdev);
};
--
2.17.1
Powered by blists - more mailing lists