Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp855454ybf; Fri, 28 Feb 2020 08:55:39 -0800 (PST) X-Google-Smtp-Source: APXvYqw0awOqgEe2fGop11D66dmVyuZ34Uyv2pcLCsyBC9jGzv7UPK+MPUU+95ZJLZiA4+I5myiv X-Received: by 2002:a05:6830:2102:: with SMTP id i2mr3961587otc.123.1582908939400; Fri, 28 Feb 2020 08:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582908939; cv=none; d=google.com; s=arc-20160816; b=m9Yj/apccN6ZDHLFWEjxRlQo1dC6Oc7NUMzQPtqkg51xqQNQvst4PCwphXhRh2KrrI VdlvBIo9ey7ohpfWW0gd2hXBpXKGibOfLfJzYfNBK4ETHFeyu3hSw7iUOXhhw+vc5URm 6qers9yFAtQGliJP3Z0ZIP6E4GpjTLSp3ChllvxthoV+/X15L+Q9fzrv7vQaZSJe9oTI N69ORfawrx24aZMME2VcUtuCZJykCBbZejeHPoncpKkiKqw/RP3z6HhwWVZVwJbBA1uX 5iDpC5UzEoQOeOfH7WWLRXGSsILFlQGJF90u98X1l7Q+QOG82fQzeqfMLnZk2ardy3r/ Socg== 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=5rtCgdvXhrlNYFQWjsDQFMUM6dYurNbdvEC8f0MuiG0=; b=yPjdTE0wY9WayPhW3PHk3ySXiMSLVwGTW8hrTYMNara2WvlZIcigYy9P0iS0zw4y1Q Q5qRQv45yun3yWDbMR8MGdt0IsQ9xV/WaTEgJ4qO0PhFsjP9Hgo+oqTAyAE14HXqSkJg w/+FKIeAP/U4SKmEqsM0jIAJACEIxEo8I/1YztXndQNunwaTtvHvl7ZR1FX4TfRIxj/2 sfBOfXJ/G02eT8FARQlDDUFTXqs5s6CGDQ9v/o3cymT95Prg2hKHUxaOU2yzSbnUKIRM PPAMSH5NTwIuQEsNcEjk2ZBzaOshGBWQ4FmE5RcgCTxtQBPKE859v5gnvfW2zl3ZyUzr nkxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OKqGBQFi; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z18si2170573oid.82.2020.02.28.08.55.26; Fri, 28 Feb 2020 08:55:39 -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=@gmail.com header.s=20161025 header.b=OKqGBQFi; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727000AbgB1QzK (ORCPT + 99 others); Fri, 28 Feb 2020 11:55:10 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38420 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726956AbgB1QzJ (ORCPT ); Fri, 28 Feb 2020 11:55:09 -0500 Received: by mail-wm1-f67.google.com with SMTP id n64so2634801wme.3; Fri, 28 Feb 2020 08:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5rtCgdvXhrlNYFQWjsDQFMUM6dYurNbdvEC8f0MuiG0=; b=OKqGBQFioE/PW01KlWFhSja6sQVxyF9aMvqnliKSuBE7vGMkTsmCQ94QPOKl7dnx4t ekFK+8dT0iBJCCz4DZKuop1qxOuWRh+IC9ViZQRFVZ3Gh1/IH1aPIeheGYiJ0nY91FSn Sh4xgaV6odFTEHPlDcyy1hkgbi3XZagVXVbpAJ1AoJ1Xw599i0yRXlUQLYJHjfv6vbOh 4fcfaNt9Z0lpaEt4HgjoaocRap99cCPe33CF7jSIhzhxadOrHFMPOiGAhJSH/Bvryfn0 MiID7Sq2Cqlje7KXcMCu/xCMlGw1wgiHOZ7gXI0JCaGguXaD/jcC+rmO2B6tJ90aRH8Q 8A1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5rtCgdvXhrlNYFQWjsDQFMUM6dYurNbdvEC8f0MuiG0=; b=m75P4/XKJHjTFZjRslUs1bQqpVn9FO3BWnqFpSke4Y+98BQCtoSpGyCZmfisWK8784 n6bdnbNHc7i2TEZ/0UuFykA66qTm5C47RggERwFAsb44Ez4edqv095tugVtgPDV5A7JJ k3YXfOprzFthxWcgLmAm45Z5VaSamZtyUZWa29L64lMh2TY9sgJ5VuffdfoxA4inQrZZ nugaVionrLwGwT+sVNzrLOCdkL9qNrNkP7mZA1eAUJKHo7lPFnbOCX9ShtJ3W/YYzrc1 gDOHynLFfDnL24gE1Uz6gEiCftv8WAhLRuXkzgds5VEwUTmWILc6Q2Uq5YyPfhz+96P2 P7Fg== X-Gm-Message-State: APjAAAWodRtaoYCcYXkHa1AY5hchrXx96PbwRoQE//4Su9Qo85B9xFNK oCgVTTmOwcLEYgUiKW+FVZXw5GIXvIY= X-Received: by 2002:a7b:c386:: with SMTP id s6mr2860061wmj.28.1582908908294; Fri, 28 Feb 2020 08:55:08 -0800 (PST) Received: from prasmi.home ([2a00:23c8:2510:d000:3855:fd13:6b76:a11b]) by smtp.gmail.com with ESMTPSA id s1sm13300071wro.66.2020.02.28.08.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 08:55:07 -0800 (PST) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Mauro Carvalho Chehab , Dave Stevenson Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar Subject: [PATCH 1/3] media: i2c: imx219: Fix power sequence Date: Fri, 28 Feb 2020 16:55:01 +0000 Message-Id: <20200228165503.18054-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228165503.18054-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200228165503.18054-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. [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 + * 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); + 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; + } + + /* getting sensor out of sleep */ + 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