From patchwork Tue Apr 23 23:20:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162755 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354902jan; Tue, 23 Apr 2019 16:21:26 -0700 (PDT) X-Received: by 2002:a63:ff18:: with SMTP id k24mr27977106pgi.140.1556061686590; Tue, 23 Apr 2019 16:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061686; cv=none; d=google.com; s=arc-20160816; b=xv+hDl9cen6bJbtYC1v5SwQ/yUxeRlg/gNKGiI7WjzF2k9hiSC+3hU6hu5vH0s+4d/ ZKKHyNGTeJQBTE8bOJw7OcHt6VLT0X+yL8eDyzzCvBeqf1SA9Pimxp8xkP7Eo/QDjEgL GSGqqOiYnIae/PiyxJQmPwdfusod6ATWyl1IWy5y3SsSy5iCXN2NdT7L7qhz14HP9axw 1RjtcXd57BVRTeBPY1DpyrAZfIpcfVB31nvJRWNWPnQlgto4qAvyPmnHbdSOrBk/YHGS 7wT/kzmc9U1TzGxKkZiKLhx8QjrU9iniY3fLCK65stmb55bnkEoroHpfMxL2G8jqsKfm odDw== 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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=JQ91BucAmIpaMQ8hfGglY80fvMloUxjwg09q/tRjqmnJZHYHNfMDKWqywMMDkv3vfq cuXysL82tpw0cGAnww6WULJqedDAest8EZeV2nYa/g3mzFzHSqZNnrLin+k52ZjpookC 8S8KH9wxW89rcBkaaE2iKLFxiUVEaCr2rEA1bc8kLqD6oKMxYCJ4OURj5ocafc3C3BtO 8Zh/E/QDsuO9mgGSMUHAQPw4GtddRP1XJFPslbbDMnFAKaqdTppRu7+G59V6veuZNhvX +Kiu7xhCCVwngPBoXasLH/Zf9DrcDirLhGLfTA+Chd/97khqjfj2dd0YdWA9pKxfbrc+ KNdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Undrc2yu; 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 bf8sor2181443plb.68.2019.04.23.16.21.26 for (Google Transport Security); Tue, 23 Apr 2019 16:21:26 -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=Undrc2yu; 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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=Undrc2yujPz9BHO8ZYDZwQgjbX9U8mUottC4PSHk1grQkFtNsdC5fKyBvwk9oJ0TUZ zxbC2QgmW1uH7J+Vwd2kw/IJOR6byz0LF9rXkp+t+UfZEnTCQQlEsReoEMKqLvaFkEaQ 4kCf6cD6IX2jndhtqkzxgojhtssD7DbgB5jHh7AVjOJzkhajgWndHjJjH1UnBjcI/YQA izmoWxzClQUddI5qaZhsMf+5uO1JONfWqB1hpyfmedSED9IvWmXTT/xK+sCDo13SmMXO st3CMl1jd/2z+4Mk6Oiy5qbAWOIl2CdRfCY1jtFIKPRV2+V0ZrfFqzMTNEqJ1c4fEbax V/cQ== 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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=OhFlDBEPAxSKOv39kGwreVCh0oVDETFYQcC9NtG4enA998QHExr8XuMgM18+FCGfY3 z+QhnFb3aST6ng+VwoWhxmdj9PnOENCSSzJRjx7lR91TsbUjO9vdoJYL6Q+fWD3mp10O 9bhTdWjgw+T433VbiEwRyVNlRKEWsajbU02wvRe7DWFNK0PelwV3Cm9H/sCqSRzUtAfZ 9ej7phl7NyLh7OtqE5rGnZhLe2UTl+fOZOtfwDfuQKM06tG1F4SPVzbZUO2m5E86tpCK +g0+V+n5XPCd909MSGdgiqU+1z+nJ0WuDF2C4VQ4qS0phoTh6K3b385zJ8LgYSt/ZZ4Y hf1g== X-Gm-Message-State: APjAAAU07GgfWhqey7ITtWv/Vpmo5v4DBUbtNBj/WV/ARPlr+aebeoO5 9fzFGziot0P+0ctZh3w8/lOT7JME X-Google-Smtp-Source: APXvYqxnEx6l5bQ9FjuGPp9T12WPdNKX/NJmS2VthRc+O+JxUxxHEOVWqS+Abvpfp1Kz/mqPRj3chA== X-Received: by 2002:a17:902:3183:: with SMTP id x3mr28891345plb.170.1556061686166; Tue, 23 Apr 2019 16:21:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:25 -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 18/25] drm: kirin: Move drm driver to driver data Date: Tue, 23 Apr 2019 16:20:49 -0700 Message-Id: <1556061656-1733-19-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 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: 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 | 27 ++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38 +------------------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 29 insertions(+), 37 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 8f15269..bdd1b00 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1049,6 +1049,32 @@ 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_PRIME | + 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_export = drm_gem_prime_export, + .gem_prime_import = drm_gem_prime_import, + .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 +1082,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 70fee30..c987b4e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -94,41 +94,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_PRIME | - 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_export = drm_gem_prime_export, - .gem_prime_import = drm_gem_prime_import, - .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; @@ -136,11 +101,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 af27acc..61fb0da 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -46,6 +46,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;