From patchwork Tue Feb 7 09:16:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 9559583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7C2160434 for ; Tue, 7 Feb 2017 09:18:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2A822236A for ; Tue, 7 Feb 2017 09:18:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A65DA2832F; Tue, 7 Feb 2017 09:18:29 +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=-4.2 required=2.0 tests=BAYES_00, 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 1C1052236A for ; Tue, 7 Feb 2017 09:18:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E8FF6E623; Tue, 7 Feb 2017 09:18:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5D4326E621 for ; Tue, 7 Feb 2017 09:18:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40B7E202BE; Tue, 7 Feb 2017 09:18:26 +0000 (UTC) Received: from localhost.localdomain (li411-102.members.linode.com [106.187.91.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EED37202F0; Tue, 7 Feb 2017 09:18:15 +0000 (UTC) From: Shawn Guo To: Daniel Vetter Subject: [PATCH v3 06/23] drm: armada: use vblank hooks in struct drm_crtc_funcs Date: Tue, 7 Feb 2017 17:16:18 +0800 Message-Id: <1486458995-31018-7-git-send-email-shawnguo@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> References: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Neil Armstrong , Liviu Dudau , Laurent Pinchart , Daniel Vetter , Marek Vasut , Alexey Brodkin , Russell King , Xinliang Liu , Tomi Valkeinen , Mali DP Maintainers , Ben Skeggs , Jyri Sarha , dri-devel@lists.freedesktop.org, Maxime Ripard X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Shawn Guo The vblank hooks in struct drm_driver are deprecated and only meant for legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks in struct drm_crtc_funcs should be used instead. As the result, functions armada_drm_crtc_enable[disable]_irq() can be static, although they are moved around a bit to save forward declaration. The armada_crtc pointer array in struct armada_private is still kept in there, because armada_debugfs.c still have reference to it. Signed-off-by: Shawn Guo Cc: Russell King Acked-by: Russell King --- drivers/gpu/drm/armada/armada_crtc.c | 56 ++++++++++++++++++++++++------------ drivers/gpu/drm/armada/armada_crtc.h | 2 -- drivers/gpu/drm/armada/armada_drv.c | 16 ----------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index e62ee4498ce4..1341e0b9368a 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -418,6 +418,25 @@ static bool armada_drm_crtc_mode_fixup(struct drm_crtc *crtc, return true; } +/* These are locked by dev->vbl_lock */ +static void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask) +{ + if (dcrtc->irq_ena & mask) { + dcrtc->irq_ena &= ~mask; + writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA); + } +} + +static void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask) +{ + if ((dcrtc->irq_ena & mask) != mask) { + dcrtc->irq_ena |= mask; + writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA); + if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask) + writel(0, dcrtc->base + LCD_SPU_IRQ_ISR); + } +} + static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat) { void __iomem *base = dcrtc->base; @@ -491,25 +510,6 @@ static irqreturn_t armada_drm_irq(int irq, void *arg) return IRQ_NONE; } -/* These are locked by dev->vbl_lock */ -void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask) -{ - if (dcrtc->irq_ena & mask) { - dcrtc->irq_ena &= ~mask; - writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA); - } -} - -void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask) -{ - if ((dcrtc->irq_ena & mask) != mask) { - dcrtc->irq_ena |= mask; - writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA); - if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask) - writel(0, dcrtc->base + LCD_SPU_IRQ_ISR); - } -} - static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc) { struct drm_display_mode *adj = &dcrtc->crtc.mode; @@ -1109,6 +1109,22 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc, return 0; } +/* These are called under the vbl_lock. */ +static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc) +{ + struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); + + armada_drm_crtc_enable_irq(dcrtc, VSYNC_IRQ_ENA); + return 0; +} + +static void armada_drm_crtc_disable_vblank(struct drm_crtc *crtc) +{ + struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); + + armada_drm_crtc_disable_irq(dcrtc, VSYNC_IRQ_ENA); +} + static const struct drm_crtc_funcs armada_crtc_funcs = { .cursor_set = armada_drm_crtc_cursor_set, .cursor_move = armada_drm_crtc_cursor_move, @@ -1116,6 +1132,8 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc, .set_config = drm_crtc_helper_set_config, .page_flip = armada_drm_crtc_page_flip, .set_property = armada_drm_crtc_set_property, + .enable_vblank = armada_drm_crtc_enable_vblank, + .disable_vblank = armada_drm_crtc_disable_vblank, }; static const struct drm_plane_funcs armada_primary_plane_funcs = { diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h index b08043e8cc3b..7e8906d3ae26 100644 --- a/drivers/gpu/drm/armada/armada_crtc.h +++ b/drivers/gpu/drm/armada/armada_crtc.h @@ -104,8 +104,6 @@ struct armada_crtc { void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int); void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int); -void armada_drm_crtc_disable_irq(struct armada_crtc *, u32); -void armada_drm_crtc_enable_irq(struct armada_crtc *, u32); void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc, diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index bb27892012de..737bfcbce87b 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -49,20 +49,6 @@ void armada_drm_queue_unref_work(struct drm_device *dev, spin_unlock_irqrestore(&dev->event_lock, flags); } -/* These are called under the vbl_lock. */ -static int armada_drm_enable_vblank(struct drm_device *dev, unsigned int pipe) -{ - struct armada_private *priv = dev->dev_private; - armada_drm_crtc_enable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA); - return 0; -} - -static void armada_drm_disable_vblank(struct drm_device *dev, unsigned int pipe) -{ - struct armada_private *priv = dev->dev_private; - armada_drm_crtc_disable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA); -} - static struct drm_ioctl_desc armada_ioctls[] = { DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0), DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0), @@ -87,8 +73,6 @@ static void armada_drm_lastclose(struct drm_device *dev) static struct drm_driver armada_drm_driver = { .lastclose = armada_drm_lastclose, - .enable_vblank = armada_drm_enable_vblank, - .disable_vblank = armada_drm_disable_vblank, .gem_free_object_unlocked = armada_gem_free_object, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle,