Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4192367rba; Tue, 2 Apr 2024 09:48:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSOEwSVvHrqTaXcRqQ1tqGsxTDb4GK8HH/3CH9wsWKUe/FFu1dSO1V5xt45joe9VQLKw5VfBDl7kLtiCWm8l/LaaBc4ZO9TDKvDIk8tQ== X-Google-Smtp-Source: AGHT+IE5q8F7lYXv78MF5AnB8eJGZUKFKe+1UpNr+/RKYyTv0zPwoJMrB0sa9HmfxIAtwweSQ6ZR X-Received: by 2002:a05:6a21:32a9:b0:1a7:2374:f1ed with SMTP id yt41-20020a056a2132a900b001a72374f1edmr2221074pzb.42.1712076524830; Tue, 02 Apr 2024 09:48:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712076524; cv=pass; d=google.com; s=arc-20160816; b=PhxIaQmkw+uozTg9da6NnD9g3/cejtYJ5QxYI5uwDWdb4k9BKrkBonDXrfmknxkJqe qw0P7IeyvhRfHvYgfyOhEO73at/Ek8HbmYznlsFIhMMKesXQk+S/scXu6aVngXE2s4XF jYxGfaQZgbuWaeUlSE+aru8FHvILjXp4rnuBmptcDXQc/xybXVKPwmf16H9z7becYeZb vAbxalR7LOIbYyKS3hZeE2a1YfOnibmpVfHHYqG4S+xTOpamRXJh8fOSFxCoQXQEvnR/ Oy+Y47cpXV+3LwEuQUYSRJbe4mNG6ul5wANrA12EvAmP3qTzUm/MBna5vJO0E3/maa8K gXTw== 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=Zvp9vfG0Jk7g28an8SJ7vQketSIg/VKljXWkv56ib7E=; fh=V7uU+DeRjxOAiWW2P+58+AzgRgVi6zajTmtshlAtZEg=; b=lSksrhK6+ftv4D4yIbeyZar9a85oOQde9W8pPJm5QpU/f7E/E5rkRlgYfR0TUBv+op 17KkDJdX6MJHhPuew3UTQIHzddoFyiZiLeZBSauLJnCeiHByhpmKw4yxsXT1vS+XUsal Bff2vT7VUuObpQ7LRFwgGR0DBjIGW1MILkDs6sqvOzFY8r3evnWDEhyzm7Zs/xjPj8wf gzpfNUIaRjF3CFk45rR+IboiSWIMfR1yLNcbIb9YfLLoE/GQUOsZ/Tbj+W7enVWd0y6F ePVhr9u3boYoyqZ5M7y8hgEYj87NzCVx3HSlOYSpghfHWwrc4OHg9rbtVMOZp2P9Tfsx hHNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BXpgWmNf; 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-128375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128375-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 g62-20020a636b41000000b005f3d2aa58d2si972717pgc.712.2024.04.02.09.48.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 09:48:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128375-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=BXpgWmNf; 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-128375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128375-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 8021D284807 for ; Tue, 2 Apr 2024 16:48:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3E4215B14C; Tue, 2 Apr 2024 16:46:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BXpgWmNf" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 2874615B119; Tue, 2 Apr 2024 16:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712076388; cv=none; b=YK5+pHeq+avq/yOU6ZzvxN9GDJUTTqSMYjAQak6CcQNniSrHYdw/iZ1+0vnOi86Cxo3yLgf09q9CnD0KrNX5bKQh0XQYVxCZmLp4gOPgBhmiFjQ8R6n3v3ufIR91l3ds4vezvCwVFwLKlVurhILW+RECIX+sYU5Uot0/EXyAZrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712076388; c=relaxed/simple; bh=H0ma8eY/8/S2N+welQc2fVRYTdGUfB4oLn55S6JvmDA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gxkoDWaKEje48hEWtH54b9JnYPtYNMsnVSVmXQWdbktLDwHRkjF6jkxUfHJw1iLyr5LiM/4Y5GLrc0OiqNuYS4tQT3g0/4qlZpRB7CI2Ie3vQsJ78bzm5Aq5XPsVimSAlNW6xXyBgwTxdxUkdDSwHyfDvAOXfp3upti6U7iwbXQ= 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=BXpgWmNf; arc=none smtp.client-ip=209.85.167.46 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-f46.google.com with SMTP id 2adb3069b0e04-515c3eeea5dso6338544e87.1; Tue, 02 Apr 2024 09:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712076385; x=1712681185; 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=Zvp9vfG0Jk7g28an8SJ7vQketSIg/VKljXWkv56ib7E=; b=BXpgWmNf6NSF3KtTrY/rWU5tJS8wZ5IGNScMCA07dhS636FyUmmBSS4wq5sBXnmOOZ wt1HGYhW5Psmgc5bF9Rh0MWSaYvnmxJ1/zc25JO074GbHxnCsX06KlGB+P9pCTm5TO6C l2xAGp8+FdDb/CWPtXJKkuZ6mC54hS/nONXoQp7XdKThoKXXfALpkZ4mCEkw09/GQV5J +BpAEtNUAUUpntFE1SKnodnf9//O17z/wZkoVzCwD8UihhslrIOIYxJFxYhO+RTx3Gz2 2F217SIBnAAU9hJkNpAIB2iBvxdVq4uq5JzfwoTu0uk4KLlaGwv/UzIP/BWFS5C/1D80 R4+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712076385; x=1712681185; 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=Zvp9vfG0Jk7g28an8SJ7vQketSIg/VKljXWkv56ib7E=; b=DLeEbBXrHcgJNL8IDBBtGp2h7G0LlaBC12B0CepNZ9492XsRhDTm6lHrqjpqoyybme rqqryhjWaEoXhyL8uWT3zi0qqF8oqWC2Mcik0uIbv1gX79DkmqCu14bivFYEJ8wdZy5L XgHk1nEUv+3LwkW8fEuAz5BbqRJv6GDKgvhXZfuF0yPXKQfqKgfojFhRcDnuGlYti3f+ dvqpVfyvQlf7THhlPgva0j3F5y7ltR5zvbcI/JFQlwVIUWjg8l/0NfA2qmJlUKdHFYES kZP/1wzHoI/fCPne0JQIu+8nRQXct5g9TlIhefE/ZENxcu6SMtzbvxHoN1ZqaoVWfW0T 7MEQ== X-Forwarded-Encrypted: i=1; AJvYcCULSObrNvN5dtl8+JLjyzxaNQQaZx4GTZqQINtGH0mFmK4cPOitcIU+Cu1H8ODh54nDGEtz3j4JQBzcKd7OWaOiVmmvqF5XyMlUsz7H X-Gm-Message-State: AOJu0YyLWMoKEJffvcsQoH0QxLDiQaljsrBBUA7zs45m3hxmDUFXMDXh b/keoKfrefgq2loeTCBB4ZKl2PhsX7QHIpKzZKKaMDwBg6CoCdIcbOxWnQHTTHkTaA== X-Received: by 2002:a05:6512:200d:b0:513:4a0c:b83d with SMTP id a13-20020a056512200d00b005134a0cb83dmr7938266lfb.46.1712076384509; Tue, 02 Apr 2024 09:46:24 -0700 (PDT) Received: from localhost ([77.91.78.25]) by smtp.gmail.com with ESMTPSA id g1-20020ac24d81000000b00515c102c826sm1779374lfe.270.2024.04.02.09.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 09:46:24 -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 v4 09/20] media: i2c: ov4689: Use runtime PM autosuspend Date: Tue, 2 Apr 2024 19:45:40 +0300 Message-ID: <20240402164552.19171-10-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402164552.19171-1-mike.rudenko@gmail.com> References: <20240402164552.19171-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 0e0e694510aa..2354397ab34c 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