summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
diff options
context:
space:
mode:
authorXu YiPing <xuyiping@hisilicon.com>2019-08-20 23:06:25 +0000
committerSam Ravnborg <sam@ravnborg.org>2019-08-21 19:15:45 +0200
commit28cd05eee4097e7c94dac8e20d3c4af8b450447b (patch)
treeb5de097907bfaf6e662d525197aa26a763620b4e /drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
parent2e89b4fbca8f8e6bdb674ae9778e7a0fd22b28ff (diff)
drm: kirin: Pass driver data to crtc init and plane init
As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the code via a passed in driver_data pointer, rather than hardcoding them via ade_driver_data variable. This will allow those funcitons to be later moved to the generic kirin_drm_drv.c using alternative driver_data structures that support other hardware. 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-25-john.stultz@linaro.org
Diffstat (limited to 'drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c')
-rw-r--r--drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index a2bb2b75be4b..bbdfeac946a7 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = {
};
static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
- struct drm_plane *plane)
+ struct drm_plane *plane,
+ const struct kirin_drm_data *driver_data)
{
struct device_node *port;
int ret;
@@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
crtc->port = port;
ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
- ade_driver_data.crtc_funcs, NULL);
+ driver_data->crtc_funcs, NULL);
if (ret) {
DRM_ERROR("failed to init crtc.\n");
return ret;
}
- drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs);
+ drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs);
return 0;
}
@@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = {
static int kirin_drm_plane_init(struct drm_device *dev,
struct kirin_plane *kplane,
- enum drm_plane_type type)
+ enum drm_plane_type type,
+ const struct kirin_drm_data *driver_data)
{
int ret = 0;
ret = drm_universal_plane_init(dev, &kplane->base, 1,
- ade_driver_data.plane_funcs,
- ade_driver_data.channel_formats,
- ade_driver_data.channel_formats_cnt,
+ driver_data->plane_funcs,
+ driver_data->channel_formats,
+ driver_data->channel_formats_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_driver_data.plane_helper_funcs);
+ drm_plane_helper_add(&kplane->base, driver_data->plane_helper_funcs);
return 0;
}
@@ -1025,7 +1027,7 @@ static int ade_drm_init(struct platform_device *pdev)
else
type = DRM_PLANE_TYPE_OVERLAY;
- ret = kirin_drm_plane_init(dev, kplane, type);
+ ret = kirin_drm_plane_init(dev, kplane, type, &ade_driver_data);
if (ret)
return ret;
}
@@ -1033,7 +1035,8 @@ static int ade_drm_init(struct platform_device *pdev)
/* crtc init */
prim_plane = ade_driver_data.prim_plane;
ret = kirin_drm_crtc_init(dev, &kcrtc->base,
- &ade->planes[prim_plane].base);
+ &ade->planes[prim_plane].base,
+ &ade_driver_data);
if (ret)
return ret;