Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1233874pxb; Sun, 21 Feb 2021 17:19:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzf3yblkvakDw9PE5VZC0WGoxOw6A4RS7ka7Ko452mo1yLgqQU0P9neOQ3hcSrhtZUKIbVB X-Received: by 2002:a17:906:3915:: with SMTP id f21mr16121504eje.295.1613956783760; Sun, 21 Feb 2021 17:19:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613956783; cv=none; d=google.com; s=arc-20160816; b=jScTObwyZxlifn2jubzg/83x63kP127Lv/kUgtxqlGEJk9PVnyxUJd6wFOFiBVhS4o LSjmJvWF8v1R4rEQVdLotTpIUrgC11mt71WXOcclu7KS9Uhs2hdAeGVVSh54RO85EL5U U9P+qFUhE5Ln1PRlLFxB81BxMve74yd6Sqn4IdNilhGtGH/sg2ysiQQGQYLOJPHhK/UB ylI6ecpyB3O9vl9OlV/0CZ1yEhV0y41XN3oY6/9r5BQ9p9BqUeg1obwEZl/n4eZQFpK1 SJ8HOgQ+3Klc8EwxKPZeEBzf8O+sBv7w6canSuZdSi4pHla7iy1TDr8wJ/eTTJ9dP27Z BgoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xgqvsfVppQSaf8A0RkReYGnz5WINztwICcN2pF4wk1k=; b=AmWriapZSN8oPRqyckwtvRyTGsKowGxwXqFTcsa0PMKGftPqpMESWcPboL97FZK5Sv 7dH5RColzdKJHybKvusT39mGOKmVUbnsgcKvdujQGL4jgk1IqYeNTn4IqoEDN6prSXiE 9Ah8KzT+Oetc6M0YCQDEIxwXnd39Bdoz2fCOUMt5aNro9UiK5KxwRWW6ovCnmAiKSGyy Y++c7Y+ZeujMTQHxF/pNhEK5f2zxaxY+j/FvYHT6HTKS/3aQsQfzaddYSUhopo714vum 5L0IO2Ae+x6fka3+QTewiN99/Ufy979sgWLDFwdwzza1JwQbLisAuF3yadJ1oa0E89j0 sdyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EMozBtUB; 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 q18si11656635edd.608.2021.02.21.17.19.19; Sun, 21 Feb 2021 17:19:43 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EMozBtUB; 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 S230045AbhBVBQr (ORCPT + 99 others); Sun, 21 Feb 2021 20:16:47 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:54556 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbhBVBQq (ORCPT ); Sun, 21 Feb 2021 20:16:46 -0500 Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AC36A517; Mon, 22 Feb 2021 02:16:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1613956563; bh=UVHO10vcFfsxKsUXdutKQiERSU0wNuxiQ+myyfBxtEA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EMozBtUBWfIxfHjpGfcaRRUP01UQTchlH/FsB/rGgYP7QzQXcH15gr3rL2Xpa52v3 MJ2DXfIWhbI96uCyE83jW359j6F6t9nlPJOJ2/VQ1Qc/l6Pa4UzkcrMMeKaXGd5NL6 X/FY+xFWkvhGTtuOuTV5dZ1YKhqZmcxpohJ3d3D4= Date: Mon, 22 Feb 2021 03:15:36 +0200 From: Laurent Pinchart To: Jacopo Mondi Cc: kieran.bingham+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org, Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/16] media: i2c: rdacm20: Re-work ov10635 reset Message-ID: References: <20210216174146.106639-1-jacopo+renesas@jmondi.org> <20210216174146.106639-7-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210216174146.106639-7-jacopo+renesas@jmondi.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, Thank you for the patch. On Tue, Feb 16, 2021 at 06:41:36PM +0100, Jacopo Mondi wrote: > 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; > + Unrelated to this patch, it could be nice to rename the GPIO-related functions to use a similar naming scheme as the gpiod API. > 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); The OV10635 requires the reset signal to be asserted for at least 200µs. Is this guaranteed by the different calls we have here after asserting reset ? Maybe a comment to explain this could be useful ? > - > + /* Release ov10635 from reset and initialize it. */ > ret = max9271_set_gpios(&dev->serializer, MAX9271_GPIO1OUT); > if (ret) > return ret; > - usleep_range(10000, 15000); Maybe a comment here to state that the delay has to be at least 2048 XVCLK cycles would be useful ? With these taken into account, Reviewed-by: Laurent Pinchart > + usleep_range(350, 500); > > for (i = 0; i < OV10635_PID_TIMEOUT; ++i) { > ret = ov10635_read16(dev, OV10635_PID); -- Regards, Laurent Pinchart