From patchwork Thu Aug 1 03:44:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11070129 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 4305513AC for ; Thu, 1 Aug 2019 03:45:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3583B283C3 for ; Thu, 1 Aug 2019 03:45:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A1DE283C8; Thu, 1 Aug 2019 03:45:20 +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 23A5B283C3 for ; Thu, 1 Aug 2019 03:45:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D65DC6E34C; Thu, 1 Aug 2019 03:45:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id DED766E34A for ; Thu, 1 Aug 2019 03:45:09 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id t132so33262505pgb.9 for ; Wed, 31 Jul 2019 20:45:09 -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=sPsp2eqITZnw2b8QC7bn0VV3MJP+delfGQJVfFYbiRk=; b=Yy880lnvfELkfUjuBb4+ZjKbs3Wi1ysgNZ8gRnKCBN4OCsnxlTLx69NNa/jW73Lgqj ldItp+G8RuuDiDstBdE0e7aogq5V/tV75U9Fw69ngN6yTFm2125xg2Vm9IZWrSEy2Uaq EZX4ZCJIw+/YVOEJy7BLvwarke1dP0wFcyuyjU6dBxcRw54aBqQDH0BxExsY1/FrsnYb xj0cTQcZKka4EhEteyqQiGSrW4ZapBW7RrHUs7iHG8X7u4c/rCw9Ppod08IDaEPkq1ji PDs3YC3/79vTOU4YCVQxS0CC05x29ABKfVk7n43Q2rECTLWGktHGSFmKY2l1axQQXpdc MVSQ== X-Gm-Message-State: APjAAAUBzdcqkZ0g2Y2GixEG2hqNef5N0n9EiL42toOYQ/y8P9yHBcgg 9sIft6gkFzUtwi64Rqh1cuX88A== X-Google-Smtp-Source: APXvYqz9J417rd70yrAxKPQ3YRSZltq4+t8BRMIPsxRjNDEPI645+q4kTkFqUGRKHPTAlVKDPrfaxQ== X-Received: by 2002:aa7:81d9:: with SMTP id c25mr51766726pfn.255.1564631107496; Wed, 31 Jul 2019 20:45:07 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id h70sm64775674pgc.36.2019.07.31.20.45.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:06 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 14/26] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Thu, 1 Aug 2019 03:44:27 +0000 Message-Id: <20190801034439.98227-15-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190801034439.98227-1-john.stultz@linaro.org> References: <20190801034439.98227-1-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=sPsp2eqITZnw2b8QC7bn0VV3MJP+delfGQJVfFYbiRk=; b=dc3g+ccVISsD+XlJfNn6R+VKW6AYYAiONlIwe8IU3AI6iT5eUtwLhaCJbpLJzy4AmG JOLlaIB3eOSsJgUD2NpkU5i6OprDNKMJsnqPjgnhA5SzrHyNmul1V63b2JlhqtKgjaBy MeKUEwl22xTMvmP6z3Zb/x4Uv3k0S90nDT1h5sAnjEOY1Nn6jCZm3lZcNd/FBKJLoqI2 Erbb7yS7qNkSo/m2YvpQ2vjqbVOIiLch05MzYqUN8WKeevWeK6P7FTuO5T6xJ6q/bK4H ac3vpQXKQaUmJf++/N6I04Sbo1rCscRkHBoFaWkSrOkbuwVtKqYWwLmhO/tprDj2HQ5Q BHUw== 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 , dri-devel , Rongrong Zou , Sam Ravnborg 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 moves the crtc and plane funcs/helper_funcs to the struct kirin_drm_data. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou 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 --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 15 ++++++++++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index acae2815eded..029733864aa8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -602,13 +602,13 @@ static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - &ade_crtc_funcs, NULL); + ade_driver_data.crtc_funcs, NULL); if (ret) { DRM_ERROR("failed to init crtc.\n"); return ret; } - drm_crtc_helper_add(crtc, &ade_crtc_helper_funcs); + drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs); return 0; } @@ -917,14 +917,15 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, if (ret) return ret; - ret = drm_universal_plane_init(dev, &kplane->base, 1, &ade_plane_funcs, - fmts, fmts_cnt, NULL, type, NULL); + ret = drm_universal_plane_init(dev, &kplane->base, 1, + ade_driver_data.plane_funcs, fmts, + fmts_cnt, NULL, type, NULL); if (ret) { DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; } - drm_plane_helper_add(&kplane->base, &ade_plane_helper_funcs); + drm_plane_helper_add(&kplane->base, ade_driver_data.plane_helper_funcs); return 0; } @@ -1056,6 +1057,10 @@ static void ade_drm_cleanup(struct platform_device *pdev) } struct kirin_drm_data ade_driver_data = { + .crtc_helper_funcs = &ade_crtc_helper_funcs, + .crtc_funcs = &ade_crtc_funcs, + .plane_helper_funcs = &ade_plane_helper_funcs, + .plane_funcs = &ade_plane_funcs, .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 cd2eaa653db7..70b04e65789c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -35,6 +35,11 @@ struct kirin_plane { /* display controller init/cleanup ops */ struct kirin_drm_data { + 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; + const struct drm_plane_funcs *plane_funcs; + int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); };