mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 0/8] Add OmniVision OV2312 RGB-IR sensor driver
@ 2026-09-25 13:29 Rishikesh Donadkar
  2026-09-25 13:29 ` [RFC PATCH 1/8] dt-bindings: media: Add bindings for Omnivision OV2312 Rishikesh Donadkar
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Rishikesh Donadkar @ 2026-09-25 13:29 UTC (permalink / raw)
  To: linux-media, linux-kernel, devicetree, linux-arm-kernel
  Cc: tomi.valkeinen, mchehab, robh, krzk+dt, conor+dt, nm, vigneshr,
	kristo, sakari.ailus, mripard, jai.luthra, jai.luthra, devarsht,
	y-abhilashchandra, mirela.rabulea, laurent.pinchart

The OmniVision OV2312 is an RGB-IR camera sensor with a 1600x1300 active
array. It uses a 4x4 Bayer pattern that interleaves near-infrared (Ir)
pixels alongside R, G, and B pixels, enabling both RGB and IR capture
from a single sensor.

Every frame the sensor alternates its exposure and IR flash strobe
settings to produce two complementary images, streamed simultaneously with
two MIPI CSI-2 virtual channels:

  - VC0: IR-dominant frame
  - VC1: RGB-dominant frame
  
Because the OV2312 uses a 4x4 Bayer pattern with Ir pixels (RGBIr), the
existing 2x2 Bayer pixel formats are insufficient. This series adds eight
new 10-bit RGBIr media-bus and V4L2 pixel formats (one per valid phase of
the 4x4 pattern) and propagates them through the relevant drivers along
the capture path : DS90UB960 deserializer, Cadence CSI-2 RX
and TI J721E CSI-2 RX as seen in the `media-ctl --print-dot` output[1]

Two alternating frames are captured under different lighting
conditions - one optimised for RGB and one for IR - they require
independent exposure and gain settings. The standard V4L2 exposure and
gain controls (V4L2_CID_EXPOSURE, V4L2_CID_AGAIN, V4L2_CID_DGAIN) are
single-valued per subdevice, which makes it impossible to express
per-stream settings for a sensor like the OV2312 that produces two
distinct streams from a single I2C-controlled device. The new
V4L2_CID_EXPOSURE_MULTI, V4L2_CID_AGAIN_MULTI, and V4L2_CID_DGAIN_MULTI
controls introduced by Mirela Rabulea [2] solve this by defining each
control as a U32 array, one element per capture type. The OV2312 driver
uses a two-element array where index 0 carries the value for the
RGB-dominant frame and index 1 carries the value for the IR-dominant
frame, giving userspace independent control over both streams through a
single subdevice handle. The driver treats a zero value as a sentinel
meaning "no update for this capture type": the register patch for a given
stream is applied only when all three controls (exposure, analog gain, and
digital gain) carry a non-zero value for that index. This allows userspace
to update RGB settings alone by setting index 0 to the desired values and
leaving index 1 at zero, and vice versa.

Both streams run at 1600x1301 resolution, 30 fps each, where the image
data is 1600x1300 and one extra row carries embedded data. The driver
exposes these as separate v4l2 streams which a downstream CSI-RX DMA
driver can route to independent /dev/videoX nodes. Because the two virtual
channels are driven by alternating register groups with different exposure
and IR strobe settings, a pipeline misrouting (e.g., an RGB frame landing
on the IR channel) may not be obvious from the pixel data alone. 

Userspace can use the embedded line, which encodes per-frame sensor state
including strobe and exposure register values, to verify that each received
frame matches the expected capture type for that virtual channel.

[1] https://gist.github.com/RISHI27-dot/1876791cba10798412050e1142fa7899
[2] https://lore.kernel.org/all/20250818155809.469479-1-mirela.rabulea@nxp.com/

Testing Details:
===============

This series is tested on the Texas Instruments AM62A7-SK EVM with the
LI-OV2312-FPDLinkIII-110H camera module connected via the 
V3Link FPDLink-III daughter card using GStreamer

Testing branch (device-tree overlays and any patches
not yet upstream): 
https://github.com/RISHI27-dot/linux/commits/lpc/ov2312/

GStreamer pipeline:
https://gist.github.com/RISHI27-dot/87dc7dec1fdec5f20ead02ca7defb4a8

source code for tiovxisp gst plugin that does the ioctl to set array
controls and does the embedded data filtering:
https://github.com/RISHI27-dot/edgeai-gst-plugins/blob/lpc/ov2312/ext/tiovx/gsttiovxisp.c

Dependencies:
============

This series depends on the following patch series:
https://lore.kernel.org/all/20250818155809.469479-1-mirela.rabulea@nxp.com/


Jai Luthra (7):
  dt-bindings: media: Add bindings for Omnivision OV2312
  media: v4l: Add 10-bit RGBIr formats
  media: i2c: ds90ub960: Add 10-bit RGBIr formats
  media: cadence: csi2rx: Add RAW10 RGBIr formats
  media: ti: j721e-csi2rx: Add RAW10 RGBIr formats
  media: i2c: ov2312: add Omnivison OV2312 driver
  arm64: dts: ti: k3-am62a7: FPDLink overlays for LI OV2312

Rishikesh Donadkar (1):
  arm64: defconfig: Enable OV2312

 .../bindings/media/i2c/ovti,ov2312.yaml       |  79 ++
 arch/arm64/boot/dts/ti/Makefile               |   6 +
 .../boot/dts/ti/k3-fpdlink-ov2312-0-0.dtso    |  89 ++
 .../boot/dts/ti/k3-fpdlink-ov2312-0-1.dtso    |  89 ++
 .../boot/dts/ti/k3-fpdlink-ov2312-0-2.dtso    |  89 ++
 .../boot/dts/ti/k3-fpdlink-ov2312-0-3.dtso    |  89 ++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/media/i2c/Kconfig                     |  12 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/ds90ub960.c                 |  18 +
 drivers/media/i2c/ov2312.c                    | 939 ++++++++++++++++++
 drivers/media/i2c/ov2312.h                    | 285 ++++++
 drivers/media/platform/cadence/cdns-csi2rx.c  |   8 +
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   |  48 +
 drivers/media/v4l2-core/v4l2-ioctl.c          |   8 +
 include/uapi/linux/media-bus-format.h         |  10 +-
 include/uapi/linux/videodev2.h                |   9 +
 17 files changed, 1779 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov2312.yaml
 create mode 100644 arch/arm64/boot/dts/ti/k3-fpdlink-ov2312-0-0.dtso
 create mode 100644 arch/arm64/boot/dts/ti/k3-fpdlink-ov2312-0-1.dtso
 create mode 100644 arch/arm64/boot/dts/ti/k3-fpdlink-ov2312-0-2.dtso
 create mode 100644 arch/arm64/boot/dts/ti/k3-fpdlink-ov2312-0-3.dtso
 create mode 100644 drivers/media/i2c/ov2312.c
 create mode 100644 drivers/media/i2c/ov2312.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-09-26 14:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:29 [RFC PATCH 0/8] Add OmniVision OV2312 RGB-IR sensor driver Rishikesh Donadkar
2026-09-25 13:29 ` [RFC PATCH 1/8] dt-bindings: media: Add bindings for Omnivision OV2312 Rishikesh Donadkar
2026-09-26 14:51   ` Laurent Pinchart
2026-09-25 13:29 ` [RFC PATCH 2/8] media: v4l: Add 10-bit RGBIr formats Rishikesh Donadkar
2026-09-26 14:30   ` Sakari Ailus
2026-09-26 14:40     ` Laurent Pinchart
2026-09-25 13:29 ` [RFC PATCH 3/8] media: i2c: ds90ub960: " Rishikesh Donadkar
2026-09-25 13:29 ` [RFC PATCH 4/8] media: cadence: csi2rx: Add RAW10 " Rishikesh Donadkar
2026-09-26 14:52   ` Laurent Pinchart
2026-09-25 13:29 ` [RFC PATCH 5/8] media: ti: j721e-csi2rx: " Rishikesh Donadkar
2026-09-25 13:29 ` [RFC PATCH 6/8] media: i2c: ov2312: add Omnivison OV2312 driver Rishikesh Donadkar
2026-09-25 13:30 ` [RFC PATCH 7/8] arm64: dts: ti: k3-am62a7: FPDLink overlays for LI OV2312 Rishikesh Donadkar
2026-09-26 14:57   ` Laurent Pinchart
2026-09-25 13:30 ` [RFC PATCH 8/8] arm64: defconfig: Enable OV2312 Rishikesh Donadkar
2026-09-26 14:55   ` Laurent Pinchart

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®