From patchwork Tue Aug 20 23:06: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: 11104835 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC2BB1395 for ; Tue, 20 Aug 2019 23:07:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A461823406 for ; Tue, 20 Aug 2019 23:07:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A461823406 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DCC76E8BE; Tue, 20 Aug 2019 23:07:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id B780B6E8BB for ; Tue, 20 Aug 2019 23:06:49 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id u17so155152pgi.6 for ; Tue, 20 Aug 2019 16:06:49 -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=OE/knvVfD1cUvaltFYKP0JvLLCHD/efyGm+69Rc7xlw=; b=QmTgzLMNe9Ffihjwj+HqQ4j9u6sqg/Bf5/ltAxWZ0lkwRRiDqpqyDNDg6kisHKkjf4 oFQ2eScVTD1nhLJ5un7SI04QAOfAV0t8ew5paOcxlynyV9gaVnBTuJs2HzaWIXxiAMcD OJYgiNev/U3RzvStl11UTH9q1v27uK3yeKo5Zy8B0TY5Swhcvuz0yIrA3WsyqEuu1Q+c AYiR6FAKc3G+ftSvYpZj6aBuZSqpQExTId43enSNDReeHXoNggX5N2KcQu699FGkay2V 8wYrB1UjvCtguGzk6D1svldFR+Bi6bfrapgnKVWoBRhiysCQ3mR0q7/h5iA/GQb1yCqI /bJw== X-Gm-Message-State: APjAAAVaEcmo+tBFkCcuDPCz6c8lxPNPmxKkEwEjXrELzkMWWtksN5NW bpUWjEP11VJzuakwajwNqOMAwQ== X-Google-Smtp-Source: APXvYqy8NWxr4UsxAfs4ZFu3Qa6r1PCDzR/mO6PksK93ygC0/2OPDBqgbMjUaZPdEPsuXPjL9mXzYw== X-Received: by 2002:a17:90a:9a90:: with SMTP id e16mr2401477pjp.71.1566342408627; Tue, 20 Aug 2019 16:06:48 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id q4sm27564747pff.183.2019.08.20.16.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 16:06:47 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v5 13/25] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Tue, 20 Aug 2019 23:06:14 +0000 Message-Id: <20190820230626.23253-14-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820230626.23253-1-john.stultz@linaro.org> References: <20190820230626.23253-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=OE/knvVfD1cUvaltFYKP0JvLLCHD/efyGm+69Rc7xlw=; b=t/W5hPjchDYa6sGZVIGnHO6x84ep6oMs8OQM95dG6M/wiomHPHQuiTvqt+n3CZLObc O+QoVXcBg9FH5iWKGRWKWGKakOXamJ+A1YDSsmZ/eag5qxWoPNbpY0T/FrWTQM4fA4bA 7a1CU2ujUC1Hcu2DpQygzwwEUXYz4SMH1LjAz7Lb/0cvZJQLByjhD8cu7uD48j0rDG8w OZig/Hnis2947iEqf9wJicr4akz0qfd58VRw9QeXmO0++iIIMihvCQLa+rg4497A7OlH dzqJVhg3Y7TS+g635mQguEl93U9enx9o+UtlHWnQjbKEsdI1sMNWx53aFsDToV8F/taD Yvzg== 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 , Xinliang Liu , Rongrong Zou , Sam Ravnborg MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 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 --- v5: checkpatch --strict whitespace fixups noticed by Sam --- 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 4c6646dfc465..a1a79f372bcd 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); };