From patchwork Wed Aug 2 14:47:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13338284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45766C04A6A for ; Wed, 2 Aug 2023 14:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234396AbjHBOrn (ORCPT ); Wed, 2 Aug 2023 10:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234384AbjHBOrm (ORCPT ); Wed, 2 Aug 2023 10:47:42 -0400 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 460581BE7 for ; Wed, 2 Aug 2023 07:47:41 -0700 (PDT) Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 8D5CD867F0; Wed, 2 Aug 2023 16:47:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1690987660; bh=vPBE+WeFYjet/7EnzMPL6KNEyP366bOqLBPiDT+JT7o=; h=From:To:Cc:Subject:Date:From; b=sBPsvqP5ZwM52yJD92OCG/wcBEYSrv2280ucah96E7vvdgJjvXN3Kj9IqzcqrpNwJ Ms585/j38FIkZ4XeNxPiEqcw1QwAS0pw2sdkL4FAoLfdMaAdNZm8R17HYpEQukXh5R mOkEr2v9M/8ExpdjbC2o1PVD/MH2e3ePxGwR0W76K8HeQ3+bKO7YV39Y+qNvkfka05 U5HcPKUou0WVM3/BMz9DXJVA0Yk+1jarvXone5qbvywr7/MbrjlmgWiflm9DSd+aZA eBMYkm7FYvwxpAYBTJzpmORD3C2/6ePILs4t567z04CPcur+XAHP/zQFUEfxzEaE42 BI+xZWTN2f4pQ== From: Marek Vasut To: linux-media@vger.kernel.org Cc: Marek Vasut , Jacopo Mondi , Aishwarya Kothari , Francesco Dolcini , Hans Verkuil , Hugues FRUCHET , Jai Luthra , Marcel Ziswiler , Mauro Carvalho Chehab , Philipp Zabel , Sakari Ailus , Steve Longerbeam Subject: [PATCH v2] media: ov5640: Enable MIPI interface in ov5640_set_power_mipi() Date: Wed, 2 Aug 2023 16:47:25 +0200 Message-Id: <20230802144725.34099-1-marex@denx.de> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface. In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case. This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame. Fixes: aa4bb8b8838f ("media: ov5640: Re-work MIPI startup sequence") Reviewed-by: Jacopo Mondi Tested-by: Jacopo Mondi # [Test on imx6q] Signed-off-by: Marek Vasut Tested-by: Jai Luthra # [Test on bplay, sk-am62] --- Cc: Aishwarya Kothari Cc: Francesco Dolcini Cc: Hans Verkuil Cc: Hugues FRUCHET Cc: Jacopo Mondi Cc: Jai Luthra Cc: Marcel Ziswiler Cc: Mauro Carvalho Chehab Cc: Philipp Zabel Cc: Sakari Ailus Cc: Steve Longerbeam Cc: linux-media@vger.kernel.org --- V2: - Update commit message to mention this fixes the first corrupted frame - Collect RB/TB - Expand CC list --- drivers/media/i2c/ov5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index ff0aef915fca5..5fe85aa2d2ec4 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2539,9 +2539,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on) * "ov5640_set_stream_mipi()") * [4] = 0 : Power up MIPI HS Tx * [3] = 0 : Power up MIPI LS Rx - * [2] = 0 : MIPI interface disabled + * [2] = 1 : MIPI interface enabled */ - ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x40); + ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x44); if (ret) return ret;