From patchwork Tue Apr 23 23:20:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913847 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 1A77F1575 for ; Tue, 23 Apr 2019 23:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06E2C285D6 for ; Tue, 23 Apr 2019 23:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBC0628969; Tue, 23 Apr 2019 23:21:39 +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 888FC285D6 for ; Tue, 23 Apr 2019 23:21:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B8E1897C8; Tue, 23 Apr 2019 23:21:34 +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 80DBB89789 for ; Tue, 23 Apr 2019 23:21:24 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id y3so8345320pgk.12 for ; Tue, 23 Apr 2019 16:21:24 -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=yGwLHd/QsORrF/a1ijwtnZ+FE24YlLye7sgtz4UzsFE=; b=Ka1QU9D1fNLnqEWiM+ghsKxpncow45sHMGVhiBL/F0cWETR9LLnvndL6j+YP5in+2d cw84SM5uh//BgvGK/i5Z201b+99E9WPyND0ytgXWsB7SQqu5+P8OoHApog+Qwa/wJp5t wh6xEPBF8QVBE8hXVC3cYyhwtEhI1YYfYjE2oivObWTvPWOvW41++8129DuYwvQSYDjf nkwuGTjLOYTwG5vV2iQ3Nfdi1Y8kZkYdUALUAuYtmRbzeuD+Fvx61N/JiqmjMT+zn+EQ S4/Gb1aseooz7IW7DOXbhknSQoJI+nUP2Vq1aNBldu7MWKW2XnqC+pREw5T/ZLbhUoPA td9w== X-Gm-Message-State: APjAAAUEkMBNXe8wI52XZxIUBm4Oe8fR3ocsx9a3mIsLw437iQBg8ict vui6q6e+GfHgwxeUYzEm2FHxEQ== X-Google-Smtp-Source: APXvYqx4xkcgjslUOx5dI/zefCl0o3ZiR4S9OssYEKtes1yNrH8CUQdAzRyAgv7ZkgB3p9XTSiFj6w== X-Received: by 2002:a62:5ec2:: with SMTP id s185mr30576470pfb.16.1556061683551; Tue, 23 Apr 2019 16:21:23 -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.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:22 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 16/25] drm: kirin: Move plane number and primay plane in driver data Date: Tue, 23 Apr 2019 16:20:47 -0700 Message-Id: <1556061656-1733-17-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=yGwLHd/QsORrF/a1ijwtnZ+FE24YlLye7sgtz4UzsFE=; b=AYPTBmaPULPqQbE+sL+NfzdmJ/NSE/o6yP6F6cIWoYXmY0CqMRVYk/UqRfdeT4uWTu FQdwL60ib0zDfBNSOWNEuX694R0uH2Q9CsYZ6cr0WqglN6ZwWFkOV+H45t9HzzwIHfF6 TI6pgwM0e7lwezJzRWb8S/5jUO4lyyb+wNYhtZUOn36PlKzewKJIGzcfo2q+JVMNnxTJ wEiGjR5F0Vt9rkPbPUA6c5ldPVlCHSSYwiJlzTFoYBjKqKC8p1p3c4J1up/bV8J/s+Z8 AHvc9WgLr89MkVCoyF7TFjEgPCQ2l354ROa52gpn4GqMXWHhhrm6JSus+CzcxEkbheR+ 5IRA== 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 moves the number of planes and the primary plane value to the kirin_drm_data structure This will make it easier to add support for new devices via a new kirin_drm_data structure. 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 comit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 21 +++++++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0e68257..b6b1da6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -35,7 +35,6 @@ #include "kirin_drm_drv.h" #include "kirin_ade_reg.h" -#define PRIMARY_CH ADE_CH1 /* primary plane */ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 @@ -991,7 +990,7 @@ static int ade_drm_init(struct platform_device *pdev) struct kirin_plane *kplane; enum drm_plane_type type; int ret; - int i; + u32 ch; ade = devm_kzalloc(dev->dev, sizeof(*ade), GFP_KERNEL); if (!ade) { @@ -1015,12 +1014,15 @@ static int ade_drm_init(struct platform_device *pdev) * TODO: Now only support primary plane, overlay planes * need to do. */ - for (i = 0; i < ADE_CH_NUM; i++) { - kplane = &ade->planes[i]; - kplane->ch = i; + for (ch = 0; ch < ade_driver_data.num_planes; ch++) { + kplane = &ade->planes[ch]; + kplane->ch = ch; kplane->hw_ctx = ctx; - type = i == PRIMARY_CH ? DRM_PLANE_TYPE_PRIMARY : - DRM_PLANE_TYPE_OVERLAY; + + if (ch == ade_driver_data.prim_plane) + type = DRM_PLANE_TYPE_PRIMARY; + else + type = DRM_PLANE_TYPE_OVERLAY; ret = ade_plane_init(dev, kplane, type); if (ret) @@ -1028,7 +1030,8 @@ static int ade_drm_init(struct platform_device *pdev) } /* crtc init */ - ret = ade_crtc_init(dev, &kcrtc->base, &ade->planes[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &kcrtc->base, + &ade->planes[ade_driver_data.prim_plane].base); if (ret) return ret; @@ -1047,6 +1050,8 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { }; struct kirin_drm_data ade_driver_data = { + .num_planes = ADE_CH_NUM, + .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 700a203..59fc888 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -41,6 +41,8 @@ struct kirin_plane { struct kirin_drm_data { const u32 *channel_formats; u32 channel_formats_cnt; + u32 num_planes; + u32 prim_plane; const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_funcs *crtc_funcs;