Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2403156imu; Thu, 17 Jan 2019 13:35:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN415sZSoaUyQOg03MjgdFH/ZwQUFTncNOT6uscYSff7BrbI8cPb2pUjaBgyJuSVQtwI+xEq X-Received: by 2002:a63:eb52:: with SMTP id b18mr14658656pgk.213.1547760927010; Thu, 17 Jan 2019 13:35:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547760926; cv=none; d=google.com; s=arc-20160816; b=fyaUR2aDBnIFjzHIz19yq+UyMuftZBMvE2bMegAsrlaBVPGgJRqrElQpWMVoO6Vy10 sEem1UhipZqqY/hIWsXQwnfih2uoFWj1bIEu6I6NiPohvUA68sGTAJBZUwFGUR/fEEBp 6hSJlrv7HDmJEyYClEF3vcDlFIk3qikMkjjuZhLTe7nvKbl9rOhQmq/9xf20ModgKkK7 jDQ8uo2S8LBB0NfhmxBbdRC8SqGkBU7idbR1Y8ZrBQepTIaTDm+X6a5xNnB8Pya0skzo 7nTAZR5vJb2+lj34WiQipu7+eZxneJeXOkay25CGoJF+hrjKl8N6ZpRlV+tLgOUgOwTk ya0w== 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=UE+B2YfptHacugBOCw2gEIV1Rz9SUGZy1HzhzKDbTTE=; b=0uA355z2ru/lW+x2AUiepv34HsbDTlRE4GsTOfLUDQlzpNj0C9plN2OtqjE8xf2YQ7 GYkEusEcXcireANki/QWTM7b8PADEIY3OaEZWOqR+CtzIQcNd4KpmtloUrXazvwsByTl drqKrViIOoiogEbqIwdCdfozLzZ/dw+rjiwwp3YTgVnIlarpGtB7L25e3BHUk0E74cXr InXh4WUYCTRqWUAe/1sPAJ++MmM5F7hoefVIQNAKtmmjA0oUtlJ33eOACXEX8yxNwmam WSza+sVRz78/qH5zAz4FArWk4wLJS98qqL1eRR8H7tIeGSsMpOqSSG+0iMVrT9zjBnOk iESQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fpxH99Mi; 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 w185si2722803pfw.122.2019.01.17.13.35.11; Thu, 17 Jan 2019 13:35:26 -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=fpxH99Mi; 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 S1727598AbfAQUtc (ORCPT + 99 others); Thu, 17 Jan 2019 15:49:32 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46891 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726905AbfAQUtc (ORCPT ); Thu, 17 Jan 2019 15:49:32 -0500 Received: by mail-pf1-f195.google.com with SMTP id c73so5379511pfe.13; Thu, 17 Jan 2019 12:49:32 -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=UE+B2YfptHacugBOCw2gEIV1Rz9SUGZy1HzhzKDbTTE=; b=fpxH99MiE2fPDYlKz9VG+tdABZCK5dM9pYWw+jpiZBNIL8NN3wQ5q7fUcK0zXZXTHT cftrrBoVFusWi9yVGkp8IqC8eEzKS8qBIAbfgS1+buN5c4gXMHg4mSdOZjbaBirwbm2e V9+9jKy0rJNl2D3lEPSzozuQSx8DAL3mAU2XxOFATXfT5711/b6xE0+PxSaTD5WbO47P 9y+7xBvJL/+sGa80V+VQ39BlrpbENV9SaXLIPu9WEUeg2He7thRcSr0TRQwhDXo523Ik rE0sbLFScYl6guV+zgUBVyZScGdcafNqF2kIuHd8lla+fj5rhpPrf/F8AVAZToKL2eAV gP+Q== 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=UE+B2YfptHacugBOCw2gEIV1Rz9SUGZy1HzhzKDbTTE=; b=PRrlkR3why2htzGAw75PbVYFGsQTEBGf0uj/myG3ya7a1yzjMUNrjUMHdsbCcbhNgi GHAX5700VBiY/j5iJT90w12vSXshkH33i8PeBP+zzuEwAOGcRryeKSPZTg7NTWUhuRIo EZlHVIxNtNLca9ydH73yXs79BxN22HUEvfK21Bll31ozBBbmD9QnODFXOrEc07/3lhRc CnilDFaKY26RPWkrXQHU52Knyhss7LIgPaMYfaVTCKOFF5WldXdh5XQF+WZQS1AprRNA ZoqqNFyxMneZb/nB+mq/n5CdZk5rCT2pCUGWzYlfLwVnFDgTV4D9eRL/xeGAvKw6U19n mXEg== X-Gm-Message-State: AJcUukcg9hxRu63XUQBYxSUFp4jm9jj/TalBEoLhdaUxFQtt6/491Su/ fK1FOTp/Rtd+ZtVXsQEGNUl547JcDHQ= X-Received: by 2002:a62:6dc7:: with SMTP id i190mr16468375pfc.166.1547758171430; Thu, 17 Jan 2019 12:49:31 -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 b68sm4007481pfg.160.2019.01.17.12.49.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 12:49:30 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , stable@vger.kernel.org, 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 v2 1/2] media: imx: csi: Disable CSI immediately after last EOF Date: Thu, 17 Jan 2019 12:49:11 -0800 Message-Id: <20190117204912.28456-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117204912.28456-1-slongerbeam@gmail.com> References: <20190117204912.28456-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. Fixes: 4a34ec8e470cb ("[media] media: imx: Add CSI subdev driver") Reported-by: Gaƫl PORTAY Signed-off-by: Steve Longerbeam Cc: stable@vger.kernel.org --- Changes in v2: - restore an empty line - Add Fixes: and Cc: stable --- drivers/staging/media/imx/imx-media-csi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index e18f58f56dfb..e0f6f88e2e70 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,9 +795,9 @@ 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] = { -- 2.17.1