From patchwork Tue Jan 8 17:23:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 1946971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 49CEEDF23A for ; Tue, 8 Jan 2013 17:26:43 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tscte-0001GN-RR; Tue, 08 Jan 2013 17:23:30 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tsctb-0001G2-Ir for linux-arm-kernel@lists.infradead.org; Tue, 08 Jan 2013 17:23:28 +0000 Received: from pizza.hi.pengutronix.de ([2001:6f8:1178:2:ca9c:dcff:febd:f1b5]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1TsctU-0002Tf-Oc; Tue, 08 Jan 2013 18:23:20 +0100 Subject: Re: [PATCH 7/7] ARM i.MX51 babbage: Add display support From: Philipp Zabel To: Marek Vasut In-Reply-To: <201301081809.38537.marex@denx.de> References: <1352733809-27230-1-git-send-email-s.hauer@pengutronix.de> <201301081809.38537.marex@denx.de> Date: Tue, 08 Jan 2013 18:23:20 +0100 Message-ID: <1357665800.2527.17.camel@pizza.hi.pengutronix.de> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 X-SA-Exim-Connect-IP: 2001:6f8:1178:2:ca9c:dcff:febd:f1b5 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130108_122328_025898_7805279A X-CRM114-Status: GOOD ( 35.04 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Sascha Hauer , Shawn Guo , Fabio Estevam , kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Am Dienstag, den 08.01.2013, 18:09 +0100 schrieb Marek Vasut: > Dear Fabio Estevam, > > > On Tue, Jan 8, 2013 at 2:41 PM, Fabio Estevam wrote: > > > Hi Sascha, > > > > > > On Mon, Nov 12, 2012 at 1:23 PM, Sascha Hauer > wrote: > > >> The babbage board has a DVI-I output which allows to output analog > > >> and digital signals simultaneously. This patch adds support for it > > >> to the devicetree. The DDC signals are not wired up on the board, so > > >> DRM will fall back on default VESA modes. > > >> > > >> Signed-off-by: Sascha Hauer > > > > > > I am running linux-next 20130108, which has this patch applied and I > > > > > get the following on my mx51babbage: > > Ok, good news. I see a nice penguin on my monitor now. > > > > Discussed with Marek and he proposed a quick workaround: > > > > --- a/drivers/staging/imx-drm/ipuv3-crtc.c > > +++ b/drivers/staging/imx-drm/ipuv3-crtc.c > > @@ -343,6 +343,11 @@ static irqreturn_t ipu_irq_handler(int irq, void > > *dev_id) { > > struct ipu_crtc *ipu_crtc = dev_id; > > > > + if (!ipu_crtc->imx_crtc) { > > + pr_err("Spurious IPU IRQ\n"); > > + return IRQ_HANDLED; > > + } > > + > > imx_drm_handle_vblank(ipu_crtc->imx_crtc); > > > > if (ipu_crtc->newfb) { > > > > It seems that this issue happened because bootloader leaves the IPU turned > > on. > > To elaborate more on this stuff: > > 491 ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch, > 492 IPU_IRQ_EOF); > 493 ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, > ipu_irq_handler, 0, > 494 "imx_drm", ipu_crtc); > 495 if (ret < 0) { > 496 dev_err(ipu_crtc->dev, "irq request failed with %d.\n", > ret); > 497 goto err_out; > 498 } > 499 > 500 disable_irq(ipu_crtc->irq); > > This code in drivers/staging/imx-drm/ipuv3-crtc.c is broken. If the IPU is on, > it produces an interrupt before the driver is fully set up. I didn't produce a > patch yet, I think I might offload this to someone else. Volunteers? Reordering the ipu_get_resources and imx_drm_add_crtc calls should resolve this: From: Philipp Zabel Subject: [PATCH] staging: imx/drm: add crtc before registering interrupt handler If the bootloader already enabled the display, the interrupt handler will be called as soon as it is registered. If the CRTC is not already added at this time, the call to imx_drm_handle_vblank will result in a NULL pointer dereference. Signed-off-by: Philipp Zabel Tested-by: Fabio Estevam --- drivers/staging/imx-drm/ipuv3-crtc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 4b3a019..3d04abb 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c @@ -506,28 +506,23 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, { int ret; - ret = ipu_get_resources(ipu_crtc, pdata); - if (ret) { - dev_err(ipu_crtc->dev, "getting resources failed with %d.\n", - ret); - return ret; - } - ret = imx_drm_add_crtc(&ipu_crtc->base, &ipu_crtc->imx_crtc, &ipu_crtc_helper_funcs, THIS_MODULE, ipu_crtc->dev->parent->of_node, pdata->di); if (ret) { dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret); - goto err_put_resources; + return ret; } - return 0; - -err_put_resources: - ipu_put_resources(ipu_crtc); + ret = ipu_get_resources(ipu_crtc, pdata); + if (ret) { + dev_err(ipu_crtc->dev, "getting resources failed with %d.\n", + ret); + return ret; + } - return ret; + return 0; } static int ipu_drm_probe(struct platform_device *pdev)