From patchwork Tue Mar 8 16:39:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 8540021 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38AA5C0553 for ; Wed, 9 Mar 2016 00:50:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53F452021A for ; Wed, 9 Mar 2016 00:50:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1524520251 for ; Wed, 9 Mar 2016 00:50:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 361276E7C9; Wed, 9 Mar 2016 00:50:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from ring0.de (ring0.de [IPv6:2a03:4000:6:1a1::1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB4556E026 for ; Tue, 8 Mar 2016 16:50:03 +0000 (UTC) Received: by ring0.de (Postfix, from userid 110) id 388F6A4A82F; Tue, 8 Mar 2016 17:41:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from sre.ring0.de (host-091-097-051-039.ewe-ip-backbone.de [91.97.51.39]) by ring0.de (Postfix) with ESMTPSA id 418D1A4A82F; Tue, 8 Mar 2016 17:40:27 +0100 (CET) From: Sebastian Reichel To: Sebastian Reichel , Tony Lindgren , Aaro Koskinen , Tomi Valkeinen Subject: [PATCH 21/23] drm: omapdrm: panel-dsi-cm: block disable until update completed Date: Tue, 8 Mar 2016 17:39:53 +0100 Message-Id: <1457455195-1938-22-git-send-email-sre@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457455195-1938-1-git-send-email-sre@kernel.org> References: <1457455195-1938-1-git-send-email-sre@kernel.org> X-Mailman-Approved-At: Wed, 09 Mar 2016 00:49:41 +0000 Cc: linux-omap@vger.kernel.org, Laurent Pinchart , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org 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 DSI hardware IPs seem to be a bit unhappy about incomplete image transfers, so try to wait for an update to finish before disabling the panel. Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index c60bc3013ff4..ca7fba59c760 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -78,6 +78,9 @@ struct panel_drv_data { atomic_t do_update; int channel; + wait_queue_head_t update_wait; + atomic_t updating; + struct delayed_work te_timeout_work; bool intro_printed; @@ -845,6 +848,13 @@ static void dsicm_disable(struct omap_dss_device *dssdev) dev_dbg(&ddata->pdev->dev, "disable\n"); + r = wait_event_timeout(ddata->update_wait, + !atomic_read(&ddata->updating), + msecs_to_jiffies(250)); + if (!r) { + dev_warn(&ddata->pdev->dev, "update did not finish, force disable!"); + } + mutex_lock(&ddata->lock); dsicm_cancel_ulps_work(ddata); @@ -871,6 +881,9 @@ static void dsicm_framedone_cb(int err, void *data) dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err); in->ops.dsi->bus_unlock(ddata->in); + + atomic_set(&ddata->updating, 0); + wake_up(&ddata->update_wait); } static irqreturn_t dsicm_te_isr(int irq, void *data) @@ -885,6 +898,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data) if (old) { cancel_delayed_work(&ddata->te_timeout_work); + atomic_set(&ddata->updating, 1); r = in->ops.dsi->update(in, ddata->channel, dsicm_framedone_cb, ddata); if (r) @@ -943,6 +957,7 @@ static int dsicm_update(struct omap_dss_device *dssdev, msecs_to_jiffies(250)); atomic_set(&ddata->do_update, 1); } else { + atomic_set(&ddata->updating, 1); r = in->ops.dsi->update(in, ddata->channel, dsicm_framedone_cb, ddata); if (r) @@ -1317,6 +1332,9 @@ static int dsicm_probe(struct platform_device *pdev) mutex_init(&ddata->lock); atomic_set(&ddata->do_update, 0); + atomic_set(&ddata->updating, 0); + + init_waitqueue_head(&ddata->update_wait); if (gpio_is_valid(ddata->reset_gpio)) { r = devm_gpio_request_one(dev, ddata->reset_gpio,