From patchwork Mon Aug 19 23:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171745 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596164ily; Mon, 19 Aug 2019 16:03:53 -0700 (PDT) X-Received: by 2002:a65:504c:: with SMTP id k12mr22333353pgo.252.1566255833263; Mon, 19 Aug 2019 16:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255833; cv=none; d=google.com; s=arc-20160816; b=t8AeSqxf6jp7cEV3FwYkiEiHYdRBvggrXl0/twXH4oO5+8adoVw1ttOVqKR+kz5roZ 0UXqFWTvuZrIk4vZ1iO3fmHYZkMY1Tn+5sKwWC7IvtPOBX5b++ee+U64BbKeCWYm44pb SlhJmMaGrr4VH9KT72fYV0x5P5/hCZoEGn6HPZNMY4l1TmRLRQTUfDf+ZIMP8w010Bxw q99yKLZhxwoX7zE2CqsM6nSiIzWrxyINp8xzT6qIKAc/5Kqh+wTYIOJPLopAfpSRk+b+ AlK8SVXtKY5901RrQjSwMeRPzI3tpDseLpmLTGMtbdOvmuFzU65mrVp1o4BW2fovD9yl 6iyw== 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=Xtc8YOCqaZZ1cFKsJ32BIebxmxyffX6TKZKTWf0ZB3U=; b=vvJ13m0L901Siqszm2CkAYWGqMmbwzduLaYJ+DP+ins1Ms9w0SMEnxEduXJnnLx/D3 Py/BFa3XfoLo/L1e2FJOnPXd02hVnUserG9bqCUuNM6STLz5I809xDKkc9kzi51K6D8t nwDgTx5ggpxuMz/h0ejiq8jJqP+iFxf7y2yD6EszOdZCke+9I5fPeXn4yVFZin1NhKMk D511/Z1h6CjbHmCJdkiEyWsOp1WK6skHWkaqk7eJWhfAkPW7MdVpH8RwX2SW3s0ugAMu OXDh2CAs4iu4sNX+XGrml6hhf/si4Gh4rdKadFI7488QIT1j9ju/0b5kr+z4k76zNfBe SZPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LDl7w3VE; 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 s13sor2550344plr.24.2019.08.19.16.03.53 for (Google Transport Security); Mon, 19 Aug 2019 16:03:53 -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=LDl7w3VE; 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=Xtc8YOCqaZZ1cFKsJ32BIebxmxyffX6TKZKTWf0ZB3U=; b=LDl7w3VEwYJGEAWm+n9mH4b6C5mMs9WVT1LRZG+vOuZf25V5X133ACFSJU3htofPOw jQ6ufPJzGnkeWWdesKsOVhd2HLjxrnBLyOUfevOR9+0ovUgjxTorHsJwT1895rbKJv8I o6RcQXOv4mNwlJP1WvafJvsxSjlQl1bkQa6g7iADZJpP8YMppVPzrhtXFmbaQr+wKgau FIus3JIVGxA9Y6g7pfNBavmocUaT8F1d3dc4EE0uL0+MVwWi2/7t9BWERxCb+vWlaZKW S6hIBkVzNbtJUrDtZGpHoM27iFpmNmHTCqnGviGtSaXitUPrEexH4GbnrNmR8mCxSCpV 8rxA== 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=Xtc8YOCqaZZ1cFKsJ32BIebxmxyffX6TKZKTWf0ZB3U=; b=WmCmv6ku/KZCc7hmXrt7+7Z1jUt7ojQufbgRDmtnDgqa3vW+vZxaw5KTSVLg1TRSxB KBPZZC3qYusxTwLipan60SPVxanK7OUxbfB1LwaPV39X2v3M1nfUTmxAK0vv9MoIO6Je khwUq1UKfP5D//h+Ta0xIitM278SiYfASHpPECfewRsldBpUGJdEfVOSQUyGOXUJHSty /pSVm0OhRWPHXGw/ZT7Xu/pIcWqpbcTYmlbc9dfm1uec4Vg2dwfmxXXoO0aEvdTbbcQj wWxCrQrOcjQv7koYQ1Rn/brFCwYBg9NSQ8bFzydFm26R8RMcxhie30iJWkXlozuWiqKe yngw== X-Gm-Message-State: APjAAAX7ucWpCIl3y1VwUl3ToCSFpJVQLzid2y9H0+yh/Wn8Q1Fr7Db4 qmpeTh9d9RVVt0undIErw11aH6Nj X-Google-Smtp-Source: APXvYqxoyTvVmfTWQisDIjAh1zW6bHXsxn85+zUFUhjXI22YOeaKbLw1toj8yQHSWNqNT4useLHjVw== X-Received: by 2002:a17:902:20b:: with SMTP id 11mr25514788plc.78.1566255832855; Mon, 19 Aug 2019 16:03:52 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:52 -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 v4 18/25] drm: kirin: Move drm driver to driver data Date: Mon, 19 Aug 2019 23:03:14 +0000 Message-Id: <20190819230321.56480-19-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-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 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 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 [jstultz: Reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 24 +++++++++++++ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 35 +------------------ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 26 insertions(+), 34 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 2e29a228f3f4..7db2cf93a245 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -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 = { .num_planes = ADE_CH_NUM, .prim_plane = ADE_CH1, @@ -1056,6 +1079,7 @@ struct kirin_drm_data ade_driver_data = { .channel_formats_cnt = ARRAY_SIZE(channel_formats), .config_max_width = 2048, .config_max_height = 2048, + .driver = &ade_driver, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 2ab32c2e3f95..c9faaa848cc6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -93,38 +93,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) 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) { 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) { - struct drm_driver *driver = &kirin_drm_driver; struct drm_device *drm_dev; int ret; - drm_dev = drm_dev_alloc(driver, dev); + drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 43be65f82a03..fdbfc4a90f22 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -42,6 +42,7 @@ struct kirin_drm_data { u32 num_planes; u32 prim_plane; + struct drm_driver *driver; const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_funcs *crtc_funcs; const struct drm_plane_helper_funcs *plane_helper_funcs;