From patchwork Wed May 21 04:42:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YoungJun Cho X-Patchwork-Id: 4214211 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1AF24BEEAB for ; Wed, 21 May 2014 04:43:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 473CA20396 for ; Wed, 21 May 2014 04:43:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 652DD20398 for ; Wed, 21 May 2014 04:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbaEUEnT (ORCPT ); Wed, 21 May 2014 00:43:19 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:38948 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534AbaEUEnQ (ORCPT ); Wed, 21 May 2014 00:43:16 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5W00L16QG2GRB0@mailout2.samsung.com>; Wed, 21 May 2014 13:43:14 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.41]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 08.46.16580.2EE2C735; Wed, 21 May 2014 13:43:14 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-ee-537c2ee2f8a5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 13.7B.08203.2EE2C735; Wed, 21 May 2014 13:43:14 +0900 (KST) Received: from localhost.localdomain ([10.252.75.90]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5W00K72QFYOO20@mmp2.samsung.com>; Wed, 21 May 2014 13:43:13 +0900 (KST) From: YoungJun Cho To: airlied@linux.ie, dri-devel@lists.freedesktop.org Cc: devicetree@vger.kernel.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, linux-samsung-soc@vger.kernel.org, thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com, s.trumtrar@pengutronix.de, djkurtz@chromium.org, kyungmin.park@samsung.com, inki.dae@samsung.com, kgene.kim@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, a.hajda@samsung.com Subject: [PATCH v2 02/18] drm/exynos: use wait_event_timeout() for safety usage Date: Wed, 21 May 2014 13:42:54 +0900 Message-id: <1400647390-26590-3-git-send-email-yj44.cho@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1400647390-26590-1-git-send-email-yj44.cho@samsung.com> References: <1400647390-26590-1-git-send-email-yj44.cho@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMIsWRmVeSWpSXmKPExsVy+t8zTd1HejXBBv9WqFrcWneO1aL33Ekm i/lHgKzGGfNZLa58fc9m0f9mIavFuVcrGS0m3Z/AYvHi3kUWi94FV9kszja9YbfonLiE3WLG +X1MFkuvX2SymDB9LYtF694j7BafPi5ksZgx+SWbxc9d81gchD3WzFvD6DG74SKLx+W+XiaP nbPusnusXP6FzWN2x0xWj02rOtk8tn97wOpxv/s4k0f/XwOPvi2rGD0+b5IL4InisklJzcks Sy3St0vgyni14BF7QT9vxfmFrYwNjDO4uxg5OSQETCQenlnGDGGLSVy4t56ti5GLQ0hgGaPE g8cPWWCKPt3pB7OFBKYzSjzcmANhtzJJfJ1pDGKzCWhKPP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0eBGjiAlilIzJlkAxLmFHCV OP//LTvELheJpjXT2CYw8i5gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERz/z6R2MK5s sDjEKMDBqMTDu6CoOliINbGsuDL3EKMEB7OSCO9ysZpgId6UxMqq1KL8+KLSnNTiQ4zJQEdN ZJYSTc4Hpqa8knhDYxMzI0sjM2MTc2Nj0oSVxHkPtFoHCgmkJ5akZqemFqQWwWxh4uCUamDM Pqd0VSIr63bf7qeyzCvV1ESmcR33uLLNevMZvjWbJy51SOxa+vFQ3vTFwYysCtf+aAl2FIu8 itOuO2BQuTTXkjvmXuuZI9fYT3/c/HyR10t1NrWCSydW7102uzFTQbA3hrPv+E89F/M5OsX9 q258Y3kvPPHal+cCa+awb+bWDb0i46nV/9ZAiaU4I9FQi7moOBEAfqPVeUMDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There could be the case that the page flip operation isn't finished correctly with some abnormal condition such as panel reset. So this patch replaces wait_event() with wait_event_timeout() to avoid waiting for page flip completion infinitely. And clears exynos_crtc->pending_flip in exynos_drm_crtc_page_flip() when exynos_drm_crtc_mode_set_commit() is failed. Signed-off-by: YoungJun Cho Acked-by: Inki Dae Acked-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 95c9435..3bf091d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -69,8 +69,10 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) if (mode > DRM_MODE_DPMS_ON) { /* wait for the completion of page flip. */ - wait_event(exynos_crtc->pending_flip_queue, - atomic_read(&exynos_crtc->pending_flip) == 0); + if (!wait_event_timeout(exynos_crtc->pending_flip_queue, + !atomic_read(&exynos_crtc->pending_flip), + HZ/20)) + atomic_set(&exynos_crtc->pending_flip, 0); drm_vblank_off(crtc->dev, exynos_crtc->pipe); } @@ -259,6 +261,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, spin_lock_irq(&dev->event_lock); drm_vblank_put(dev, exynos_crtc->pipe); list_del(&event->base.link); + atomic_set(&exynos_crtc->pending_flip, 0); spin_unlock_irq(&dev->event_lock); goto out;