From patchwork Tue Aug 20 23:06:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171874 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp180262ily; Tue, 20 Aug 2019 16:06:51 -0700 (PDT) X-Received: by 2002:a63:24a:: with SMTP id 71mr26350432pgc.273.1566342411814; Tue, 20 Aug 2019 16:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566342411; cv=none; d=google.com; s=arc-20160816; b=NTmg/dEjbciQDchfVQq9lMFzSKkb2vPHpSmSE4u16bC6XOueGL3SdR6F5SXD242yYJ 5aWpZhmeOqo3Mi+uw/dsSrYEVZ+6xBKvhGvncx7IIN7DqaMAcq4zbSQi1pQglhuJBrfa MtHFSn/DSyN5JCkJ1rCRr2xoxx/nhmxWzRIGrf4BpG93IeZvIbCkgNWYEEOKdF92nNP7 bczhbtgjwtGl3FwGmZPnX+mTLCR/7EWpkEmnpCXEjkhYYP3VWDH7FwQhX25qauYX+v+w ig1omYQ27cVWHqN1HQMRPV30hKiWGtIvCc7AiU6I96V7zOU2W9TLlci8NB+lXhmgaQLh rIqg== 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=NvRBTkEpcrR5Rep8edui09Pbrs4gwjsFcJ1vUHe92C8=; b=i1W4CwxY1wQe4ej6KmLQZUV/1rV3Idm0cpYK+uPVqSQQI/B2mRwYJ+LpVaEaExsqNR lHYjKJLdLVy2EBw3Fnh3+MqdKl2w9vSGr8et4/2Lbw5zwSaSgFF6NrUiC3DSrxmt+mSz C59DwfErZHhXZ9U6xCWNnrIBagp91VkxLmRsbULATtiVOkUfR4bHoV6+OZhZhDE1gUUo bPs7Yb/FmzwNgm6VWYKg9GBeFoFMkpyB+9kFae2kB1zvA9YHtz425dbdGqpZMMKqSx2u 57iNOV8lGfgT7EKdzw5sKBJA6CoUG2ZahgHjk4D1hlCmGFffgPPLn3Q5BoRS1CFSA3Vn R7Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SpmUoFqT; 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 q1sor6781586pll.52.2019.08.20.16.06.51 for (Google Transport Security); Tue, 20 Aug 2019 16:06:51 -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=SpmUoFqT; 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=NvRBTkEpcrR5Rep8edui09Pbrs4gwjsFcJ1vUHe92C8=; b=SpmUoFqTQ+QJ0g9hL7qgwe495wxUfIF5aJWDRv8mSGtUIbWZzEoSG+rlz9UkFpecSy /0C7WUsQ44Y05xaq68bMfODCQWQ124ezsD9PsPxx8LQvOKarjb1trxJuayJiEJG4Ds8X eVCL3EiK8jPXMqsNg1hln1fi116iayO8WR21flpsPW9o9Dvb9h4kX6d1OMYPbxjt1Jb3 PvD30Eb2rT0BAkR2GNDkO7kuW7tdX2G3epYPLwPZ2+TY9gmuvxa8xO/VrzdyvOVN4Bxm 3LlBwM03+GBOB/X/kGUx4hvq/zCruqoIM3dTxfX+4MT9ka2Q3BjWShFP8pE4+WB5JGpv X47Q== 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=NvRBTkEpcrR5Rep8edui09Pbrs4gwjsFcJ1vUHe92C8=; b=bcWWdj8DYPeysZWqBzzOSTOoTinGPvzASVZzOhKT7DW7D4wdAMTSXphc65wgiSeXm+ zePZBrpopfAv9SMDFkTSn2+k91reEjJl5TDr9qf/QJnHytMexNv2GRbzNfQo0h38P4Rq slD2rIa+Du58kI4CWh14w8odc9ND6Dua4cAGOCPFPpOtdmFFqG5gqC8PiAhL8ZYO1x/+ fGTIGCgmGYQgd/kR4Wp1MVVwB3XV3TuL1wZ/fLuJXvk1E/AD8hv01Cptk+rztPbYcTP2 9cgjIANrD2Jg1uAalx0hB7cKOM/UOZfEilPKLMK5VECbAWsGHigx+2jk/B7Ujsoabgq1 EobA== X-Gm-Message-State: APjAAAWosrm+8gTSiF2hUsEH9raq6jJLw+v8fTVZS+adpUHH1hhWJJIy pmXv9LlJ7PrzddatGfavOQrNPuX1 X-Google-Smtp-Source: APXvYqxk1+RpZrPxlzUTPywKtSA/GrnBztJYlBYhotscSB7kHX9LZWOXAZRnLh+wBMuGbZ8bR4CLNw== X-Received: by 2002:a17:902:41:: with SMTP id 59mr8508124pla.268.1566342411457; Tue, 20 Aug 2019 16:06:51 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id q4sm27564747pff.183.2019.08.20.16.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 16:06:50 -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: [PATCH v5 15/25] drm: kirin: Move mode config function to driver_data Date: Tue, 20 Aug 2019 23:06:16 +0000 Message-Id: <20190820230626.23253-16-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820230626.23253-1-john.stultz@linaro.org> References: <20190820230626.23253-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 Acked-by: Xinliang Liu 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 0489b6378e01..94d74c467a81 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 3d22f944a840..25191824b64e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -40,12 +40,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; @@ -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_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); };