drm: kirin: Move config max_width and max_height to driver data
authorXu YiPing <xuyiping@hisilicon.com>
Tue, 20 Aug 2019 23:06:18 +0000 (23:06 +0000)
committerSam Ravnborg <sam@ravnborg.org>
Wed, 21 Aug 2019 17:15:41 +0000 (19:15 +0200)
As part of refactoring the kirin driver to better support
different hardware revisions, this patch moves the max_width
and max_height values used in kirin_drm_mode_config_inita to
hardware specific driver data.

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>
[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-18-john.stultz@linaro.org
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h

index a74b262..a4cf122 100644 (file)
@@ -1054,6 +1054,8 @@ struct kirin_drm_data ade_driver_data = {
        .prim_plane = ADE_CH1,
        .channel_formats = channel_formats,
        .channel_formats_cnt = ARRAY_SIZE(channel_formats),
+       .config_max_width = 2048,
+       .config_max_height = 2048,
        .crtc_helper_funcs = &ade_crtc_helper_funcs,
        .crtc_funcs = &ade_crtc_funcs,
        .plane_helper_funcs = &ade_plane_helper_funcs,
index 2519182..2ab32c2 100644 (file)
@@ -40,17 +40,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
        return 0;
 }
 
-static void kirin_drm_mode_config_init(struct drm_device *dev)
-{
-       dev->mode_config.min_width = 0;
-       dev->mode_config.min_height = 0;
-
-       dev->mode_config.max_width = 2048;
-       dev->mode_config.max_height = 2048;
-
-       dev->mode_config.funcs = driver_data->mode_config_funcs;
-}
-
 static int kirin_drm_kms_init(struct drm_device *dev)
 {
        int ret;
@@ -59,7 +48,11 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 
        /* dev->mode_config initialization */
        drm_mode_config_init(dev);
-       kirin_drm_mode_config_init(dev);
+       dev->mode_config.min_width = 0;
+       dev->mode_config.min_height = 0;
+       dev->mode_config.max_width = driver_data->config_max_width;
+       dev->mode_config.max_height = driver_data->config_max_width;
+       dev->mode_config.funcs = driver_data->mode_config_funcs;
 
        /* display controller init */
        ret = driver_data->init(to_platform_device(dev->dev));
index 2b660df..43be65f 100644 (file)
@@ -37,6 +37,8 @@ struct kirin_plane {
 struct kirin_drm_data {
        const u32 *channel_formats;
        u32 channel_formats_cnt;
+       int config_max_width;
+       int config_max_height;
        u32 num_planes;
        u32 prim_plane;