Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp479668rwb; Sat, 14 Jan 2023 03:41:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXto8JTTXkFFgqed0CWMnovYq0wGFBtiy9R2wnR4GpgPq67YFEuti9r0ThL6Ni4RHgHZU8X9 X-Received: by 2002:a17:903:25cf:b0:193:2d53:3fcf with SMTP id jc15-20020a17090325cf00b001932d533fcfmr22835850plb.14.1673696465600; Sat, 14 Jan 2023 03:41:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673696465; cv=none; d=google.com; s=arc-20160816; b=y7OkMAouhsuZ4zYCARZ8soWZofCrL61N6N4qEywwyE0iI6Zi8DNTwK1qxmZ//XQPmt VQpzWIiCGTmUfaMD5FsAFdoYi8XBzrPY1vgMwuaL7qEEfMp+2UQfk+M9ycUzqko99UAP 0NPkkBF3ij7as/o7Ad5DFz+1HCGYG99TqWShOv2iWp0VYLY9doS74vUk3YbCRkvlcZ29 6ilRC3D2xlJKiT4eKbEkOR6di8MJJDINTT8eDc0YgE3lvHT+WPFKzQfmdW4Ak5nhJ3sn t2FVSqXXFGN+sH3wqWhJOETxOQNIN5fGWieuzcDHbhBnBar52fXMUeI0FOsKnC/7pi2u avBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=J5fd62izaRzYKahE51Ez8OS6iAYgUaFPo+1VfaByxNo=; b=NZXFtKopSu+Qj86EUSBiJkWGcgZqWZHI3GMncghfgNAKflhAUf9o9YAUDPcb4U34Ox CbYUAbYw4S08zzfvX8vT1R9JDhzbR5gmjhSTQuNZCDzKIKEbIkK7PJFEmKTRr0Ebd9sa qrLDZynLUsMKjMee0iBuSpw92SrooQc0B2Tvv3NXRc8QIOVpO3Sw5fEUBAWdY+M4k5gO MH0GIU+CDHb+w5VKPyZvTgbVsWWHRvlteBdFi5hnvbvO8AoE6OYpQUVWcBXTTkSYGUzS aDrcQEaQ1eDzd3c+urBalr9Xblwu0mbUA32leJXPu615XOaqI/WkW2TWoEXA3MH+goFo Eiuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="M8/CANIF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a170902e75200b001893b7f5ed7si25925400plf.205.2023.01.14.03.40.55; Sat, 14 Jan 2023 03:41:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="M8/CANIF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229764AbjANLVx (ORCPT + 51 others); Sat, 14 Jan 2023 06:21:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjANLVw (ORCPT ); Sat, 14 Jan 2023 06:21:52 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C5796EBF; Sat, 14 Jan 2023 03:21:51 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id y25so36535911lfa.9; Sat, 14 Jan 2023 03:21:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=J5fd62izaRzYKahE51Ez8OS6iAYgUaFPo+1VfaByxNo=; b=M8/CANIF4UP/MqZe9a6Ypax6eHzS9U0jbDs0VRK9lrRiFwQKSHxYtVUR+MSn2g5lfj exO7IfrsR8HQZFnTkeNMNl8HPXdr7FEWmgJiiGqddEtbmajuoLv3YDu63CKWyy5T6fgX d78+dqBnrOgIJ4Gqhqp+f4b/96PhKB1fLDfaqX+eSnJ5OXf45qiy9Cx6zU4BxFv/zPX+ XxEvAQXefPG0EYeCmd6+3qaTwEevnOn9sf8jzYvqwIsVdCD0TRX0f6qxfEpsRDfUK5BH LMxvQ7H+k0IIbqp+2suqxhoGnHKJOCNV31mqVk5viTezddRTnEbLwdK3pfIYr4arv5ux RPig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=J5fd62izaRzYKahE51Ez8OS6iAYgUaFPo+1VfaByxNo=; b=DHvkObHCE+UxeTE5ceNLdpoxqhd+N0VFjtRYET3nRSPHxvvNwazGiDUTZFrJiSObTG fkglqpltGvxetIzUvLBBbOQxNk0DWJhm37dF1jCQc9P/awaumFsNvAMW5Heidxkott3z E81DcOtMrGHgLUCifJkmBsCPhXWZviI7YLunSo7LyScWQUmqoxMv58WGhBEhfTW3mxSW o7hPQT8zYDqNWAszqf37qHdBTv4NB53w2DaNN/T9hspDtPLR89lXOFmOI3HSOGBCRJeV 5RsC7g5iidGuL76fs5DoLpmjXE7ZlTtxvU1cS5fjogQxnwI2AtxSTQgJ0tJluY3ei7YQ CY9w== X-Gm-Message-State: AFqh2kqF6PBEfAS4NvC7B9ArZVPcwYm57NDyFph+EQI7V5sWln16wp5m G2nTVSdwYDZPZg/cGvYAGv0xqCYxmhs= X-Received: by 2002:a05:6512:1049:b0:4b0:a1e7:915a with SMTP id c9-20020a056512104900b004b0a1e7915amr27257766lfb.49.1673695309242; Sat, 14 Jan 2023 03:21:49 -0800 (PST) Received: from localhost.localdomain ([2a05:3580:f312:6c02:b940:4283:cb3e:a3e8]) by smtp.gmail.com with ESMTPSA id f16-20020a056512361000b004cb27d8edd1sm4281728lfs.85.2023.01.14.03.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Jan 2023 03:21:48 -0800 (PST) From: Andrey Skvortsov To: Steve Longerbeam , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrey Skvortsov Subject: [PATCH] media: ov5640: Update last busy timestamp to reset autosuspend timer Date: Sat, 14 Jan 2023 14:21:09 +0300 Message-Id: <20230114112109.982005-1-andrej.skvortzov@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Otherwise autosuspend delay doesn't work and power is cut off immediately as device is freed. Signed-off-by: Andrey Skvortsov --- drivers/media/i2c/ov5640.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index ac35350..f71c0f7 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -1238,6 +1238,7 @@ static int ov5640_write_reg(struct ov5640_dev *sensor, u16 reg, u8 val) return ret; } + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); return 0; } @@ -1305,6 +1306,7 @@ static int ov5640_read_reg(struct ov5640_dev *sensor, u16 reg, u8 *val) } *val = buf[0]; + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); return 0; } @@ -3615,6 +3617,7 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl) break; } + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); pm_runtime_put_autosuspend(&sensor->i2c_client->dev); return 0; @@ -3702,6 +3705,7 @@ static int ov5640_s_ctrl(struct v4l2_ctrl *ctrl) break; } + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); pm_runtime_put_autosuspend(&sensor->i2c_client->dev); return ret; @@ -4034,8 +4038,10 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) out: mutex_unlock(&sensor->lock); - if (!enable || ret) + if (!enable || ret) { + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); pm_runtime_put_autosuspend(&sensor->i2c_client->dev); + } return ret; } @@ -4203,6 +4209,7 @@ static int ov5640_probe(struct i2c_client *client) pm_runtime_set_autosuspend_delay(dev, 1000); pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); return 0;