[libcamera-devel] [PATCH 1/1] libipa: Add CameraSensorHelper for IMX258

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Jul 20 02:01:55 CEST 2021


Hi Umang,

Thank you for the patch.

On Mon, Jul 19, 2021 at 03:44:36PM +0530, Umang Jain wrote:
> Extend the CameraSensorHelper factory with support for an
> IMX258 sensor as found in the Nautilus Chromebook.
> 
> The values are read by hacking the IMX258 kernel driver.
> 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.

I'd expand this to explain why.

The imx258 kernel driver hints that the IMX258 sensor may be compatible
with the MIPI CCS specification, as the register set matches. The gain
parameter values have been retrieved from the sensor by reading the
analog gain read-only registers as defined by CCS.

This being said, given that the maximum gain value doesn't match the
driver, I think we need to run additional tests to figure out if this is
actually correct. Setting the gain to 0, 256, 384 and 448 should result
in gain values of x1, x2, x4 and x8 according to the coefficients, and
it should be possible to validate that by capturing images with a fixed
exposure time and calculate the average luminance for the different gain
values. The exposure time should be picked to have a luminance value of
about 10% when the gain is x1, as lower valus would result in measuring
noise rather than actual data, and higher values would saturate at
higher gains.

If the formula holds with those values, you could try setting the gain
to values higher than 448, up to the maximum value of 0x1fff accepted by
the driver, to see what happens.

If 448 is indeed the maximum value, then we should fix the driver
accordingly.

> Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>  src/ipa/libipa/camera_sensor_helper.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> index 709835a8..c43368df 100644
> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> @@ -295,6 +295,16 @@ public:
>  };
>  REGISTER_CAMERA_SENSOR_HELPER("imx219", CameraSensorHelperImx219)
>  
> +class CameraSensorHelperImx258 : public CameraSensorHelper
> +{
> +public:
> +        CameraSensorHelperImx258()
> +        {
> +                analogueGainConstants_ = { AnalogueGainLinear, 0, 512, -1, 512 };
> +        }
> +};
> +REGISTER_CAMERA_SENSOR_HELPER("imx258", CameraSensorHelperImx258)
> +
>  class CameraSensorHelperOv5670 : public CameraSensorHelper
>  {
>  public:

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list