Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp3092264ybj; Mon, 23 Sep 2019 14:42:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrZJj4CO4t9K8dAaB8Wi6Dp6y4zwlTG6obOKvbfumJDfXhKkJoK8C/ypBJDunClivgNQBk X-Received: by 2002:a50:a57d:: with SMTP id z58mr2333696edb.115.1569274953987; Mon, 23 Sep 2019 14:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569274953; cv=none; d=google.com; s=arc-20160816; b=vE4PYsYxqzP5QqV1gmr4rYC9MOr9fRmXTZlYvUNipmHAuQL7RUzxrbfnSQsly5Evge gJBSL8Y96KlqphK2WgpxPf3YHRd3X/3Ixu//3izNzJiLWB9JpFD2t9boE6b8ayTEiLnQ Y//2H19rILhgw85P/YpryaaQfhY76ADXko1dyvsujP0pP7mYn2QjGKKa9tw5YAee8CW2 OJGffgvkqStsVxUDh7pGdiDPth3E4jzs6phd0zY5zW+y6ehF2NmL/9du3TbeLoXkRwXb 48O4aT9JoT3WXfgi3AOrh7wkZEHijrH67fFmn5Z1hOX5OuBYWNQMoYLDJOsjdmc80Hhc RGsg== 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=vtqBs0bSFtIfxrgywFVEnh/9zs2gggbsmjs6LrXok3s=; b=ahCtcGmCRmfuOEyGujHw8bqJK+Mrxed8q46MTVHHSkVWN8FTaB9Lvq5bbe+3gbazOk A1PfdH+1iK5QE/pqkiTpXGV5aPJMiDHhDUYuWSlPzyu3CeCi6QetNkAihC4u4tjxe/Q6 eBMeg3cnQOUjqe1JeaSEcAVpzkz8HXOJPu00uVf9SGq8Zih6XkhoHuo/kTUjGAIE9874 ZQsGX+LXjiW9yEr418FKBuPtj8CRgOAQzKx/sfVxtq+QtjzESMON5nVJottFZ5f+3Yl5 30XFYfcmTSBj8S7CMM9wBX8BUOIOs+8IdUAp/hNvYGfU+kM6Ldw7IEWqa6zbmaQq5N0e C8GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DcnKPPdN; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si7456086edd.431.2019.09.23.14.42.09; Mon, 23 Sep 2019 14:42:33 -0700 (PDT) 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=@kernel.org header.s=default header.b=DcnKPPdN; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390140AbfIVSqk (ORCPT + 99 others); Sun, 22 Sep 2019 14:46:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:42788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390057AbfIVSqf (ORCPT ); Sun, 22 Sep 2019 14:46:35 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16C9E21971; Sun, 22 Sep 2019 18:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569177994; bh=UgYhas+Ne82pUddsBnQzmIKiDCnGAB4Tisqknu33vB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DcnKPPdNE+BwCuiKQhiUe420xuiDnPZ3hGZFdMXEgg+iswj0Et8ceIpu66PhIyzS4 9xtwaJ6NkhT0RBkG1Nq/g2pbFX/3u1QSX67vNOGW/HcDoI5mNfoLsFyoo0fvN3zM+u Ep6ot950ljYLPJxa4SZI3p4tLdyeq10YARz0n5NY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ezequiel Garcia , Fabio Estevam , Steve Longerbeam , Philipp Zabel , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 5.3 085/203] media: imx: mipi csi-2: Don't fail if initial state times-out Date: Sun, 22 Sep 2019 14:41:51 -0400 Message-Id: <20190922184350.30563-85-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184350.30563-1-sashal@kernel.org> References: <20190922184350.30563-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ezequiel Garcia [ Upstream commit 0d5078c7172c46db6c58718d817b9fcf769554b4 ] Not all sensors will be able to guarantee a proper initial state. This may be either because the driver is not properly written, or (probably unlikely) because the hardware won't support it. While the right solution in the former case is to fix the sensor driver, the real world not always allows right solutions, due to lack of available documentation and support on these sensors. Let's relax this requirement, and allow the driver to support stream start, even if the sensor initial sequence wasn't the expected. Also improve the warning message to better explain the problem and provide a hint that the sensor driver needs to be fixed. Signed-off-by: Ezequiel Garcia Signed-off-by: Fabio Estevam Reviewed-by: Steve Longerbeam Reviewed-by: Philipp Zabel Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/imx/imx6-mipi-csi2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index f29e28df36ed8..bfa4b254c4e48 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -243,7 +243,7 @@ static int __maybe_unused csi2_dphy_wait_ulp(struct csi2_dev *csi2) } /* Waits for low-power LP-11 state on data and clock lanes. */ -static int csi2_dphy_wait_stopstate(struct csi2_dev *csi2) +static void csi2_dphy_wait_stopstate(struct csi2_dev *csi2) { u32 mask, reg; int ret; @@ -254,11 +254,9 @@ static int csi2_dphy_wait_stopstate(struct csi2_dev *csi2) ret = readl_poll_timeout(csi2->base + CSI2_PHY_STATE, reg, (reg & mask) == mask, 0, 500000); if (ret) { - v4l2_err(&csi2->sd, "LP-11 timeout, phy_state = 0x%08x\n", reg); - return ret; + v4l2_warn(&csi2->sd, "LP-11 wait timeout, likely a sensor driver bug, expect capture failures.\n"); + v4l2_warn(&csi2->sd, "phy_state = 0x%08x\n", reg); } - - return 0; } /* Wait for active clock on the clock lane. */ @@ -316,9 +314,7 @@ static int csi2_start(struct csi2_dev *csi2) csi2_enable(csi2, true); /* Step 5 */ - ret = csi2_dphy_wait_stopstate(csi2); - if (ret) - goto err_assert_reset; + csi2_dphy_wait_stopstate(csi2); /* Step 6 */ ret = v4l2_subdev_call(csi2->src_sd, video, s_stream, 1); -- 2.20.1