Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5880151pxb; Tue, 16 Feb 2021 09:44:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLqRq3hGJoS1kwgUnL7lRYqvmYqaW26sSTm6T3AnGCd+O1Rp9K33uzIg/tVW9wdzlYlhjr X-Received: by 2002:aa7:da19:: with SMTP id r25mr730988eds.367.1613497477901; Tue, 16 Feb 2021 09:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613497477; cv=none; d=google.com; s=arc-20160816; b=BwGq9ID0wzIXihjw4CfUNcHNVn87rLIhIBC5d2QeKxpTVGsjPmEikcTT38nT7DA81z /F5v1G+KMZf0Fsyk9/CoKM3/9TZCses8blXsIoHgxPzKo7SF4Vr0Y4qmvzFuK+aWbP5A VVPXWj4rL6HBpok4c8UR5cvXWaEwZQS62roy64WQe3CHFb1O6vMJW8zgKFLcGWaDHYXP dxABT0sLppo7h4hHEPBSbO0jeGnu7p0ZLoWk3g6AzLDq5+XM+iUOrOBKbNXBR0Q7SIav 5YC2pijsTMbNy6mcmG49gtod2r0VbpgUyg1516cxSHm5/wgvWhJtAMugEkH0pLJBV5W2 tbzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oxQdOyJX+q5GyO6b/4Kh1w4cwB2UOfn1oN8kfY8tot0=; b=io2qzjXPpxiUT/gvEvSEBgh9KCsHD38ZNUVKLFsBL3Abp+wGROP9CyoR5g3Q+yAaM/ DIB1pnAr1SwX/2gnQDGvfuPc0GQ/bgMuegOOnH3lvpT/h7/U6vKY9/EdKRQF14XT5ILe 4XXH1rVyVfBLxW8wMhbHsxTgjNmxPbFG08ciuFKRRuUM8KgZlGZXPTC3dDdHAQjK2V2y WnKRs6idrZ/y0BSmASn2j6IfPakK9b6SlNLsp6maMw7rgBt/h8vx+ykLVFfKDqONJjiF NfHrQQY1X0puDojX0as5q7HsYqP4cCeRddpXIhdbgFgKD6mo7AQzjssTqnsV04VHpjHZ xdDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si15588886edw.243.2021.02.16.09.44.14; Tue, 16 Feb 2021 09:44:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbhBPRnL (ORCPT + 99 others); Tue, 16 Feb 2021 12:43:11 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:40901 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbhBPRmU (ORCPT ); Tue, 16 Feb 2021 12:42:20 -0500 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 1F17220000D; Tue, 16 Feb 2021 17:41:36 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Jacopo Mondi , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/16] media: i2c: rdacm20: Re-work ov10635 reset Date: Tue, 16 Feb 2021 18:41:36 +0100 Message-Id: <20210216174146.106639-7-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216174146.106639-1-jacopo+renesas@jmondi.org> References: <20210216174146.106639-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OV10635 image sensor embedded in the camera module is currently reset after the MAX9271 initialization with two long delays that were most probably not correctly characterized. Re-work the image sensor reset procedure by holding the chip in reset during the MAX9271 configuration, removing the long sleep delays and only wait after the chip exits from reset for 350-500 microseconds interval, which is larger than the minimum (2048 * (1 / XVCLK)) timeout characterized in the chip manual. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/rdacm20.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c index e982373908f2..ea30cc936531 100644 --- a/drivers/media/i2c/rdacm20.c +++ b/drivers/media/i2c/rdacm20.c @@ -477,6 +477,15 @@ static int rdacm20_initialize(struct rdacm20_device *dev) if (ret) return ret; + /* Hold OV10635 in reset during max9271 configuration. */ + ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT); + if (ret) + return ret; + + ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT); + if (ret) + return ret; + ret = max9271_configure_gmsl_link(&dev->serializer); if (ret) return ret; @@ -490,23 +499,11 @@ static int rdacm20_initialize(struct rdacm20_device *dev) return ret; dev->serializer.client->addr = dev->addrs[0]; - /* - * Reset the sensor by cycling the OV10635 reset signal connected to the - * MAX9271 GPIO1 and verify communication with the OV10635. - */ - ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT); - if (ret) - return ret; - - ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT); - if (ret) - return ret; - usleep_range(10000, 15000); - + /* Release ov10635 from reset and initialize it. */ ret = max9271_set_gpios(&dev->serializer, MAX9271_GPIO1OUT); if (ret) return ret; - usleep_range(10000, 15000); + usleep_range(350, 500); for (i = 0; i < OV10635_PID_TIMEOUT; ++i) { ret = ov10635_read16(dev, OV10635_PID); -- 2.30.0