From patchwork Mon Dec 19 14:47:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 88485 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1195593qgi; Mon, 19 Dec 2016 06:47:24 -0800 (PST) X-Received: by 10.84.216.93 with SMTP id f29mr11542394plj.91.1482158844308; Mon, 19 Dec 2016 06:47:24 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id e9si18641912pfk.129.2016.12.19.06.47.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Dec 2016 06:47:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8D136E610; Mon, 19 Dec 2016 14:47:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B5886E610 for ; Mon, 19 Dec 2016 14:47:20 +0000 (UTC) Received: by mail-wm0-x22b.google.com with SMTP id f82so103197417wmf.1 for ; Mon, 19 Dec 2016 06:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=IHPD55ddfu8y/nYb7JsvH+MTlMCS35dvp+MuYRFXeUU=; b=VtQWk0Ctw4tSK/Ilr0zj/1UX5qVkC1VSAdHWRdJsyYgxc5KyVfPT3nIu4umo7IOwHF wtUxwp3qkAc/GNHeHmUbGjz9Cq0D7rHqMKaphY30+TgVjieosMQgMla2cTuwvN+TU6Zn lwkxpwq/mJTUIYN3H/geBPSorO0vR+mrC5oNJJ1aMW3DBCOtYN3/ZYE1C8LIl1yGt0N1 66v+7ybowuzySZ3vpTVLXnQlSOKa276O7PpjLMPFaO3qf/afF4YssLSHeeh0+2g3JmOu /usOmJy6Q8SWLxvYHw/IM8lRsCFwL8pao2VAkAuHQJc2OvO0PgTrP45nonshLJBu/+Vl J1vw== 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; bh=IHPD55ddfu8y/nYb7JsvH+MTlMCS35dvp+MuYRFXeUU=; b=odl7L0UGWwBXssLNOU0FAtmm9+7ywcGjveBwTdCJNFjUAJkMxV+4Hl+65TrpFqDBa2 pBSOJ5mv+5meEGxhaSWPKmUSwZp1d+setjTd3Unfr/CpCmot0d0QKSt43TfIIELfAbow kN3EUMUBft5RysrrzektQ0xD+6x+Xtymyv7zxwRjoCwuEtlm4gK3VKUC0iV1ZktXGf6+ FCbsI9pvYrd1hmKdGYbutXUffdzpZytqZ1M5ghq5jUS97keTGkmG8UCZ4Fe/SHuFzeL3 uYTgc1J1KbXHBA6De8K7UcQSsGJ7/VDRM0MpCvOi8FkOESaR3diafWEl7g9Iu4R/IdIx /6Tg== X-Gm-Message-State: AIkVDXJL8PUpLOWByZ5F3y9DfCGf8BNEC48EKRgimsLIksaq1UmIZBoBQXmz+2qyOrrYFhrs X-Received: by 10.28.163.5 with SMTP id m5mr14440213wme.98.1482158838465; Mon, 19 Dec 2016 06:47:18 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id x7sm21020789wjp.18.2016.12.19.06.47.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Dec 2016 06:47:17 -0800 (PST) From: Bartosz Golaszewski To: Jyri Sarha , Tomi Valkeinen , David Airlie , Kevin Hilman , Michael Turquette , Sekhar Nori Subject: [PATCH v2] drm: tilcdc: simplify the recovery from sync lost error on rev1 Date: Mon, 19 Dec 2016 15:47:14 +0100 Message-Id: <1482158834-29477-1-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 Cc: Peter Ujfalusi , Bartosz Golaszewski , LKML , linux-drm , arm-soc 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" Revision 2 of LCDC suffers from an issue where a SYNC_LOST error caused by limited memory bandwidth may leave the picture shifted a couple pixels to the right. This issue has not been observed on revision 1, while the recovery mechanism introduces a different issue, where the END_OF_FRAME interrupt doesn't fire while drm is waiting for vblanks. On rev1: recover from sync lost errors by simply clearing the RASTER_ENABLE bit in the RASTER_CTRL register and re-enabling it again as is suggested by the datasheet. Signed-off-by: Bartosz Golaszewski Reviewed-by: Jyri Sarha --- v1 -> v2: - add a check to see if the RASTER_ENABLE bit is set before clearing it drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 9942b05..2004107 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -856,7 +856,7 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); struct drm_device *dev = crtc->dev; struct tilcdc_drm_private *priv = dev->dev_private; - uint32_t stat; + uint32_t stat, reg; stat = tilcdc_read_irqstatus(dev); tilcdc_clear_irqstatus(dev, stat); @@ -921,17 +921,26 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) dev_err_ratelimited(dev->dev, "%s(0x%08x): Sync lost", __func__, stat); tilcdc_crtc->frame_intact = false; - if (tilcdc_crtc->sync_lost_count++ > - SYNC_LOST_COUNT_LIMIT) { - dev_err(dev->dev, "%s(0x%08x): Sync lost flood detected, recovering", __func__, stat); - queue_work(system_wq, &tilcdc_crtc->recover_work); - if (priv->rev == 1) + if (priv->rev == 1) { + reg = tilcdc_read(dev, LCDC_RASTER_CTRL_REG); + if (reg & LCDC_RASTER_ENABLE) { tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, - LCDC_V1_SYNC_LOST_INT_ENA); - else + LCDC_RASTER_ENABLE); + tilcdc_set(dev, LCDC_RASTER_CTRL_REG, + LCDC_RASTER_ENABLE); + } + } else { + if (tilcdc_crtc->sync_lost_count++ > + SYNC_LOST_COUNT_LIMIT) { + dev_err(dev->dev, + "%s(0x%08x): Sync lost flood detected, recovering", + __func__, stat); + queue_work(system_wq, + &tilcdc_crtc->recover_work); tilcdc_write(dev, LCDC_INT_ENABLE_CLR_REG, LCDC_SYNC_LOST); - tilcdc_crtc->sync_lost_count = 0; + tilcdc_crtc->sync_lost_count = 0; + } } }