From patchwork Tue Apr 23 23:20:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A25141575 for ; Tue, 23 Apr 2019 23:21:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92080285D6 for ; Tue, 23 Apr 2019 23:21:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 865C328969; Tue, 23 Apr 2019 23:21:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F8602895F for ; Tue, 23 Apr 2019 23:21:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60C17897D7; Tue, 23 Apr 2019 23:21:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id A306B897BB for ; Tue, 23 Apr 2019 23:21:33 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id y3so8345471pgk.12 for ; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=kkxaHlUG2VNYQBhyeqyVPP6QplcGgfT47P403u8dzDeDOGpVxz0vGCg0MmYZr7Kp10 QO+juHHzc/YN0m3Q88xghfQmSEeETrtG+2FkFqIn8OTLT/IbAYfS2k9K8TXQZuICpxZC pO1vnb2ukAZDY1VQ8K2WaNK6SlBh/akhQvz+gTO7GCSc+oQs5zsneVZP2O7V3qDUUUsj +GqoShThT4FIY6ilz/XMXOtNTZAi/JlRmPAim7ZLkEmK70KDJRQYp7Elhrg4YF25xbYE uFHnRx97z4IcfAQuufbzsU++tPVcD1yqAwN5n1XNcqwlTov+5Y2VvcvwzN01uVy0dda+ rd4Q== X-Gm-Message-State: APjAAAVj9F5+Ke7Xn2IXvRbov3phXrVWqFnjoRv6EBgZ+dLGQLOWbXQU dJ2sGNe8nuWKlQGq/sPYfseRug== X-Google-Smtp-Source: APXvYqz8GDtuEf42eI35uaJpItKZLJSWWg9sDHjfvRMh4FewHjzW+BcTBuYF9lMJA4CyvbPWWnvOhw== X-Received: by 2002:aa7:8518:: with SMTP id v24mr22541292pfn.219.1556061693163; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) 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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:32 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 23/25] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Tue, 23 Apr 2019 16:20:54 -0700 Message-Id: <1556061656-1733-24-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> X-Mailman-Original-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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=YvFX/fern8eZoKAnjIxAf5RUz4Uvp8J4p+xGsXoGVflJquwMrkpMrG5g8ZV/A05vEL yW4+YKBR+RsZlQhjDsCS8pJ/EmpS7jY5Nxgx/1AQ3Ya5XcDNOjPb4k8GciQ+eajGnR/5 RXoEnF4psLyE5PY753D8fvFFFGFUlRDP49VQujstxvFXl9/CyxSjTs159j/utvmq+X/s qPrI7Cib+zCask/1pHW5q5vdYjmF78xWdpJEJ86ShLuA6lz1CQltJKk0Roi5f1NAwx/B aYeJM1u+qRXXYRuBlkLqNqHVbjpQ7Qfb+aOQ9sDEROm0ngV+RtvVOxttKiHa++iOEKVP 4CKw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xu YiPing , David Airlie , Chen Feng , dri-devel , Xinliang Liu , Xinwei Kong , Rongrong Zou MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the alloc/clean_hw_ctx functions to be called via driver_data specific funciton pointers. This will allow the ade_drm_init to later be made generic and moved to kirin_drm_drv.c 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 | 9 ++++++++- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 3d5bd3a..71671f8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -999,7 +999,7 @@ static int ade_drm_init(struct platform_device *pdev) return -ENOMEM; } - ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); + ctx = ade_driver_data.alloc_hw_ctx(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); return -EINVAL; @@ -1038,6 +1038,10 @@ static int ade_drm_init(struct platform_device *pdev) return 0; } +static void ade_hw_ctx_cleanup(void *hw_ctx) +{ +} + static void ade_drm_cleanup(struct platform_device *pdev) { } @@ -1090,6 +1094,9 @@ struct kirin_drm_data ade_driver_data = { .plane_funcs = &ade_plane_funcs, .mode_config_funcs = &ade_mode_config_funcs, + .alloc_hw_ctx = ade_hw_ctx_alloc, + .cleanup_hw_ctx = ade_hw_ctx_cleanup, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 8818ccf..17c45b5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -53,6 +53,11 @@ struct kirin_drm_data { 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; + + void *(*alloc_hw_ctx)(struct platform_device *pdev, + struct drm_crtc *crtc); + void (*cleanup_hw_ctx)(void *hw_ctx); + int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); };