Commit graph

31 commits

Author SHA1 Message Date
Alexander Stein
7235248d38 libcamera: libipa: camera_sensor: Add Sony IMX415 sensor properties
Provide the Sony IMX415 camera sensor properties and registration
with libipa for the gain code helpers.

The test patterns exposed by the IMX415 do not map well to the current
set of test pattern controls supplied by libcamera. These are left
intentionally unimplemented.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-03 17:58:41 +03:00
Kieran Bingham
6b1b2bd7ea libcamera: libipa: camera_sensor: Add Sony IMX335 sensor properties
Provide the Sony IMX335 camera sensor properties and registration
with libipa for the gain code helpers.

The test patterns exposed by the IMX335 do not map well to the current
set of test pattern controls supplied by libcamera. These are left
intentionally unimplemented.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-03 14:50:45 +05:30
Kieran Bingham
2ac544cfd6 libcamera: libipa: camera_sensor: Add Sony IMX283 sensor properties
Provide the IMX283 camera sensor properties and registration
with libipa for the gain code helpers.

The test patterns exposed by the IMX283 do not map well to the current
set of test pattern controls supplied by libcamera. These are left
intentionally unimplemented.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-05-03 14:50:43 +05:30
Jacopo Mondi
aa5066b413 libipa: camera_sensor_helper: Add OV64A40 helper
Add a CameraSensorHelper for the OV64A40 camera sensor.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:03 +00:00
Benjamin Bara
0a37c203da libipa: camera_sensor_helper: Restore alphabetical order
The addition of the CameraSensorHelperImx327 class was not correctly
inserted in alphabetical sort order.

Move it to the correct location.

