From patchwork Tue Apr 23 23:20:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162752 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354821jan; Tue, 23 Apr 2019 16:21:22 -0700 (PDT) X-Received: by 2002:a17:902:6b:: with SMTP id 98mr12967182pla.271.1556061682390; Tue, 23 Apr 2019 16:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061682; cv=none; d=google.com; s=arc-20160816; b=G10Nv+wPRrVCXVCEy80QDvbtgYKy4WPGuO3mA5YjeZ84MsQsEreYxIMUnGbQrHvAoK XcjONbTuClvBqTyWO/X6UtevkPCosasG8uKSlDr11BUqF7h1kqxC54lpzALBBG6T4lS+ etjO9sjlIrvMwjrRHd5O0VgwQ1/l8AMc88KKcbYH6/cxso4YreH+3OoHJYBFG7MyMIWL bgeyLEOztyMQt9Q6zYMegDQ1jWf8fXPFt/QHBd2us6SSWrS6pBLhfJ1Yt4WsMc4b340N 534A0ttJSHnVo5asR99jAJrA7pOXOX6jjlIkFSD1U07ha+KIG35FZr9fY1E4TBxi7YX3 JpXQ== 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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=YnPf/wMziRD9EoJd+gZOE1cMGbufiPcN4No/6IqWsC8JP1D8AUdbtxqGhWcMzIb9zZ tqCACkzvBjXPCMaQ+bIkpWYe5M9IAwT8qy5YXXp0LSK7cHugU+4SFPMa0TwxqFm/6DRv WQ+ieJTHB7dHHF1o3VpxryuMF9sG08cbtrseaNQV37+boNx+2d1a1wOkTRQdMaFEO1cb Ck9AzhAJjqdd4H/S0hP88/4/s8jX7lppBQYz4gRTLk6W/cj/4b81mVUB+bsAelK+6JkG XVkaLTYaaijDJ4cCiqgNgujAtwAkKiigiDzp6S26eBD7bzHnhxwQVc6yRyi+3Mdehusj l8uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oVWn/lsE"; 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 m23sor19895310pfi.67.2019.04.23.16.21.22 for (Google Transport Security); Tue, 23 Apr 2019 16:21:22 -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="oVWn/lsE"; 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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=oVWn/lsEfBEEg1ittPmeAehdCZlbXDUOseKSawgAKA3xZqf0ekcOV18j8vkRNyihvx MgjjxKIYgGwKqhogozHZKjyLPMqPpULYvEtGoKp6v0xcebU2Hln5+4jYVO4Q9oYer/p9 0bM5jzkvdJoYToIQ4pk/EjhL2RojThFQRfrXjTfb7PpYlSqiOfwoE0kDPKNKZjKdIKsg /cO6w///QLDG6GSt9t0DQmTxaBm7mg8Oid8l0Shpg6rRAe3di95hCJJDFRJz3anrPEmm mTFr1nMp7kZKLtR6/FnICTn834D3axUuxaBVpfe8ijqHc79RzJBLoCuRVmtGQxbGrII2 vCNw== 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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=hR/NAVpXiXaktiN3qkb7LAJR8LyA/inQjcEl6xygI9m95DepiDRuUmnTFzJ3tss9p7 kunC4YEWkr8l8BgvAyQp+URKh+YAlMp7PCGxyd/WeWMcUUXOGWyNx/DokjkSRC+Kjzd4 P4twbCbVJJiYHjC5RS3D58AOHunAfs/M8rj1A1jTfxVAXC8CzZL3AMIpjDgt1QcxSaoI vihHcmrU48PxEOSUUPUFixz0yep90nfXirJG9JAQaa9kG2gGFP/lEVg1Z6ztU3mCkCXy pCn+Jc97ZPK0qMLmgW6PqVxFE7gHB0Jd8+dShX8jnfO56nukBoMGu/a9YpPsPbyq11rj XSoQ== X-Gm-Message-State: APjAAAWlsK48kGxKqcvHrY6aTjfrPjzFUitomloM4T0PUWTeTeUGagcR fb3pTg0qeLcDjFaaH2d75EVl6Xwu X-Google-Smtp-Source: APXvYqy5jPd8/syV+26q23zSB0JKQ5Qd5Jtzd9xqtc4PXOznIW7qKcD5ehVs7FCVSQ79/L2Nt5arVA== X-Received: by 2002:aa7:8e55:: with SMTP id d21mr29525492pfr.62.1556061682009; Tue, 23 Apr 2019 16:21:22 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:21 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 15/25] drm: kirin: Move mode config function to driver_data Date: Tue, 23 Apr 2019 16:20:46 -0700 Message-Id: <1556061656-1733-16-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: Reworded commit message] 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0ebe715..0e68257 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 b52c40d09..4b210ea 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -41,12 +41,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; @@ -55,7 +49,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 f688612..700a203 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -46,7 +46,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); };