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 0/4] media: i2c: ov5693: Fix mode changes, flips and autosuspend
Date: Sat, 28 Nov 2026 00:11:32 +0100	[thread overview]
Message-ID: <20261128-ov5693-fixes-v3-0-bcdd169958b6@gmail.com> (raw)

Fixes for the ov5693, found while getting the front camera of the
Microsoft Surface Pro 5 (IPU3) to work, and since tested on IPU6 and
IPU4P Surfaces as well.

Patch 1 drops the registers that the driver programs itself from the
global register list, as Sakari asked in the v2 review: the low byte of
the analogue gain and the FORMAT1/FORMAT2 registers. The driver now
writes the non-flip bits of FORMAT1/FORMAT2 in full.

Patch 2 writes format and crop changes to the sensor when it is powered,
on top of the write at power-on, so that a format change also reaches
a sensor that stays powered between streams (autosuspend delay, runtime
PM disabled). Changes on the active state are refused with -EBUSY while
streaming.

Patch 3 keeps the reported SBGGR10 order when a single flip is enabled
at full resolution: each flip moves the Bayer phase by one column, so
the output window is shifted by one column when hflip XOR vflip.

Patch 4 drops the usage count at stream stop with
pm_runtime_put_autosuspend(), so that the autosuspend delay counts from
stream stop rather than from the last resume.

The patches come from the linux-surface tree [1]. This version was
tested on a Surface Pro 5 (IPU3), with the media next driver plus this
series built for the running kernel: the full-resolution Bayer order is
stable with all four flip combinations, 16 changes between 2592x1944
and a 1920x1080 crop with the sensor kept powered all stream the new
format, a format set during the autosuspend delay reaches the sensor
at once (OUTPUT_SIZE_X read back over I2C), set_fmt() while streaming
returns -EBUSY, and the sensor suspends 1.16 s after stream stop with
the default 1 s delay.

I used an AI coding assistant to draft these patches and the changelogs;
I reviewed them and can answer for them.

[1] https://github.com/linux-surface/kernel/pull/181

Signed-off-by: Marco Ziliani <rylos78@gmail.com>
---
Changes in v3:
- New patch 1: keep the registers the driver programs out of the global
  register list (Sakari)
- Patch 2 (was 1): write the mode registers on power-on as before and
  from set_fmt()/set_selection() when the sensor is powered, instead of
  on every stream start; return -EBUSY for active format and crop
  changes while streaming (Sakari). Tested-by tags dropped, since the
  code changed
- Patch 3 (was 2): unchanged; the window offset vs
  V4L2_CTRL_FLAG_MODIFY_LAYOUT question from v1 is still open (Dan)
- Patch 4 (was 3): changelog updated for the new patch 2
- Link to v2: https://patch.msgid.link/20261029-ov5693-fixes-v2-0-2526d7b13030@gmail.com

Changes in v2:
- Patch 1: move ov5693_mode_configure() from ov5693_sensor_init() to
  ov5693_s_stream() rather than calling it in both, and shorten the
  commit message (Dan)
- Patch 1: Tested-by tags not carried over, since the code changed
- Patch 2: unchanged; whether to shift the window or to use
  V4L2_CTRL_FLAG_MODIFY_LAYOUT is still being discussed on v1, happy
  to switch if that is preferred (Dan)
- Patches 2 and 3: collected Reviewed-by and Tested-by tags
- Retested the series on the Surface Pro 5 (IPU3)
- Link to v1: https://patch.msgid.link/20261027-ov5693-fixes-v1-0-3c8ab1ae104d@gmail.com

---
Marco Ziliani (4):
      media: i2c: ov5693: Keep driver-managed registers out of the global list
      media: i2c: ov5693: Write format and crop changes to a powered sensor
      media: i2c: ov5693: Keep the Bayer order when flipping at full resolution
      media: i2c: ov5693: Use autosuspend when stopping the stream

 drivers/media/i2c/ov5693.c | 131 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 106 insertions(+), 25 deletions(-)
---
base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
change-id: 20261027-ov5693-fixes-8ec29752893a

Best regards,
--  
Marco Ziliani <rylos78@gmail.com>


             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 Marco Ziliani [this message]
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 ` [PATCH v3 4/4] media: i2c: ov5693: Use autosuspend when stopping the stream 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=20261128-ov5693-fixes-v3-0-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®