From patchwork Fri Jun 2 03:00:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9761449 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 AA3776038E for ; Fri, 2 Jun 2017 03:01:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0C1F28524 for ; Fri, 2 Jun 2017 03:01:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9596528536; Fri, 2 Jun 2017 03:01: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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 9393E28524 for ; Fri, 2 Jun 2017 03:01:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6D066E4C0; Fri, 2 Jun 2017 03:01:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE17E89A14 for ; Fri, 2 Jun 2017 03:01:06 +0000 (UTC) Received: from trochilidae.toradex.int (unknown [IPv6:2601:602:8801:c3e0::127]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 6FC7F5C1B0D; Fri, 2 Jun 2017 04:59:50 +0200 (CEST) From: Stefan Agner To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/fsl-dcu: implement irq_preinstall/uninstall callbacks Date: Thu, 1 Jun 2017 20:00:57 -0700 Message-Id: <37033e2d4e251d3ffaa16f31459864c5ee365b2f.1496372207.git-series.stefan@agner.ch> X-Mailer: git-send-email 2.13.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1496372391; bh=yGkRWcZ5fVmN7LBKhr2lfMEmQGfrRtXN1LwxBpf37TQ=; h=From:To:Cc:Subject:Date:Message-Id; b=Ix2zzVip1xaK1YmIds37/auoTfxaKkrC1qIeIXb2AdAWK/GUp+1tdnypQAFi6nq1/6N586YQEuHt6iCGtm27Ow60QSnB4LoPHcV5jgt+YGcTgYGYXtc/l224gI4l1F3gV9zdy1xmvKYMPtYdZmnUJqcTAcxSiMah5ASijo4G1tI= Cc: meng.yi@nxp.com, alison.wang@freescale.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org 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 Make use of the irq_preinstall/uninstall callback to clear and mask all interrupts. Use write 1 to clear as documented by the data sheet (writing a 0 seems to have cleared interrupt status too). Remove fsl_dcu_drm_irq_init and call drm_irq_install directly from fsl_dcu_load makes error handling a bit simpler. Do not set irq_enabled since drm_irq_install is taking care of it. Signed-off-by: Stefan Agner --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) base-commit: 2a1720376adda5ecf8e636fbfb05339c7dad1c55 diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 6e00f4b..d86f35c 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -51,19 +51,12 @@ static const struct regmap_config fsl_dcu_regmap_config = { .volatile_reg = fsl_dcu_drm_is_volatile_reg, }; -static int fsl_dcu_drm_irq_init(struct drm_device *dev) +static void fsl_dcu_irq_uninstall(struct drm_device *dev) { struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - int ret; - - ret = drm_irq_install(dev, fsl_dev->irq); - if (ret < 0) - dev_err(dev->dev, "failed to install IRQ handler\n"); - regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0); + regmap_write(fsl_dev->regmap, DCU_INT_STATUS, ~0); regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0); - - return ret; } static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) @@ -83,10 +76,11 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) goto done; } - ret = fsl_dcu_drm_irq_init(dev); - if (ret < 0) + ret = drm_irq_install(dev, fsl_dev->irq); + if (ret < 0) { + dev_err(dev->dev, "failed to install IRQ handler\n"); goto done; - dev->irq_enabled = true; + } if (legacyfb_depth != 16 && legacyfb_depth != 24 && legacyfb_depth != 32) { @@ -170,6 +164,8 @@ static struct drm_driver fsl_dcu_drm_driver = { .load = fsl_dcu_load, .unload = fsl_dcu_unload, .irq_handler = fsl_dcu_drm_irq, + .irq_preinstall = fsl_dcu_irq_uninstall, + .irq_uninstall = fsl_dcu_irq_uninstall, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,