Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp274825lqb; Tue, 16 Apr 2024 15:48:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxK6d4094yzIFpSRCn9plk4cYQj650QFnCT1rsrQJe+Xtwd9/WHlbhv3SgEtRIXMbMh0En2TFAblMFcgxkiGQqw6WcI63phelVdL6Rqg== X-Google-Smtp-Source: AGHT+IGRStqioyNCaTsHMqGR9ehKkaOrHjlJKtWIIiZ0YS9uO/VOTzWXkYPtuWxV+swB2P8T5+kM X-Received: by 2002:a17:902:d883:b0:1e2:bf94:487 with SMTP id b3-20020a170902d88300b001e2bf940487mr13673275plz.57.1713307701927; Tue, 16 Apr 2024 15:48:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713307701; cv=pass; d=google.com; s=arc-20160816; b=GGkPwgmLu2UivQBshP1Ae/WPAOwJnCv4qjZjOcI5b4IliVIvzqad/G6j39Y6q3DfQZ AQic6CwgBTgl08GJQOq89P59QzeQCoeKxC+Rhy/pxLFOmMT9vzX/GIv1LuzC8R3Z7+V5 1h2HkDnwIKbwCrzgHLxw2HpEuh4V0rQmRm1zoLcJmD16wTy4x5RMROLu9a2J+Ci90nXp oviJVwDM8EzyJAxAr7Tf7niGjCj5nDGcmuyYqZPpT71MkZ3Sut/onvEislSe5NCTwH05 r43TkDqMGevg5d8rCMKqcm3sB1rZn9e+lQR/QQ5OtCHyX1l9s7owRIlo2y0insoipZ/R Ph7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/wi/0pJh/E7nGNzByWLAqj9/04e2L/P2ERnTt5QTMBc=; fh=/nzh5G9fzd05mGvEPFH5c1XLAdcpY2bGGXk9Fb0LYVo=; b=GVpDH5pcp5z6MSduz3WvJmbNB2yxrfbG8Bd8xktr8QIzItAFTtKaFPwE8JIq3ykJab APcj4GX7Ee2MMe1bGdpGMpuRj14pivosM8NPweCIhpKgVBVC2CzAhc8RZptEj8Gqcr4U gfhktapvW2DqHvRT0B0NTpkbKU44cIBGFKIDFUluhGM19DzGjmK9+z2PgOqvd1OgPAAF JurjYJb7jWPMb6OrWt/XWCz3bXv2NsivcRLi2+Yola7XzP03vVlPzsfDzQ45RnTz8Y/y 9tIquWZf1iEPoYh7kk+eSa2KI6I9a7rkQWZFnuKF7nJd/Rln1GR6W/XMToih2x7LdfT1 oQWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="H/cKjnt/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e12-20020a170902ef4c00b001e25e66d998si10922241plx.617.2024.04.16.15.48.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 15:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="H/cKjnt/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5FD7C284C40 for ; Tue, 16 Apr 2024 22:47:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D137313C8F0; Tue, 16 Apr 2024 22:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H/cKjnt/" Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7F513C668; Tue, 16 Apr 2024 22:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713307545; cv=none; b=Z26qKKcHbjDCXRfsKBxd4aFIWFlAu7FO9fe0BYHNquV7ahra+GJ4k7sV2b0gYkI1mK3I1ope+jqIV3HGBQDZN99yTsQPM7M+9o6igI9u7278wgxIb2vrwACF27v/Y+59LzDD3jxu+JxAkcCeWYauF8vS9S7I/SN67rzLHtA2ysg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713307545; c=relaxed/simple; bh=dV8K4F0A9pXNtzsdUUObhQc03J0IRYcsli8GUU2LmRU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AJxfutJg+FHxuh3fBiGx/RJcyG1JdHuo8Bb2Dw5PIKNqMLTOLh3zqHJIWz3OU2VVRCkNuBU+++EuBwTUdvUsJ+7YuNh1Th3fEVdzJg80BWtyycqAA8Ltsnz5jhkmLx5mecCm41H8EP8KjgPdnl1kH5E+2mkgyxrLRXEzHoV9GwE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H/cKjnt/; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-516d6e23253so5512666e87.1; Tue, 16 Apr 2024 15:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713307541; x=1713912341; darn=vger.kernel.org; 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=/wi/0pJh/E7nGNzByWLAqj9/04e2L/P2ERnTt5QTMBc=; b=H/cKjnt/zPYr5Ahe4jm4hCJe1YtVRXrlaqY080OSEYTqFbfb7uGaFUnfRgrJy/uwD0 1ISJfpLeYRXgZgDe3t4ThtA52wnqeCwdN6PWJ9yvzZHIdUp24yOHt4P4YXeVfg+UaNWA hVJkdKlaODX8Br8IY9tAz0/9sdaBkfAUmHTl9rsFmyKX6Mg/j9zoPiJqx+DSMUSft4O1 yQTq8+NCSMAiKtMT9Nhc7faAQYm2dz4BnL5by3jYZ8fD89Iq4NSc7ZE1kWCMFw0mxA8c DlcrxYU5/dVZLmhoRCjh1YNvNIxul7rgTvusyBJUrZ7YFTHLeNdLRzYS/KVOBbM5d3Lq rbBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713307541; x=1713912341; 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=/wi/0pJh/E7nGNzByWLAqj9/04e2L/P2ERnTt5QTMBc=; b=L1X0N+JDrOepbd+dHxClCLHgUNdSbWeblKSyNWHjWJlmlBj4crCuY7PLlThJyajPqY 15mIKnM9FliPcSxbmNScKuGZpAGsBlz7Jk2gco90rJGIzz1uQYcrugA4rFpM44ECu60G FqOHVxxYVGE6dCLL3BpxvqwRahT5dzWxxLshZuNXGGqLRXeSBKArfS4nk8eKEczatXze ClLqsRtfWepBqK1ENZGAlcaOMdmzDgARzXcdMC3mKgMOsYs+Eakzv3jFYw9QXAZkGl5+ eEfOoKb+rXx6LBMDrLHj0TCNDKG0eMxARKvIMbnPV+EuUiRBe82xCShIllEh1iWXaFDq LJlQ== X-Forwarded-Encrypted: i=1; AJvYcCVViDDzwHqhynLl+sNL8r+Uip1528R8sP1Rdr3FwudfNIgTUwz5odjtf6GCauFBKGUpo0fumjlQyj6ktyqwJ16CfJcHyjt6KAaMkgCk X-Gm-Message-State: AOJu0YzTlCQ7Gqfs8sGJdNuhS98fklOWUJTtJZKmpVa2IrNpDkURnisN /kzc4WDadXkcvkH9plV7G7g440jwmYGQqiSD4Jg+gQrJGVzU6KbnMUXfibP2tRM= X-Received: by 2002:a05:6512:281b:b0:518:d956:5c5e with SMTP id cf27-20020a056512281b00b00518d9565c5emr7813250lfb.67.1713307541016; Tue, 16 Apr 2024 15:45:41 -0700 (PDT) Received: from localhost (95-24-153-47.broadband.corbina.ru. [95.24.153.47]) by smtp.gmail.com with ESMTPSA id y5-20020a196405000000b00515d407aaa0sm1756247lfb.252.2024.04.16.15.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 15:45:40 -0700 (PDT) From: Mikhail Rudenko To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sakari Ailus , Laurent Pinchart , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab , Mikhail Rudenko Subject: [PATCH v5 09/16] media: i2c: ov4689: Use runtime PM autosuspend Date: Wed, 17 Apr 2024 01:45:17 +0300 Message-ID: <20240416224524.1511357-10-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240416224524.1511357-1-mike.rudenko@gmail.com> References: <20240416224524.1511357-1-mike.rudenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use runtime PM autosuspend to avoid powering off the sensor during fast stop-reconfigure-restart cycles. Signed-off-by: Mikhail Rudenko Reviewed-by: Laurent Pinchart --- drivers/media/i2c/ov4689.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index ab30d7de5a52..12bd4b010c05 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -426,7 +426,8 @@ static int ov4689_s_stream(struct v4l2_subdev *sd, int on) } else { cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE, OV4689_MODE_SW_STANDBY, NULL); - pm_runtime_put(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); } unlock_and_return: @@ -606,7 +607,8 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) break; } - pm_runtime_put(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); return ret; } @@ -876,8 +878,10 @@ static int ov4689_probe(struct i2c_client *client) } pm_runtime_set_active(dev); + pm_runtime_get_noresume(dev); pm_runtime_enable(dev); - pm_runtime_idle(dev); + pm_runtime_set_autosuspend_delay(dev, 1000); + pm_runtime_use_autosuspend(dev); ret = v4l2_async_register_subdev_sensor(sd); if (ret) { @@ -885,11 +889,14 @@ static int ov4689_probe(struct i2c_client *client) goto err_clean_subdev_pm; } + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + return 0; err_clean_subdev_pm: pm_runtime_disable(dev); - pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); v4l2_subdev_cleanup(sd); err_clean_entity: media_entity_cleanup(&sd->entity); -- 2.44.0