Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2375024ybf; Mon, 2 Mar 2020 07:25:09 -0800 (PST) X-Google-Smtp-Source: ADFU+vtKHPyycPkC23jRJQ0cWpJVnvlCFfSpd+qyGieuo9b8o6lhPYlL5OI/uf+m7bnXs3ZYi5Q4 X-Received: by 2002:aca:ba55:: with SMTP id k82mr31967oif.94.1583162709716; Mon, 02 Mar 2020 07:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583162709; cv=none; d=google.com; s=arc-20160816; b=zOBZDpmdpNruUj9teOaetpn4UuTLgPPHMld9uv3VHXjXFcxKJMkheHVdNq+UlF6RJu v4uG5tx1lPGhwEb3ZHuVcU9K+Ey61dwXGRnCHkU2gVDZKaCo2wX3lpwuka1DYHV0uPuj YwfIr8WyxsDuILZ74VJxzzqpABn2/8DcLVPqteAQwWuZD8gtW069hx39wrYxtBK5D36W JoEK7h8iowqHXVKd5QWI2c6PPLTovhh1C1wt2lUeQ/nEdsIu7a7Pdt6IWWyq7CmRvRN0 jUBQGjnK2EzwNBY3PtYQTQWrYdU+/gNOHP4vCusl7n9GawaVz3+kMkA0nXnI6r51e+n2 Tq8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6/CIkWNCwNaImmXlS8dDLwAcR6sRgPxwGGxRlcKCoVs=; b=uogmJcpWZkWazRkuQziid7jo3SUK3puvUp+Lxn+5QXU57Jx9R8Q2FYs6t1iV8wiofj jDLhqEsOWx6WoBGpnvHi0j0MMTHv+ykzfP9kOKrouQTXKrCTXQhyW17j6XtPo7MAi8Bn I39xC7izHThzg6oNPA5UCojhc3s5gZzIQKLjI4RNsj07HxosvHW3X/5xPwDNsYgglsI5 uu5e/c5SaLjVtAp6jj2btu4WAHbFGpcwmkuBbSB+owbNkrMOYUUVHEPp/9DN0hVS56aV RWrnrf+b02wCsNvUuwBkfmsafNOQtY56D5mmAz8WnhHYmWlW4gt0/LKKCpQd8LblOVtR TrCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=ZF1JAjbn; 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=raspberrypi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 74si6134359otd.45.2020.03.02.07.24.56; Mon, 02 Mar 2020 07:25:09 -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=@raspberrypi.com header.s=google header.b=ZF1JAjbn; 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=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbgCBPYT (ORCPT + 99 others); Mon, 2 Mar 2020 10:24:19 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38723 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbgCBPYS (ORCPT ); Mon, 2 Mar 2020 10:24:18 -0500 Received: by mail-wr1-f65.google.com with SMTP id t11so160065wrw.5 for ; Mon, 02 Mar 2020 07:24:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6/CIkWNCwNaImmXlS8dDLwAcR6sRgPxwGGxRlcKCoVs=; b=ZF1JAjbnFfIgiCw6NX8mgzBabbjZJRZ4pT7T3b0Z7AbuYhSseXIOObM0JlCuObWu+Q jsc2U3owHmjYwWLA9kG8h9lVtxNutsF4FQA5TPXf6psBmNT7GUs6OM+0kIQv083y0i+a yXE70XLBvDPTe+WfDAmBf52LvcXEVoRFkb+AzcOr8/bNEH5GhckOIO4p/nCwvrpeiVIA p+mWJyS9xTFDzaV9RmEc2AU1N4+XE97vlAhV3KGI/EBGNILL+WxiS9ZVxxEvzML36cpP VHXh2ql3saT3JJyFFAwbcplIvcGUTD/JkVJ68613fQSE55NaDAIl6iHWYGaOHqJOkBv3 Ik5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6/CIkWNCwNaImmXlS8dDLwAcR6sRgPxwGGxRlcKCoVs=; b=FXlSgvFMIQMplUwQ8OS5ycqr+9o/IBIsNlLjXrL3ZllsmyBBqaXHRziitCGeR4DM4u CiW35RaCd3qQP7Xv65PpLTkzl9BNopdmxrEREwIKNxJWpascRJ+gnD3ZkmIBpeUhpg0Z U2dn67PaiGUxOVYKlX0gARdBYjrm89VudfzzL2cqctfUrqmCnb0tQPWlh9IlmILZ6Yuh 8PWsiwzS/wukb9EByoFhFAmEtKy5QQbvO176Itu0sYd27/ss4p/02ua8xJkoLdR3b4S2 ZSA8KJvqYeyA4ymcLlalbNO8Dv9mPeQWtWHVYumO8Kt1A32yS3arUzkLKdjGQlOyalhH XazQ== X-Gm-Message-State: ANhLgQ0WgaYZ6aeymGgOnaQvNvsQczaMyDSOZKwsPs0MiagNIXomzz7J 6CvwxvBSR+AFlIRT9QQMbcjm/nJRzDcCm0nKlTE3ng== X-Received: by 2002:adf:e542:: with SMTP id z2mr160388wrm.150.1583162656640; Mon, 02 Mar 2020 07:24:16 -0800 (PST) MIME-Version: 1.0 References: <20200228165503.18054-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200228165503.18054-2-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20200228165503.18054-2-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Dave Stevenson Date: Mon, 2 Mar 2020 15:24:01 +0000 Message-ID: Subject: Re: [PATCH 1/3] media: i2c: imx219: Fix power sequence To: Lad Prabhakar Cc: Mauro Carvalho Chehab , Linux Media Mailing List , linux-kernel@vger.kernel.org, Lad Prabhakar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lad. Thanks again for the patch. On Fri, 28 Feb 2020 at 16:55, Lad Prabhakar wrote: > > When supporting Rpi Camera v2 Module on the RZ/G2E, found the driver had > some issues with rcar mipi-csi driver. The sesnosr never entered into LP-11 s/sesnosr/sensor > state. > > The powerup sequence in the datasheet[1] shows the sensor entering into > LP-11 in streaming mode, so to fix this issue transitions are performed > from "standby -> streaming -> standby" in the probe(). > > With this commit the sensor is able to enter LP-11 mode during power up, > as expected by some CSI-2 controllers. I guess I'm lucky that the CSI2 receiver I deal with doesn't care on this front. The datasheet does seem to imply that the line is left in what appears to be LP-00 after power up, but this feels like a huge amount of stuff to do. > [1] https://publiclab.org/system/images/photos/000/023/294/original/ > RASPBERRY_PI_CAMERA_V2_DATASHEET_IMX219PQH5_7.0.0_Datasheet_XXX.PDF > > Signed-off-by: Lad Prabhakar > --- > drivers/media/i2c/imx219.c | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c > index f1effb5a5f66..8b48e148f2d0 100644 > --- a/drivers/media/i2c/imx219.c > +++ b/drivers/media/i2c/imx219.c > @@ -1171,6 +1171,7 @@ static int imx219_check_hwcfg(struct device *dev) > > static int imx219_probe(struct i2c_client *client) > { > + const struct imx219_reg_list *reg_list; > struct device *dev = &client->dev; > struct imx219 *imx219; > int ret; > @@ -1224,6 +1225,38 @@ static int imx219_probe(struct i2c_client *client) > /* Set default mode to max resolution */ > imx219->mode = &supported_modes[0]; > > + /* sensor doesn't enter to LP-11 state upon power up until and unless Remove "to" > + * streaming is started, so upon power up set the default format and > + * switch the modes: standby -> streaming -> standby > + */ > + /* getting sensor out of sleep */ > + ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, > + IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY); The datasheet says the default for IMX219_REG_MODE_SELECT is already 0 / STANDY, so this should be unnecessary as we've only just powered up. > + if (ret < 0) > + goto error_power_off; > + usleep_range(100, 110); > + > + reg_list = &imx219->mode->reg_list; > + ret = imx219_write_regs(imx219, reg_list->regs, reg_list->num_of_regs); > + if (ret) { > + dev_err(&client->dev, "%s failed to default mode\n", __func__); > + goto error_power_off; > + } Seeing as we don't want the images produced, and we're about to power the sensor back down again, do the default register settings do enough to allow the shift to LP-11? ie can we drop writing any mode setup registers here, and just got to STREAMING and back to STANDBY? > + /* getting sensor out of sleep */ We already did that above. This is standby->streaming. > + ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, > + IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING); > + if (ret < 0) > + goto error_power_off; > + usleep_range(100, 110); > + > + /* put sensor back to standby mode */ > + ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, > + IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY); > + if (ret < 0) > + goto error_power_off; > + usleep_range(100, 110); > + > ret = imx219_init_controls(imx219); > if (ret) > goto error_power_off; > -- > 2.20.1 Cheers, Dave