Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2332621imu; Thu, 17 Jan 2019 12:17:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN7jdMt+a86Btaj06cx4fbPw/J5UXrmQ2Ck3Z++eBLlOfUTsSm9hUx5VduTeZ6xMbNGp/+LG X-Received: by 2002:a65:49cd:: with SMTP id t13mr14888620pgs.376.1547756274880; Thu, 17 Jan 2019 12:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547756274; cv=none; d=google.com; s=arc-20160816; b=IUGMrVh+NBXHWy9eY7Z/Fg5dJam+6fTB2Bk4ahkpV3mC2d/96F3spkkVtXrgjqmlQV Y/IoMXgL2qil3o40WuG9DbgTCaGP48ID255e7cp1C/FQcvm9ZTudNozSMfceeO7DsEFp VHrbz6OIiT6K7xCYqd2nBSthr8kbp0cXMnatm1MTKunqQeSL0GEkk4z4a266HDzv8EL7 3mIq1b4LfZe51fg0ciGk0ixVlJa7s+c1jLt++lyaeIHGwdsXsvVhvBsfvgSm67M3NQLp 0gFiVme/v1YbUuqukG69LWZL6bF784zXfkqculD6JPW2E9BwBdafv1n8jpv7pjZG8umm vblA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sgUZreCQVIZO2d4p0RUgihsvFO7rMp1SP2qO9BGpjm4=; b=btO8KA9F3WyTcz7xHbX1y4vU8skfq7uAla7iHhKdq2CUYSi2MlehCyzVhTijWDNyz4 r5L9uQUDp7q2lODomfJhK0Kzxr0J0jlHnQDRVTA9OUI6DQYf6qxxuJMCkSpCYRVILG46 Roib4R40waxeHDxSPNoYGEWOEqntWzF5+gbGqssDFdqHXJ4R99O5UmRPIMiqTVyLB8Fe Fx628KhaeIcdYyYmNx2F6icQRIMaR3XnR0btl1G4faAn+OttT2qbCZoUJbLYY2dnEkj/ higMvcKbjFWuW0xCXPdZWoRd2UNLdNZVBpjeBs34t/xurGhXg7MSm8K9DqsI1MP53+V2 ZWxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Tp456RGa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o28si2496468pgm.238.2019.01.17.12.17.39; Thu, 17 Jan 2019 12:17:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Tp456RGa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729562AbfAQUPE (ORCPT + 99 others); Thu, 17 Jan 2019 15:15:04 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35538 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729408AbfAQUPD (ORCPT ); Thu, 17 Jan 2019 15:15:03 -0500 Received: by mail-pg1-f194.google.com with SMTP id s198so4933962pgs.2; Thu, 17 Jan 2019 12:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sgUZreCQVIZO2d4p0RUgihsvFO7rMp1SP2qO9BGpjm4=; b=Tp456RGaPKmgPbzrfZamiIQS/S83Iz1KhTg+iLVJaP3Ew/R2WkxOGRya/w8fbD4PE4 5j5KLb7W3UbGu+d6fZ6xhpOm6CCUG74vJWL1ooqAKHAZqeahFZXqnPkg6IZ1oXHxz4Hr ni29v4S6pn7qQA84WZoHIqKn5o0VsJfoTLxOm68SElHsWW9IP2Ny5NShMqCCWB1FYEkd +CmOZICJ18kZ/EyUJXWiIqhJVSnz+3qKZ8/EjPpzYrqRg/aR3cJDydG3bdLjiqh/cahN 3Wjy2VHzIm9eC9pKp/YlbDA9o0tWqbnUNlG5hfqznXHvrqRqlv0T1V2vu9PRaSlr3ilk Oczw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sgUZreCQVIZO2d4p0RUgihsvFO7rMp1SP2qO9BGpjm4=; b=T8PaWsoDyIMbkx2b4jVudPGBtTLu7gy+kcm0VY14+Gl+Ebsu1AR0eU1sEBJy5YiN+V YY8jYtPGChNzSxRTtr+oYBPXBQxCBIN50kYh7wn+OKlN/qUDKypmNB2drffRsYByefYI mryztiGGtTearHigbGkL2uWDDScturPoIRB+loc+pAQW1durhF3HXzXzCK5hZiZu8+Kk gXAxsl9AbvScn6NILkFZ2zqGgTog2sK5cGRnhOJTjXe3KM/+nnS8EmQH+5I+MKqGOmPQ yuGyL+bOqvVoSZcVM4Ie7UoGuLnR24j81BZtgLHCUf/Z29sQhQZ2uSNABPhfUiZpIOnG CofA== X-Gm-Message-State: AJcUukd85TKg6L+qF2rL/4z77cXEMrOjpRfMmQm53iPCTYlN01fRKT6V TZupAZHg5a/UVSQARdJ30GX5KdjgtGE= X-Received: by 2002:a63:d10:: with SMTP id c16mr14830267pgl.382.1547756102468; Thu, 17 Jan 2019 12:15:02 -0800 (PST) Received: from majic.sklembedded.com (c-73-202-231-77.hsd1.ca.comcast.net. [73.202.231.77]) by smtp.googlemail.com with ESMTPSA id b202sm5600744pfb.88.2019.01.17.12.15.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 12:15:01 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] media: imx: csi: Disable CSI immediately after last EOF Date: Thu, 17 Jan 2019 12:13:46 -0800 Message-Id: <20190117201347.27347-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117201347.27347-1-slongerbeam@gmail.com> References: <20190117201347.27347-1-slongerbeam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Disable the CSI immediately after receiving the last EOF before stream off (and thus before disabling the IDMA channel). This fixes a complete system hard lockup on the SabreAuto when streaming from the ADV7180, by repeatedly sending a stream off immediately followed by stream on: while true; do v4l2-ctl -d4 --stream-mmap --stream-count=3; done Eventually this either causes the system lockup or EOF timeouts at all subsequent stream on, until a system reset. The lockup occurs when disabling the IDMA channel at stream off. Disabling the CSI before disabling the IDMA channel appears to be a reliable fix for the hard lockup. Reported-by: Gaƫl PORTAY Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-media-csi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index e18f58f56dfb..9218372cb997 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -681,6 +681,8 @@ static void csi_idmac_stop(struct csi_priv *priv) if (ret == 0) v4l2_warn(&priv->sd, "wait last EOF timeout\n"); + ipu_csi_disable(priv->csi); + devm_free_irq(priv->dev, priv->eof_irq, priv); devm_free_irq(priv->dev, priv->nfb4eof_irq, priv); @@ -793,11 +795,10 @@ static void csi_stop(struct csi_priv *priv) /* stop the frame interval monitor */ if (priv->fim) imx_media_fim_set_stream(priv->fim, NULL, false); + } else { + ipu_csi_disable(priv->csi); } - - ipu_csi_disable(priv->csi); } - static const struct csi_skip_desc csi_skip[12] = { { 1, 1, 0x00 }, /* Keep all frames */ { 5, 6, 0x10 }, /* Skip every sixth frame */ -- 2.17.1