mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marco Ziliani <rylos78@gmail.com>
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>,
	 Tony Garcia <tony@loafecho.com>,
	Simon Kruse <simon0x+git@proton.me>,
	 "D. Manresa" <dmanresa@gmail.com>,
	linux-kernel@vger.kernel.org,  Marco Ziliani <rylos78@gmail.com>
Subject: [PATCH v3 4/4] media: i2c: ov5693: Use autosuspend when stopping the stream
Date: Sat, 28 Nov 2026 00:11:36 +0100	[thread overview]
Message-ID: <20261128-ov5693-fixes-v3-4-bcdd169958b6@gmail.com> (raw)
In-Reply-To: <20261128-ov5693-fixes-v3-0-bcdd169958b6@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. Now
that format changes are written to a powered sensor, keeping it 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
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Tested-by: Chris Simpson <chris@nilk.net>
Tested-by: Tony Garcia <tony@loafecho.com>
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 6e76e289f..5c64ae063 100644
--- a/drivers/media/i2c/ov5693.c
+++ b/drivers/media/i2c/ov5693.c
@@ -1098,7 +1098,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.1


      parent reply	other threads:[~2026-11-27 23:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 23:11 [PATCH v3 0/4] media: i2c: ov5693: Fix mode changes, flips and autosuspend Marco Ziliani
2026-11-27 23:11 ` [PATCH v3 1/4] media: i2c: ov5693: Keep driver-managed registers out of the global list Marco Ziliani
2026-11-27 23:11 ` [PATCH v3 2/4] media: i2c: ov5693: Write format and crop changes to a powered sensor Marco Ziliani
2026-11-27 23:11 ` [PATCH v3 3/4] media: i2c: ov5693: Keep the Bayer order when flipping at full resolution Marco Ziliani
2026-11-27 23:11 ` Marco Ziliani [this message]

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=20261128-ov5693-fixes-v3-4-bcdd169958b6@gmail.com \
    --to=rylos78@gmail.com \
    --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=sakari.ailus@linux.intel.com \
    --cc=simon0x+git@proton.me \
    --cc=tony@loafecho.com \
    /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®