From patchwork Thu Aug 1 03:44:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11070149 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 8E08B13B1 for ; Thu, 1 Aug 2019 03:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F39C283C3 for ; Thu, 1 Aug 2019 03:45:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73629283C8; Thu, 1 Aug 2019 03:45:34 +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 0F629283C3 for ; Thu, 1 Aug 2019 03:45:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3FF56E35D; Thu, 1 Aug 2019 03:45:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 143306E362 for ; Thu, 1 Aug 2019 03:45:25 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id u14so33173475pfn.2 for ; Wed, 31 Jul 2019 20:45:25 -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=gE/41V3p8E7KtwwzgftBMLTA6SAC75G2Kpa5UKCO8Qo=; b=Z9d4GRtndWj98SXqoj6iatHjY/0KxeVuJyY+EaDzfBFB/eD4YBoaN5E+ukdUdzDCym ZYROGO6nw8h7amfOjVbXROkmqoUWvWWBoHcLLtZOuUdFOy1g8YAPU76bzL24sBEFuwC8 m0Tr8JXwe/hwqRvw/zo40QL+58lm46rufSGrqihnoCUxZnLuGzruhW7TiwQdj1rB0mCH 1BWPl80kuR0HyQqPdAKcMNHYlA0d+OaVVMvCCU9tAqTN5PrUdQ4vgEDTBPV4pkDZL3kT PkTOjr5fV1HaoYtOdQMTt/jLLal6XZDKo8p7K6TnT7c6VKXWed70WSuVsQIBuh8kLO00 pLRg== X-Gm-Message-State: APjAAAXz0gG/ISJ4Bhh8ttV3kNGxuk+raZUec+lNW9RN/xuZgdD64ZUh 1rmIu1Fxr6FhWuDmly7RLuF5tA== X-Google-Smtp-Source: APXvYqwT1VFMzc9tchbe9OkpDTvnzfmXSm4NMZYpWM+g4G4Q0+yWy9eVQ91PrnNFB3Ofujh71vMk+Q== X-Received: by 2002:a63:5c7:: with SMTP id 190mr114583297pgf.67.1564631124394; Wed, 31 Jul 2019 20:45:24 -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.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:23 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 25/26] drm: kirin: Pass driver data to crtc init and plane init Date: Thu, 1 Aug 2019 03:44:38 +0000 Message-Id: <20190801034439.98227-26-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=gE/41V3p8E7KtwwzgftBMLTA6SAC75G2Kpa5UKCO8Qo=; b=C5j8hBfr3aQsA/OwNaVL8RCHkNAn9o85zTFnFGuituGatDhp15FNjaHXBlQlTMU6rz R9Ueq+9X6/0S14B9yYKbMcun3w2oWE/LS2TLZtVeagOiBxnh6zj4VD9+wgFm8U/37cqw FsiOGw/k9+82qWFd/6b3+1sKJwJmKS4rmnrGjNbWYe/U+gCgkMNLxgOdd0CFCrmaOV43 0K5yQZTMiRJy7XWuING4I+3VjkycyWBXP3G9qfOOFokyx0en29yAN4ha6CvcK7Fe3d0k PuqkPSdckPrm32/FuFGSFPpayCgH1l5vV3xwmBy4dlS/yIVPUbWbBRiOLkgguX/cQqYm g3FQ== 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 changes the code via a passed in driver_data pointer, rather than hardcoding them via ade_driver_data variable. This will allow those funcitons to be later moved to the generic kirin_drm_drv.c using alternative driver_data structures that support other hardware. 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 --- v2: Whitespace fixups, commit message tweaks suggested by Sam. --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index f729a1de6e14..ab0c5d03903d 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { }; static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, - struct drm_plane *plane) + struct drm_plane *plane, + const struct kirin_drm_data *driver_data) { struct device_node *port; int ret; @@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - ade_driver_data.crtc_funcs, NULL); + driver_data->crtc_funcs, NULL); if (ret) { DRM_ERROR("failed to init crtc.\n"); return ret; } - drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs); + drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs); return 0; } @@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = { static int kirin_drm_plane_init(struct drm_device *dev, struct kirin_plane *kplane, - enum drm_plane_type type) + enum drm_plane_type type, + const struct kirin_drm_data *driver_data) { int ret = 0; ret = drm_universal_plane_init(dev, &kplane->base, 1, - ade_driver_data.plane_funcs, - ade_driver_data.channel_formats, - ade_driver_data.channel_formats_cnt, - NULL, type, NULL); + driver_data->plane_funcs, + driver_data->channel_formats, + driver_data->channel_formats_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_driver_data.plane_helper_funcs); + drm_plane_helper_add(&kplane->base, driver_data->plane_helper_funcs); return 0; } @@ -1024,14 +1026,15 @@ static int ade_drm_init(struct platform_device *pdev) else type = DRM_PLANE_TYPE_OVERLAY; - ret = kirin_drm_plane_init(dev, kplane, type); + ret = kirin_drm_plane_init(dev, kplane, type, &ade_driver_data); if (ret) return ret; } /* crtc init */ ret = kirin_drm_crtc_init(dev, &kcrtc->base, - &ade->planes[ade_driver_data.prim_plane].base); + &ade->planes[ade_driver_data.prim_plane].base, + &ade_driver_data); if (ret) return ret;