From: Robert Bozik <robertbozik@gmail.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Robert Bozik <robertbozik@gmail.com>
Subject: [PATCH 0/3] media: Add OmniVision OV32C4 sensor driver
Date: Wed, 26 Aug 2026 09:19:59 +0200 [thread overview]
Message-ID: <20260826072002.14357-1-robertbozik@gmail.com> (raw)
Hi,
this series adds a driver for the OmniVision OV32C4, a 32 megapixel RGBC
CMOS image sensor. It ships as the under-display camera in the Lenovo
Yoga Slim 9 14ILL10, where it is enumerated through ACPI (_HID
"OVTI32C4") behind an INT3472 discrete control logic node and feeds an
Intel IPU7. The last patch adds the sensor to ipu-bridge; without it the
bridge builds no fwnode graph for the sensor and the driver never binds.
The driver supports 3264x1840 at 30 fps, 10-bit Bayer, 4 CSI-2 lanes at
a 400 MHz link frequency, with exposure, analogue gain, digital gain,
vblank, hblank and flip controls, runtime PM and .get_selection.
Tested on the machine above: the sensor probes, streams continuously at
a measured 30.00 fps, and the frames arrive complete (60 frames =
720691200 bytes = 60 * 3264 * 1840 * 2, V4L2_PIX_FMT_SGRBG10 carrying
one 16-bit sample per pixel). The full path up to a processed image was
exercised with libcamera's software ISP.
There is no public datasheet for this sensor, so a note on where the
numbers come from, since that is the first thing a reviewer will want to
know:
- The mode register table is the verbatim initialisation sequence from
the vendor Windows driver: 1787 writes, strictly ascending, copied
1:1 with nothing added or reordered.
- The register meanings the controls depend on (exposure 0x3500,
analogue gain 0x3508, digital gain 0x350a, VTS 0x380e, and the rule
exposure_max = VTS - 32) were read out of the same binary and then
confirmed against the values the chip reports.
- The derived timings were checked against reality: the computed
320000000 / (4080 * 2614) = 30.005 fps matches the measured 30.00.
- The 6560x4928 pixel array and the 6528x4896 active area reported by
.get_selection follow from the window registers of the mode table
and agree with the vendor's published product brief.
The gain ranges in this series were measured on the sensor, not
inherited: the vendor driver clamps gain a layer above and carries no
limits of its own, and the obvious donor - ov13b10, same registers -
puts analogue unity at 0x80, which turned out to be wrong here. Analogue
response is exactly proportional between 0x100 and 0x7c0 (1x to 7.75x,
0x100 also being the power-up value); digital gain is proportional with
1024 as unity and clips to black one step above 16383. I mention it
because these are the kind of constants that get copied between
OmniVision drivers unchecked.
Flip handling was measured the same way. This sensor preserves the Bayer
order across mirror and flip, so the driver only toggles the bits and the
media bus code never changes. I mention it because ov13b10 compensates the
crop window by one pixel on the same registers to undo a Bayer shift; doing
that here introduces one rather than removing it, which is easy to copy
across by accident.
Two things I would like reviewers to look at, because I am not confident
they are right:
1) The sensor core rail is gated by a companion chip that ACPI lists as
the second I2C resource of _CRS and that ipu-bridge instantiates as a
VCM. Without a single write of 0x04 to register 0x1001 on that chip,
the sensor does not answer on I2C at all. The driver currently does
that write itself with a bare i2c_transfer(), deliberately not
claiming the address so the VCM driver can still have it.
I am aware this bypasses both the I2C device model and the regulator
framework, and that the architecturally correct answer is probably a
regulator provided by the VCM driver, consumed here as dvdd-supply.
I did not want to redesign ipu-bridge's VCM handling as part of an
initial sensor submission, so I am asking rather than assuming. If
the bare write is not acceptable, I am happy to do it properly -
I would just like guidance on the shape.
2) While streaming, the IPU7 receiver reports exactly one
csi2-0 error: Received packet is too long
per frame. It is not a lost or corrupted frame: bit 2 of the D-PHY
error register ("unrecognised data type") never fires, the image data
is complete, and the byte count above is exact.
I could not make it go away from the sensor side. All of 0x4800-0x48FF
and 0x3800-0x38FF were swept register by register - 512 measurements -
and no value silences it while streaming continues. The vendor driver
does not suppress it either; it exposes EnableEmbeddedData next to the
MIPI link parameters and the Windows IPU stack has a matching
GetEmbeddedData path, i.e. Windows receives that extra packet rather
than turning it off.
Receiving it on Linux would need metadata capture in the IPU7 driver,
which is marked as a TODO there today, plus a second frame descriptor
entry - and adding that entry alone makes the IPU7 wait for a second
capture node that does not exist in the graph, so streaming stops.
I therefore left the driver reporting a single stream and am
documenting the warning here rather than papering over it.
Tooling disclosure, as asked for by Documentation/process/generated-content.rst:
this series was written with the help of an AI coding assistant (Claude,
Anthropic; claude-opus-5 for the early work, claude-fable-5 for the rest)
in an extended interactive session. The assistant drafted the driver
source, the binding and this cover letter from my descriptions of the
hardware and of the vendor driver; every register meaning, gain range and
timing in it was measured by me on the sensor as described above, I ran
all of the tests, and I have reviewed and understand all of the code and
take responsibility for it. The mode register table was copied 1:1 from
the vendor driver, not generated. Static checks used: checkpatch.pl
--strict, sparse (C=1), W=1 and dt_binding_check. The individual patches
carry Assisted-by tags.
The series applies to media_stage.git; base-commit is below.
Thanks,
Robert
Robert Bozik (3):
dt-bindings: media: i2c: Add OmniVision OV32C4
media: i2c: Add driver for OmniVision OV32C4
media: ipu-bridge: Add OmniVision OV32C4
.../bindings/media/i2c/ovti,ov32c4.yaml | 109 +
MAINTAINERS | 8 +
drivers/media/i2c/Kconfig | 11 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/ov32c4.c | 2839 +++++++++++++++++
drivers/media/pci/intel/ipu-bridge.c | 10 +
6 files changed, 2978 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov32c4.yaml
create mode 100644 drivers/media/i2c/ov32c4.c
base-commit: 4900cad020c0580dfb1be27776ff10a4ef110cfa
--
2.53.0
next reply other threads:[~2026-08-26 7:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 7:19 Robert Bozik [this message]
2026-08-26 7:20 ` [PATCH 1/3] dt-bindings: media: i2c: Add OmniVision OV32C4 Robert Bozik
2026-08-26 16:13 ` Conor Dooley
[not found] ` <CALSBEvTvrhniBrM29Y7sery15W-onz7t_8ZQhg1TW8nBDgYKxg@mail.gmail.com>
2026-08-26 22:47 ` Conor Dooley
2026-08-26 7:20 ` [PATCH 2/3] media: i2c: Add driver for " Robert Bozik
2026-08-26 7:31 ` sashiko-bot
2026-08-26 7:20 ` [PATCH 3/3] media: ipu-bridge: Add " Robert Bozik
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=20260826072002.14357-1-robertbozik@gmail.com \
--to=robertbozik@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.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