drm: kirin: Move drm driver to driver data

As part of refactoring the kirin driver to better support
different hardware revisions, this patch moves the drm_driver
structure to be under device specific driver data.

This will allow us to more easily add support for kirin960
hardware with later patches.

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-19-john.stultz@linaro.org
This commit is contained in:
Xu YiPing 2019-08-20 23:06:19 +00:00 committed by Sam Ravnborg
parent 49af461139
commit 1053d01864
3 changed files with 26 additions and 34 deletions

View File

@ -1049,6 +1049,29 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = {
}; };
DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
static struct drm_driver ade_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops = &ade_fops,
.gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.dumb_create = drm_gem_cma_dumb_create_internal,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
.gem_prime_vmap = drm_gem_cma_prime_vmap,
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
.gem_prime_mmap = drm_gem_cma_prime_mmap,
.name = "kirin",
.desc = "Hisilicon Kirin620 SoC DRM Driver",
.date = "20150718",
.major = 1,
.minor = 0,
};
struct kirin_drm_data ade_driver_data = { struct kirin_drm_data ade_driver_data = {
.num_planes = ADE_CH_NUM, .num_planes = ADE_CH_NUM,
.prim_plane = ADE_CH1, .prim_plane = ADE_CH1,
@ -1056,6 +1079,7 @@ struct kirin_drm_data ade_driver_data = {
.channel_formats_cnt = ARRAY_SIZE(channel_formats), .channel_formats_cnt = ARRAY_SIZE(channel_formats),
.config_max_width = 2048, .config_max_width = 2048,
.config_max_height = 2048, .config_max_height = 2048,
.driver = &ade_driver,
.crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_helper_funcs = &ade_crtc_helper_funcs,
.crtc_funcs = &ade_crtc_funcs, .crtc_funcs = &ade_crtc_funcs,
.plane_helper_funcs = &ade_plane_helper_funcs, .plane_helper_funcs = &ade_plane_helper_funcs,

View File

@ -93,38 +93,6 @@ err_mode_config_cleanup:
return ret; return ret;
} }
DEFINE_DRM_GEM_CMA_FOPS(kirin_drm_fops);
static int kirin_gem_cma_dumb_create(struct drm_file *file,
struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
return drm_gem_cma_dumb_create_internal(file, dev, args);
}
static struct drm_driver kirin_drm_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops = &kirin_drm_fops,
.gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.dumb_create = kirin_gem_cma_dumb_create,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
.gem_prime_vmap = drm_gem_cma_prime_vmap,
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
.gem_prime_mmap = drm_gem_cma_prime_mmap,
.name = "kirin",
.desc = "Hisilicon Kirin SoCs' DRM Driver",
.date = "20150718",
.major = 1,
.minor = 0,
};
static int compare_of(struct device *dev, void *data) static int compare_of(struct device *dev, void *data)
{ {
return dev->of_node == data; return dev->of_node == data;
@ -132,11 +100,10 @@ static int compare_of(struct device *dev, void *data)
static int kirin_drm_bind(struct device *dev) static int kirin_drm_bind(struct device *dev)
{ {
struct drm_driver *driver = &kirin_drm_driver;
struct drm_device *drm_dev; struct drm_device *drm_dev;
int ret; int ret;
drm_dev = drm_dev_alloc(driver, dev); drm_dev = drm_dev_alloc(driver_data->driver, dev);
if (IS_ERR(drm_dev)) if (IS_ERR(drm_dev))
return PTR_ERR(drm_dev); return PTR_ERR(drm_dev);

View File

@ -42,6 +42,7 @@ struct kirin_drm_data {
u32 num_planes; u32 num_planes;
u32 prim_plane; u32 prim_plane;
struct drm_driver *driver;
const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_helper_funcs *crtc_helper_funcs;
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;