From patchwork Wed Aug 14 18:46:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171348 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203383ily; Wed, 14 Aug 2019 11:47:36 -0700 (PDT) X-Received: by 2002:a63:8dc9:: with SMTP id z192mr471776pgd.151.1565808456788; Wed, 14 Aug 2019 11:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808456; cv=none; d=google.com; s=arc-20160816; b=ZsywU6Wo1XDpDY2fw8F+lLGRUD89uFOP7dWlBVca6P+7gpPq5X1PpOwMqorAMIC23D 2mgheCP9KTKtAq38sx9r6LA1ifErfxmo+YNrgkYy6iK1AxJ3Nu1pLwErvBeV4r3Ivp5l Mi9e9US/ezTP7Ty3+p1ZvYG+wZqj0o1cRg0ejo3k7qvvgJkJt4fk9xjvUhgtGZRF9GZ/ dQ2WR25c8cLShAr3FOEUw23XDMKVcOLGrmfV7JNDyZftl5tro8m058z47+mb/oYtmDJ7 hBh65zQRANmMOigGZ+/aAuFxE1KcFmixSkuU+Ggwx+wCgZSnw2ASEsykUuHnwoIJ4yz3 ImkA== 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=Gw3U46bCPqQ3ETjFXBi+tKlBVOcmrTwPQEr2UHcNkBY=; b=ojbSxB+vCqHx8U+8Ko0n/7uC2bG+Z9SuF0LdQbti2F7dbZFCDRJ3IZpKFc3l9B+7bF n0+vspX6Pcr8rz3NmQn0VW0lSWtWrz3fHJEoakrAT5nOxCOY4J+rvUL60stP5GfXFLA4 EoaYjwygxsTZTmuGvBRYI+aMzJxALIgokWRbsBFhhcxQV5HOMDFXOwEjtuWl6HCJbI5u PUpdal8cQ65rC8OCaQPlsSWiukbYaD+cMsBaB1mMyo3hC6qCoftMeCoIB57/w9DfGkVq A4ionM5nIyYnQn9d4Mfd0E0NUSwHQq1/4WXidrNHAj98JBDVHUOsIXGnsJi3AzvBdtgp B1ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pmouxbbv; 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 m32sor774947pld.32.2019.08.14.11.47.36 for (Google Transport Security); Wed, 14 Aug 2019 11:47:36 -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=pmouxbbv; 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=Gw3U46bCPqQ3ETjFXBi+tKlBVOcmrTwPQEr2UHcNkBY=; b=pmouxbbveIAlwOzdvdJ0p2QuUl0N5XG++0VuOjCBBmWnVYFCP4/wQRHPGVv1pRGvYw 4wg1Xf4d9fVYnzoyLtAeULaYrcSYtaYG0I1Z3y0FhIX2KJk1ocSo8T8h5Z71WP6z/hH5 s4wFGm6zOHbqtkCTaoqfwS5uH1UECFUwKa8GMRieSlsL2z1NJirkTdgU/XR8LN8hjXkm rmCn+GHiNihGmUzm7VuuAORrLmjxRpgweMfjbCxY+7UHg0oXbkJPUByS0z9mHj8eEDZz zm3mQOQIY8TXhMNSWzud0C5PhOYdPkLBKq00eOqjrkRiO52X3Z/F8dlVIiLiAJlgApE/ TCag== 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=Gw3U46bCPqQ3ETjFXBi+tKlBVOcmrTwPQEr2UHcNkBY=; b=AB9CYUUf9IjXf8uEwtaXSA8p/tn/yLJA4UfF2+o2zLFgRoIsMhxgTrrr48vB8GQG4F Ge1agG3IYsdjJe3m/7HS1NiBuGZRpKKA/XxZSsTpVlbgU74Y5SwL7dyrrscB8IrthGjK PlKOwwCmoibDvF7kTJhbS32UsxxghOye+0Br3oCGe+gR3tnO11ULsJYQ6j/GiZqcYQqM BJ2WMs7Q1q0QeXKkUlQLRBvHBnIsT5JCKtlfSG2aBiYXJLydCnsa+6NE/iXeMaGYqJkg Fu5Arsw9ydfPuE16sJk+Wnb5+j7uzpDYpsVlq/AQv2z3cuKtD3JFsv5cqSS+Dm9VMdYv 9xyA== X-Gm-Message-State: APjAAAUP8HkECMmRZEyH0C4jZeNKUgR+SOclrSvTiUgorGicc/HHXhsT AmF1ISQGC4E688fvmQ8J7fnizcJe X-Google-Smtp-Source: APXvYqxf8PRCM/QdhrsCcFY9B3bUT+kDckdce2dIlrs5TtWi1x5QHwHYOwWNMfZiWnKyqYVld6Vd2Q== X-Received: by 2002:a17:902:7686:: with SMTP id m6mr744989pll.239.1565808456343; Wed, 14 Aug 2019 11:47:36 -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.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:35 -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 19/26] drm: kirin: Move drm driver to driver data Date: Wed, 14 Aug 2019 18:46:55 +0000 Message-Id: <20190814184702.54275-20-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 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 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 | 27 +++++++++++++ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38 +------------------ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 29 insertions(+), 37 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 68efd508d86b..0bc2e538913b 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 7956d698d368..296661ba300f 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -92,41 +92,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; @@ -134,11 +99,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;