Fixes: 7d5b38e2ef ("libipa: camera_sensor_helper: Add IMX327 helper")
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:14:37 +03:00
Benjamin Bara
7d5b38e2ef libipa: camera_sensor_helper: Add IMX327 helper
Add support for the Sony IMX327, which is added to the kernel with
commit 2d41947ec2c0 ("media: i2c: imx290: Add support for imx327
variant"). It is basically a derivate of the IMX290, therefore also
derive the helper.

Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-05-19 18:25:59 +01:00
Kieran Bingham
ffa3afdd61 ipa: libipa: Add OV2685 Camera Sensor Helper
Provide a CameraSensorHelper for the OV2685, along with the
corresponding camera sensor properties.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-03-21 23:40:41 +00:00
Kieran Bingham
8c0ae95865 ipa: libipa: Add OV5647 Camera Sensor Helper
Provide a CameraSensorHelper for the OV5647 as used in the Raspberry Pi
Camera Module v1.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Christopher Obbard <chris.obbard@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-03-21 23:34:28 +00:00
Nicholas Roth
0f382a9926 libcamera: Add support for OmniVision OV8858
Support for the OmniVision OV8858 sensor is scheduled for inclusion in
the Linux kernel in version v6.3.

Add support for the sensor in libcamera by providing static properties
and a camera sensor helper in libipa.

The camera sensor helper expresses analogue gain increments in 1/128
step which differs from what is reported in the sensor documentation in
section "5.8 manual exposure compensation/ manual gain compensation" [0]

A more detailed analysis of the sensor gain model is reported at:
2022110617.166892-2-nicholas@rothemail.net/#142267

Record with a \todo note a reference to discussion on the gain model
implementation.

Signed-off-by: Nicholas Roth <nicholas@rothemail.net>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-26 18:33:47 +01:00
Mikhail Rudenko
3643c59617 ipa: camera_sensor_helper: Add OV4689 support
Add support for Omnivision OV4689 image sensor to libipa.

The sensor implements a linear gain equation with analogue gain
control values 0-2047 corresponding to 0x-16x physical gain range.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25 18:42:51 +01:00
Jacopo Mondi
ff9b8befbb ipa: camera_sensor_helper: Add AR0521 support
Add support for OnSemi AR0521 5Mpx image sensor to libipa.

The sensor analogue gain is implemented as a coarse and a fine factor,
with the coarse gain being a power of two and the fine gain being a
value in the [1.0, 2.0[ range. The mapping between gain codes and gain
values is tabulated in the datasheet, and the table values are very
close but not identical to the mathematical model. Compute the gain
using the model to keep the code shorter, if this causes precision
issues the calculation could be replaced with a table.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-22 12:11:21 +01:00
Laurent Pinchart
014698cba1 ipa: camera_sensor_helper: Implement factories through class templates
The REGISTER_CAMERA_SENSOR_HELPER() macro defines a class type that
inherits from the CameraSensorHelperFactory class, and implements a
constructor and createInstance() function. Replace the code generation
through macro with the C++ equivalent, a class template, as done by the
Algorithm factory.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:10:05 +03:00
Laurent Pinchart
9d9481188f ipa: camera_sensor_helper: Return unique_ptr from createInstance
Avoid naked pointer with memory allocation by returning a unique_ptr
from CameraSensorHelperFactory::createInstance(), in order to increase
memory allocation safety.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:02:16 +03:00
Laurent Pinchart
c4d39f0c31 ipa: camera_sensor_helper: Make factory createInstance() function const
The CameraSensorHelperFactory::createInstance() function has no need to
modify the factory instance. Make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:01:44 +03:00
Naushir Patuck
b7ce7e1d34 libipa: camera_sensor_helper: Add Sony IMX477 helper
Add support for the Sony IMX477 sensor in the camera helper database.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 09:12:08 +03:00
Laurent Pinchart
f8e4649680 ipa: camera_sensor_helper: Fix equation in exponential gain documentation
The exponential gain documentation is missing a '\' in the equation. Fix
t.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-26 12:22:32 +03:00
Quentin Schulz
5efb6c8e2a libipa: camera_sensor_helper: Add OV5675 helper
The OV5675 is an OmniVision sensor with a linear gain model, expressed
in 1/128 steps.

Cc: Quentin Schulz <foss+libcamera@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-13 06:57:43 +03:00
Paul Elder
0040820fc1 libipa: camera_sensor_helper: Add OV5640 helper
The OV5640 is an OmniVision sensor with a linear gain model, expressed
in 1/16 steps.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-04-01 14:48:29 +03:00
Laurent Pinchart
e342e522cb libipa: camera_sensor_helper: Add IMX296 helper
The IMX296 is a Sony sensor that expresses its gain in 0.1dB units. It
thus maps to the exponential gain model.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:48:29 +03:00
Laurent Pinchart
4011994780 libipa: camera_sensor_helper: Add IMX290 helper
The IMX290 is a Sony sensor that expresses its gain in 0.3dB units. It
thus maps to the exponential gain model.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:48:24 +03:00
Laurent Pinchart
8ad9249fb0 libipa: camera_sensor_helper: Implement exponential gain model
The CameraSensorHelper specifies two gain models, linear and
exponential. They are modelled after the MIPI CCS specification. Only
the linear model has been implemented, the exponential model was left
for later.

We now need to support sensors that configure their gain in a hardware
register with a value expressed in dB. This has similarities with the
MIPI CCS exponential gain model, but is only has an exponential factor,
while CCS also allows sensors to support a configurable linear factor.

The full CCS exponential model needs two values (for the linear and
exponential factors) to express a gain, while IPAs use a single linear
gain value internally. However, the exponential gain model example in
the CCS specification has a fixed linear factor, which may indicate that
it could be common for sensors that implement the exponential gain model
to only use the exponential factor. For this reason, implement the
exponential gain model with a fixed linear factor, but with a
sensor-specific coefficient for the exponential factor that allows
expressing the gain in dB (or other logarithmical units) instead of
limiting it to powers of 2 as in the MIPI CCS specification.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:29:25 +03:00
Laurent Pinchart
a9d43c4710 libipa: camera_sensor_helper: Reorganize gain constants
To prepare for other gain models than the linear model, store the gain
constants in a union with per-model members. Due to the lack of
designated initializer support in gcc with C++17, initializing a single
complex structure that includes a union will be difficult. Split the
gain model type to a separate variable to work around this issue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:29:05 +03:00
Daniel Scally
f0bfb2f19e libipa: Add CameraSensorHelper for OV2740
The datasheet for the OV2740 gives 0x80 as 1x gain, so real gain
is GainCode / 128.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-17 16:34:47 +00:00
Jean-Michel Hautbois
aad674c544 libipa: Correct IMX219 in CameraSensorHelper
The equation is badly reported in the CameraSensorHelper, as m1 and c0
are inverted. Correct it to have a proper gain calculation.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29 20:41:37 +01:00
Laurent Pinchart
a48a000a33 libcamera: Rename 'method' to 'function'
Usage of 'method' to refer to member functions comes from Java. The C++
standard uses the term 'function' only. Replace 'method' with 'function'
or 'member function' through the whole code base and documentation.
While at it, fix two typos (s/backeng/backend/).

The BoundMethod and Object::invokeMethod() are left as-is here, and will
be addressed separately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-09 15:40:32 +03:00
Daniel Scally
2c88a6dbc1 libipa: Add CameraSensorHelper for ov8865
Add a CameraSensorHelperOv8865 class. The gain coefficients are gleaned
from the datasheet; the lowest 7 bits are reported there as fractional
bits, so real gain is val/128.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-25 01:52:48 +03:00
Umang Jain
48a380b389 libipa: Add CameraSensorHelper for IMX258
Extend the CameraSensorHelper factory with support for the IMX258
sensor found in the Nautilus Chromebook.

The values are read by manually tweaking the IMX258 kernel driver.
The IMX258 kernel driver hints that the sensor may be compatible
with the MIPI CCS specification, as the register set matches.
The values for analog gain constants are obtained by reading the
register indexes, corresponding to the analog gain constants, as
mentioned in MIPI CCS v1.1 specification.

The values have further been confirmed by Dave Stevenson as being
those specified in the datasheet.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-23 22:48:12 +05:30
Jean-Michel Hautbois
ea0b199da7 libipa: Correct OV5670 CameraSensorHelper gain values
The datasheet states that the low 7 bits are fraction bits.
real_gain = GainCode/128
For example, 0x080 is 1x gain, 0x100 is 2x gain.

It means that we should have m0=1 and c1=128.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-15 17:27:33 +02:00
Jean-Michel Hautbois
bda10cae5e libipa: Add CameraSensorHelper for OV13858
Extend the CameraSensorHelper factory with support for an
OV13858 sensor as found in the Soraka Chromebook.

The datasheet states that low 7 bits are fraction bits, so the gain is
calculated as gainCode=128*gain.
According to the formula, it means m0=1 and c1=128.
m1 then has to be 0, and c0=0.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-15 17:27:23 +02:00
Jean-Michel Hautbois
f23f3922b3 ipa: libipa: Fixups in CameraSensorHelpers
A few lines needed to be wrapped under 80 lines.
Remove some unneeded documentation and minor typos.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-09 21:20:22 +02:00
Jean-Michel Hautbois
32677e1220 ipa: Create a camera sensor helper class
For various sensor operations, it may be needed to do sensor specific
computations, like analogue gain or vertical blanking.

This commit introduces a new camera sensor helper in libipa which aims
to solve this specific issue.
It is based on the MIPI alliance Specification for Camera Command Set
and implements, for now, only the analogue "Global gain" mode.
Setting analogue gain for a specific sensor is not a straightforward
operation, as one needs to know how the gain is calculated for it.

Three helpers are created in this patch: imx219, ov5670 and ov5693.

Adding a new sensor is pretty straightforward as one only needs to
implement the sub-class for it and register that class to the
CameraSensorHelperFactory.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-06-28 10:48:33 +02:00