Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp676882ybh; Tue, 10 Mar 2020 06:18:36 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuF+IJPS81iE/4YFCKbWc3fmGEvToUSngYyh/RQacp67AElayDbY45L6US6fGVsVZStZQ8b X-Received: by 2002:aca:f1c2:: with SMTP id p185mr1120157oih.87.1583846316195; Tue, 10 Mar 2020 06:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583846316; cv=none; d=google.com; s=arc-20160816; b=YAuRyeegPjSxJAeZwJGqdnq0uCNEAScx8jbptcC1SjLvINrnXlQJw7tzMhpdINalPR DgYo7TfhdWdToHLEpiSSeUQtjWj+EnUqXnWqf8PCQb0wJQ9na/F8pA7d4P34Ko+dySB/ aAv9+tgHssVkWYjCIWja8BkPwWD/kPW7Cl43gzirKdQV/wrMsRgAK35bEoapgua/dIsZ qNxktrhacd3SnYiRGgP4OPhzJygXMpMohM3b0+qhI0bpQeHIHcqIbXdmD9iJk2awxrDb Rdl4KmBL9C2idEwuzOIvp/fQlXsEsxXKG5F4/THAvYWZ+VkPg2OoQdlgy1K04AqIXSF6 wXJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=jMasYSrT30IcAJ76rJm5Q6rROdkkmCtMYPOA9Gv3qY8=; b=K8oeJ5THEa1bz7L3jXTf3JYsrjrzebyqjiKCTi0pFyj5QrXPaiv/PZ4iO/teO7/xlX 2yxz+Qv8yVWbzvEsqe7gKHpISfCurqoyqo0ltYdWBQhkbnoaSdP/rvrvnLQ0HS0GGBFE Ft6c0YDnBqAIoxcaOpxt1pXYaZvVd+LshjFIXoebKw53XAXNeAp7E3fvwMe2+EkVA3tH HHbGxANxsud2k+kyjFUu2KiKkEPrgmri9t9l01hg3GtP4oD880X7WjSTOyLsIS7bXFMB //7DZRYmScyCq6aV7vQOANg34Bs9GdBBPV3teLnLSg97a8zcjPWGO+pAMJRh2ajFjHh1 X3GA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4si1996287otn.175.2020.03.10.06.18.24; Tue, 10 Mar 2020 06:18:36 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731495AbgCJNRm (ORCPT + 99 others); Tue, 10 Mar 2020 09:17:42 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:31755 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731383AbgCJNRj (ORCPT ); Tue, 10 Mar 2020 09:17:39 -0400 X-IronPort-AV: E=Sophos;i="5.70,537,1574089200"; d="scan'208";a="41499811" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 10 Mar 2020 22:17:37 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 209F14290415; Tue, 10 Mar 2020 22:17:35 +0900 (JST) From: Lad Prabhakar To: Dave Stevenson , Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar , Lad Prabhakar Subject: [PATCH v4 1/3] media: i2c: imx219: Fix power sequence Date: Tue, 10 Mar 2020 13:17:07 +0000 Message-Id: <1583846229-6799-2-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583846229-6799-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <1583846229-6799-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> 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 sensor 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 "streaming -> standby" in the probe() after power up. 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 Acked-by: Dave Stevenson --- drivers/media/i2c/imx219.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index f1effb5..16010ca 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1224,6 +1224,23 @@ static int imx219_probe(struct i2c_client *client) /* Set default mode to max resolution */ imx219->mode = &supported_modes[0]; + /* sensor doesn't enter LP-11 state upon power up until and unless + * streaming is started, so upon power up switch the modes to: + * streaming -> standby + */ + 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.7.4