From patchwork Mon Apr 10 11:16:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 9672341 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 2A60E60244 for ; Mon, 10 Apr 2017 11:17:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DC0226E54 for ; Mon, 10 Apr 2017 11:17:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 127B327B13; Mon, 10 Apr 2017 11:17:20 +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 9217A26E54 for ; Mon, 10 Apr 2017 11:17:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C52396E099; Mon, 10 Apr 2017 11:17:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5904F6E099 for ; Mon, 10 Apr 2017 11:17:17 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v3ABHB62018221; Mon, 10 Apr 2017 06:17:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1491823031; bh=AuU9nvU8lX73gld0gynjWMTEpnsIgsxdZhuWknznJ28=; h=From:To:CC:Subject:Date; b=WlazLN+a2ZkZB/CaG0nYjcAHc6tWKaYpI9xBbC3ogi1o4Li1C7QchD7uhh5RvzAHd q4P1Rmu+BN0UGlv67sbpR+ODXzdYthAsNm+Uh9OjZHBr8ptJAEXnrn0wvaau9yZ1wD zGM5LyMMIa+4e+Jpre6Qoj7CJ8pyNkpRV4n7UNLs= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v3ABHBFV008099; Mon, 10 Apr 2017 06:17:11 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Mon, 10 Apr 2017 06:17:10 -0500 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v3ABH90w028800; Mon, 10 Apr 2017 06:17:09 -0500 From: Jyri Sarha To: Subject: [PATCH] drm/tilcdc: If CRTC is enabled at init phase, disable it Date: Mon, 10 Apr 2017 14:16:54 +0300 Message-ID: <1491823014-1780-1-git-send-email-jsarha@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: tomi.valkeinen@ti.com, Jyri Sarha , laurent.pinchart@ideasonboard.com, ingrassia@epigenesys.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the LCDC is already enabled (e.g. by the bootloader) at the initialization phase, disable it before returning from the probe. Signed-off-by: Jyri Sarha Reported-by: Emiliano Ingrassia --- This patch should fix the same issus as this patch does: https://lists.freedesktop.org/archives/dri-devel/2017-March/137091.html I do not like the above patch duplicating the already existing code for CRTC disable. Another issue is making the check every time the CRTC is turned on. drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 21 +++++++++++++++++++++ drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 +++ drivers/gpu/drm/tilcdc/tilcdc_drv.h | 1 + 3 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index afd2a7b..540378a 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -566,6 +566,26 @@ void tilcdc_crtc_shutdown(struct drm_crtc *crtc) tilcdc_crtc_off(crtc, true); } +void tilcdc_crtc_disable_init(struct drm_crtc *crtc) +{ + struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); + struct drm_device *dev = crtc->dev; + + /* + * If the LCDC was already enabled (e.g. by the bootloader) + * disable the CRTC before finishing the probe. + */ + pm_runtime_get_sync(dev->dev); + if (tilcdc_read(dev, LCDC_RASTER_CTRL_REG) & LCDC_RASTER_ENABLE) { + tilcdc_crtc->enabled = true; + tilcdc_crtc_enable_irqs(dev); + /* To match pm_runtime_put_sync() in tilcdc_crtc_off() */ + pm_runtime_get_sync(dev->dev); + tilcdc_crtc_off(crtc, false); + } + pm_runtime_put_sync(dev->dev); +} + static bool tilcdc_crtc_is_on(struct drm_crtc *crtc) { return crtc->state && crtc->state->enable && crtc->state->active; @@ -1054,6 +1074,7 @@ int tilcdc_crtc_create(struct drm_device *dev) } priv->crtc = crtc; + return 0; fail: diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index d7ae5be..7dabe55 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -415,6 +415,9 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) goto init_failed; priv->is_registered = true; + + tilcdc_crtc_disable_init(priv->crtc); + return 0; init_failed: diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h index 8caa11b..adde1e4 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h @@ -179,6 +179,7 @@ void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc *crtc, int tilcdc_crtc_update_fb(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event); +void tilcdc_crtc_disable_init(struct drm_crtc *crtc); int tilcdc_plane_init(struct drm_device *dev, struct drm_plane *plane);