Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2131431rwb; Sun, 15 Jan 2023 09:41:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXsv8I9qYqEQWotli+fOTO0E7Z3F4IYD2NIJWV2tmPC5RBtliBSjcEXKBqD5Ew2dj9VWVdr+ X-Received: by 2002:a17:90a:8a8c:b0:226:b627:6779 with SMTP id x12-20020a17090a8a8c00b00226b6276779mr18567166pjn.5.1673804488728; Sun, 15 Jan 2023 09:41:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673804488; cv=none; d=google.com; s=arc-20160816; b=Ikb0CXftMDnbmxbf7tNLYct0qcp5VRLzbtNb3+zoQaIZgkOSwRIGpKx1kRaUSXgjN1 clYKCLI5WHX5LZ5ncqNdcHnN4C/kmCxCQ/onTRfrrDiT6o+Er4p6EGmhWhIqKpP8dsi5 6r6t5ZoKBH+pXJjSksHk5XH+T4xOUtL5KkcF3KbwUzqI1SwFsOp24rvAT1Edb+yoqyi6 8Fu5VSozAv0PA0uKEo8YTIguAFrN/p5KU+KvvO/smWfTfdzLZsBYydCa1UrxilKPIbPu qz/LSYZTyt0/Vsh2WpcdDViuI9eT6JZ42O2UBXFiLpixK/lxxL5K25K4yVRBQXS06U30 m2dA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/ebf/oMXVYkekYORrvr7onKgABPLQXE20mj48sKZlpw=; b=K6BIFPKOcoCLm3lwEdWBQuS+1aQrFbC7PP8tcd5cT73djJmIUv9rzDEwWJDH0gZe2n KSwHvpqF3ZrEoknMz2owRql6XfhrYUUcpZ3eVSSpNSOnyiNaKya++kHbx+EDADVkQ2hZ ipAwcsEL0BBjgatbx4AYZCXM2LjpZ2/waiykXsthXnQUKQaI6WmZXHXowqCBjIYQWyqV cBTtS0rUHYK+0/AhkB59e1BZCU42Z2hYAjTb4OVAZUjmpmUSCYs5283RrEDuu3L0dvDs F38xSY90MgS4KNcWtSjfYzctnur0YV9tWyx/DpFeZLFPSwWz1PaWsUsJlHft3tdRHKjK 8tzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VgSLbySZ; 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 kb4-20020a17090ae7c400b0022908c7edfbsi10913090pjb.36.2023.01.15.09.41.22; Sun, 15 Jan 2023 09:41:28 -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=VgSLbySZ; 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 S231356AbjAORaf (ORCPT + 53 others); Sun, 15 Jan 2023 12:30:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbjAORae (ORCPT ); Sun, 15 Jan 2023 12:30:34 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1014CC21; Sun, 15 Jan 2023 09:30:32 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id cf42so39856081lfb.1; Sun, 15 Jan 2023 09:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/ebf/oMXVYkekYORrvr7onKgABPLQXE20mj48sKZlpw=; b=VgSLbySZZ5EApqg7phVC233TMn/iI/ffZlfBP4ilUSsmwPmPwadMmGQal7pNVCMYZJ I/0DfwoSYpgfDpoJPjDoxHUdCEaLEolKMNQsns65U1AGWFux7DlOjuxON5LUt0p8Alyc WAbGDQ+JADw6z9qFxG1HFrnSGsxKqy0FIt1oT6ai1pJZP7s7LmjUHNaDU5zwAs+Wlu+N rF86s9kLAmWybL6z4cOhT8Nx+btz3K7qA/WGNQ8GyAxTsRiTt1K3yZII9F82nlpUVUIv /+Zs9XJxx85r6J8vSdtitWqRvOhk/stPN166HgBBzJStrOgUxzYqFgB9YD7W913CTaml 6Gzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/ebf/oMXVYkekYORrvr7onKgABPLQXE20mj48sKZlpw=; b=6HQoSKEEvDQQdPvSC6XYZKog2V637Nh18qJ6XBMSIeP2djOtlkVnsGjrTvpYT6Mc4n At3LWN+EJNV2JSutmFInKG4mC2qoqh9M494qaHojkyDwTpC2RhkD4PSCycyl6vh82Lh0 T+c9FM0u5H6KzdsMNg5ELXqM/+xiuyg0BjdoxfgZ8Dle5E29Rpyae9DYnX3mfhyIyeoL 5Il7SRjmMYHNwMMlKRyEkqXD+gwSdlV/rC9ul/QyRVkMVdFh4dPChpqdNOmN7adZKclr /+tbGqLdw9dpCKIrkepdGSivlCvzQ5jEoSK1376hU2l0k9rzXHLkEkKjK8Q2EGoDnzh2 bYlw== X-Gm-Message-State: AFqh2kp6y7M8yPbZoWOF2Xs8oZ9H2TJ6wYvAd5pZ2fIMxB2gGc4viDLZ DgUJxfucwJ26sjDxv2rbzt7uvTHSzW8= X-Received: by 2002:a19:6552:0:b0:4cc:8572:c7bc with SMTP id c18-20020a196552000000b004cc8572c7bcmr1928468lfj.65.1673803831077; Sun, 15 Jan 2023 09:30:31 -0800 (PST) Received: from localhost.localdomain ([2a05:3580:f312:6c02:b940:4283:cb3e:a3e8]) by smtp.gmail.com with ESMTPSA id u10-20020a05651220ca00b004cb10c151fasm4775008lfr.88.2023.01.15.09.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 09:30:30 -0800 (PST) From: Andrey Skvortsov To: Steve Longerbeam , Jacopo Mondi , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrey Skvortsov Subject: [PATCHv2] media: ov5640: Update last busy timestamp to reset autosuspend timer Date: Sun, 15 Jan 2023 20:30:10 +0300 Message-Id: <20230115173010.1237320-1-andrej.skvortzov@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: 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 --- Changes since PATCHv1: * Removed pm_runtime_mask_last_busy call from ov5640_write_reg and ov5640_read_reg as suggested by Sakari Ailus * Updated diff against next-20230113 drivers/media/i2c/ov5640.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index e0f908af581b..24f4f395aad6 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -3316,6 +3316,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; @@ -3391,6 +3392,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; @@ -3710,8 +3712,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; } @@ -3912,6 +3916,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; -- 2.39.0