mirror of https://gitee.com/openkylin/linux.git
drm: kirin: Move mode config function to driver_data
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the mode config initialization values into the kirin_drm_data structure. This will make it easier to add support for new devices via a new kirin_drm_data structure. 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> 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-16-john.stultz@linaro.org
This commit is contained in:
parent
e200d8eb39
commit
bdaf419efe
|
@ -30,6 +30,7 @@
|
||||||
#include <drm/drm_plane_helper.h>
|
#include <drm/drm_plane_helper.h>
|
||||||
#include <drm/drm_probe_helper.h>
|
#include <drm/drm_probe_helper.h>
|
||||||
#include <drm/drm_vblank.h>
|
#include <drm/drm_vblank.h>
|
||||||
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
|
|
||||||
#include "kirin_drm_drv.h"
|
#include "kirin_drm_drv.h"
|
||||||
#include "kirin_ade_reg.h"
|
#include "kirin_ade_reg.h"
|
||||||
|
@ -1038,6 +1039,13 @@ static void ade_drm_cleanup(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct drm_mode_config_funcs ade_mode_config_funcs = {
|
||||||
|
.fb_create = drm_gem_fb_create,
|
||||||
|
.atomic_check = drm_atomic_helper_check,
|
||||||
|
.atomic_commit = drm_atomic_helper_commit,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
struct kirin_drm_data ade_driver_data = {
|
struct kirin_drm_data ade_driver_data = {
|
||||||
.channel_formats = channel_formats,
|
.channel_formats = channel_formats,
|
||||||
.channel_formats_cnt = ARRAY_SIZE(channel_formats),
|
.channel_formats_cnt = ARRAY_SIZE(channel_formats),
|
||||||
|
@ -1045,6 +1053,8 @@ struct kirin_drm_data ade_driver_data = {
|
||||||
.crtc_funcs = &ade_crtc_funcs,
|
.crtc_funcs = &ade_crtc_funcs,
|
||||||
.plane_helper_funcs = &ade_plane_helper_funcs,
|
.plane_helper_funcs = &ade_plane_helper_funcs,
|
||||||
.plane_funcs = &ade_plane_funcs,
|
.plane_funcs = &ade_plane_funcs,
|
||||||
|
.mode_config_funcs = &ade_mode_config_funcs,
|
||||||
|
|
||||||
.init = ade_drm_init,
|
.init = ade_drm_init,
|
||||||
.cleanup = ade_drm_cleanup
|
.cleanup = ade_drm_cleanup
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,12 +40,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = {
|
|
||||||
.fb_create = drm_gem_fb_create,
|
|
||||||
.atomic_check = drm_atomic_helper_check,
|
|
||||||
.atomic_commit = drm_atomic_helper_commit,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void kirin_drm_mode_config_init(struct drm_device *dev)
|
static void kirin_drm_mode_config_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->mode_config.min_width = 0;
|
dev->mode_config.min_width = 0;
|
||||||
|
@ -54,7 +48,7 @@ static void kirin_drm_mode_config_init(struct drm_device *dev)
|
||||||
dev->mode_config.max_width = 2048;
|
dev->mode_config.max_width = 2048;
|
||||||
dev->mode_config.max_height = 2048;
|
dev->mode_config.max_height = 2048;
|
||||||
|
|
||||||
dev->mode_config.funcs = &kirin_drm_mode_config_funcs;
|
dev->mode_config.funcs = driver_data->mode_config_funcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kirin_drm_kms_init(struct drm_device *dev)
|
static int kirin_drm_kms_init(struct drm_device *dev)
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct kirin_drm_data {
|
||||||
const struct drm_crtc_funcs *crtc_funcs;
|
const struct drm_crtc_funcs *crtc_funcs;
|
||||||
const struct drm_plane_helper_funcs *plane_helper_funcs;
|
const struct drm_plane_helper_funcs *plane_helper_funcs;
|
||||||
const struct drm_plane_funcs *plane_funcs;
|
const struct drm_plane_funcs *plane_funcs;
|
||||||
|
const struct drm_mode_config_funcs *mode_config_funcs;
|
||||||
int (*init)(struct platform_device *pdev);
|
int (*init)(struct platform_device *pdev);
|
||||||
void (*cleanup)(struct platform_device *pdev);
|
void (*cleanup)(struct platform_device *pdev);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue