From patchwork Tue Apr 23 23:20:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913821 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 66FAF14DB for ; Tue, 23 Apr 2019 23:21:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55ED6285D6 for ; Tue, 23 Apr 2019 23:21:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48A2628969; Tue, 23 Apr 2019 23:21:08 +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 CCD74285D6 for ; Tue, 23 Apr 2019 23:21:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A033896ED; Tue, 23 Apr 2019 23:21:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2FB178972C for ; Tue, 23 Apr 2019 23:21:02 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id f36so8247924plb.5 for ; Tue, 23 Apr 2019 16:21:02 -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=7ws3Dd9BPtQNXdrE11DrYoo1hw98ZqIgdLIuIoohWAI=; b=Nb4NhwwKtZhN6zE303pSiWLxsoeHKUQv8TLarqu0blsdYjQhZYCojTB9cjE7ZHd6/y ExKEH1zAUATMEqRw9/TC7hGK6sHX0uPvX3uzbncj+BP8vZ/gTJqMZkdy6x8DdJxIWuQE fGr4mkcr1MSTfS/PbDQoSijZsDDzIngeAjh/36/5/yGzOce8Rnm9HP2x5xe0KIKF0Q5k MqCrF9vc+tVcme1XGX8kbPYIFk3jW4Mc/AkWM8hR/bUFEjCQ9ytxfEHShKnZlm8GSdDK pMw/Q+KEnY6ShBy7gSPRKlKliyqtbV+UPvUKoXu7MBuNOXn5GyuNl0zdxTa1JcFvTxZY 6p4A== X-Gm-Message-State: APjAAAUHFbPXUwM/fZj4IegERe5GprBX4OV31qOuK2NGIUzOfVkxoQd4 EIttmduaHXTU0rI5XOJm3CEVbw== X-Google-Smtp-Source: APXvYqwsyaUiw7o1uBnCgw9SPEnaS1Y92ydgJWTukVYM8eJMcb6g6lyEOjvMv/xGEOLTaxGwqm+f3w== X-Received: by 2002:a17:902:263:: with SMTP id 90mr29348524plc.257.1556061661621; Tue, 23 Apr 2019 16:21:01 -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.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:00 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 01/25] drm: kirin: Fix for hikey620 display offset problem Date: Tue, 23 Apr 2019 16:20:32 -0700 Message-Id: <1556061656-1733-2-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=7ws3Dd9BPtQNXdrE11DrYoo1hw98ZqIgdLIuIoohWAI=; b=vOlspHR05P7wEGxI/4z2kZzKI04SunMOWWy1zhhr3rUFzMseipE5BG8dgRvRjT39r5 TmB3GfVEW/EMe3pLxSJfOIvPul16TcafmVWyQfBsssAE2plbwkLhg1B5xp5RBfaGFygk 9HA7w/JdxmUZkix8IpEpgAxLIanq034B0rpx+PqKuGD8jc9oYLf8d4A7SbFHA7q6uTIG bS1dvU1Z0pD233XfI+8MtIn0hV4Vxk1QSRnQchQozT7TOngkOE/+pNzgXV54J6ZJ7uM8 hnumrjo13fCydbP9e+89R7W/yQVw52cut4pqQ5XbnqYJmQ5vyZHFlemrzFWJyj9OYADs 7jAg== 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: David Airlie , Chen Feng , dri-devel , Xinliang Liu , Rongrong Zou , Xinwei Kong , Da Lv , Yidong Lin MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Da Lv The original HiKey (620) board has had a long running issue where when using a 1080p montior, the display would occasionally blink and come come back with a horizontal offset (usually also shifting the colors, depending on the value of the offset%4). After lots of analysis by HiSi developers, they found the issue was due to when running at 1080p, it was possible to hit the device memory bandwidth limits, which could cause the DSI signal to get out of sync. Unfortunately the DSI logic doesn't have the ability to automatically recover from this situation, but we can get a an LDI underflow interrupt when it happens. To then correct the issue, when we get an LDI underflow irq, we we can simply suspend and resume the display, which resets the hardware. Thus, this patch enables the ldi underflow interrupt, and initializes a workqueue that is used to suspend/resume the display to recover. Then when the irq occurs we clear it and schedule the workqueue to reset display engine. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Da Lv Signed-off-by: Yidong Lin [jstultz: Reworded the commit message, checkpatch cleanups] Signed-off-by: John Stultz --- v2: Minor cleanups --- drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h | 6 ++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h index 4cf281b7..ced40c6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h @@ -87,6 +87,7 @@ #define VSIZE_OFST 20 #define LDI_INT_EN 0x741C #define FRAME_END_INT_EN_OFST 1 +#define UNDERFLOW_INT_EN_OFST 2 #define LDI_CTRL 0x7420 #define BPP_OFST 3 #define DATA_GATE_EN BIT(2) @@ -97,6 +98,11 @@ #define LDI_HDMI_DSI_GT 0x7434 /* + *BIT_LDI_UNFLOW + */ +#define BIT_LDI_UNFLOW BIT(2) + +/* * ADE media bus service regs */ #define ADE0_QOSGENERATOR_MODE 0x010C diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 73611a9..beb2a3c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -58,6 +58,7 @@ struct ade_hw_ctx { struct ade_crtc { struct drm_crtc base; struct ade_hw_ctx *ctx; + struct work_struct drm_device_wq; bool enable; u32 out_format; }; @@ -176,6 +177,7 @@ static void ade_init(struct ade_hw_ctx *ctx) */ ade_update_bits(base + ADE_CTRL, FRM_END_START_OFST, FRM_END_START_MASK, REG_EFFECTIVE_IN_ADEEN_FRMEND); + ade_update_bits(base + LDI_INT_EN, UNDERFLOW_INT_EN_OFST, MASK(1), 1); } static bool ade_crtc_mode_fixup(struct drm_crtc *crtc, @@ -345,6 +347,17 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) MASK(1), 0); } +static void drm_underflow_wq(struct work_struct *work) +{ + struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + drm_device_wq); + struct drm_device *drm_dev = (&acrtc->base)->dev; + struct drm_atomic_state *state; + + state = drm_atomic_helper_suspend(drm_dev); + drm_atomic_helper_resume(drm_dev, state); +} + static irqreturn_t ade_irq_handler(int irq, void *data) { struct ade_crtc *acrtc = data; @@ -362,6 +375,12 @@ static irqreturn_t ade_irq_handler(int irq, void *data) MASK(1), 1); drm_crtc_handle_vblank(crtc); } + if (status & BIT_LDI_UNFLOW) { + ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, + MASK(1), 1); + DRM_ERROR("LDI underflow!"); + schedule_work(&acrtc->drm_device_wq); + } return IRQ_HANDLED; } @@ -1038,6 +1057,9 @@ static int ade_drm_init(struct platform_device *pdev) /* vblank irq init */ ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, IRQF_SHARED, dev->driver->name, acrtc); + + INIT_WORK(&acrtc->drm_device_wq, drm_underflow_wq); + if (ret) return ret; From patchwork Tue Apr 23 23:20:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913823 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 D1FC114DB for ; Tue, 23 Apr 2019 23:21:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C29A9285D6 for ; Tue, 23 Apr 2019 23:21:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6E3D28969; Tue, 23 Apr 2019 23:21:10 +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 B7297285D6 for ; Tue, 23 Apr 2019 23:21:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9EDB389722; Tue, 23 Apr 2019 23:21:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id D721289568 for ; Tue, 23 Apr 2019 23:21:03 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id l18so8226367pgj.6 for ; Tue, 23 Apr 2019 16:21:03 -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=ffq6t3h4iha2b8rRhkjsypDQIKuHdAwEEoooYwQNUbA=; b=Kto/cS7NeGzSRa/N1DFDRbzWgVVi0jU4y4DsxF8sA2OiE2lC9OcSwxGtiDP5UIJgwb S3Vpca3mTfllHuU+Pemo6TBPR+Ea7QXPefCvkZgtv26Qnf+/oC8RuSRRS3so52AFmD5X 22G8KZhneyhNcoaskgOj9Rh/XNADS6R/iivL04gtBUuNypJYdzL7cgfrHMW79dKICiTu FRKrhJI9xrtnRRiYpcg8fziLdHFi99wn1lOskLREJLR0Aa1HLaTFtClxXTt6KpttPXZU ZrsRt7MLnejSxNqbnV7/yygGgv+K4+5VcAjCgAJx5baJI47aHV7KwXrw69U2UsneXyPU fKuw== X-Gm-Message-State: APjAAAXjB+uqzdLlx/vCaUjAihPHxp+PZFyxYWpT/2dv3dEn7/LjI4ap biT0GU9oeLsph50kUf51q9wjaA== X-Google-Smtp-Source: APXvYqyy7+HL910ob3T/U/6+X+behbvUMZtG72iWdqYN0rvFz1h1auspIOq2AIb3SBVVn4K+kYH1dQ== X-Received: by 2002:a63:7e10:: with SMTP id z16mr28060734pgc.40.1556061663317; Tue, 23 Apr 2019 16:21:03 -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.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:02 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 02/25] drm: kirin: Remove HISI_KIRIN_DW_DSI config option Date: Tue, 23 Apr 2019 16:20:33 -0700 Message-Id: <1556061656-1733-3-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=ffq6t3h4iha2b8rRhkjsypDQIKuHdAwEEoooYwQNUbA=; b=pbjIoTJHu8+xPePFhwY4xi9ya/ligccZ0pj7BpUULWYCP1l020YPTE4IeijEjdARQq tpgr7CKCzne4FecwXpBNa5o1486idq5SFsH9RMOUef8xBqn6yDeyN1Zii7clSuLcepNk +2h5o6st23kjLObnaMHmTvvU37Tbcl0EntgE8AiEy7MQjYedduMhHpmYLRrkGCYiJ9b9 sX5Ew3NodXoIrY/dAXLQB8uN6tBP5QQL0iR8wcrMUKaP7wkHj7HXdp8ubct0QQ0oqWLO ijP3pNdtoxkx1zxJxYHPGHqr6SO1x+MguxaOhkD4Li8luNGdQhZ5lKl1tgXyJ8Xstxj+ hQCA== 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: 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 The CONFIG_HISI_KIRIN_DW_DSI option is only used w/ kirin driver, so cut out the middleman and condense the config logic down. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/Kconfig | 10 +--------- drivers/gpu/drm/hisilicon/kirin/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/Kconfig b/drivers/gpu/drm/hisilicon/kirin/Kconfig index 499f644..6ef7906 100644 --- a/drivers/gpu/drm/hisilicon/kirin/Kconfig +++ b/drivers/gpu/drm/hisilicon/kirin/Kconfig @@ -4,16 +4,8 @@ config DRM_HISI_KIRIN select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER - select HISI_KIRIN_DW_DSI + select DRM_MIPI_DSI help Choose this option if you have a hisilicon Kirin chipsets(hi6220). If M is selected the module will be called kirin-drm. -config HISI_KIRIN_DW_DSI - tristate "HiSilicon Kirin specific extensions for Synopsys DW MIPI DSI" - depends on DRM_HISI_KIRIN - select DRM_MIPI_DSI - help - This selects support for HiSilicon Kirin SoC specific extensions for - the Synopsys DesignWare DSI driver. If you want to enable MIPI DSI on - hi6220 based SoC, you should selet this option. diff --git a/drivers/gpu/drm/hisilicon/kirin/Makefile b/drivers/gpu/drm/hisilicon/kirin/Makefile index cdf6158..3585327 100644 --- a/drivers/gpu/drm/hisilicon/kirin/Makefile +++ b/drivers/gpu/drm/hisilicon/kirin/Makefile @@ -1,6 +1,6 @@ kirin-drm-y := kirin_drm_drv.o \ - kirin_drm_ade.o + kirin_drm_ade.o \ + dw_drm_dsi.o obj-$(CONFIG_DRM_HISI_KIRIN) += kirin-drm.o -obj-$(CONFIG_HISI_KIRIN_DW_DSI) += dw_drm_dsi.o From patchwork Tue Apr 23 23:20:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913855 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 607BE1575 for ; Tue, 23 Apr 2019 23:21:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 524AC285D6 for ; Tue, 23 Apr 2019 23:21:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 466ED28969; Tue, 23 Apr 2019 23:21:47 +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 F3820285D6 for ; Tue, 23 Apr 2019 23:21:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CA52897E8; Tue, 23 Apr 2019 23:21:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CAFC896ED for ; Tue, 23 Apr 2019 23:21:05 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id y3so8345031pgk.12 for ; Tue, 23 Apr 2019 16:21:05 -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=PJpt961AUotkx92U9UhQ+Xu1suFDY3Q+xFz+vrGcjE4=; b=rwM4Sc7l2dKKIUng+9qhFA9sfQ6NoMvT1iQ65CsqrCnJbApeEyHdythqtHaJIK1Is4 KODLaUUksyH8srz+MqEJlYcQ3cAiCcYOIl41vMvbp7njLMy8MWwgzJmVQIJc9ntm2Rgh YxZHc+J8XjaDS7LgT5Vww+sd+lM4dxcvl9iwyZhnq7W3ZFsA9sf+uceNnIbLRaxCVYCV mgMsycxgEz6DO8Z7Oc87M9pAYzBaOkhCRW9tUApVmyeL5jWiOOtrzWuVN0sE3wGeXKva 9FJspZ4OLIUmRcyyCMGdb20FCeAGe2cRQiPe9SjlvV+L9wsuaV81qg6IY1kluaQpytd2 07lg== X-Gm-Message-State: APjAAAWZRnxVz9UbI+kmlEoxyLQ4nvtQCORsJ6jp+XDpiUSHyT1Ztt5K sKFREzo2MYfeAc+a9nlyQ0eEMg== X-Google-Smtp-Source: APXvYqyUlIaK+U1ReA6lItnW8fmKebrGKmYIDisAG1J6wlj/1UzHFWPbBZCESsA8GvKTEPWg6fbcpg== X-Received: by 2002:a65:5202:: with SMTP id o2mr27247072pgp.402.1556061664628; Tue, 23 Apr 2019 16:21:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:03 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 03/25] drm: kirin: Remove unreachable return Date: Tue, 23 Apr 2019 16:20:34 -0700 Message-Id: <1556061656-1733-4-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=PJpt961AUotkx92U9UhQ+Xu1suFDY3Q+xFz+vrGcjE4=; b=AmWnkmaLsdXPfYTFhHB5uW5qtrJ6UY93Uhapl8moRr/XyDxKUfPDiduErIL0PZSlXT jZSnCoKEVWH8f7Saj0aer4vXinxRi6YUL5ddDdh9ABXRAXWaUDnRhqI4m23CWENhK4tv ZtrL69sGTtL5esCcVyl1Emz05kbVxAIoAeHY6NDAPZJeFpirI0MTqF2RRmrBYxt6YRRy hsr0wbgZxAudSHehCPOOkKXwvtZyL58jBvvylzmCb962pVnepYpM/QzX4vfxT7+wjpuo SC80FeVylBl4aAQ4+GMHOd+V98/28MyE3Qtxdg6McYZzC8nHucF0ilLQ9w9P5wUYx4pj 8UeQ== 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: 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 The 'return 0' in kirin_drm_platform_probe() is unreachable code, so remove it. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Suggested by: Xu YiPing Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 7cb7c04..c9297d6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -212,8 +212,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) of_node_put(remote); return component_master_add_with_match(dev, &kirin_drm_ops, match); - - return 0; } static int kirin_drm_platform_remove(struct platform_device *pdev) From patchwork Tue Apr 23 23:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913829 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 865BF1575 for ; Tue, 23 Apr 2019 23:21:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77B7B285D6 for ; Tue, 23 Apr 2019 23:21:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63C982896F; Tue, 23 Apr 2019 23:21:16 +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 0B444285D6 for ; Tue, 23 Apr 2019 23:21:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20C878973E; Tue, 23 Apr 2019 23:21:12 +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 128B68973E for ; Tue, 23 Apr 2019 23:21:07 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id z16so3743583pgv.11 for ; Tue, 23 Apr 2019 16:21:07 -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=vuhHNfWnMx8uWZhY+QeUk1qBtGP4f5NldA6jQRHm+6s=; b=dVMNmOV3e2WWLW/hvpeUvNga3doTiYh3A/htUKLxIRIUmh6O3rek5AWfpg2sTlhrU9 7FCCt4KQEvVvK5gVKe8iRQzBFNEl9fxRIWh4Trq+Vk1G8wAPqiBEeECUyeIBhaXj/HSn dMdMvJPIPlhb6J2hnsoLwqctvPSkSOUeKOlU6tWyEj3QCVZpgLkshmlkfxGbOrtC/wMA D2kzMiXvicER9+pEat0huB8nlF/69CjVGFoB0V0xkZVeoMUNZeldZYNIraBZZl3D97eP mQ0EIQAJ2uXff7dR4zMq6zyJ9488Fl+BkbT+55Cn0W5ilMuehtUQE7iN5prarJqXrQ6j I1Sg== X-Gm-Message-State: APjAAAWLS5QKod6IxAMdNLyfR3afX/qXk0SR5nx0QCBntKueR+bA/04G Fxe8hxx8WxcfnieJV4OdEFv50A== X-Google-Smtp-Source: APXvYqyU5nndpzr0QoWum+fQJyhtInddKfe6IAExSW1yiBxCfRbTNkbhkh/AY20A0+K5tMxuOD6cUA== X-Received: by 2002:a62:1c87:: with SMTP id c129mr4927145pfc.113.1556061666498; Tue, 23 Apr 2019 16:21:06 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:05 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 04/25] drm: kirin: Remove uncessary parameter indirection Date: Tue, 23 Apr 2019 16:20:35 -0700 Message-Id: <1556061656-1733-5-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=vuhHNfWnMx8uWZhY+QeUk1qBtGP4f5NldA6jQRHm+6s=; b=NQairEvLvSGh1SguVJ2rpCemcsun3HCniG1nJhW94XLuu7Ucb+iUdicNtGfflaMyUt MkrpWYirbCzWneqOb6R778tc9wbpCvxtcsrXfukpO27qUFuVsgTpP46Y5lrOKq9SR+zY ggMFp7R1m+u3dwTHZ2tIJW17pfMqlvGUsrZChyaGacT8cyxLEUyN9Qfc6jSMCBMGOZLl tHl5Phh9o8xC65tjxfg+VOplgFnhiaYcsGeR9QqyVVZJdXv+hRopVBIckebvJOQpVQNj FbpPMtEnmslUKSHEwPR1cmD/JV6yo9G1WlwxkY7QWyb2LCkNk64yJ7ARC+xgLv0rkL9c YD/Q== 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 In a few functions, we pass in a struct ade_crtc, which we only use to get to the underlying struct ade_hw_ctx. Thus this patch refactors the functions to just take the struct ade_hw_ctx directly. 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 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index beb2a3c..56a55d9 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -210,11 +210,10 @@ static void ade_set_pix_clk(struct ade_hw_ctx *ctx, adj_mode->clock = clk_get_rate(ctx->ade_pix_clk) / 1000; } -static void ade_ldi_set_mode(struct ade_crtc *acrtc, +static void ade_ldi_set_mode(struct ade_hw_ctx *ctx, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) { - struct ade_hw_ctx *ctx = acrtc->ctx; void __iomem *base = ctx->base; u32 width = mode->hdisplay; u32 height = mode->vdisplay; @@ -301,9 +300,8 @@ static void ade_power_down(struct ade_hw_ctx *ctx) ctx->power_on = false; } -static void ade_set_medianoc_qos(struct ade_crtc *acrtc) +static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx) { - struct ade_hw_ctx *ctx = acrtc->ctx; struct regmap *map = ctx->noc_regmap; regmap_update_bits(map, ADE0_QOSGENERATOR_MODE, @@ -515,7 +513,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, return; } - ade_set_medianoc_qos(acrtc); + ade_set_medianoc_qos(ctx); ade_display_enable(acrtc); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); @@ -545,7 +543,7 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) if (!ctx->power_on) (void)ade_power_up(ctx); - ade_ldi_set_mode(acrtc, mode, adj_mode); + ade_ldi_set_mode(ctx, mode, adj_mode); } static void ade_crtc_atomic_begin(struct drm_crtc *crtc, @@ -558,7 +556,7 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc, if (!ctx->power_on) (void)ade_power_up(ctx); - ade_ldi_set_mode(acrtc, mode, adj_mode); + ade_ldi_set_mode(ctx, mode, adj_mode); } static void ade_crtc_atomic_flush(struct drm_crtc *crtc, From patchwork Tue Apr 23 23:20:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913825 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 61B3314DB for ; Tue, 23 Apr 2019 23:21:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 541F3285D6 for ; Tue, 23 Apr 2019 23:21:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 489FD2896F; Tue, 23 Apr 2019 23:21:12 +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 D6E68285D6 for ; Tue, 23 Apr 2019 23:21:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 819DB8972D; Tue, 23 Apr 2019 23:21:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6877D8972D for ; Tue, 23 Apr 2019 23:21:08 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id z16so3743619pgv.11 for ; Tue, 23 Apr 2019 16:21:08 -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=/bl8KjJZ8VdKQUaQRpB+hHEQjF/aOlCQlEyUX72UB6E=; b=m2TIBi08ce8lrfQIgHo1LssGDB9wSRjkUeCoDnpHygHPeTjr13q0RJOzOX5J3cvilF Y/dRFfPk/KsCX70ko7sP3EzCeW78hnuQuDeit14xmOxL26L1P0J9OMqxBjoR9WNZmjkX K8ZOst075ba9Q2ypYSgjCYy5tDqgO633Abp/Q+Pd+8TuzuV+rkn5y0GkqTdrAOP6d6ph 43aIEczaTmTDN3JrSBSmbNg9RxtdIeuh7xuwQQPBvg97UT4Cz0xyvlUvSe2qh35ePxIP 7n3deydSHNHFZAzyVJozkx8VFzWYjnuRIZu9DeOvxUCmYQ45xoRW027931ewJyHWtydz aQoQ== X-Gm-Message-State: APjAAAVC8esV+epxj2Lx52WYyTTCO90d4q7A1b7q4PMYEJ7j38d/Vcd1 6eqUwgpcUTy4NgDBwpKbhbL11A== X-Google-Smtp-Source: APXvYqybCUl1ESlOHxixy4zHex8X6auuxEd3pYgD+rEA0e1A5nQ0uG8/073n5wgpDK5+PbJOxhszuQ== X-Received: by 2002:a62:1d94:: with SMTP id d142mr29806248pfd.83.1556061667802; Tue, 23 Apr 2019 16:21:07 -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.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:07 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 05/25] drm: kirin: Remove out_format from ade_crtc Date: Tue, 23 Apr 2019 16:20:36 -0700 Message-Id: <1556061656-1733-6-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=/bl8KjJZ8VdKQUaQRpB+hHEQjF/aOlCQlEyUX72UB6E=; b=OtmWoZBIcZcpMPhq5QJY7URkVpfaVsaraS6hIv67HgjGOoxqt57yVNkoo6100XtjNx kBnwpBmgfo5Ta4Cq1nVSgLojL8KlHU/Z3ytxnOQISl+0ockKjuwM9vsPDkKXhFHIjVhm obMXeYCsaNw6s033mdWlROD0fpuMO1WntVXFqmdt4dF1yifXbIAcvvs6l/e2qp7GUKpj exbe91fcZi/UYhi8rWQdXk7fBLbLhBq2ifYh0ZUpYwhliv/JigIRtClhoVm9eIVAApud 468K0QK2vuGUEpUFcS1okbeGuAWNqzFvLfdt3OCSGv0Rg+HHkbry27Q4ppANyq73P5ud 1+EA== 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 removes the out_format field in the struct ade_crtc, which was only ever set to LDI_OUT_RGB_888. Thus this patch removes the field and instead directly uses LDI_OUT_RGB_888. 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 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 56a55d9..27a5441 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -60,7 +60,6 @@ struct ade_crtc { struct ade_hw_ctx *ctx; struct work_struct drm_device_wq; bool enable; - u32 out_format; }; struct ade_plane { @@ -383,11 +382,10 @@ static irqreturn_t ade_irq_handler(int irq, void *data) return IRQ_HANDLED; } -static void ade_display_enable(struct ade_crtc *acrtc) +static void ade_display_enable(struct ade_hw_ctx *ctx) { - struct ade_hw_ctx *ctx = acrtc->ctx; void __iomem *base = ctx->base; - u32 out_fmt = acrtc->out_format; + u32 out_fmt = LDI_OUT_RGB_888; /* enable output overlay compositor */ writel(ADE_ENABLE, base + ADE_OVLYX_CTL(OUT_OVLY)); @@ -514,7 +512,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, } ade_set_medianoc_qos(ctx); - ade_display_enable(acrtc); + ade_display_enable(ctx); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); acrtc->enable = true; @@ -1024,7 +1022,6 @@ static int ade_drm_init(struct platform_device *pdev) ctx = &ade->ctx; acrtc = &ade->acrtc; acrtc->ctx = ctx; - acrtc->out_format = LDI_OUT_RGB_888; ret = ade_dts_parse(pdev, ctx); if (ret) From patchwork Tue Apr 23 23:20:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913827 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 B45141575 for ; Tue, 23 Apr 2019 23:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A377E285D6 for ; Tue, 23 Apr 2019 23:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97FE828970; Tue, 23 Apr 2019 23:21:14 +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 175D92895F for ; Tue, 23 Apr 2019 23:21:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31C2789736; Tue, 23 Apr 2019 23:21:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35F448972D for ; Tue, 23 Apr 2019 23:21:10 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id d31so8361249pgl.7 for ; Tue, 23 Apr 2019 16:21:10 -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=DvGXg8jivUTV+n5vONXfna2nW1twVfjjnPtpm0T5HXo=; b=f8ODZmZL/MBUJslJH/8KlErzcOorNcjWT5C1dPWXC9bxxEc14q9l/xiKkYwbELE0sZ UgdOVG8ulK2s8rGK4oSHIvwUpOfwu6CGr7YGWR/bAlbooHI0y4PrqAU4l/3sJd5ROtpy 1k5KWHQq4AVqh4M0zKfOcQmEp+gLAZolj/1+534zVhwoXPFLnL7ldpcz2VxEKcrMVHAD RhJiKisJtpUbCZNVq6BE0186a9JwFDiQwwLAVolOR5CX+AA873nIBEb+22Cv6cufE/T9 F/884yJ+sJ9VA++y2flWVDOaav/EafKdjfy3/va6QQWBjfJIhe+Cu6g6UtIROoF/81Jt KDxw== X-Gm-Message-State: APjAAAXUAbNsIg2YD1oK7cmOzntRO42qWG2TqTKSh4BVFjjX8YvrKJXY NQk1o17mq1sy6mndRAHqxCxxmA== X-Google-Smtp-Source: APXvYqyAvxDUilcktH+6XRWek7LPMSsg6O1HVQtsJu2ELkYiMLsR/yRPKk2D7OsCpdbUeG/UoUsPSA== X-Received: by 2002:a62:a513:: with SMTP id v19mr29373670pfm.212.1556061669266; Tue, 23 Apr 2019 16:21:09 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:08 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 06/25] drm: kirin: Rename ade_plane to kirin_plane Date: Tue, 23 Apr 2019 16:20:37 -0700 Message-Id: <1556061656-1733-7-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=DvGXg8jivUTV+n5vONXfna2nW1twVfjjnPtpm0T5HXo=; b=KrpWhKYW3Rt3OXTN4s/LhMn1SA/vDPr40ld8JhkyD2zMO5eJRf04FrAZ6Nx06TZKtf 8QpH25Eis+u+ebanyinpluKKZ6DweUpfjUZw185649keXFPW5eUNN/VpRqL5Ppkoitkg P/LJ1ayWw9uoe2uZFK6kCIRDjn+evIR1Tq2nVfcsrZ1Cl+/1mHvkdla9RKI4V/H9unzi D2ZGzuC/AgRRev9P33HxO05DFP7BSB/tWY0m/L21Z4Vxb9I6XYuRt+usNHBxvfxJc6hc 2aZQFuUcITPHGThudIK9btSOvA3YX3UuGyjPBY1FqRq1E3y3qq0acm479HWiX3GDbkvu 5kpQ== 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 renames the struct ade_plane to kirin_plane. The struct kirin_plane will later used by both kirin620 and future kirin960 driver, and will be moved to a common kirin_drm_drv.h in a future patch 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 | 57 +++++++++++++------------ 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 27a5441..a229da9 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -41,8 +41,9 @@ #define to_ade_crtc(crtc) \ container_of(crtc, struct ade_crtc, base) -#define to_ade_plane(plane) \ - container_of(plane, struct ade_plane, base) +#define to_kirin_plane(plane) \ + container_of(plane, struct kirin_plane, base) + struct ade_hw_ctx { void __iomem *base; @@ -62,15 +63,15 @@ struct ade_crtc { bool enable; }; -struct ade_plane { +struct kirin_plane { struct drm_plane base; - void *ctx; - u8 ch; /* channel */ + void *hw_ctx; + u32 ch; }; struct ade_data { struct ade_crtc acrtc; - struct ade_plane aplane[ADE_CH_NUM]; + struct kirin_plane planes[ADE_CH_NUM]; struct ade_hw_ctx ctx; }; @@ -795,16 +796,16 @@ static void ade_compositor_routing_disable(void __iomem *base, u32 ch) /* * Typicaly, a channel looks like: DMA-->clip-->scale-->ctrans-->compositor */ -static void ade_update_channel(struct ade_plane *aplane, +static void ade_update_channel(struct kirin_plane *kplane, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, u32 src_x, u32 src_y, u32 src_w, u32 src_h) { - struct ade_hw_ctx *ctx = aplane->ctx; + struct ade_hw_ctx *ctx = kplane->hw_ctx; void __iomem *base = ctx->base; u32 fmt = ade_get_format(fb->format->format); - u32 ch = aplane->ch; + u32 ch = kplane->ch; u32 in_w; u32 in_h; @@ -828,11 +829,11 @@ static void ade_update_channel(struct ade_plane *aplane, ade_compositor_routing_set(base, ch, crtc_x, crtc_y, in_w, in_h, fmt); } -static void ade_disable_channel(struct ade_plane *aplane) +static void ade_disable_channel(struct kirin_plane *kplane) { - struct ade_hw_ctx *ctx = aplane->ctx; + struct ade_hw_ctx *ctx = kplane->hw_ctx; void __iomem *base = ctx->base; - u32 ch = aplane->ch; + u32 ch = kplane->ch; DRM_DEBUG_DRIVER("disable channel%d\n", ch + 1); @@ -894,10 +895,10 @@ static int ade_plane_atomic_check(struct drm_plane *plane, static void ade_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct drm_plane_state *state = plane->state; - struct ade_plane *aplane = to_ade_plane(plane); + struct drm_plane_state *state = plane->state; + struct kirin_plane *kplane = to_kirin_plane(plane); - ade_update_channel(aplane, state->fb, state->crtc_x, state->crtc_y, + ade_update_channel(kplane, state->fb, state->crtc_x, state->crtc_y, state->crtc_w, state->crtc_h, state->src_x >> 16, state->src_y >> 16, state->src_w >> 16, state->src_h >> 16); @@ -906,9 +907,9 @@ static void ade_plane_atomic_update(struct drm_plane *plane, static void ade_plane_atomic_disable(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct ade_plane *aplane = to_ade_plane(plane); + struct kirin_plane *kplane = to_kirin_plane(plane); - ade_disable_channel(aplane); + ade_disable_channel(kplane); } static const struct drm_plane_helper_funcs ade_plane_helper_funcs = { @@ -926,7 +927,7 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int ade_plane_init(struct drm_device *dev, struct ade_plane *aplane, +static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, enum drm_plane_type type) { const u32 *fmts; @@ -934,18 +935,18 @@ static int ade_plane_init(struct drm_device *dev, struct ade_plane *aplane, int ret = 0; /* get properties */ - fmts_cnt = ade_get_channel_formats(aplane->ch, &fmts); + fmts_cnt = ade_get_channel_formats(kplane->ch, &fmts); if (ret) return ret; - ret = drm_universal_plane_init(dev, &aplane->base, 1, &ade_plane_funcs, + ret = drm_universal_plane_init(dev, &kplane->base, 1, &ade_plane_funcs, fmts, fmts_cnt, NULL, type, NULL); if (ret) { - DRM_ERROR("fail to init plane, ch=%d\n", aplane->ch); + DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; } - drm_plane_helper_add(&aplane->base, &ade_plane_helper_funcs); + drm_plane_helper_add(&kplane->base, &ade_plane_helper_funcs); return 0; } @@ -1007,7 +1008,7 @@ static int ade_drm_init(struct platform_device *pdev) struct ade_data *ade; struct ade_hw_ctx *ctx; struct ade_crtc *acrtc; - struct ade_plane *aplane; + struct kirin_plane *kplane; enum drm_plane_type type; int ret; int i; @@ -1033,19 +1034,19 @@ static int ade_drm_init(struct platform_device *pdev) * need to do. */ for (i = 0; i < ADE_CH_NUM; i++) { - aplane = &ade->aplane[i]; - aplane->ch = i; - aplane->ctx = ctx; + kplane = &ade->planes[i]; + kplane->ch = i; + kplane->hw_ctx = ctx; type = i == PRIMARY_CH ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; - ret = ade_plane_init(dev, aplane, type); + ret = ade_plane_init(dev, kplane, type); if (ret) return ret; } /* crtc init */ - ret = ade_crtc_init(dev, &acrtc->base, &ade->aplane[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &acrtc->base, &ade->planes[PRIMARY_CH].base); if (ret) return ret; From patchwork Tue Apr 23 23:20: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: 10913833 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 CCF4C1575 for ; Tue, 23 Apr 2019 23:21:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDB08285D6 for ; Tue, 23 Apr 2019 23:21:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B252128969; Tue, 23 Apr 2019 23:21:24 +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 202D5285D6 for ; Tue, 23 Apr 2019 23:21:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A785089781; Tue, 23 Apr 2019 23:21:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4E18489740 for ; Tue, 23 Apr 2019 23:21:11 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id c207so8244801pfc.7 for ; Tue, 23 Apr 2019 16:21:11 -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=C2Of27sjsVd0ORjTyF+gAiuy1lvWfZZrKjZ9JKI5ILg=; b=ARfsoj4Y4/BqB2hMRC9oZ5N8FYIKpw59lZoOnWc/FARjopi1D+Hu6FcdUwzeNX4y2/ 9Ip2oIUslGdJkOYwcrDwsHbmFG1sNqd7LwirLG27R6FTGo/1nSmO2GnL0U/CAwlfUjb9 R4w9Ay5AVxHY1GoV+IBc7WACDHNlw2K1xub3hwxASZkMY58ronIuqhgxfMzOeBsNEdfg L79er1wrQJyZDwUEMFqmA68RJWoQYCDTiJGMd40FfmBlqP782C7oAP4RC8H2RMakEept Ghf2Q+cxGt8+0F2KBlEIL7txMTtq/ovlwpfumAibyWfcmAvMf9930X6a+GLen0LZTaMR 8vWA== X-Gm-Message-State: APjAAAV63f1m4hO5FANBdVXjpN2dQzEvUfBlaSnlfurlSAZ/Qbax61+g 1UlqBW2y52TbJpYfS1yY8sQRNw== X-Google-Smtp-Source: APXvYqzKw7zS0EAy8qbNtzZzV53lfdRumIR/g1abofkw90uzoBOhtz6+KSCIx/k+nNLuBlJLxdFrKA== X-Received: by 2002:a62:70c6:: with SMTP id l189mr29822449pfc.139.1556061670711; Tue, 23 Apr 2019 16:21:10 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:09 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 07/25] drm: kirin: Rename ade_crtc to kirin_crtc Date: Tue, 23 Apr 2019 16:20:38 -0700 Message-Id: <1556061656-1733-8-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=C2Of27sjsVd0ORjTyF+gAiuy1lvWfZZrKjZ9JKI5ILg=; b=mNrrWoqnEM1ruztqKaXfuhFtumiBcgRZliUpxg8b7+y5eRAP9btg54IP9NQK1De/+m 9DIzVZAn3sD1OZHHoN1sVwQBaRMazsa3NNpk/AAxxZXRpWRrJyeLevFa/bo5EKr6UUlT iPEquBtvyrLk1unX1ZYgfDp53qC9WmNVSH2LZWyAi8Js5S2Q5mYYy/+qSnJZAGAN2M8x nOYzuhKdGER4UuRaoLW3oVn6DqLWJqF5g8bjtAVj1WQFsKcwHzQnYvnyq+jZy5fI0Q/t OuQaV/+fMgzyPUBRll+/bGqkjb0veFV3LoEIiAUJgLXltwgbrkRtZbZ4iMFn1MJWzZbj 5eFA== 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 renames the struct ade_crtc to kirin_crtc. The struct kirin_crtc will later used by both kirin620 and future kirin960 driver, and will be moved to a common kirin_drm_drv.h in a future patch 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 | 74 ++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index a229da9..c29ca75 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -38,8 +38,8 @@ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 -#define to_ade_crtc(crtc) \ - container_of(crtc, struct ade_crtc, base) +#define to_kirin_crtc(crtc) \ + container_of(crtc, struct kirin_crtc, base) #define to_kirin_plane(plane) \ container_of(plane, struct kirin_plane, base) @@ -56,9 +56,9 @@ struct ade_hw_ctx { int irq; }; -struct ade_crtc { +struct kirin_crtc { struct drm_crtc base; - struct ade_hw_ctx *ctx; + void *hw_ctx; struct work_struct drm_device_wq; bool enable; }; @@ -70,7 +70,7 @@ struct kirin_plane { }; struct ade_data { - struct ade_crtc acrtc; + struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; struct ade_hw_ctx ctx; }; @@ -184,8 +184,8 @@ static bool ade_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; adjusted_mode->clock = clk_round_rate(ctx->ade_pix_clk, mode->clock * 1000) / 1000; @@ -317,8 +317,8 @@ static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx) static int ade_crtc_enable_vblank(struct drm_crtc *crtc) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; void __iomem *base = ctx->base; if (!ctx->power_on) @@ -332,8 +332,8 @@ static int ade_crtc_enable_vblank(struct drm_crtc *crtc) static void ade_crtc_disable_vblank(struct drm_crtc *crtc) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; void __iomem *base = ctx->base; if (!ctx->power_on) { @@ -347,7 +347,7 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) static void drm_underflow_wq(struct work_struct *work) { - struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, drm_device_wq); struct drm_device *drm_dev = (&acrtc->base)->dev; struct drm_atomic_state *state; @@ -358,9 +358,9 @@ static void drm_underflow_wq(struct work_struct *work) static irqreturn_t ade_irq_handler(int irq, void *data) { - struct ade_crtc *acrtc = data; - struct ade_hw_ctx *ctx = acrtc->ctx; - struct drm_crtc *crtc = &acrtc->base; + struct kirin_crtc *kcrtc = data; + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; + struct drm_crtc *crtc = &kcrtc->base; void __iomem *base = ctx->base; u32 status; @@ -377,7 +377,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, MASK(1), 1); DRM_ERROR("LDI underflow!"); - schedule_work(&acrtc->drm_device_wq); + schedule_work(&kcrtc->drm_device_wq); } return IRQ_HANDLED; @@ -499,11 +499,11 @@ static void ade_dump_regs(void __iomem *base) { } static void ade_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; int ret; - if (acrtc->enable) + if (kcrtc->enable) return; if (!ctx->power_on) { @@ -516,27 +516,27 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, ade_display_enable(ctx); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); - acrtc->enable = true; + kcrtc->enable = true; } static void ade_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; - if (!acrtc->enable) + if (!kcrtc->enable) return; drm_crtc_vblank_off(crtc); ade_power_down(ctx); - acrtc->enable = false; + kcrtc->enable = false; } static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; struct drm_display_mode *mode = &crtc->state->mode; struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode; @@ -548,8 +548,8 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) static void ade_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; struct drm_display_mode *mode = &crtc->state->mode; struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode; @@ -562,13 +562,13 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; struct drm_pending_vblank_event *event = crtc->state->event; void __iomem *base = ctx->base; /* only crtc is enabled regs take effect */ - if (acrtc->enable) { + if (kcrtc->enable) { ade_dump_regs(base); /* flush ade registers */ writel(ADE_ENABLE, base + ADE_EN); @@ -1007,7 +1007,7 @@ static int ade_drm_init(struct platform_device *pdev) struct drm_device *dev = platform_get_drvdata(pdev); struct ade_data *ade; struct ade_hw_ctx *ctx; - struct ade_crtc *acrtc; + struct kirin_crtc *kcrtc; struct kirin_plane *kplane; enum drm_plane_type type; int ret; @@ -1021,8 +1021,8 @@ static int ade_drm_init(struct platform_device *pdev) platform_set_drvdata(pdev, ade); ctx = &ade->ctx; - acrtc = &ade->acrtc; - acrtc->ctx = ctx; + kcrtc = &ade->crtc; + kcrtc->hw_ctx = ctx; ret = ade_dts_parse(pdev, ctx); if (ret) @@ -1046,15 +1046,15 @@ static int ade_drm_init(struct platform_device *pdev) } /* crtc init */ - ret = ade_crtc_init(dev, &acrtc->base, &ade->planes[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &kcrtc->base, &ade->planes[PRIMARY_CH].base); if (ret) return ret; /* vblank irq init */ ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, - IRQF_SHARED, dev->driver->name, acrtc); + IRQF_SHARED, dev->driver->name, kcrtc); - INIT_WORK(&acrtc->drm_device_wq, drm_underflow_wq); + INIT_WORK(&kcrtc->drm_device_wq, drm_underflow_wq); if (ret) return ret; From patchwork Tue Apr 23 23:20:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913835 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 39A2414DB for ; Tue, 23 Apr 2019 23:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 294862895F for ; Tue, 23 Apr 2019 23:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D7F328969; Tue, 23 Apr 2019 23:21:26 +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 A28B62896F for ; Tue, 23 Apr 2019 23:21:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9514D8977A; Tue, 23 Apr 2019 23:21:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6856E89740 for ; Tue, 23 Apr 2019 23:21:13 +0000 (UTC) Received: by mail-pl1-x642.google.com with SMTP id w23so8271747ply.4 for ; Tue, 23 Apr 2019 16:21:13 -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=ZL7k6e/+E9bi/0it7T1LpM5/z2yHQD26NCZ4fJDDMXo=; b=GcVmIDGVVBxOHbaSOT/Wi8W4sGsIswqN5Hdb1VTuWzmRD8n38u5zdDlNmdAahYFLeI zN3pZ1eHv24PhOARLX+Cb7XI6SSsNFJ5hNWLwFp2ezbm12InqHX07O3InEnB8FVJfkbH xTj1YMwbb2liMsBumrXOgZKmwBIOYaWkp/7WaofxvzcdHp1KqCMY2URp7yXBoqGe/5J/ oUNxaBAWeRpFB+LRhyNecVbn9S+sbqihW3gQC+IM9CC/77lfpVefe8+l/LIsjmspeRU+ HuOmLEtbXk++eFlNRuYds5bqjB8Yzo0LjJ7Mq1ujHFQGrsDRlG887KCcis4UCaYKQIT2 lIgw== X-Gm-Message-State: APjAAAWIMC8lIMPAyoRC1q9z2GE2VqE91OUlDxETDI9untZLrVbnLGRQ xIcn4eVywuOQ8zqruXudMrVTQA== X-Google-Smtp-Source: APXvYqwe2/5g10OCkqetibI8U3Eh/TAGQv3PJF1E8wn4SUxctSU1TSdYDszeqlbbwNLKeQ2z0TEn3w== X-Received: by 2002:a17:902:2bc9:: with SMTP id l67mr29137478plb.237.1556061672036; Tue, 23 Apr 2019 16:21:12 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:11 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 08/25] drm: kirin: Dynamically allocate the hw_ctx Date: Tue, 23 Apr 2019 16:20:39 -0700 Message-Id: <1556061656-1733-9-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=ZL7k6e/+E9bi/0it7T1LpM5/z2yHQD26NCZ4fJDDMXo=; b=e9dZ1wVLSPvWA/a7Am/iUIeh3p/2KfR17jKwh4ILeoBT1TFA6w2cGTm+5redia83kT NZLaz34vgkgOSq93x41VFcF8ZGOo93Fa+fhuuTFqu4uGONrzbEduvBmgco2DzKF9B7CY KnIAMAhlyqkhVN8Y2gBmw82LR73xjibvdiwjBWUhWU6sjpYuHsNAx3wC+wdWh4SSZ/5c lPP9mghFDRCC4UsYuozd4QxjmFyx9fmMr0UybTHs8nJfKr1CiLsQJtu0vRGC2EypQA0T dDehixG3Yxse6Uap9N4y+PQiM2M5jq2MXVW0JkFP7d0GwwOaQvneXn+rAWMXTxh54Vpq lbuw== 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 modifies the initialization function to dynamically allocate the ade_hw_ctx structure previously kept as part of struct ade_data. This is done so that later we can have the hw_ctx point to hardware revision specific ctx structures. 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 | 39 +++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index c29ca75..0aa716e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -72,7 +72,7 @@ struct kirin_plane { struct ade_data { struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; - struct ade_hw_ctx ctx; + struct ade_hw_ctx *hw_ctx; }; /* ade-format info: */ @@ -951,55 +951,62 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, return 0; } -static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx) +static void *ade_hw_ctx_alloc(struct platform_device *pdev) { struct resource *res; struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; + struct ade_hw_ctx *ctx = NULL; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) { + DRM_ERROR("failed to alloc ade_hw_ctx\n"); + return ERR_PTR(-ENOMEM); + } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctx->base = devm_ioremap_resource(dev, res); if (IS_ERR(ctx->base)) { DRM_ERROR("failed to remap ade io base\n"); - return PTR_ERR(ctx->base); + return ERR_PTR(-EIO); } ctx->reset = devm_reset_control_get(dev, NULL); if (IS_ERR(ctx->reset)) - return PTR_ERR(ctx->reset); + return ERR_PTR(-ENODEV); ctx->noc_regmap = syscon_regmap_lookup_by_phandle(np, "hisilicon,noc-syscon"); if (IS_ERR(ctx->noc_regmap)) { DRM_ERROR("failed to get noc regmap\n"); - return PTR_ERR(ctx->noc_regmap); + return ERR_PTR(-ENODEV); } ctx->irq = platform_get_irq(pdev, 0); if (ctx->irq < 0) { DRM_ERROR("failed to get irq\n"); - return -ENODEV; + return ERR_PTR(-ENODEV); } ctx->ade_core_clk = devm_clk_get(dev, "clk_ade_core"); if (IS_ERR(ctx->ade_core_clk)) { DRM_ERROR("failed to parse clk ADE_CORE\n"); - return PTR_ERR(ctx->ade_core_clk); + return ERR_PTR(-ENODEV); } ctx->media_noc_clk = devm_clk_get(dev, "clk_codec_jpeg"); if (IS_ERR(ctx->media_noc_clk)) { DRM_ERROR("failed to parse clk CODEC_JPEG\n"); - return PTR_ERR(ctx->media_noc_clk); + return ERR_PTR(-ENODEV); } ctx->ade_pix_clk = devm_clk_get(dev, "clk_ade_pix"); if (IS_ERR(ctx->ade_pix_clk)) { DRM_ERROR("failed to parse clk ADE_PIX\n"); - return PTR_ERR(ctx->ade_pix_clk); + return ERR_PTR(-ENODEV); } - return 0; + return ctx; } static int ade_drm_init(struct platform_device *pdev) @@ -1020,14 +1027,16 @@ static int ade_drm_init(struct platform_device *pdev) } platform_set_drvdata(pdev, ade); - ctx = &ade->ctx; + ctx = ade_hw_ctx_alloc(pdev); + if (IS_ERR(ctx)) { + DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); + return -EINVAL; + } + ade->hw_ctx = ctx; + kcrtc = &ade->crtc; kcrtc->hw_ctx = ctx; - ret = ade_dts_parse(pdev, ctx); - if (ret) - return ret; - /* * plane init * TODO: Now only support primary plane, overlay planes From patchwork Tue Apr 23 23:20:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913837 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 30CA414DB for ; Tue, 23 Apr 2019 23:21:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21B5D285D6 for ; Tue, 23 Apr 2019 23:21:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1572028969; Tue, 23 Apr 2019 23:21:28 +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 A8915285D6 for ; Tue, 23 Apr 2019 23:21:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A69489762; Tue, 23 Apr 2019 23:21:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D47289740 for ; Tue, 23 Apr 2019 23:21:14 +0000 (UTC) Received: by mail-pl1-x642.google.com with SMTP id t16so8276404plo.0 for ; Tue, 23 Apr 2019 16:21:14 -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=CaDQKtmoJIrSmTozd8EuBlUja2GH18dHC9/QnJ1EnV0=; b=dfX/ZMratdAHGCkw2dRyr5oD58uYE8okmHWCbeMM7N54mag3EQj1rpLaRlCoQ4PS3q c+H/rnHpDDqhw1fpzJyBpaBBb/R9TWWdZEM08+f8L2I/JOdl00SOq632hhfIzWxcgmUS rGAwnErbs7xhml869W5lZjBtsDKWy3HyrOa3tylf7wbBkvMZbOesBu1TkW0KF2O38VM3 6H/WY8bqYNUzAxNF4BWamRxy+qaGISxWuQJrJrbpG7z7rHn8W7jWuqQmohKfASPMghJd IIxO5rHPC2KAqFqYW9lc8eN9QLiYLXV2iiSlCwoCzUKkfQeSQ+CcJwJSJKVPKTLaHpYg aIZA== X-Gm-Message-State: APjAAAVs6jX+Rl7eEFKWuQG9wSwREBh4rFdsI2qNuyL+Tw+cVyPERTjS PwRkmyz51ef12rIAM3C9baAQtA== X-Google-Smtp-Source: APXvYqx6GhW3MwgQc0Z4atGss2HmuRGSfxvNHOR/nmwRjSjppjo/kNExudaCLMo7krOJ2zFYPx1oBQ== X-Received: by 2002:a17:902:e683:: with SMTP id cn3mr28997997plb.115.1556061673428; Tue, 23 Apr 2019 16:21:13 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:12 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 09/25] drm: kirin: Move request irq handle in ade hw ctx alloc Date: Tue, 23 Apr 2019 16:20:40 -0700 Message-Id: <1556061656-1733-10-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=CaDQKtmoJIrSmTozd8EuBlUja2GH18dHC9/QnJ1EnV0=; b=GRUGQM90BHyiEZRiNX+NUKgtw0znVvvXJmoarXas0EkZYjMBVWaBh5BSb1FfmEjkEl EcQJc5zmZ957OsDrFJd2XEKFrIjd3cIuJxV6vFitrPu2pSSR9S+rVKGLA7njA44gRFVX OgmLv8F4WLWIGqlMK7tSXqNj5bm06Oz7FGOBVuIUlpjqi8RpPTG0uPEkQPtU/UXXrR0m cxKhPqUSAWnr1zhR2Uyg8L7g+dEpe5LZFTIb0IJypWwhF8qP7h2L4rvVCJnfh5H5o8DZ tjTZRmwr7Tzo7lN8NkfWEG+YZqf73MNY1uvEuZVCnEJAH47fO36cKxSvqjf3YFYVvSWZ Z+XA== 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 modifies the initialization routines so the devm_request_irq() function is called as part of the allocation function. This will be needed in the future when we will have different allocation functions to allocate hardware specific hw_ctx structures, which will setup the vblank irq differently. 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 | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0aa716e..94dcad0 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -54,6 +54,8 @@ struct ade_hw_ctx { struct reset_control *reset; bool power_on; int irq; + + struct drm_crtc *crtc; }; struct kirin_crtc { @@ -358,9 +360,9 @@ static void drm_underflow_wq(struct work_struct *work) static irqreturn_t ade_irq_handler(int irq, void *data) { - struct kirin_crtc *kcrtc = data; - struct ade_hw_ctx *ctx = kcrtc->hw_ctx; - struct drm_crtc *crtc = &kcrtc->base; + struct ade_hw_ctx *ctx = data; + struct drm_crtc *crtc = ctx->crtc; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); void __iomem *base = ctx->base; u32 status; @@ -951,12 +953,14 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, return 0; } -static void *ade_hw_ctx_alloc(struct platform_device *pdev) +static void *ade_hw_ctx_alloc(struct platform_device *pdev, + struct drm_crtc *crtc) { struct resource *res; struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; struct ade_hw_ctx *ctx = NULL; + int ret; ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { @@ -1006,6 +1010,14 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev) return ERR_PTR(-ENODEV); } + /* vblank irq init */ + ret = devm_request_irq(dev, ctx->irq, ade_irq_handler, + IRQF_SHARED, dev->driver->name, ctx); + if (ret) + return ERR_PTR(-EIO); + + ctx->crtc = crtc; + return ctx; } @@ -1027,7 +1039,7 @@ static int ade_drm_init(struct platform_device *pdev) } platform_set_drvdata(pdev, ade); - ctx = ade_hw_ctx_alloc(pdev); + ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); return -EINVAL; @@ -1059,15 +1071,8 @@ static int ade_drm_init(struct platform_device *pdev) if (ret) return ret; - /* vblank irq init */ - ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, - IRQF_SHARED, dev->driver->name, kcrtc); - INIT_WORK(&kcrtc->drm_device_wq, drm_underflow_wq); - if (ret) - return ret; - return 0; } From patchwork Tue Apr 23 23:20:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913831 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 6EE4914DB for ; Tue, 23 Apr 2019 23:21:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F804285D6 for ; Tue, 23 Apr 2019 23:21:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53A1428969; Tue, 23 Apr 2019 23:21:21 +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 4E626285D6 for ; Tue, 23 Apr 2019 23:21:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E771189740; Tue, 23 Apr 2019 23:21:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F98A89740 for ; Tue, 23 Apr 2019 23:21:16 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id w24so8264694plp.2 for ; Tue, 23 Apr 2019 16:21:16 -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=xTm116jbzqBEXo1zbyHHVrRjnaN2HZMnf5sPll9zTbw=; b=KI+Mq4S1jCT9oygTb8kYybJzkCv0e8+WRedB2qFX2WMff2DiVuG/SkBZLBMzwJKmXG WeMaB7ZWPMiKeYCU8YmbXi2XgbQHeg37OaX/ScEn6ws79SqLP6fs2HX28JL4+GxeVQCg 0vKOI7mg3CZkGW3sxfLSrIfQEQoVOxtHy8PJHpnsk+sXy7dfTEHqPYmDQLgvNARpyaSf XAuFhloRBf1rux50RZZ7d8kscSfzHkXl2Ygqu5uNciKST6q8Mf2SUPnhtWGp9pEgVeoT 4ZVCf3yXW1HVBUgVMWa3msY/sccA0IaxQmTJil017YPxfbC8ie19FahiCU1LllMjUN2g nF2g== X-Gm-Message-State: APjAAAWyXofsRBWvk/Tw6SJIAOJuaHOPv+Ts3eHo4Lp/3HUoOrhfG1f2 YXeLYdj2zJXF+oj72/Rf51q6OQ== X-Google-Smtp-Source: APXvYqywTXKIf62IMwvoI+e2f34rybm50ANUcnv+iKH/YohFQP0Xgd9A95IgogAWE4lL9vspQkXEYg== X-Received: by 2002:a17:902:e684:: with SMTP id cn4mr28490956plb.71.1556061674718; Tue, 23 Apr 2019 16:21:14 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:13 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure Date: Tue, 23 Apr 2019 16:20:41 -0700 Message-Id: <1556061656-1733-11-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=xTm116jbzqBEXo1zbyHHVrRjnaN2HZMnf5sPll9zTbw=; b=iQmaSI6qMUz6Cmn3MAJaIzmnZjHAJOpl6IiabW5xVfy4iQLZ0Dw5AwDnOCUR4bkap4 LXSb39TrOxCo8f/ADnd/pKEZQEQdHh6WFj14PoTcv8SV0FvZEODFg0uXy/xrn8kXH0en GnFVY12TrHTMDPBQrHToJu7LFzJ3xSRuHCT8s3x+IHpMxkFEcm2rPrAElzrz/WuDMsS6 filnJMkHdg6n3/S0Vn6mnkGlIz8Tva2hPAwy0jS9vyFVfglvxeuHsXYuOKS+v4fWCpwx ul7M4gutNYptU3lCDZviwc3l9UNjf+08FowMjODa6EpbvuFy0jDnfPspn94fKl1NMbEs 5P1A== 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: 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 The workqueue used to reset the display when we hit an LDI underflow error is ADE specific, so since this patch series works to make the kirin_crtc structure more generic, move the workqueue to the ade_hw_ctx structure instead. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 94dcad0..f54cf99 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -52,6 +52,7 @@ struct ade_hw_ctx { struct clk *media_noc_clk; struct clk *ade_pix_clk; struct reset_control *reset; + struct work_struct drm_device_wq; bool power_on; int irq; @@ -61,7 +62,6 @@ struct ade_hw_ctx { struct kirin_crtc { struct drm_crtc base; void *hw_ctx; - struct work_struct drm_device_wq; bool enable; }; @@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) static void drm_underflow_wq(struct work_struct *work) { - struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, + struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx, drm_device_wq); - struct drm_device *drm_dev = (&acrtc->base)->dev; + struct drm_device *drm_dev = ctx->crtc->dev; struct drm_atomic_state *state; state = drm_atomic_helper_suspend(drm_dev); @@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data) { struct ade_hw_ctx *ctx = data; struct drm_crtc *crtc = ctx->crtc; - struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); void __iomem *base = ctx->base; u32 status; @@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, MASK(1), 1); DRM_ERROR("LDI underflow!"); - schedule_work(&kcrtc->drm_device_wq); + schedule_work(&ctx->drm_device_wq); } return IRQ_HANDLED; @@ -1016,6 +1015,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev, if (ret) return ERR_PTR(-EIO); + INIT_WORK(&ctx->drm_device_wq, drm_underflow_wq); ctx->crtc = crtc; return ctx; @@ -1071,8 +1071,6 @@ static int ade_drm_init(struct platform_device *pdev) if (ret) return ret; - INIT_WORK(&kcrtc->drm_device_wq, drm_underflow_wq); - return 0; } From patchwork Tue Apr 23 23:20:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913839 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 9DD871575 for ; Tue, 23 Apr 2019 23:21:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E25C2895F for ; Tue, 23 Apr 2019 23:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8177B2896F; Tue, 23 Apr 2019 23:21:30 +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 205262895F for ; Tue, 23 Apr 2019 23:21:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3E6589755; Tue, 23 Apr 2019 23:21:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3170B89740 for ; Tue, 23 Apr 2019 23:21:17 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id w24so8264721plp.2 for ; Tue, 23 Apr 2019 16:21:17 -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=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=m92BI9PbgwBdHRDUDaG7NR21mo0vxy3JKnVBWxG2NOWGzhWK0cyCxtVKx+iq+JOuhG 2LskjoXEAPxWuKkttM1DcoeXfHnBJOIL+TrazcOC/C9b4UKXu6qgXvhCO4DKgGqFdxNG TyUB0WL6KeMC/ocEAa6Nm4C+40LzhTAinxgW4BvP7Knms1b26SY+iBeS2uyMP8w58xtg OvxeKQg8qqFn7kVrwI8Nm0AOWt2sfSGuTwTyPAQCNVsOG5jz1466l06IWnVpDR1Kc6O0 FsljI1qMmOoGQyX45pygyezvvY9JnIVNud04ZZ7xP88bcj/jRXA82bO/TMgqTrdE5W7K xZcw== X-Gm-Message-State: APjAAAXCLvb/phyaPEV6PNKntW/SBQKpaEKyFSOYWW+hySXfLqzQ3aVI qlzJu3jvmjQODEEUKu4NJ1fZiA== X-Google-Smtp-Source: APXvYqxcrohcoxF7N0y3iDmLR1PiNAeIDv8NwK0xG5vjhqwI1ajGwj0jXu3C4/WphYQxCdjQhubPBA== X-Received: by 2002:a17:902:a7:: with SMTP id a36mr28776329pla.111.1556061676303; Tue, 23 Apr 2019 16:21:16 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:15 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Tue, 23 Apr 2019 16:20:42 -0700 Message-Id: <1556061656-1733-12-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=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=cjViXEEth7iNuFYI0MTKtfltpV1DEW3RM2sP6kFUQRF1yZR+gHY7wnkxF3NQprorMh QZzV6oCUnje+bIBXL2+EU2opo6GijlLcAJlFZsX/91h9PBwEgQ6rR+QJVP/O0TDvse8n pQ/VJ6Qz9VTNyjO7XHtJiG+mFyQZKYwb70p6MYw1n0iIyJuoBhyyOBdNueeuYFDrrUm/ oJvlcKblSvExCfIpIG6Ngvo1v3zwOfBaUogRlbYNEeLPs7baorv9X9m/lbXA1tqQE4vi grJpEZNhCwaSYGU/9srOxbi2No7gzI0KKYLH8uJHtHf4fjcB3woDCkn/k2jsCI6VTlhB wScw== 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 some shared structures and helpers to the common kirin_drm_drv.h These structures will later used by both kirin620 and future kirin960 driver 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 | 27 ++----------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index f54cf99..69604ad 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -38,12 +38,6 @@ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 -#define to_kirin_crtc(crtc) \ - container_of(crtc, struct kirin_crtc, base) - -#define to_kirin_plane(plane) \ - container_of(plane, struct kirin_plane, base) - struct ade_hw_ctx { void __iomem *base; @@ -59,18 +53,6 @@ struct ade_hw_ctx { struct drm_crtc *crtc; }; -struct kirin_crtc { - struct drm_crtc base; - void *hw_ctx; - bool enable; -}; - -struct kirin_plane { - struct drm_plane base; - void *hw_ctx; - u32 ch; -}; - struct ade_data { struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; @@ -78,12 +60,7 @@ struct ade_data { }; /* ade-format info: */ -struct ade_format { - u32 pixel_format; - enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = { /* 16bpp RGB: */ { DRM_FORMAT_RGB565, ADE_RGB_565 }, { DRM_FORMAT_BGR565, ADE_BGR_565 }, @@ -127,7 +104,7 @@ static u32 ade_get_format(u32 pixel_format) for (i = 0; i < ARRAY_SIZE(ade_formats); i++) if (ade_formats[i].pixel_format == pixel_format) - return ade_formats[i].ade_format; + return ade_formats[i].hw_format; /* not found */ DRM_ERROR("Not found pixel format!!fourcc_format= %d\n", diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index ad027d1..b6626f5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -13,6 +13,30 @@ #define MAX_CRTC 2 +#define to_kirin_crtc(crtc) \ + container_of(crtc, struct kirin_crtc, base) + +#define to_kirin_plane(plane) \ + container_of(plane, struct kirin_plane, base) + +/* kirin-format translate table */ +struct kirin_format { + u32 pixel_format; + u32 hw_format; +}; + +struct kirin_crtc { + struct drm_crtc base; + void *hw_ctx; + bool enable; +}; + +struct kirin_plane { + struct drm_plane base; + void *hw_ctx; + u32 ch; +}; + /* display controller init/cleanup ops */ struct kirin_dc_ops { int (*init)(struct platform_device *pdev); From patchwork Tue Apr 23 23:20:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913841 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 162411575 for ; Tue, 23 Apr 2019 23:21:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0521B285D6 for ; Tue, 23 Apr 2019 23:21:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA3F228969; Tue, 23 Apr 2019 23:21:31 +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 81ED3285D6 for ; Tue, 23 Apr 2019 23:21:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7122089780; Tue, 23 Apr 2019 23:21:22 +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 1BCAB89740 for ; Tue, 23 Apr 2019 23:21:18 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id v12so8375884pgq.1 for ; Tue, 23 Apr 2019 16:21:18 -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=6PCKCPiU9SZdVwZNOi58l1CUoj0+t8ipJfFd6cL3prM=; b=XZUHvkZ7cSORaYwsMACm3j0zTEUTlo9Oces45BBGBums+u0HM7JtpbsXbTH0EEVojQ nmuAb6W8ckxTFkV6uxO0caXsejNFyaMnq9ShvyEfK0NQFtfOTasbF3U0FGMupTild8Eg qGgGVpSLfTkibQHoHyTX4tyQ8tDZRsZ6rwm5yatRtHocPDCpmbwpSCMP9lNb2+vAzB/k m5LutSWeaHkqtxbG0OzSU25jx3pCUB5obPfwfNOeYNe1ri5dUnyLKfMq+FPgRldAFAIo QjsLhjdUFWiZmoIOkD46oGiKGaI5NC22djy7XHfwvlrL7jQRMCfo7U6E5k5a6u50ZGeO q8fw== X-Gm-Message-State: APjAAAUq6JP2LxikcC2Z75nCB53dZF3rkTB4izhilhJ5t7f9rVKOEzq0 vFtqszEehD2WxfzafsEkjIPSxA== X-Google-Smtp-Source: APXvYqxgF42hSTlly68/9rDVQn5ZzCxjggQGa9A7iGZV0Pli2Urp/fkPZiDR+6p7r3hmRhWkcrG6hQ== X-Received: by 2002:a63:28f:: with SMTP id 137mr27875194pgc.377.1556061677599; Tue, 23 Apr 2019 16:21:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:16 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 12/25] drm: kirin: Reanme dc_ops to kirin_drm_data Date: Tue, 23 Apr 2019 16:20:43 -0700 Message-Id: <1556061656-1733-13-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=6PCKCPiU9SZdVwZNOi58l1CUoj0+t8ipJfFd6cL3prM=; b=GwhOGLabNj1ogmYVg2kJPECIFEX5dIE1sqaqYYlbpRHHj/MegxUZs2twDSbdDOpPrN qx89kGM6TT0YMzGJ6MR3VV0EwL1lxcGqj0LpzQaDwSmVNkF2DWg9mFYZ+A84x476fegM 1zz7DdykbEVJVcC8SODv5cUQNdDmEU0d376ZzTUc0vDqc2uBDDGvi56f67ZyQJ9QcFH8 u9KqgTLaRwfI/eF8vHHmmpBFydcY63EIrjH6C9+aH8pnCsj1jZjwIR5GyZAuNSGXGIoi moOSEzaEQ2i9BsEctw2ye1fGEZbjWQ/zUZ8tdCpXgnFk9ULihgT7SVZDCW/V0QE6REwv hR2w== 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 renames the struct kirin_dc_ops to struct kirin_drm_data and cleans up the related variable names. 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 | 2 +- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 11 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 69604ad..221bfbb 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1055,7 +1055,7 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } -const struct kirin_dc_ops ade_dc_ops = { +struct kirin_drm_data ade_driver_data = { .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index c9297d6..b52c40d09 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -30,12 +30,12 @@ #include "kirin_drm_drv.h" -static struct kirin_dc_ops *dc_ops; +static struct kirin_drm_data *driver_data; static int kirin_drm_kms_cleanup(struct drm_device *dev) { drm_kms_helper_poll_fini(dev); - dc_ops->cleanup(to_platform_device(dev->dev)); + driver_data->cleanup(to_platform_device(dev->dev)); drm_mode_config_cleanup(dev); return 0; @@ -69,7 +69,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) kirin_drm_mode_config_init(dev); /* display controller init */ - ret = dc_ops->init(to_platform_device(dev->dev)); + ret = driver_data->init(to_platform_device(dev->dev)); if (ret) goto err_mode_config_cleanup; @@ -100,7 +100,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) err_unbind_all: component_unbind_all(dev->dev, dev); err_dc_cleanup: - dc_ops->cleanup(to_platform_device(dev->dev)); + driver_data->cleanup(to_platform_device(dev->dev)); err_mode_config_cleanup: drm_mode_config_cleanup(dev); @@ -198,8 +198,8 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) struct component_match *match = NULL; struct device_node *remote; - dc_ops = (struct kirin_dc_ops *)of_device_get_match_data(dev); - if (!dc_ops) { + driver_data = (struct kirin_drm_data *)of_device_get_match_data(dev); + if (!driver_data) { DRM_ERROR("failed to get dt id data\n"); return -EINVAL; } @@ -217,13 +217,13 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) static int kirin_drm_platform_remove(struct platform_device *pdev) { component_master_del(&pdev->dev, &kirin_drm_ops); - dc_ops = NULL; + driver_data = NULL; return 0; } static const struct of_device_id kirin_drm_dt_ids[] = { { .compatible = "hisilicon,hi6220-ade", - .data = &ade_dc_ops, + .data = &ade_driver_data, }, { /* end node */ }, }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index b6626f5..276b159 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -38,11 +38,11 @@ struct kirin_plane { }; /* display controller init/cleanup ops */ -struct kirin_dc_ops { +struct kirin_drm_data { int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); }; -extern const struct kirin_dc_ops ade_dc_ops; +extern struct kirin_drm_data ade_driver_data; #endif /* __KIRIN_DRM_DRV_H__ */ From patchwork Tue Apr 23 23:20:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913851 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 F2FC614DB for ; Tue, 23 Apr 2019 23:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E30EA2895F for ; Tue, 23 Apr 2019 23:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D76FA2896F; Tue, 23 Apr 2019 23:21:43 +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 745982895F for ; Tue, 23 Apr 2019 23:21:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 96E23897D4; 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-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71BA38975F for ; Tue, 23 Apr 2019 23:21:19 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id f36so8248289plb.5 for ; Tue, 23 Apr 2019 16:21:19 -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=nanMR9WGZAGOt8W9FCJsIT2NdvldMFJeYO2gST1GNm0=; b=fLF7Q4VxnArfxh7cZX6eaUAHgliS0matdXXct2oYwMG4fg3BKKZNRg+AD98nJhkizc AKhc7OhM5ZiV/0B0luH7HdXGBzohMyDTtOUjziMtfn2BjKS9URkYox/qbCgCQjLHGPTh 9N2GBdWo7JiynedFrhqm0nwRX2CcCPmtH0825hmSLV9lMiyVGlyNXPi8Ihbj9qrUl+O4 3Ca1exCqiz8jByPaKFRlWJ/DFdS6gM+RKCL06sSnLrLje0uwXd1A/041PhB6JlbZnhIp ErXDYdvQ43Tjqs5+dPGnutCysfLy3L7zEygfThcmq4CCaZE8vZK2/zwWbCpfZpGL2YMT Ip1Q== X-Gm-Message-State: APjAAAU2mcBiuY8cYMTYw6Gq+hA+9OHuJmsHaGHV9a2Nd0HbTf5/Lf4S kdDV9LqdDitwO4RyNl7sPquv9A== X-Google-Smtp-Source: APXvYqyALxw5aburaoX8Cho1JkZDKW/0Bhym/vqMYkT0zsTkkFhaiQrNR0Zl20E/oAv3pySG0Kta6g== X-Received: by 2002:a17:902:8a8b:: with SMTP id p11mr28494162plo.227.1556061678919; Tue, 23 Apr 2019 16:21:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:18 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 13/25] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Tue, 23 Apr 2019 16:20:44 -0700 Message-Id: <1556061656-1733-14-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=nanMR9WGZAGOt8W9FCJsIT2NdvldMFJeYO2gST1GNm0=; b=aaCMAzKK87Q6UwN6wPqpfWKm4r5h4W2daAKhhs0a/xCwkqMd1/t7RzCSkZgdGoC5JE VS9i7z2Ar4OSACfCAcsHuYKZHPdyhV8p0ipQakZUFPC1Gc7BboDmYHjLbsIIOBOFEC/7 I0o6VV0Vi/JJ7HwoCvocaunOnRsFyrXffVeqj6abGZ4fFc0/lvJXULVa1WL3Mj9bLxb8 G8SMg6onZZKW+7CQlUMuYU18/cH4NFd3Dad6t9Ia9wPOls+G0PpLzAWGwrMUcWO6jSE0 wHyAM9jM7qDS8Ll7wmv7jzwMwSFV12Lg+vw1/LyDzXw2KirEp/cWHudNU9TcvoSnbE8J n76Q== 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 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: 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 | 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 221bfbb..6aa529f 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 276b159..05161ff 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -39,6 +39,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); }; From patchwork Tue Apr 23 23:20:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913849 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 154351575 for ; Tue, 23 Apr 2019 23:21:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 052C6285D6 for ; Tue, 23 Apr 2019 23:21:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC3E328969; Tue, 23 Apr 2019 23:21:41 +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 87D89285D6 for ; Tue, 23 Apr 2019 23:21:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79274897D0; 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-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D86589786 for ; Tue, 23 Apr 2019 23:21:21 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id w25so8246181pfi.9 for ; Tue, 23 Apr 2019 16:21:21 -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=3w6o3fIq2iIb7WJJVP20Z4EfqmYB1pkBjh2u5OeFpHE=; b=DuKT14mFiyB/mUHLqPtDJPwiRZc9TEqtatXfBZ47KwU81bKqct0ft7vxTFVPdMMOOV i4QFNHnltSazw+JxOkp8J5U01gFLnbUgHuPV9c54PyrH9RT6R1+ztxYvE1VUR2KCTdEz /Kf9t3X0oNDP92s2v0w0x7dhVtENBqyAt046y9xQT9FEpjPhWCl3GOIq6L0zuNDweNDm c/asen8g6XCUF7QsIgTKuvxDgOIHmL7fy/VNNeoS0mlPdOUc9H8ADHRGVl3KZSOTiUwL mLBK6Sz4OcCsTr3qeN5hQp+xLDkYM9cHFN5rV59sxzhiFhX0+d7KP7sjqyqSaYTNe+vO j3ig== X-Gm-Message-State: APjAAAXvsJ9ywSASwfKFdtlQjjcO82oHtMomgdqd8X/5So6F5LaqDspN lUMAjvjSvm4LeRjAGcLG6DPW9A== X-Google-Smtp-Source: APXvYqwUCGfe++hbxuKspqGxqH+ClR1wU0pXlx9MmWXqxBNFEBl3f+cwivJTEk5ptc68rsDcine/YA== X-Received: by 2002:a65:6414:: with SMTP id a20mr3518840pgv.217.1556061680604; Tue, 23 Apr 2019 16:21:20 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:19 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 14/25] drm: kirin: Move channel formats to driver data Date: Tue, 23 Apr 2019 16:20:45 -0700 Message-Id: <1556061656-1733-15-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=3w6o3fIq2iIb7WJJVP20Z4EfqmYB1pkBjh2u5OeFpHE=; b=nsh6amFfhd4Ifw8Uob3BkzyqOpMWuM5rJhtKKK0K9SUaDGzpNqrP6Lnc++KtbbEF3h LIMAIvD+l3blZ+t0HETDRB0yQXT7NQnHsqLQw8dDMjbWsjm906Q/cB/TSShSRYBftQZO mZ3LbYAg4Cm+ma8lYjL98QaSTKq2IIJAS3weMwVpv69FnsZJ4o75c3NXktFKh1/FE0bF YR5Lkrlg0WpXi7dRsarHuft1+QdTWcJj6RXKCUfYuizv1dR4mhJWqoOu7wxTz1A3JdQq UabNV8mgRAODM/JiiZggCXDfQNl1oEUaK8LCz1dtOoMoQV8IiKCHyTXldR0RMTF95++N TscQ== 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 channel format arrays into 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 commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 30 ++++++------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 3 +++ 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 6aa529f..0ebe715 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -76,7 +76,7 @@ static const struct kirin_format ade_formats[] = { { DRM_FORMAT_ABGR8888, ADE_ABGR_8888 }, }; -static const u32 channel_formats1[] = { +static const u32 channel_formats[] = { /* channel 1,2,3,4 */ DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, DRM_FORMAT_RGB888, DRM_FORMAT_BGR888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888, @@ -84,19 +84,6 @@ static const u32 channel_formats1[] = { DRM_FORMAT_ABGR8888 }; -u32 ade_get_channel_formats(u8 ch, const u32 **formats) -{ - switch (ch) { - case ADE_CH1: - *formats = channel_formats1; - return ARRAY_SIZE(channel_formats1); - default: - DRM_ERROR("no this channel %d\n", ch); - *formats = NULL; - return 0; - } -} - /* convert from fourcc format to ade format */ static u32 ade_get_format(u32 pixel_format) { @@ -908,18 +895,13 @@ static struct drm_plane_funcs ade_plane_funcs = { static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, enum drm_plane_type type) { - const u32 *fmts; - u32 fmts_cnt; int ret = 0; - /* get properties */ - fmts_cnt = ade_get_channel_formats(kplane->ch, &fmts); - if (ret) - return ret; - ret = drm_universal_plane_init(dev, &kplane->base, 1, - ade_driver_data.plane_funcs, fmts, - fmts_cnt, NULL, type, NULL); + ade_driver_data.plane_funcs, + ade_driver_data.channel_formats, + ade_driver_data.channel_formats_cnt, + NULL, type, NULL); if (ret) { DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; @@ -1057,6 +1039,8 @@ static void ade_drm_cleanup(struct platform_device *pdev) } struct kirin_drm_data ade_driver_data = { + .channel_formats = channel_formats, + .channel_formats_cnt = ARRAY_SIZE(channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_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 05161ff..f688612 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -39,6 +39,9 @@ struct kirin_plane { /* display controller init/cleanup ops */ struct kirin_drm_data { + const u32 *channel_formats; + u32 channel_formats_cnt; + 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; From patchwork Tue Apr 23 23:20:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913857 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 1382C14DB for ; Tue, 23 Apr 2019 23:21:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00485285D6 for ; Tue, 23 Apr 2019 23:21:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8BE828969; Tue, 23 Apr 2019 23:21:52 +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 7B821285D6 for ; Tue, 23 Apr 2019 23:21:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DA814897E0; Tue, 23 Apr 2019 23:21:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8611189786 for ; Tue, 23 Apr 2019 23:21:22 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id 8so8260169pfr.4 for ; Tue, 23 Apr 2019 16:21:22 -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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=TyplOEI/wbCOalt0fCxIK3Gs7yIz/9NbrhbhIvfYs0a00UTrB/ISjUVNnubEDBFnz6 EUEutkDFchFdcM5JWdPTZipGHOFP6I+33+V2nBfPrzLmqd3rkJ0OSXfn1Hz7qstAF1v+ Ryk6PTlPk/dvoyn50VNlwVlCNZH31yviCeShZ+zJwwblCVyw6aZIsUWQ0b8r7cWHGtRt 0hxtCFojnVP2y6Ec7QavOpOAmb57LfZURLVl0iHVXLPFzFytU2bFETqvGOzR7O2CD5r4 nF9IYC3l24B4fFUSwlXTMlkYLm9XtdHQTBhYrd5O3mNIo8XzESlb5b1S9tuNy55Ruv4I teIQ== X-Gm-Message-State: APjAAAUD63wRCrTe0yKXcL6gWh6mE7YO5xGKctpw7RckrGMzb31hDaD6 YZQAEW1bgEvf8CePv8CLF2wJzw== X-Google-Smtp-Source: APXvYqy5jPd8/syV+26q23zSB0JKQ5Qd5Jtzd9xqtc4PXOznIW7qKcD5ehVs7FCVSQ79/L2Nt5arVA== X-Received: by 2002:aa7:8e55:: with SMTP id d21mr29525492pfr.62.1556061682009; Tue, 23 Apr 2019 16:21:22 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:21 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 15/25] drm: kirin: Move mode config function to driver_data Date: Tue, 23 Apr 2019 16:20:46 -0700 Message-Id: <1556061656-1733-16-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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=oVWn/lsEfBEEg1ittPmeAehdCZlbXDUOseKSawgAKA3xZqf0ekcOV18j8vkRNyihvx MgjjxKIYgGwKqhogozHZKjyLPMqPpULYvEtGoKp6v0xcebU2Hln5+4jYVO4Q9oYer/p9 0bM5jzkvdJoYToIQ4pk/EjhL2RojThFQRfrXjTfb7PpYlSqiOfwoE0kDPKNKZjKdIKsg /cO6w///QLDG6GSt9t0DQmTxaBm7mg8Oid8l0Shpg6rRAe3di95hCJJDFRJz3anrPEmm mTFr1nMp7kZKLtR6/FnICTn834D3axUuxaBVpfe8ijqHc79RzJBLoCuRVmtGQxbGrII2 vCNw== 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 mode config initialization values into 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 commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 +- 3 files changed, 12 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 0ebe715..0e68257 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "kirin_drm_drv.h" #include "kirin_ade_reg.h" @@ -1038,6 +1039,13 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } +static const struct drm_mode_config_funcs ade_mode_config_funcs = { + .fb_create = drm_gem_fb_create, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, + +}; + struct kirin_drm_data ade_driver_data = { .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), @@ -1045,6 +1053,8 @@ struct kirin_drm_data ade_driver_data = { .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, .plane_funcs = &ade_plane_funcs, + .mode_config_funcs = &ade_mode_config_funcs, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index b52c40d09..4b210ea 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -41,12 +41,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { - .fb_create = drm_gem_fb_create, - .atomic_check = drm_atomic_helper_check, - .atomic_commit = drm_atomic_helper_commit, -}; - static void kirin_drm_mode_config_init(struct drm_device *dev) { dev->mode_config.min_width = 0; @@ -55,7 +49,7 @@ static void kirin_drm_mode_config_init(struct drm_device *dev) dev->mode_config.max_width = 2048; dev->mode_config.max_height = 2048; - dev->mode_config.funcs = &kirin_drm_mode_config_funcs; + dev->mode_config.funcs = driver_data->mode_config_funcs; } static int kirin_drm_kms_init(struct drm_device *dev) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index f688612..700a203 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -46,7 +46,7 @@ struct kirin_drm_data { const struct drm_crtc_funcs *crtc_funcs; 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; int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); }; 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; From patchwork Tue Apr 23 23:20:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913843 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 CBB4814DB for ; Tue, 23 Apr 2019 23:21:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB17F285D6 for ; Tue, 23 Apr 2019 23:21:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF65128970; Tue, 23 Apr 2019 23:21:36 +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 4B490285D6 for ; Tue, 23 Apr 2019 23:21:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23C32897C5; 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-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C59A89786 for ; Tue, 23 Apr 2019 23:21:27 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id i17so8250403pfo.6 for ; Tue, 23 Apr 2019 16:21:27 -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=uz24bMZkViIyZeft57rxEgaLGT+lil7nI2PxrW42mfI=; b=Iv0pvEOu/S2g39v7qAst4nYFmp+zSbbVEkRQOTbgGu2aafudIXgDGNEEH+xBe1WpAj yWr3ZV18ikXXaRl4Vrvj/uMe2uQnxSIAFtovpl6D0PKmgAtVXu9NC5ysdmQ/YbP1gkjI PgCRK3omPP5rA55cOJ7rOW7+HFAOE/ASpaEc9gq5fvDmAGtgZl8CtlTsJBpNsuL+YE2K 5zahWHMFFh05113Vg3fjTofNDpA0FuQKxt4QLWynphDXoZTXDqK7Sua+1rzzPdaGfKH7 sdd/C3kJ01msSzNoTWJexnkcoQRW3Q8mF034698Qi/I19HWFdULTw3OmxiBuDpe4n+4J Ou/g== X-Gm-Message-State: APjAAAWKWvhtjtIuUTK+94olhnYUJAxKZZC7scq1LDXAdEJr95s8ln/C EmoIgbrprGGk2cr2tD0kswK4MQ== X-Google-Smtp-Source: APXvYqzaQtp/hoCTDB1oJS8t8WWJg3hNjFooU0vTdyY+fPoz4HEer+IeO5PcJE0YZVOjw5Sj4j0vrA== X-Received: by 2002:a62:6807:: with SMTP id d7mr29014610pfc.75.1556061684829; Tue, 23 Apr 2019 16:21:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:24 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 17/25] drm: kirin: Move config max_width and max_height to driver data Date: Tue, 23 Apr 2019 16:20:48 -0700 Message-Id: <1556061656-1733-18-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=uz24bMZkViIyZeft57rxEgaLGT+lil7nI2PxrW42mfI=; b=fTy8g/79O0qRKYvKP2RA0bslJG7zvilBCVnEtjN2gYOP06t2CbJd8WhLxUF6wP+avC OA4zDKjq6w/qLqnBAyMmLXGoolHASn1fHzgNoFF4jjFWNN+ixU5A8hHC2X8jljvHZbvK c9vZWThmvpr5SHcmFje/wJEGzWf2M2AnoqigE4QKOwbIMcYPLIBSE7ZsA05BjnhHGGqE Y2rZMgViwnDm+lYCCrABRCAlhPjbcmc13D2EIV16Tct6u54mQi3yCdguIAmtGTO9832/ ut767RhEY0yZcBpSaI9KiekMCnaank+ZjmFwGEk/c56yqj0FHkyudqNvF+G3gMGjhde6 rdrw== 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 max_width and max_height values used in kirin_drm_mode_config_inita to hardware specific driver data. 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 commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 ++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 17 +++++------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index b6b1da6..8f15269 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1054,6 +1054,8 @@ struct kirin_drm_data ade_driver_data = { .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), + .config_max_width = 2048, + .config_max_height = 2048, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 4b210ea..70fee30 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -41,17 +41,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static void kirin_drm_mode_config_init(struct drm_device *dev) -{ - dev->mode_config.min_width = 0; - dev->mode_config.min_height = 0; - - dev->mode_config.max_width = 2048; - dev->mode_config.max_height = 2048; - - dev->mode_config.funcs = driver_data->mode_config_funcs; -} - static int kirin_drm_kms_init(struct drm_device *dev) { int ret; @@ -60,7 +49,11 @@ static int kirin_drm_kms_init(struct drm_device *dev) /* dev->mode_config initialization */ drm_mode_config_init(dev); - kirin_drm_mode_config_init(dev); + dev->mode_config.min_width = 0; + dev->mode_config.min_height = 0; + dev->mode_config.max_width = driver_data->config_max_width; + dev->mode_config.max_height = driver_data->config_max_width; + dev->mode_config.funcs = driver_data->mode_config_funcs; /* display controller init */ ret = driver_data->init(to_platform_device(dev->dev)); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 59fc888..af27acc 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; + int config_max_width; + int config_max_height; u32 num_planes; u32 prim_plane; From patchwork Tue Apr 23 23:20:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913859 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 49CF61575 for ; Tue, 23 Apr 2019 23:21:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3924E285D6 for ; Tue, 23 Apr 2019 23:21:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D95B28969; Tue, 23 Apr 2019 23:21:54 +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 B0BFA285D6 for ; Tue, 23 Apr 2019 23:21:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F0FB897F0; Tue, 23 Apr 2019 23:21:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 52AF789798 for ; Tue, 23 Apr 2019 23:21:28 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id e92so6469847plb.6 for ; Tue, 23 Apr 2019 16:21:28 -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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=GajXkCWrYHkfKcch0C+HScPuw5j3hHWXpyJ2GD6I05tL0LSHFleMMh8VqlIGsjpf6N ydcUqx8dwRFKYkL7NjF/z+yo1iwixGG6sOuf91dG8cUGOQ6vV2FNI0K1Fiocpn033ZSY 9ixA7lfQ1iiFayC/QplMNDe0JfMyTnzacU5JFEoGUNeDjtkyi+CpOWAwEMFFNVUENMg7 qDnkd1sCnSjflGJvF8x+/sZdJP3ZMJePrOGQBi2xQDisaYM7Lp9YhjU8GBPwDnFARBSB 0+2nm1kzJHiM5/LjAFHnVZxvaILUZ65Ae70BpFSCnINWiW6crK5VDCXdal4KbNQ8T2uu X+3w== X-Gm-Message-State: APjAAAVGzXFiqHvf5NG5kY7pCCmdhDLcHcKgf2BMpVzhsnkyuTCHeRko 6GRoJA/AUGfR9jAgADSTMoadNg== X-Google-Smtp-Source: APXvYqxnEx6l5bQ9FjuGPp9T12WPdNKX/NJmS2VthRc+O+JxUxxHEOVWqS+Abvpfp1Kz/mqPRj3chA== X-Received: by 2002:a17:902:3183:: with SMTP id x3mr28891345plb.170.1556061686166; Tue, 23 Apr 2019 16:21:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:25 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 18/25] drm: kirin: Move drm driver to driver data Date: Tue, 23 Apr 2019 16:20:49 -0700 Message-Id: <1556061656-1733-19-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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=Undrc2yujPz9BHO8ZYDZwQgjbX9U8mUottC4PSHk1grQkFtNsdC5fKyBvwk9oJ0TUZ zxbC2QgmW1uH7J+Vwd2kw/IJOR6byz0LF9rXkp+t+UfZEnTCQQlEsReoEMKqLvaFkEaQ 4kCf6cD6IX2jndhtqkzxgojhtssD7DbgB5jHh7AVjOJzkhajgWndHjJjH1UnBjcI/YQA izmoWxzClQUddI5qaZhsMf+5uO1JONfWqB1hpyfmedSED9IvWmXTT/xK+sCDo13SmMXO st3CMl1jd/2z+4Mk6Oiy5qbAWOIl2CdRfCY1jtFIKPRV2+V0ZrfFqzMTNEqJ1c4fEbax V/cQ== 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 drm_driver structure to be under device specific driver data. This will allow us to more easily add support for kirin960 hardware with later patches. 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 | 27 ++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38 +------------------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 8f15269..bdd1b00 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1049,6 +1049,32 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { }; +DEFINE_DRM_GEM_CMA_FOPS(ade_fops); + +static struct drm_driver ade_driver = { + .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | + DRIVER_ATOMIC, + .fops = &ade_fops, + .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_vm_ops = &drm_gem_cma_vm_ops, + .dumb_create = drm_gem_cma_dumb_create_internal, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_import = drm_gem_prime_import, + .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, + .gem_prime_vmap = drm_gem_cma_prime_vmap, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, + + .name = "kirin", + .desc = "Hisilicon Kirin620 SoC DRM Driver", + .date = "20150718", + .major = 1, + .minor = 0, +}; + struct kirin_drm_data ade_driver_data = { .num_planes = ADE_CH_NUM, .prim_plane = ADE_CH1, @@ -1056,6 +1082,7 @@ struct kirin_drm_data ade_driver_data = { .channel_formats_cnt = ARRAY_SIZE(channel_formats), .config_max_width = 2048, .config_max_height = 2048, + .driver = &ade_driver, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 70fee30..c987b4e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -94,41 +94,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) return ret; } -DEFINE_DRM_GEM_CMA_FOPS(kirin_drm_fops); - -static int kirin_gem_cma_dumb_create(struct drm_file *file, - struct drm_device *dev, - struct drm_mode_create_dumb *args) -{ - return drm_gem_cma_dumb_create_internal(file, dev, args); -} - -static struct drm_driver kirin_drm_driver = { - .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | - DRIVER_ATOMIC, - .fops = &kirin_drm_fops, - - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - .dumb_create = kirin_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_export = drm_gem_prime_export, - .gem_prime_import = drm_gem_prime_import, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - - .name = "kirin", - .desc = "Hisilicon Kirin SoCs' DRM Driver", - .date = "20150718", - .major = 1, - .minor = 0, -}; - static int compare_of(struct device *dev, void *data) { return dev->of_node == data; @@ -136,11 +101,10 @@ static int compare_of(struct device *dev, void *data) static int kirin_drm_bind(struct device *dev) { - struct drm_driver *driver = &kirin_drm_driver; struct drm_device *drm_dev; int ret; - drm_dev = drm_dev_alloc(driver, dev); + drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index af27acc..61fb0da 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -46,6 +46,7 @@ struct kirin_drm_data { u32 num_planes; u32 prim_plane; + struct drm_driver *driver; 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; From patchwork Tue Apr 23 23:20:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913865 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 A4E1214DB for ; Tue, 23 Apr 2019 23:22:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 956DB285D6 for ; Tue, 23 Apr 2019 23:22:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 899D428969; Tue, 23 Apr 2019 23:22:03 +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 2A063285D6 for ; Tue, 23 Apr 2019 23:22:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA152897FB; Tue, 23 Apr 2019 23:22:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CDBF8979E for ; Tue, 23 Apr 2019 23:21:28 +0000 (UTC) Received: by mail-pl1-x642.google.com with SMTP id e92so6469889plb.6 for ; Tue, 23 Apr 2019 16:21:28 -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=LzxumMzcEtq/SNQTqskpd8l6h66SMPqIvO/SUnJJpKM=; b=eSBt+sRouur/Q2zXOWOAspra68flUUodkac7Qt+gbByFO8fDd2dhxNneDDgF0SsBzr AXgbFOznEPuDI/8lzV8DUfQZ8bAi9KH06QXnAAh2jWy8jkn08NQV/oIkUOQwQOSQtYR5 nobfgCMwsh3BfQOHCOTYGXB35bAblXV3brMF5HEbprKuz8rXpc024UW5b6GbI5AcWmtN +t/PD0lvK63/g8iSGKM3bYsENNjuBGkrwahnh+zhemp04FvhI2r/WTHEeSgN06sakaCA NMoF4Tr90ZgBrvT/foIrE4A8Oy1nUyC98I4A/FsU3QfWD/Jn6ggL4d0jJWR1NLvDPVgn dCWw== X-Gm-Message-State: APjAAAXm+lKz9lmh3LpVMrscJeXL3V0FBuKWmrQtGGO8a6kLuVDM9R3+ 652G0SIxacVS3dC7NPJn2ZmXaQ== X-Google-Smtp-Source: APXvYqzCahw17URM7uPDNgnjEJPFq7bbhmKrHgotw8tL24qZ6Ookm3NHOl1b3VFuO++uU1km6VLpmg== X-Received: by 2002:a17:902:7085:: with SMTP id z5mr18996294plk.78.1556061687689; Tue, 23 Apr 2019 16:21:27 -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.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:26 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 19/25] drm: kirin: Add register connect helper functions in drm init Date: Tue, 23 Apr 2019 16:20:50 -0700 Message-Id: <1556061656-1733-20-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=LzxumMzcEtq/SNQTqskpd8l6h66SMPqIvO/SUnJJpKM=; b=K7nqhQ4oUzp+oLLua5HKg230xAqYILqx/7xXmGUjCnyj9D5AAhdGD+GNp3T8DMLrzl ph04wV1JpRAB90Sbx4IYwihZte0cxfMdYvm9Fisf8m/gOj92AuoBWwzExFK+5os+EUfk p3NXmrbKmHB5VMw6K6aAALPCKQjV4jvoyRGw0l/Tu1sujuXX3UeHto5WaeKkrQ/dbR6I aUuqqVWvIlTUKuONfHdYSFKflXOtOUYxkoJXY2vNpMiZVPSoLKHZajYF5AciTpQuNXmK Zps1LUzTEICkOweLOfLhBidUtU0IsK0kjPaH3ath5NrX6sGAmsAJG/ptOpFWrZi50I08 0mqw== 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 adds a flag to the device specific driver data so that we can conditionally register the connectors at init. 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 | 1 + drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 43 +++++++++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 45 insertions(+) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index bdd1b00..fcc01c2 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1076,6 +1076,7 @@ static struct drm_driver ade_driver = { }; struct kirin_drm_data ade_driver_data = { + .register_connects = false, .num_planes = ADE_CH_NUM, .prim_plane = ADE_CH1, .channel_formats = channel_formats, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index c987b4e..5ee90d7 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -99,6 +99,40 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static int kirin_drm_connectors_register(struct drm_device *dev) +{ + struct drm_connector *connector; + struct drm_connector *failed_connector; + struct drm_connector_list_iter conn_iter; + int ret; + + mutex_lock(&dev->mode_config.mutex); + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + ret = drm_connector_register(connector); + if (ret) { + failed_connector = connector; + goto err; + } + } + drm_connector_list_iter_end(&conn_iter); + mutex_unlock(&dev->mode_config.mutex); + + return 0; + +err: + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + if (failed_connector == connector) + break; + drm_connector_unregister(connector); + } + drm_connector_list_iter_end(&conn_iter); + mutex_unlock(&dev->mode_config.mutex); + + return ret; +} + static int kirin_drm_bind(struct device *dev) { struct drm_device *drm_dev; @@ -118,8 +152,17 @@ static int kirin_drm_bind(struct device *dev) drm_fbdev_generic_setup(drm_dev, 32); + /* connectors should be registered after drm device register */ + if (driver_data->register_connects == true) { + ret = kirin_drm_connectors_register(drm_dev); + if (ret) + goto err_drm_dev_unregister; + } + return 0; +err_drm_dev_unregister: + drm_dev_unregister(drm_dev); err_kms_cleanup: kirin_drm_kms_cleanup(drm_dev); err_drm_dev_put: diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 61fb0da..8818ccf 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -43,6 +43,7 @@ struct kirin_drm_data { u32 channel_formats_cnt; int config_max_width; int config_max_height; + bool register_connects; u32 num_planes; u32 prim_plane; From patchwork Tue Apr 23 23:20:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913845 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 93FAA14DB for ; Tue, 23 Apr 2019 23:21:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84199285D6 for ; Tue, 23 Apr 2019 23:21:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 771E12896F; Tue, 23 Apr 2019 23:21:38 +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 04861285D6 for ; Tue, 23 Apr 2019 23:21:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5FD39897CD; 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-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5547E897AC for ; Tue, 23 Apr 2019 23:21:30 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id f36so8248445plb.5 for ; Tue, 23 Apr 2019 16:21:30 -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=l/4HxndEudHwbox8bYtalM+RzpPcrsQmywphYVO0zYc=; b=XY2e3naD2jPo1oL4ehpY7abzV1H8aJ2MoMWFKa4hxXyM9pDSvvKa+pyrun7GW0Urrg 0gvfU/erHn2+FSLs8StSbId1XFNl6p4sbRWrlykgz38H8bjYixQwfcFSLwJHGfNiNnzD H7H/kXq2MaAhLK8pe6dZ427NheVdb3K5RNe54BayLUQJZRegCwDWex/t1KOD4FRgdE84 Bu3ozxmU3aam5buV2nK+hi9gS934UOOQDRHSXW0g+Qd/Uq4UZBw68sJ5LI9vwRIT6z31 bqMJTCcL6+7BG1RsqilwJ4HxK5/gjzoiSI/pdtuvsrb1TzchbSGVsEZDhE2MZf8XbrJr I2Qw== X-Gm-Message-State: APjAAAXQzPGEISgpVQMDODw29maxNuyS785Uj8p3wMcZfEX+psFxqQq1 a7OQhG9MM8hdASQOuO8HFw7umA== X-Google-Smtp-Source: APXvYqznrvpDjtreESEdxVrYCapvLp99vt28Wwa/eBLgzR4YMg+4MxUeBU80XpmD1fo4NGrxwhOEHA== X-Received: by 2002:a17:902:d701:: with SMTP id w1mr27423947ply.124.1556061688981; Tue, 23 Apr 2019 16:21:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:28 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 20/25] drm: kirin: Rename plane_init and crtc_init Date: Tue, 23 Apr 2019 16:20:51 -0700 Message-Id: <1556061656-1733-21-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=l/4HxndEudHwbox8bYtalM+RzpPcrsQmywphYVO0zYc=; b=wrbjvLIo7S8yefWAy6S+t5N9WVIMTHNi7nErLNj2JKhJMJl251rGYiIplpc1EiXgNM Cm8XYxORSs0TYxOCaR2AWcCv0fIBZy/FXBxGbysMh1iDK/LxOOHFbzsVWfxEq0GbMIk7 GIG3qZDuYuMgTYYPlRATA2pucx+HITzMYtk5WQWPyTDUaQcSqeL37Om9XOS1jjNrFZT2 ikZoyF1PFPXRmNB7xyMmZg7N95Yi0A5MS9w1+RqUKHQYLnNSvpJHsCfRrRJQ2VDLqF6r i7umYS2xIC9MeFswCLO7ecu4e4plaJruFjQwwVxSDXBhpFrgwqO5eVLpfQw78byznb7X f4dA== 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 renames ade_crtc/plane_init kirin_plane/crtc_init, as they will later be moved to kirin drm drv and shared with the kirin960 hardware support. 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 | 11 ++++++----- 1 file changed, 6 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 fcc01c2..21965ee 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -571,7 +571,7 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { .disable_vblank = ade_crtc_disable_vblank, }; -static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, +static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *plane) { struct device_node *port; @@ -892,8 +892,9 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, - enum drm_plane_type type) +static int kirin_drm_plane_init(struct drm_device *dev, + struct kirin_plane *kplane, + enum drm_plane_type type) { int ret = 0; @@ -1024,13 +1025,13 @@ static int ade_drm_init(struct platform_device *pdev) else type = DRM_PLANE_TYPE_OVERLAY; - ret = ade_plane_init(dev, kplane, type); + ret = kirin_drm_plane_init(dev, kplane, type); if (ret) return ret; } /* crtc init */ - ret = ade_crtc_init(dev, &kcrtc->base, + ret = kirin_drm_crtc_init(dev, &kcrtc->base, &ade->planes[ade_driver_data.prim_plane].base); if (ret) return ret; From patchwork Tue Apr 23 23:20:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913863 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 425D414DB for ; Tue, 23 Apr 2019 23:21:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32778285D6 for ; Tue, 23 Apr 2019 23:21:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2727F28969; Tue, 23 Apr 2019 23:21:59 +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 CABA4285D6 for ; Tue, 23 Apr 2019 23:21:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14252897F6; Tue, 23 Apr 2019 23:21:52 +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 BB43C8979E for ; Tue, 23 Apr 2019 23:21:32 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id e24so8230320pfi.12 for ; Tue, 23 Apr 2019 16:21:32 -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=VZpIv+9XMJ9csXRza8KzL21yNgQLvZSyCbypyWHMOUw=; b=YqOG6L1CusTjdfEUY1T8PyemlFEAqUmaG3uLkzcFvEV7VOv3xV4V+ctoGPpKFGc5n3 NC0Q5OApLFhxP26jyW03lR3+cmT9sEaydj0Sw1OOr8/n5JpHJUy995ekMHChKMcsBXNQ Dv62aMnCJt24HfhKQSEZWUjUbzmWwb3K2p3fFnGuZSSTsPDXQhyelNvDXpR8/dRFeZF4 hwggUoau6Fvni6vA/nGxOVyFVej2lDMGp2IAkkHqLC6KmdEQZ5R2Y5MLcY7a27oTr6O0 dbZo18SPxw9loxn7W/22rUFIKpOq1bDjHdyTIrqquPv53nazG/mjQNWevjF5afV8LiEY U6DQ== X-Gm-Message-State: APjAAAWj91hQDYMyjUToCWFqww4VKVCaI7v/CBE7ROKwJu0XB2fhYd8U tJkQUqA6qVOQxKydRjkNuWMPrA== X-Google-Smtp-Source: APXvYqz9MfY/qTz0PFUH+681l2VpDr/fJck5yp7tggLJ7C4wLYYD1x3aIj8pRAQAd8EMBRUTP09Qdg== X-Received: by 2002:aa7:8458:: with SMTP id r24mr10796538pfn.231.1556061690322; Tue, 23 Apr 2019 16:21:30 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:29 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 21/25] drm: kirin: Fix dev->driver_data setting Date: Tue, 23 Apr 2019 16:20:52 -0700 Message-Id: <1556061656-1733-22-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=VZpIv+9XMJ9csXRza8KzL21yNgQLvZSyCbypyWHMOUw=; b=zRR/Qo5bYroXdXojCw8cu739K44KjE9a9FCvieFsAEgn4wA0iSXY4E8KlxyzBr8AIJ fCkc8zhwYkRj0wRJW8zO36ltNNXsH9tcC21c6owPLKQFGSkZKulPoh1WRMhBRS/eWtFn sOI6NTCzAIp6hHrRq3P/3wGZzWanOAdARjN/4k+fg1urddAfw2v+hVRXIBLFTpucRKrg x1WRMiNoLMX84V+RXhiMXCtAMAKYzjh3ZxijaOz8noszCMRJOy8Q9dF5XDGmI6LLfgsr skSZfAHFC6wCQaOKfFo1S4g6IgobfFVbt+SVllr/v31fxbi9yDQMkvOd48y+mZuilEP5 hy+A== 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 dev->driver_data to point to a drm_device, not ade_data. Thus we set the driver data to drm device after alloc. 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 | 1 - drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 21965ee..3d5bd3a 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -998,7 +998,6 @@ static int ade_drm_init(struct platform_device *pdev) DRM_ERROR("failed to alloc ade_data\n"); return -ENOMEM; } - platform_set_drvdata(pdev, ade); ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 5ee90d7..a2938d4 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -45,8 +45,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) { int ret; - dev_set_drvdata(dev->dev, dev); - /* dev->mode_config initialization */ drm_mode_config_init(dev); dev->mode_config.min_width = 0; @@ -141,6 +139,7 @@ static int kirin_drm_bind(struct device *dev) drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); + dev_set_drvdata(dev, drm_dev); ret = kirin_drm_kms_init(drm_dev); if (ret) From patchwork Tue Apr 23 23:20:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913867 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 198031575 for ; Tue, 23 Apr 2019 23:22:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 090F8285D6 for ; Tue, 23 Apr 2019 23:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F11C928969; Tue, 23 Apr 2019 23:22:04 +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 90275285D6 for ; Tue, 23 Apr 2019 23:22:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 025AA8980C; Tue, 23 Apr 2019 23:22:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id CBECB897AC for ; Tue, 23 Apr 2019 23:21:32 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id o7so6013710pll.13 for ; Tue, 23 Apr 2019 16:21:32 -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=EYoqwtlhspVO6DfzyLClaQUxGfmShRm+XxIRhwBQn0I=; b=DT+E7ZvQm5DMPEnBy/EEczZKMGpy9+szZF4NM/DbPhlJNbquxGMRWrO9y0QgwDdN6F p0STc339BSQZPJDNhKUkdkryngmPh7PDepSAVajnb5FUhB5gwmzC5/Beg84P50XVXPmJ sW2PYco/JfdxQoZFoeOg/N59qVLVu/yjsdSYcJYc82tn0wP8HFTAr/Bz0QuK7VtiAKIF nDg/rXEb/ZBISXhYw66EyvEImTpvWtLX6/j5Lr1XsjtlltZ0K9mtmfd9W3MrfjIxuB68 UW4S/JEebLPZRSSu8r8mmIGy1d/hK0W3ZKVbl7wl7cQZqiVykiMH08UMhBr0Bpk3x4E4 wAHA== X-Gm-Message-State: APjAAAUht2sj3BXdrth7EwAt0p6UXNJ2JuKgP1GWg0Rfz9FUo5ERf4sX 2osaMNMaFyXNEaFU4cpOTR59hQ== X-Google-Smtp-Source: APXvYqwSsIHNNCSlSYPmHMjgWsENBgc+jn8ULcVY1CgFWt3IEmlE6/E3F36W0TwLmUHJ8AIgZE/Zyg== X-Received: by 2002:a17:902:9898:: with SMTP id s24mr7893823plp.268.1556061691666; Tue, 23 Apr 2019 16:21:31 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:30 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 22/25] drm: kirin: Make driver_data variable non-global Date: Tue, 23 Apr 2019 16:20:53 -0700 Message-Id: <1556061656-1733-23-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=EYoqwtlhspVO6DfzyLClaQUxGfmShRm+XxIRhwBQn0I=; b=untjjzDTKcvx3+iaKnypN+M8KVcNEUpB4mwwFbgfwC7yJnVLUBuXEpWrZKIITqTcBN gVCMKZuU7x49a1EvydCQLYZ0v5weudYBbmFitR1K7Gh24cS8vTgajFK56tt7Hu+U48bE +w4OzV1FKl0FgVZHth0AEKFh/mDjlgqxlMNAyxjO9pXkUD2io8Y5+MQCESi7DzfOD8o+ DhYLCwlN38AEvwfx6tQsucj4HusnSH7zA6DI4x2BvZmeeAHqpDk+2wjNAaNfLS/6u640 AvHBbHkJcdxSBilkrUHaTcRf8S459B45aqIU5crH6Q4NTEN1NEQ86QgF0YXzfCgYlUsh 6Cvg== 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 driver_data value to not be a global variable. Instead the driver_data value is accessed via the of_device_get_match_data() when needed. 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_drv.c | 43 ++++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index a2938d4..634fd58 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -30,18 +30,9 @@ #include "kirin_drm_drv.h" -static struct kirin_drm_data *driver_data; -static int kirin_drm_kms_cleanup(struct drm_device *dev) -{ - drm_kms_helper_poll_fini(dev); - driver_data->cleanup(to_platform_device(dev->dev)); - drm_mode_config_cleanup(dev); - - return 0; -} - -static int kirin_drm_kms_init(struct drm_device *dev) +static int kirin_drm_kms_init(struct drm_device *dev, + const struct kirin_drm_data *driver_data) { int ret; @@ -97,6 +88,21 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static int kirin_drm_kms_cleanup(struct drm_device *dev) +{ + const struct kirin_drm_data *driver_data; + + drm_kms_helper_poll_fini(dev); + + driver_data = of_device_get_match_data(dev->dev); + if (driver_data->cleanup) + driver_data->cleanup(to_platform_device(dev->dev)); + + drm_mode_config_cleanup(dev); + + return 0; +} + static int kirin_drm_connectors_register(struct drm_device *dev) { struct drm_connector *connector; @@ -133,15 +139,21 @@ static int kirin_drm_connectors_register(struct drm_device *dev) static int kirin_drm_bind(struct device *dev) { + struct kirin_drm_data *driver_data; struct drm_device *drm_dev; int ret; + driver_data = (struct kirin_drm_data *)of_device_get_match_data(dev); + if (driver_data == NULL) + return -EINVAL; + drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); dev_set_drvdata(dev, drm_dev); - ret = kirin_drm_kms_init(drm_dev); + /* display controller init */ + ret = kirin_drm_kms_init(drm_dev, driver_data); if (ret) goto err_drm_dev_put; @@ -191,12 +203,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) struct component_match *match = NULL; struct device_node *remote; - driver_data = (struct kirin_drm_data *)of_device_get_match_data(dev); - if (!driver_data) { - DRM_ERROR("failed to get dt id data\n"); - return -EINVAL; - } - remote = of_graph_get_remote_node(np, 0, 0); if (!remote) return -ENODEV; @@ -210,7 +216,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) static int kirin_drm_platform_remove(struct platform_device *pdev) { component_master_del(&pdev->dev, &kirin_drm_ops); - driver_data = NULL; return 0; } 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); }; From patchwork Tue Apr 23 23:20:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10913861 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 CBC6C1575 for ; Tue, 23 Apr 2019 23:21:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBC01285D6 for ; Tue, 23 Apr 2019 23:21:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFA4828969; Tue, 23 Apr 2019 23:21:57 +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 4F9FB285D6 for ; Tue, 23 Apr 2019 23:21:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E0DD0897F9; Tue, 23 Apr 2019 23:21:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8294B897DC for ; Tue, 23 Apr 2019 23:21:35 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id c207so8245210pfc.7 for ; Tue, 23 Apr 2019 16:21:35 -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=BvIii0rpBLgX+wwqwL/0OsyeoCyTJ/LguEAz+P3IFTk=; b=MeUfA17aoDDTc2w5n1vBuNjOqFlaBmZ6LHuoGb6L+atvQrRqvaqr3L/uvp/hY0PqdZ hzSR+UfgLka42OHSDyTTNGpKFhCQ6tMX+l1/5jXAnCO/kDkoLI+ZOSnVTo8ulPm56OmZ js5igQD6nfiT/+7jP9NO0ERBGY+ScpgX3G/P70GsBPUtuJ2z+bg3vlCgRdtuPMTl6xT9 RW+l+1DNxOUlYYzVuotyynXuueF6EWw+DpoOJF8hl6MOqicMQet1VKUAkjYbLU6zvkOo SQHe6PpyyRGlR5oRG+Q7pUtbtEaEQow/26RYFxjgnh6jqu0SuiXx7CDAYm7t0V8eDira 75FQ== X-Gm-Message-State: APjAAAXsn9Qm8l4pzG4/HUHfWTlgr0BxpiE8shLZZZ0qxENGjFIw03ly CyI0XLLA0KRJc7bHbSflJu4sXA== X-Google-Smtp-Source: APXvYqzw+pUXyclfRXDV1TZekbBMMDVlL0SOVff5oY0DiBlSQhsq3d+eMnwM3635pkNkObZAkNmSbw== X-Received: by 2002:a62:aa01:: with SMTP id e1mr29934003pff.43.1556061694850; Tue, 23 Apr 2019 16:21:34 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:33 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init Date: Tue, 23 Apr 2019 16:20:55 -0700 Message-Id: <1556061656-1733-25-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=BvIii0rpBLgX+wwqwL/0OsyeoCyTJ/LguEAz+P3IFTk=; b=CYwdS5PeelmfD2irWAn0bYe3ptymOpnIEYyoFy+PvmAdcp+pAwgymZkAQxtFyKifQH VJZFG0qu8dTg34cxK+/TKJab5K3exR9lc9UijG3AgKAJ4T9c2dVrCkM2aZOQVqtAzlQ3 4ATCqPMlOvg44oJytrIRmcN6l/9Q3my5KBAjYeGrPBmWytTR/jVY9UGPdQORQdiY2WIV AmLrzYyd9gM6VrbwfcBqMrVzcKNpntVbYA8SLgpR6JUg0KvesAWeUq1ROXtSp7oM747U eW12liqDNdINlMAtvaRQBGMIF1KtlgbLjE+wMC54nHO8sH4wk90qdR94gBeET3LDHQ2F fkrw== 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 funcitons to pass the kirin_driver_data as a prameter. This will allow those funcitons to be later moved to the generic 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 | 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 71671f8..876e25b 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;