From patchwork Fri Jun 30 08:47:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 9818809 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 5CC5E603D7 for ; Fri, 30 Jun 2017 08:48:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DB6C283BB for ; Fri, 30 Jun 2017 08:48:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4214C283BD; Fri, 30 Jun 2017 08:48:21 +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 5EC902845C for ; Fri, 30 Jun 2017 08:48:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BF136E350; Fri, 30 Jun 2017 08:48:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id EDD3C6E350 for ; Fri, 30 Jun 2017 08:48:15 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v5U8lxGu031570; Fri, 30 Jun 2017 03:47:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1498812479; bh=Rfkzm9Kb+DppvCkDHZvRPrKQ3eqSthkm0LsbOtLerm4=; h=Subject:From:To:CC:References:Date:In-Reply-To; b=ZUrFHqA9cKFkzyl/Na6dcL6QnPIHhVhOenItz5RXlhzX3sr8HcJpxOrh1N/MIcj1c l02L473V8/WaeZ+QYP6b7kcgGKK9BPHI0saeteyYQ8Pk/ObeT/HU3b8WCCQsoS6BtN F+PsN0XS2BEYvFvYtEMw1HsBGrBDcRJYqodOmPiM= Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v5U8lxZO026226; Fri, 30 Jun 2017 03:47:59 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 30 Jun 2017 03:47:58 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v5U8luLD026888; Fri, 30 Jun 2017 03:47:57 -0500 Subject: Re: [BISECTED, REGRESSION] v4.12-rc: omapdrm fails to probe on Nokia N900 From: Tomi Valkeinen To: Aaro Koskinen , Peter Ujfalusi References: <20170614221133.k7gmbzzjsbmbjgbc@darkstar.musicnaut.iki.fi> <20170629185013.aec7qhvrl3waifww@darkstar.musicnaut.iki.fi> Message-ID: Date: Fri, 30 Jun 2017 11:47:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Cc: Tony Lindgren , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 30/06/17 09:41, Tomi Valkeinen wrote: > So, I don't know... I guess I need to try to invent some horrible hacks > around the driver to somehow manage the omap3 problems. Perhaps > disabling/enabling the outputs when sync lost happens... Well, I tried that (attached), but it didn't work either. For some reason the error worker seems to stop after the disable. Possibly the irq flood keeps it from running, so maybe it should catch all the errors (I see underflows too). Sorry, but I can't use more time on this today, and I'm leaving for vacation today. I hope Laurent can help during my absence. We could try reverting the patch you mention, but I think it doesn't cause the problem. Did you have CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV enabled earlier when things worked? If you didn't, and the dts did not contain display aliases, I think the omapdrm may have started without TV. So maybe the TV side is the culprit, somehow (I couldn't find anything when I looked at that side either). Tomi From c4ceb8934dbfa51bc966b927b17394c4b622712c Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 30 Jun 2017 11:39:53 +0300 Subject: [PATCH] drm/omap: hack error worker --- drivers/gpu/drm/omapdrm/omap_crtc.c | 69 ++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index dccd03726796..eb36b35f5eb8 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -36,12 +36,15 @@ struct omap_crtc { struct videomode vm; - bool ignore_digit_sync_lost; + bool ignore_sync_lost; bool enabled; bool pending; wait_queue_head_t pending_wait; struct drm_pending_vblank_event *event; + + struct work_struct error_work; + u32 error_channels; }; /* ----------------------------------------------------------------------------- @@ -157,7 +160,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) * Digit output produces some sync lost interrupts during the * first frame when enabling, so we need to ignore those. */ - omap_crtc->ignore_digit_sync_lost = true; + omap_crtc->ignore_sync_lost = true; } framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(channel); @@ -191,7 +194,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) } if (omap_crtc->channel == OMAP_DSS_CHANNEL_DIGIT) { - omap_crtc->ignore_digit_sync_lost = false; + omap_crtc->ignore_sync_lost = false; /* make sure the irq handler sees the value above */ mb(); } @@ -263,17 +266,65 @@ static const struct dss_mgr_ops mgr_ops = { * Setup, Flush and Page Flip */ +static void omap_crtc_error_worker(struct work_struct *work) +{ + struct omap_crtc *omap_crtc = container_of(work, struct omap_crtc, error_work); + struct drm_crtc *crtc = &omap_crtc->base; + struct drm_device *dev = omap_crtc->base.dev; + struct omap_drm_private *priv = dev->dev_private; + + drm_modeset_lock(&crtc->mutex, NULL); + + dev_warn(dev->dev, "sync lost on %s, enabling & disabling...\n", + omap_crtc->name); + + priv->dispc_ops->mgr_enable(omap_crtc->channel, false); + + msleep(50); + dev_warn(dev->dev, "sync lost enabling %s\n", + omap_crtc->name); + + priv->dispc_ops->mgr_enable(omap_crtc->channel, true); + + msleep(50); + + dev_warn(dev->dev, "sync lost recovery done on on %s\n", + omap_crtc->name); + + omap_crtc->ignore_sync_lost = false; + /* make sure the irq handler sees the value above */ + mb(); + + drm_modeset_unlock(&crtc->mutex); +} + void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); + struct drm_device *dev = omap_crtc->base.dev; + struct omap_drm_private *priv = dev->dev_private; + enum omap_channel channel = omap_crtc_channel(crtc); + u32 sync_lost_irq; + bool sync_lost; + + sync_lost_irq = priv->dispc_ops->mgr_get_sync_lost_irq(channel); - if (omap_crtc->ignore_digit_sync_lost) { - irqstatus &= ~DISPC_IRQ_SYNC_LOST_DIGIT; - if (!irqstatus) - return; + sync_lost = irqstatus & sync_lost_irq; + + if (sync_lost) { + if (omap_crtc->ignore_sync_lost) { + irqstatus &= ~sync_lost_irq; + } else { + /* error worker will set this to false */ + omap_crtc->ignore_sync_lost = true; + schedule_work(&omap_crtc->error_work); + } } - DRM_ERROR_RATELIMITED("%s: errors: %08x\n", omap_crtc->name, irqstatus); + if (!irqstatus) + return; + + printk("%s: errors: %08x\n", omap_crtc->name, irqstatus); } void omap_crtc_vblank_irq(struct drm_crtc *crtc) @@ -612,6 +663,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, init_waitqueue_head(&omap_crtc->pending_wait); + INIT_WORK(&omap_crtc->error_work, omap_crtc_error_worker); + omap_crtc->channel = channel; omap_crtc->name = channel_names[channel]; -- 2.7.4