| Message ID | c6a502b4-4193-40a6-8cfa-62a19bfb5011@opendigital.cc |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Hi Stuart On Wed, Mar 25, 2026 at 10:31:45AM +0100, Stuart J Mackintosh wrote: > From ae84819121c206dd352c5e24942c1170ff7c6819 Mon Sep 17 00:00:00 2001 > From: Stuart J Mackintosh <sjm@opendigital.cc> > Date: Wed, 25 Mar 2026 10:19:05 +0100 > Subject: [PATCH] ipa: libipa: camera_sensor_helper: Add OV01A10 There is something going on with the way you submitted the patch as 'git am' is not able to apply it. it seem you copied the patch in an email message ? Could you check Documentation/contributing.rst and use git-send-email ? > > Add a CameraSensorHelper for the OmniVision OV01A10 image sensor, > used in Dell XPS 13 and other laptops with the Intel IPU6 camera > subsystem. > > The analogue gain model is derived from the V4L2 control range > reported by the sensor driver. The minimum gain code is 256 with > a step of 1, giving the linear model: > > gain = code / 256 Following this line of reasoning, the max gain code in the driver is said to be 0x3fff which would give a max gain of x64 which seems quite high (however I surely can't rule out it is correct). > > This corresponds to AnalogueGainLinear{ 1, 0, 0, 256 }, consistent > with the pattern used by other OmniVision sensors in this file. Are we going by reasoning just looking at the min/max ? Aren't there other sources that migh confirm the analogue gain model is actually a linear one ? Have you tried manually increasing the analogue gain and validate you get a linear response ? > > The black level of 0x40 at 10 bits (4096 scaled to 16 bits) was > confirmed by dark frame measurement with the lens covered. Great > > Without this helper, libcamera's AGC algorithm cannot convert between > gain codes and real gain values, causing auto-exposure oscillation and > the following warning: > > IPASoft: Failed to create camera sensor helper for ov01a10 > > Signed-off-by: Stuart J Mackintosh <sjm@opendigital.cc> > --- > Note: Colour calibration (CCM) for this sensor is not yet available. > A tuning file exists at /usr/share/libcamera/ipa/simple/ov01a10.yaml > but contains no calibrated parameters. This is deferred to a follow-up > contribution once calibration data is available. That would be nice! Do you plan to generate the CCM values yourself ? Thanks j > > src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/ipa/libipa/camera_sensor_helper.cpp > b/src/ipa/libipa/camera_sensor_helper.cpp > index e3e3e535..72466867 100644 > --- a/src/ipa/libipa/camera_sensor_helper.cpp > +++ b/src/ipa/libipa/camera_sensor_helper.cpp > @@ -653,6 +653,18 @@ public: > }; > REGISTER_CAMERA_SENSOR_HELPER("imx708", CameraSensorHelperImx708) > +class CameraSensorHelperOv01a10 : public CameraSensorHelper > +{ > +public: > + CameraSensorHelperOv01a10() > + { > + /* From dark frame measurement: 0x40 at 10bits. */ > + blackLevel_ = 4096; > + gain_ = AnalogueGainLinear{ 1, 0, 0, 256 }; > + } > +}; > +REGISTER_CAMERA_SENSOR_HELPER("ov01a10", CameraSensorHelperOv01a10) > + > class CameraSensorHelperOv2685 : public CameraSensorHelper > { > public: > -- > 2.47.3 > > > -- > Stuart J Mackintosh > > Business & digital technology consultant > > Open Digital Consulting Co > > Open Digital Consulting Co Logo > > UK: +44 20 36 27 90 40 > > FR: +33 1 89 48 00 40 > > Email: sjm@opendigital.cc <mailto:sjm@opendigital.cc> > > Web: https://opendigital.cc <https://opendigital.cc> > > IM: xmpp:sjm@opendigital.cc <xmpp:sjm@opendigital.cc> >
Hi Jacopo, On 25/03/2026 17:02, Jacopo Mondi wrote: > Hi Stuart > > On Wed, Mar 25, 2026 at 10:31:45AM +0100, Stuart J Mackintosh wrote: >> From ae84819121c206dd352c5e24942c1170ff7c6819 Mon Sep 17 00:00:00 2001 >> From: Stuart J Mackintosh<sjm@opendigital.cc> >> Date: Wed, 25 Mar 2026 10:19:05 +0100 >> Subject: [PATCH] ipa: libipa: camera_sensor_helper: Add OV01A10 > There is something going on with the way you submitted the patch > as 'git am' is not able to apply it. it seem you copied the patch in > an email message ? > > Could you check Documentation/contributing.rst and use git-send-email ? Yes - I haven't used this method before, I am used to making PR's, so learning on this one. I will configure |git send-email| and resubmit. >> Add a CameraSensorHelper for the OmniVision OV01A10 image sensor, >> used in Dell XPS 13 and other laptops with the Intel IPU6 camera >> subsystem. >> >> The analogue gain model is derived from the V4L2 control range >> reported by the sensor driver. The minimum gain code is 256 with >> a step of 1, giving the linear model: >> >> gain = code / 256 > Following this line of reasoning, the max gain code in the driver is > said to be 0x3fff which would give a max gain of x64 which seems quite > high (however I surely can't rule out it is correct). The upstream kernel driver defines |OV01A10_ANAL_GAIN_MAX = 0x3fff| = 16383, giving a maximum of 63.99x. My running kernel (6.12.74+deb13) reports max=65535 via V4L2, which appears to be an older driver version predating a recent fix. The gain model is correct regardless - only the clamp value differs.(AI) >> This corresponds to AnalogueGainLinear{ 1, 0, 0, 256 }, consistent >> with the pattern used by other OmniVision sensors in this file. > Are we going by reasoning just looking at the min/max ? Aren't > there other sources that migh confirm the analogue gain model is > actually a linear one ? > > Have you tried manually increasing the analogue gain and validate you > get a linear response ? The kernel driver writes the analogue gain register directly without scaling: |cci_write(ov01a10->regmap, OV01A10_REG_ANALOG_GAIN, ctrl->val, NULL)|. The minimum |OV01A10_ANAL_GAIN_MIN = 0x100| = 256 represents unity gain, consistent with Q8 fixed-point where |gain = register_value / 256|. This is the same fixed-point convention used for digital gain, where |OV01A10_DGTL_GAIN_DEFAULT = 1024| represents unity with a 6-bit fractional part. (AI) >> Without this helper, libcamera's AGC algorithm cannot convert between >> gain codes and real gain values, causing auto-exposure oscillation and >> the following warning: >> >> IPASoft: Failed to create camera sensor helper for ov01a10 >> >> Signed-off-by: Stuart J Mackintosh<sjm@opendigital.cc> >> --- >> Note: Colour calibration (CCM) for this sensor is not yet available. >> A tuning file exists at /usr/share/libcamera/ipa/simple/ov01a10.yaml >> but contains no calibrated parameters. This is deferred to a follow-up >> contribution once calibration data is available. > That would be nice! Do you plan to generate the CCM values yourself ? Yes, that is my intention once I have worked out a reasonable calibration approach. A little more background - I am using a Dell XPS and it generally works with Debian, the biggest problem being this camera so I am committed to chipping away at it until it is usable. This patch already makes a big difference and I am keen to get the fixes upstream. I am using AI to assist this work and marked the generated statements with (AI); I am not CPP experienced. What would help me is to know the recommended way to capture frames at a fixed analogue gain value on an IPU6 platform, bypassing the AGC, to help validate the gain parameters? Any guidance that you might have with diagnostics is welcome. Best wishes, Stuart. > > Thanks > j > >> src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp >> b/src/ipa/libipa/camera_sensor_helper.cpp >> index e3e3e535..72466867 100644 >> --- a/src/ipa/libipa/camera_sensor_helper.cpp >> +++ b/src/ipa/libipa/camera_sensor_helper.cpp >> @@ -653,6 +653,18 @@ public: >> }; >> REGISTER_CAMERA_SENSOR_HELPER("imx708", CameraSensorHelperImx708) >> +class CameraSensorHelperOv01a10 : public CameraSensorHelper >> +{ >> +public: >> + CameraSensorHelperOv01a10() >> + { >> + /* From dark frame measurement: 0x40 at 10bits. */ >> + blackLevel_ = 4096; >> + gain_ = AnalogueGainLinear{ 1, 0, 0, 256 }; >> + } >> +}; >> +REGISTER_CAMERA_SENSOR_HELPER("ov01a10", CameraSensorHelperOv01a10) >> + >> class CameraSensorHelperOv2685 : public CameraSensorHelper >> { >> public: >> -- >> 2.47.3 >> >> >> -- >> Stuart J Mackintosh >> >> Business & digital technology consultant >> >> Open Digital Consulting Co >> >> Open Digital Consulting Co Logo >> >> UK: +44 20 36 27 90 40 >> >> FR: +33 1 89 48 00 40 >> >> Email:sjm@opendigital.cc <mailto:sjm@opendigital.cc> >> >> Web:https://opendigital.cc <https://opendigital.cc> >> >> IM:xmpp:sjm@opendigital.cc <xmpp:sjm@opendigital.cc> >>
diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index e3e3e535..72466867 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -653,6 +653,18 @@ public: }; REGISTER_CAMERA_SENSOR_HELPER("imx708", CameraSensorHelperImx708) +class CameraSensorHelperOv01a10 : public CameraSensorHelper +{ +public: + CameraSensorHelperOv01a10() + { + /* From dark frame measurement: 0x40 at 10bits. */ + blackLevel_ = 4096; + gain_ = AnalogueGainLinear{ 1, 0, 0, 256 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("ov01a10", CameraSensorHelperOv01a10) + class CameraSensorHelperOv2685 : public CameraSensorHelper { public: -- 2.47.3