Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1587155pxk; Fri, 4 Sep 2020 13:20:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/lRVp7HsKXHuWEgxuHnvjlZLEJYMlVn8877FFf0kGbGNpZ/XyyP/b6NITFpJLdVqKxtEn X-Received: by 2002:a05:6402:138a:: with SMTP id b10mr10519635edv.113.1599250806535; Fri, 04 Sep 2020 13:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599250806; cv=none; d=google.com; s=arc-20160816; b=D1O5ovN6Y1962QxqSdF4nLGw3FkIboX9OE1Ym2ejmkjYMSBFiXlhE937WVThNFLiJK rbV4mX4g0I5AScZs42sChMwHT3t7Byvy6YzUDjcfnmAn8xJA/MTyUARSGozGQKuSIdy2 sBzaAViZJzgblzRMYI52PfDIrZauT/4HDu1XrRYZSHOrfVRPsZbu6gGDOUrkyf2+mLSj xHc/T90am8Jkz9V/6hb37mH3/9OM5afPqu6A8k9YyZN+tOrdFsgNnawxOslhXPnGL4Ux 6KWuLRv4fYayczo43F6/ENjxvK/yeU94Nd52dE56iHmrnvz5gW8jZA4C+mmVX8t+bWLr OTDA== 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=wH09xfjGEmS/iWiFyQ6niNWy/uQ69diAUT7hsD8o+hE=; b=Uhr3olbxjmoTcKGZRMu3NaQ1C19LJetnAHJf8RYXkS57GjH8CPpdrE8qEEZbGY6Q8/ CpVc1qhlJQhmRCRco0MjvnnIKxKj/LZYyMbJVXExp8wybDX5t1lgmfbatTEZLNlkmsXm OqLXhiXACL2fjPq9PftKz6xnmGw4XIZ5itWySht5d2ofyeFcitUyxHdavPr5nfBJ24pk yl/O2uUSy/Bw6PVdVunutYDPDEWp+gCBwXIoCJ4DBEVuWDlOUp++85qQFW0MuKz0UQ7T 3triH+EdtNfj9xuU9zgJA/CPpmo5f5AS0I2GNGceEleXPQ72tba9EgRIjBco63IIVYjZ ieiA== 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 t22si4798487ejy.433.2020.09.04.13.19.43; Fri, 04 Sep 2020 13:20:06 -0700 (PDT) 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 S1728111AbgIDUSw (ORCPT + 99 others); Fri, 4 Sep 2020 16:18:52 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:7897 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728109AbgIDUSt (ORCPT ); Fri, 4 Sep 2020 16:18:49 -0400 X-IronPort-AV: E=Sophos;i="5.76,391,1592838000"; d="scan'208";a="56193948" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 05 Sep 2020 05:18:47 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 373D9400C441; Sat, 5 Sep 2020 05:18:45 +0900 (JST) From: Lad Prabhakar To: Jacopo Mondi , Sakari Ailus , Laurent Pinchart , Steve Longerbeam , Paul , Hugues Fruchet Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Lad Prabhakar , Biju Das , Prabhakar , Mauro Carvalho Chehab Subject: [PATCH v4 1/6] media: i2c: ov5640: Remain in power down for DVP mode unless streaming Date: Fri, 4 Sep 2020 21:18:30 +0100 Message-Id: <20200904201835.5958-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200904201835.5958-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200904201835.5958-1-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 Keep the sensor in software power down mode and wake up only in ov5640_set_stream_dvp() callback. Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Tested-by: Jacopo Mondi --- drivers/media/i2c/ov5640.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 2fe4a7ac0592..880fde73a030 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -34,6 +34,8 @@ #define OV5640_REG_SYS_RESET02 0x3002 #define OV5640_REG_SYS_CLOCK_ENABLE02 0x3006 #define OV5640_REG_SYS_CTRL0 0x3008 +#define OV5640_REG_SYS_CTRL0_SW_PWDN 0x42 +#define OV5640_REG_SYS_CTRL0_SW_PWUP 0x02 #define OV5640_REG_CHIP_ID 0x300a #define OV5640_REG_IO_MIPI_CTRL00 0x300e #define OV5640_REG_PAD_OUTPUT_ENABLE01 0x3017 @@ -1120,6 +1122,12 @@ static int ov5640_load_regs(struct ov5640_dev *sensor, val = regs->val; mask = regs->mask; + /* remain in power down mode for DVP */ + if (regs->reg_addr == OV5640_REG_SYS_CTRL0 && + val == OV5640_REG_SYS_CTRL0_SW_PWUP && + sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY) + continue; + if (mask) ret = ov5640_mod_reg(sensor, reg_addr, mask, val); else @@ -1297,9 +1305,14 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on) * PAD OUTPUT ENABLE 02 * - [7:2]: D[5:0] output enable */ - return ov5640_write_reg(sensor, - OV5640_REG_PAD_OUTPUT_ENABLE02, - on ? 0xfc : 0); + ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE02, + on ? 0xfc : 0); + if (ret) + return ret; + + return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ? + OV5640_REG_SYS_CTRL0_SW_PWUP : + OV5640_REG_SYS_CTRL0_SW_PWDN); } static int ov5640_set_stream_mipi(struct ov5640_dev *sensor, bool on) -- 2.17.1