[RFC PATCH v3 0/2] media: i2c: Add onsemi AR0234 camera sensor driver

Alexander Shiyan
2026-03-06T10:36:37Z

This series adds a driver for the onsemi AR0234 CMOS image sensor.
The AR0234 is a 1/2.6-inch global-shutter sensor with a 1940x1220
pixel array, capable of 1920x1200 resolution at up to 120 fps.
It supports MIPI CSI-2 output with 1 to 4 data lanes, raw Bayer
(8/10-bit) and monochrome formats, as well as DPCM 10->8 compression.

The driver has been tested with 2 and 4 lanes on an ARM64 Rockchip
RK3568 platform with a 27 MHz external clock. Both 8-bit and 10-bit
raw Bayer modes are functional.

Notes:
- 1-lane mode is currently disabled; attempts to use it produced no
valid image. Further investigation is needed.
- The driver uses a private streaming flag to protect cropping changes
during streaming. Is this the recommended approach, or should we
rely solely on the subdev state?
- The DPCM (10->8 compression) mode is included in the code but could
not be tested due to lack of suitable hardware; any testing help
would be appreciated.

Changes since v2:
- Added devicetree binding documentation for the onsemi AR0234 sensor.
- Added support for 8-bit raw Bayer output (verified working).
- Added DPCM 10->8 compression mode (untested, included for
completeness).
- Reworked mode handling: each mode now specifies input/output bpp,
DPCM flag, MIPI data type, and link frequency index.
- Reworked link frequency handling: the driver now accepts any valid
link frequencies from the device tree. It expects two frequencies -
one for 8-bit mode and one for 10-bit mode - but does not enforce
a fixed set; frequencies are validated by attempting PLL calculation.
This makes the driver compatible with a wider range of system
configurations.
- Updated ar0234_calculate_pll() to use a temporary structure and
update cached PLL only on success.

Changes since v1:
- Improved error handling: use cci_write() with &ret chaining for
sequential register writes, as suggested by Isaac Scott.
- Refactored format and cropping support:
Replaced static format list with dynamic cropping rectangle
(struct v4l2_rect crop).
Implemented get_selection and set_selection for V4L2_SEL_TGT_CROP,
allowing runtime selection of the active sensor area.
- Migrated to modern streaming model: replaced s_stream with
enable_streams/disable_streams using v4l2_subdev_s_stream_helper.
- Corrected blanking constants: replaced ambiguous AR0234_HBLANK_DEF
with AR0234_LINE_LENGTH_PCK_MIN; updated min/max ranges.
- Added ACPI match table (untested).
- Style fixes.

Any further comments or test results would be greatly appreciated.

Alexander Shiyan (2):
dt-bindings: media: i2c: Add onsemi AR0234 image sensor binding
media: i2c: Add onsemi AR0234 image sensor driver

.../bindings/media/i2c/onnn,ar0234.yaml | 109 ++
drivers/media/i2c/Kconfig | 12 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/ar0234.c | 1309 +++++++++++++++++
4 files changed, 1431 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0234.yaml
create mode 100644 drivers/media/i2c/ar0234.c

--
2.52.0