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: 9480409 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 E121260237 for ; Mon, 19 Dec 2016 14:52:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2FBB284C8 for ; Mon, 19 Dec 2016 14:52:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C62D0284E1; Mon, 19 Dec 2016 14:52:06 +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=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 85709284C8 for ; Mon, 19 Dec 2016 14:52:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cIzGU-0000WG-Eq; Mon, 19 Dec 2016 14:50:10 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cIzE4-0006C4-Kh for linux-arm-kernel@lists.infradead.org; Mon, 19 Dec 2016 14:47:59 +0000 Received: by mail-wm0-x232.google.com with SMTP id t79so102937609wmt.0 for ; Mon, 19 Dec 2016 06:47:19 -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=swR4A9T3r5iH9t95Zanvea0UdUznXZdytlfQ8MirY7OApp5fAq7XMv0XmLaJ+tihsS mtlJGlcm0P6RbOVaCMG6kd1jrqSu43v72qeI5yvIPaVKAe/VFMMe49tuFjabjukqK8e+ 1B76gvPUa0FX6YH0v+L9JI5E16ZJIRLxSbIT26aOt886sdAI7dmlUqsxDP/8hISlhEF9 uTrLhPPvwYrjxJcEf8M6vCcjv3SsSCdMgOL9KNXY+TqDfxZQzivaRSSsk1ZUjDW262KW R7ERatUhsPg4RtI9Lz4IXT2l1p5jxF7CAXuXJK+LxFhJi8wcGv/GZTpMMg286jRfwFB5 VJEQ== X-Gm-Message-State: AIkVDXJWxsDpNBja6uSsOsqHtZjgsut1u27xcWpc+u7zVZt+i07xhgPnJz1y4xWB0SNvPX4J 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161219_064741_237688_5EEA5CC7 X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , LKML , linux-drm , arm-soc MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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; + } } }