mbox series

[PATCH/RFC,v2,0/9] media: i2c: AR0144 camera sensor driver with companding support

Message ID 20240905225308.11267-1-laurent.pinchart@ideasonboard.com
Headers show
Series media: i2c: AR0144 camera sensor driver with companding support | expand

Message

Laurent Pinchart Sept. 5, 2024, 10:52 p.m. UTC
Hello,

This patch series adds a driver for the onsemi AR0144 camera sensor.

The AR0144 is a 1/4" 1MP 12-bit raw camera sensor, with monochrome and
Bayer variants. It has both parallel and MIPI CSI-2 output capability.
Its features include analog crop, binning/skipping and the usual set of
controls applicable to raw sensors. It has a CCS-compatible clock tree,
but doesn't use the CCS register layout.

In addition to the standard features, the sensor supports automatic
exposure and black level correction. Furthermore, it supports dynamic
range compression to reduce the bit rate. This last feature is new to
V4L2, and is why this series is marked as RFC.

Patch 1/9 adds the DT binding, and patch 2/9 the driver. Support for the
parallel interface comes in patch 3/9. I haven't bundled it with 2/9 as
my test platform supports CSI-2 only, so I couldn't test the parallel
interface, and I suspect it will not work out of the box. I'm fine
leaving 3/9 out for now, it will be available in the list archives
should anyone decide to test and complete support for the parallel
output.

Patches 4/9 to 7/9 then add support for internal pads, routing and
embedded data. This is split from patch 3/9 as the necessary APIs are
not merged in the kernel yet. The DT binding and the base driver could
be upstreamed first and independently from embedded data support,
depending on the timing of the dependencies.

Patch 8/9 then starts the RFC part. It adds a new V4L2 control for
companding. Companding is a combination of compressing (on the camera
sensor side) and expanding the data to reduce the bandwidth transmitted
on the bus. The AR0144 support compressing data using a custom curve
similar to A-law when outputting 8- or 10-bit data. This improves the
sensitivity in the middle of the dynamic range. The new control allows
enabling compression. The control doesn't affect the bit depth of the
output format, only the way the larger bit depth of the sensor is
reduced.

Finally, patch 9/9 implement the companding control in the ar0144
driver.

The series is based on "[PATCH v9 00/46] Generic line based metadata
support, internal pads" ([1]). I have pushed it to a branch ([2]) that
includes the dependencies (along with other relevant - and less relevant
- bits and pieces such as DT overlays for testing).

[1] https://lore.kernel.org/all/20240416193319.778192-1-sakari.ailus@linux.intel.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=nxp/v6.11/dev/rpi-cam/next

Laurent Pinchart (9):
  media: dt-bindings: media: i2c: Add AR0144 camera sensor
  media: i2c: Add a driver for the onsemi AR0144 camera sensor
  media: i2c: ar0144: Add support for the parallel interface
  media: i2c: ar0144: Add internal image sink pad
  media: i2c: ar0144: Add image stream
  media: i2c: ar0144: Report internal routes to userspace
  media: i2c: ar0144: Add embedded data support
  media: v4l: ctrls: Add a control for companding
  media: i2c: ar0144: Add support for companding

 .../bindings/media/i2c/onnn,ar0144.yaml       |  162 ++
 .../media/v4l/ext-ctrls-image-process.rst     |   16 +
 MAINTAINERS                                   |    7 +
 drivers/media/i2c/Kconfig                     |   11 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/ar0144.c                    | 2111 +++++++++++++++++
 drivers/media/v4l2-core/v4l2-ctrls-defs.c     |    9 +
 include/uapi/linux/v4l2-controls.h            |    5 +
 8 files changed, 2322 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0144.yaml
 create mode 100644 drivers/media/i2c/ar0144.c


base-commit: 39574b6b7bf1368c42975263988d86cc400526e2

Comments

Rob Herring (Arm) Sept. 6, 2024, 12:14 a.m. UTC | #1
On Fri, 06 Sep 2024 01:52:59 +0300, Laurent Pinchart wrote:
> Add device tree binding for the onsemi AR0144 CMOS camera sensor. The
> binding supports both the monochrome and color sensor versions.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> Changes since v1:
> 
> - Drop clock-names
> - Rename vdd_io-supply to vddio supply
> - Drop unnecessary |
> ---
>  .../bindings/media/i2c/onnn,ar0144.yaml       | 162 ++++++++++++++++++
>  MAINTAINERS                                   |   6 +
>  2 files changed, 168 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0144.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/onnn,ar0144.example.dtb: camera@10: 'clock-names' is a required property
	from schema $id: http://devicetree.org/schemas/media/i2c/onnn,ar0144.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240905225308.11267-2-laurent.pinchart@ideasonboard.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Laurent Pinchart Sept. 6, 2024, noon UTC | #2
On Thu, Sep 05, 2024 at 07:14:49PM -0500, Rob Herring (Arm) wrote:
> 
> On Fri, 06 Sep 2024 01:52:59 +0300, Laurent Pinchart wrote:
> > Add device tree binding for the onsemi AR0144 CMOS camera sensor. The
> > binding supports both the monochrome and color sensor versions.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > Changes since v1:
> > 
> > - Drop clock-names
> > - Rename vdd_io-supply to vddio supply
> > - Drop unnecessary |
> > ---
> >  .../bindings/media/i2c/onnn,ar0144.yaml       | 162 ++++++++++++++++++
> >  MAINTAINERS                                   |   6 +
> >  2 files changed, 168 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0144.yaml
> > 
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/onnn,ar0144.example.dtb: camera@10: 'clock-names' is a required property
> 	from schema $id: http://devicetree.org/schemas/media/i2c/onnn,ar0144.yaml#

My bad, I forgot to retest before sending v2 :( Sorry about that. It
will be fixed (and tested) in v3.

> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240905225308.11267-2-laurent.pinchart@ideasonboard.com
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.