From patchwork Tue Dec 13 15:07:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9472503 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 BED5860760 for ; Tue, 13 Dec 2016 15:07:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B075D28342 for ; Tue, 13 Dec 2016 15:07:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A42DD283FF; Tue, 13 Dec 2016 15:07:45 +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 EBF4228342 for ; Tue, 13 Dec 2016 15:07:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DA4C6E5B1; Tue, 13 Dec 2016 15:07:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA2426E5B1 for ; Tue, 13 Dec 2016 15:07:42 +0000 (UTC) Received: by mail-wm0-x231.google.com with SMTP id u144so23463584wmu.1 for ; Tue, 13 Dec 2016 07:07:42 -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=IbzubiQ5SrYCssm/E906keWrIrEFwuVNd8xyNOhlZdg=; b=RFfNvGLdj3k4JJVxojUsaxLvS4wW4FVlt484OKK9zfFReJ/LCAYX/LaZ5j0v1918tc tM3+ZBK35jr2FxmcDs4qRoDLSadFgluuHvix3/TAl2QVssA9L0JR4zU5cURw3fYFngs6 6NpQqJx0I2UXDg69dAXZnsHieBRaPvuH4rBqZ6U/f9le02Q8ZDZehr8zuFaTJg/W2IiR qHVJvDJNoXdlYsaQN5dbeMAry6XnoffHJ09gzkZd6tivj0DrhmqzcbdGfB7WHiik7asC Q40wz2chLVJuWt6S1sjW6xNq6BgGwp+wY82heGpzW7BRBZ6VKRNfeYjslWrvCMJsJdaG s/ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IbzubiQ5SrYCssm/E906keWrIrEFwuVNd8xyNOhlZdg=; b=D334OjiEkflaRhXNCYGupT5Juqf7c3D9CtFfaRM8PJjGZyzO5oIFs/zCqb5f/aS5+q 8NiD/GA+Ed/a30fCjNic52IWF3yC1gLa72xjiN+XIchmqpBIXn405EtlJUKnXEinN8hP o0e9f3PnG17+XEYaCvzAYtjj/jVaAQSehPD5joghkUds8CbHMAKbsh3kEAg91rbHN1Vk GQmRSo3R8z+Li2Iho00nCfSJu5a6dP+CHVuLaisRxoXd7/BcXbbtYTEU2TvOdU3AejBp /GHPSy3L9Izc5wN7nnnElgrA9h9R+EPyPRM1kLFer3MxDhCg9BTIUTHETLOnDUBPo6R1 Geyg== X-Gm-Message-State: AKaTC02Zz/2yhPerKV03DWrDhY8yMPUiL/VqHaPGMCdUVHtpaLNOio0AJ7sHRdjGilJDPBmk X-Received: by 10.28.182.70 with SMTP id g67mr3331701wmf.90.1481641661124; Tue, 13 Dec 2016 07:07:41 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id n5sm3040660wmf.0.2016.12.13.07.07.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Dec 2016 07:07:40 -0800 (PST) From: Bartosz Golaszewski To: Jyri Sarha , Tomi Valkeinen , David Airlie , Kevin Hilman , Michael Turquette , Sekhar Nori Subject: [PATCH] drm: tilcdc: simplify the recovery from sync lost error on rev1 Date: Tue, 13 Dec 2016 16:07:36 +0100 Message-Id: <1481641656-25227-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" 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 --- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 9942b05..70e57a7 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -921,17 +921,23 @@ 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) - tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, - LCDC_V1_SYNC_LOST_INT_ENA); - else + if (priv->rev == 1) { + tilcdc_clear(dev, + LCDC_RASTER_CTRL_REG, 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; + } } }