media: i2c: Add AR0234 camera sensor driver
Subsystems (2)
RFC PATCH v2 1/1 media: i2c: Add AR0234 camera sensor driver
This is the second RFC version of the AR0234 camera sensor driver. I would like to thank Isaac Scott and Dave Stevenson for their valuable feedback on v1, which helped improve the driver.
The driver supports the onsemi AR0234 CMOS image sensor in 10-bit raw Bayer mode (SGRBG10) at 1920x1200 resolution up to 120 fps, using 2 or 4 CSI-2 data lanes.
It has been tested with 4 lanes and 2 lanes (both work) at 27 MHz external clock on an ARM64 RK3568 Rockchip platform with custom ISP (not a mainline CIF-driver).
Notes:
- Unfortunately, 1?lane mode did not function correctly and was temporarily removed from the driver?s lane handling. Further investigation is needed to make it work; any insights or testing help would be greatly appreciated.
- 8-bit mode (which should be easily added by extending the ar0234_modes table) was attempted but did not produce a valid image. The cause is still unknown; the mode may require different PLL settings or additional register writes not yet implemented. I decided to omit it from this version until the issue is resolved.
- I added a private streaming boolean that is set in enable_streams and cleared in disable_streams. Is this the correct approach, or is there a more standard way to query whether the subdev is currently streaming (e.g., through the V4L2 core or the subdev state)? I want to ensure I'm following best practices.
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.
---
Cc: Isaac Scott <[email protected]>
Cc: Dave Stevenson <[email protected]>
drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ar0234.c | 1251 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1264 insertions(+) create mode 100644 drivers/media/i2c/ar0234.c
drivers/media/i2c/Kconfig +12 -0
@@ -62,6 +62,18 @@ config VIDEO_AP1302 This is a Video4Linux2 sensor-level driver for the external ISP AP1302. +config VIDEO_AR0234 + tristate "onsemi AR0234 sensor support" + depends on ACPI || OF || COMPILE_TEST + select V4L2_CCI_I2C + select VIDEO_CCS_PLL + help + This is a Video4Linux2 sensor driver for the onsemi + AR0234 camera. + + To compile this driver as a module, choose M here: the + module will be called ar0234. + config VIDEO_AR0521 tristate "ON Semiconductor AR0521 sensor support" help
drivers/media/i2c/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_VIDEO_AK881X) += ak881x.o obj-$(CONFIG_VIDEO_ALVIUM_CSI2) += alvium-csi2.o obj-$(CONFIG_VIDEO_AP1302) += ap1302.o obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o +obj-$(CONFIG_VIDEO_AR0234) += ar0234.o obj-$(CONFIG_VIDEO_AR0521) += ar0521.o obj-$(CONFIG_VIDEO_BT819) += bt819.o obj-$(CONFIG_VIDEO_BT856) += bt856.o
drivers/media/i2c/ar0234.c new file +1251 -0
1,251 lines not on this page · raw message
Signature · 1 line
2.52.0