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: 9472533 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 580396021C for ; Tue, 13 Dec 2016 15:10:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488E7285E1 for ; Tue, 13 Dec 2016 15:10:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AEAD285F4; Tue, 13 Dec 2016 15:10:12 +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 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 AD4AD285E1 for ; Tue, 13 Dec 2016 15:10:11 +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 1cGogc-0004Sf-7U; Tue, 13 Dec 2016 15:08:10 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGogV-0004J6-KE for linux-arm-kernel@lists.infradead.org; Tue, 13 Dec 2016 15:08:05 +0000 Received: by mail-wm0-x22f.google.com with SMTP id f82so124211958wmf.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=dpQ+suNbGkYaPZQq3DUE1CT0UFDb6e0spL5U2txDwEGh9mS5o8kGiMMbnTojEtgken LSS44C9JBu30wuE3/ZbnWYd4vtkvNQKRl9QycSVJ9smNHMwqPFsumKl2aEadlv1WtbzZ LpnCrvtNCa/rtZG/fvcZfurdfHgJvJ4cN72+JYYkTyZDQBfCK7MI8sfPdUYRCVw4o0G5 et1VIA1beTUWebmstZ/Q0FbU9YFmvnTGt0oquzwUzYuwH2wf8sSZcujuqCFpJ7V0dJVm KvfPvD7SzoZWqDVt/6vw6QPeXbA/Rt/ItPKcC8UUfdO/BVtyzOPH1IprghVjk6xdS/tx qBQQ== X-Gm-Message-State: AKaTC01Xo0eS+oimpFkTPikszEEoudPkZVy8FM9U3yiJkfxoRCyxDBHScDTQukc5pid5y5Hu 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161213_070803_849945_A6B4A7EA X-CRM114-Status: GOOD ( 14.81 ) 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 --- 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; + } } }