From patchwork Wed Aug 14 18:46:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171345 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203285ily; Wed, 14 Aug 2019 11:47:32 -0700 (PDT) X-Received: by 2002:aa7:9799:: with SMTP id o25mr1433156pfp.74.1565808452043; Wed, 14 Aug 2019 11:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808452; cv=none; d=google.com; s=arc-20160816; b=Ajb8ZaFDgBBVo0JuXnBoF6SJGpVzTl32l7qHL9kqmxdSEiFSULraNVE+TA8hwjVN1F CXR/DvbPfQrweHAwrjb2n6yxJZfWGNDooCk47fuPLE4GPTYNEyc6TMAcmFP9oI4CAvyz VL9pstRYwgRyk68zt+eQiBV2b0512H4sY52OamJTPR92eThD1RQfbhbxy+wDGd8WjqSO 2Nkj+pPGKFKwmVjGMiPx+JJsLxC3UA7k5BrS59GK8zqELdWAJKs/vBtklMbC9UjuuKl8 jyjo5FPH0p8CaX21AK7uEhnVF+w0RC0FPoQwpcyFz7S9UQEzCKNy5mol0LzxUSce+AL4 oywA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7xmifYrtKTPY0d7eMeK1iDayOhz0vPlAHH86GCYxNMs=; b=VRP00wg6QXGdejFVzlOz9VGii+CXTK4zVDoSdMspL4TjQ4LoaYd/GawbvKVOJuD6+b QHInoDmrHEbRPeJlA+70QPORETe377jnTalCAKWc3JujoCwcRsGR9CuDZFyJsw8iqh0H d8johsclk0s6CgGmmnyxjvcYn5eXKQmXnBySPlK2XUu+oDyjNCbdTepeds77IVLpmMee TB2U08SfT+iBVfWkMTp6NqYhuA1KoRGQMr4VxjR6vfk3ukD2F00dX2BR7bKHT2p+V5dj nx97hYXHp69B2xCV0TFOWN6CqNLLzr5Am5PW9ZVa95O6RlMNSfn6ZfFcM/B8mJVVhGdX KPtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MDJ24+fb; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id q203sor561475pfc.66.2019.08.14.11.47.31 for (Google Transport Security); Wed, 14 Aug 2019 11:47:32 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MDJ24+fb; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7xmifYrtKTPY0d7eMeK1iDayOhz0vPlAHH86GCYxNMs=; b=MDJ24+fbIYI2njKcl0UW8QdPWZN8z1ATr0nx6vvAzkELs6AP29eMQJTHu8d0g96Q4b UuPmYWS7jw2bXtpk7W6DFFP8vlkWnvmGPPh88msA1DwYuIx8y+I1kq1Njcfp8yMRH8c9 N70+9g6ljOKsaJp9uEPGm/jwV5vbNlU5x6TOs8nb1Ien0pW9XgJDNFRl6FwxEx1hspc9 ntZABvazZYTCa4WQVeQ/ybz/jr1nv5NlWW9bKAa/RL4g0UaiOb+brObMbjFFd3SO/K6S XWlksBKNIl0pRalg9v/j3jCsHpMMWD5yTdWY2GyvgUAJOH+6CQMBVp+zP4BCWVCPHUGs R9xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7xmifYrtKTPY0d7eMeK1iDayOhz0vPlAHH86GCYxNMs=; b=J2+dVG5ijfk6TBEMR0mWFqrwbYqyrF1eaC4YggsshS6+p1DRrUw0vq+z0cAP716h1i h0m2/F/sa6iqP+FDFQ6F5gNq7fVktbn+1SZMZIK9Vp+e3B/1z88VMYj/z9q6G8sEG6uE mdmb0AjjKA3YpmgaM+qsmQIdrf4FqDc3ri46KoKN/NIqWenygbk5GAy0rluAv5TGW9cS iMrgZYiOSFa49wZW2aaxV5rkn5xtRQxGRoJhmGQQ7BlllKbXQmey7+k3uWae5otysHWa Fh/C+3uLjpynkiPUQ1v20ZrEkFgBaU8g8srilC4BzOgUgLWMQ+uydCrzh7/19vNB4PmS aiMg== X-Gm-Message-State: APjAAAWTWD5jeUHnh+UQM4DQ860YnNj6VuBbmA4BeJRh2T0NNuljh7Ww XDQjJe09Vc45p5s01KF5llBUKBdN X-Google-Smtp-Source: APXvYqxW0U5tK9Ms1Ev3Ni5SJx77as/7G+tySsw0so+NqkPxOdCRIc7atSRk9kaGa7tKOVtfUzh7YQ== X-Received: by 2002:aa7:9790:: with SMTP id o16mr1419890pfp.51.1565808451659; Wed, 14 Aug 2019 11:47:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:30 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [RESEND][PATCH v3 16/26] drm: kirin: Move mode config function to driver_data Date: Wed, 14 Aug 2019 18:46:52 +0000 Message-Id: <20190814184702.54275-17-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-1-john.stultz@linaro.org> From: Xu YiPing 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 Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 99dfd15af771..bca080e14009 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "kirin_drm_drv.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 = { .channel_formats = 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, .plane_helper_funcs = &ade_plane_helper_funcs, .plane_funcs = &ade_plane_funcs, + .mode_config_funcs = &ade_mode_config_funcs, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 60c164623f56..bf1e601fb367 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -39,12 +39,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) 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) { dev->mode_config.min_width = 0; @@ -53,7 +47,7 @@ static void kirin_drm_mode_config_init(struct drm_device *dev) dev->mode_config.max_width = 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) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 66916502a9e6..ce9ddccc67a8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -42,7 +42,7 @@ struct kirin_drm_data { const struct drm_crtc_funcs *crtc_funcs; const struct drm_plane_helper_funcs *plane_helper_funcs; const struct drm_plane_funcs *plane_funcs; - + const struct drm_mode_config_funcs *mode_config_funcs; int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); };