mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marco Ziliani via B4 Relay <devnull+rylos78.gmail.com@kernel.org>
To: Daniel Scally <dan.scally@ideasonboard.com>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, Chris Simpson <chris@nilk.net>,
	 Simon Kruse <simon0x+git@proton.me>,
	"D. Manresa" <dmanresa@gmail.com>,
	 linux-kernel@vger.kernel.org, Marco Ziliani <rylos78@gmail.com>
Subject: [PATCH 3/3] media: i2c: ov5693: Use autosuspend when stopping the stream
Date: Tue, 27 Oct 2026 21:29:47 +0100	[thread overview]
Message-ID: <20261027-ov5693-fixes-v1-3-3c8ab1ae104d@gmail.com> (raw)
In-Reply-To: <20261027-ov5693-fixes-v1-0-3c8ab1ae104d@gmail.com>

From: Marco Ziliani <rylos78@gmail.com>

The driver enables runtime PM autosuspend with a 1 second delay at
probe, but drops the usage count at stream stop with pm_runtime_put(),
which doesn't update the device's last busy time. The autosuspend
delay is then counted from the runtime resume at stream start rather
than from stream stop, so after any stream longer than the delay the
sensor is powered off right away.

Use pm_runtime_put_autosuspend(), which marks the device busy, so that
the delay counts from stream stop as intended, and a following stream
started within it doesn't power the sensor up from scratch again. With
the mode now programmed on every stream start, keeping the sensor
powered between streams no longer leaves it in a stale mode.

On a Surface Pro 9 (IPU6) with autosuspend_delay_ms set to 3000, the
sensor suspended 1-2 ms after a 5 s stream stopped; with this change,
3.7 s after it, i.e. the delay plus the autosuspend timer slack. On a
Surface Pro 5 (IPU3) with the default 1 s delay, the sensor suspended
as soon as a 2 s stream stopped; with this change, 1.1 s after it.

Fixes: 89aef879cb53 ("media: i2c: Add support for ov5693 sensor")
Reported-by: D. Manresa <dmanresa@gmail.com>
Closes: https://github.com/linux-surface/kernel/pull/181#issuecomment-6436016335
Signed-off-by: Marco Ziliani <rylos78@gmail.com>
---
 drivers/media/i2c/ov5693.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c
index ca0968498..ef5e7285c 100644
--- a/drivers/media/i2c/ov5693.c
+++ b/drivers/media/i2c/ov5693.c
@@ -1070,7 +1070,7 @@ static int ov5693_s_stream(struct v4l2_subdev *sd, int enable)
 		goto err_power_down;
 
 	if (!enable)
-		pm_runtime_put(ov5693->dev);
+		pm_runtime_put_autosuspend(ov5693->dev);
 
 	return 0;
 err_power_down:

-- 
2.56.0



  parent reply	other threads:[~2026-10-27 20:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 20:29 [PATCH 0/3] media: i2c: ov5693: Fix mode changes, flips and autosuspend Marco Ziliani via B4 Relay
2026-10-27 20:29 ` [PATCH 1/3] media: i2c: ov5693: Program the mode registers on stream start Marco Ziliani via B4 Relay
2026-10-28  8:16   ` Dan Scally
2026-10-27 20:29 ` [PATCH 2/3] media: i2c: ov5693: Keep the Bayer order when flipping at full resolution Marco Ziliani via B4 Relay
2026-10-28  9:31   ` Dan Scally
2026-10-28 11:31     ` Marco Ziliani
2026-10-27 20:29 ` Marco Ziliani via B4 Relay [this message]
2026-10-28  8:19   ` [PATCH 3/3] media: i2c: ov5693: Use autosuspend when stopping the stream Dan Scally
2026-10-27 21:08 ` [PATCH 0/3] media: i2c: ov5693: Fix mode changes, flips and autosuspend Chris Simpson
2026-10-27 23:48 ` Tony Garcia
2026-10-28  8:29 ` Simon Kruse
2026-10-28  9:44   ` Marco Ziliani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261027-ov5693-fixes-v1-3-3c8ab1ae104d@gmail.com \
    --to=devnull+rylos78.gmail.com@kernel.org \
    --cc=chris@nilk.net \
    --cc=dan.scally@ideasonboard.com \
    --cc=dmanresa@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rylos78@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=simon0x+git@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®