[v4,0/2] Add imx471 soft-ISP sensor support
mbox series

Message ID CALr1FG__gS_agbUnB5iWZ8wQypxdJch_UHziw2xuuG5Axp3vtQ@mail.gmail.com
Headers show
Series
  • Add imx471 soft-ISP sensor support
Related show

Message

John Cronin July 31, 2026, 3:15 p.m. UTC
Add CameraSensorHelper and static sensor properties for Sony IMX471
(SONY471A), used on Lenovo ThinkPad X9 / X1 Carbon Gen14 (IPU7).

Changes since v3:
- Document measured analogue gain model and black level on real
  hardware (raw Bayer sweep, fixed exposure).
- Confirm G = 1024/(1024-code) within ~1.5% over codes 0..800; max
  ~4.57x is the V4L2 code range under that model.
- Black level ~64 DN @ 10-bit from min exposure/gain raw frames.

v3 process notes (still apply): new thread, split patches, empty
sensorDelays, no self Tested-by.

Tested on Fedora 44 / ThinkPad X9-15 Gen 1 (kernel 7.1.5).

John Cronin (2):
  libipa: camera_sensor_helper: Add imx471
  libcamera: camera_sensor_properties: Add imx471

 src/ipa/libipa/camera_sensor_helper.cpp       | 29 +++++++++++++++++++
 .../sensor/camera_sensor_properties.cpp       | 14 +++++++++
 2 files changed, 43 insertions(+)

Comments

Jacopo Mondi July 31, 2026, 4:23 p.m. UTC | #1
Hi John

how did you formatted/sent the patches ?
I can't apply them with `git am` as I usually do:

error: git diff header lacks filename information when removing 1 leading pathname component at .git/rebase-apply/patch:6

Apparently the client you used to send emails broke lines which makes
the patch untreatable for git am.

Did you use git-send-email to send the patch ?
See Documentation/contributing.rst in particular
https://git-send-email.io/

Thanks
  j

On Fri, Jul 31, 2026 at 08:15:05AM -0700, John Cronin wrote:
> Add CameraSensorHelper and static sensor properties for Sony IMX471
> (SONY471A), used on Lenovo ThinkPad X9 / X1 Carbon Gen14 (IPU7).
>
> Changes since v3:
> - Document measured analogue gain model and black level on real
>   hardware (raw Bayer sweep, fixed exposure).
> - Confirm G = 1024/(1024-code) within ~1.5% over codes 0..800; max
>   ~4.57x is the V4L2 code range under that model.
> - Black level ~64 DN @ 10-bit from min exposure/gain raw frames.
>
> v3 process notes (still apply): new thread, split patches, empty
> sensorDelays, no self Tested-by.
>
> Tested on Fedora 44 / ThinkPad X9-15 Gen 1 (kernel 7.1.5).
>
> John Cronin (2):
>   libipa: camera_sensor_helper: Add imx471
>   libcamera: camera_sensor_properties: Add imx471
>
>  src/ipa/libipa/camera_sensor_helper.cpp       | 29 +++++++++++++++++++
>  .../sensor/camera_sensor_properties.cpp       | 14 +++++++++
>  2 files changed, 43 insertions(+)
>
> --
> 2.55.0
John Cronin July 31, 2026, 4:33 p.m. UTC | #2
Hi Jacopo,

On Fri, Jul 31, 2026 at 06:23:31PM +0200, Jacopo Mondi wrote:
> how did you formatted/sent the patches ?
> I can't apply them with `git am` as I usually do:
>
> error: git diff header lacks filename information when removing 1 leading
> pathname component ...
>
> Apparently the client you used to send emails broke lines which makes
> the patch untreatable for git am.
>
> Did you use git-send-email to send the patch ?

Sorry about that — no, I did not use git-send-email. The patches were
sent as plain-text bodies through Gmail's API/web path, which wrapped
long lines and mangled the format-patch headers for `git am`.

I do not have git-send-email/SMTP set up on this machine yet (will fix
that for future submissions; thanks for the contributing.rst pointer).

To unblock apply without relying on the MUA, here is a **git-am-ready**
format-patch series (raw files, tabs preserved, verified with `git am`
locally):

  https://gist.github.com/johncronin3/51dfc0bb2204b8ab13c678b9fad0bb13

  curl -fsSL https://gist.githubusercontent.com/johncronin3/51dfc0bb2204b8ab13c678b9fad0bb13/raw/0001-libipa-camera_sensor_helper-Add-imx471.patch
| git am
  curl -fsSL https://gist.githubusercontent.com/johncronin3/51dfc0bb2204b8ab13c678b9fad0bb13/raw/0002-libcamera-camera_sensor_properties-Add-imx471.patch
| git am

That series is **v5** vs the broken Gmail v4:
- Drop the long in-code helper comment (measurement detail stays in the
  commit message only) — please do drop it if you still prefer that.
- Drop the redundant test-pattern comment on properties (as on your R-b).
- Same functional code (blackLevel 4096, AnalogueGainLinear 1024 model).

Also fine if you apply from the earlier content and just drop the
comments yourself; the gist is only to give you a clean `git am` path.

Measurement write-up/script remains at:
  https://gist.github.com/johncronin3/15d9eacbf64f91ecc600fe583686325f

Thanks for your patience,
John Cronin
Jacopo Mondi Aug. 3, 2026, 7:15 a.m. UTC | #3
Hi John

On Fri, Jul 31, 2026 at 09:33:33AM -0700, John Cronin wrote:
> Hi Jacopo,
>
> On Fri, Jul 31, 2026 at 06:23:31PM +0200, Jacopo Mondi wrote:
> > how did you formatted/sent the patches ?
> > I can't apply them with `git am` as I usually do:
> >
> > error: git diff header lacks filename information when removing 1 leading
> > pathname component ...
> >
> > Apparently the client you used to send emails broke lines which makes
> > the patch untreatable for git am.
> >
> > Did you use git-send-email to send the patch ?
>
> Sorry about that — no, I did not use git-send-email. The patches were
> sent as plain-text bodies through Gmail's API/web path, which wrapped
> long lines and mangled the format-patch headers for `git am`.
>
> I do not have git-send-email/SMTP set up on this machine yet (will fix
> that for future submissions; thanks for the contributing.rst pointer).
>
> To unblock apply without relying on the MUA, here is a **git-am-ready**
> format-patch series (raw files, tabs preserved, verified with `git am`
> locally):
>
>   https://gist.github.com/johncronin3/51dfc0bb2204b8ab13c678b9fad0bb13
>
>   curl -fsSL https://gist.githubusercontent.com/johncronin3/51dfc0bb2204b8ab13c678b9fad0bb13/raw/0001-libipa-camera_sensor_helper-Add-imx471.patch
> | git am
>   curl -fsSL https://gist.githubusercontent.com/johncronin3/51dfc0bb2204b8ab13c678b9fad0bb13/raw/0002-libcamera-camera_sensor_properties-Add-imx471.patch
> | git am

Thanks, I've applied the patches with this.

Make sure to use git-send-email next time ;)

>
> That series is **v5** vs the broken Gmail v4:
> - Drop the long in-code helper comment (measurement detail stays in the
>   commit message only) — please do drop it if you still prefer that.
> - Drop the redundant test-pattern comment on properties (as on your R-b).
> - Same functional code (blackLevel 4096, AnalogueGainLinear 1024 model).
>
> Also fine if you apply from the earlier content and just drop the
> comments yourself; the gist is only to give you a clean `git am` path.

I have slightly reworded the commit messages to remove references to
SoftISP as the changes apply for all platforms, I have split the
comment on the helper in two

+               /* Measured: 64 DN at 10-bit; */
+               blackLevel_ = 4096;
+               /* gain = 1024/(1024 - code); code = [0, 800]; max gain = x4.57 */
+               gain_ = AnalogueGainLinear{ 0, 1024, -1, 1024 };

And remove the comment on the properties as the cell size is self
describing and the sensor array size doesn't come from properties but
rather from format.

>
> Measurement write-up/script remains at:
>   https://gist.github.com/johncronin3/15d9eacbf64f91ecc600fe583686325f
>

Are you interested in making this a tool in utils/ and writing some
lines in Documentation/guides ?

> Thanks for your patience,

Thank you for the effort and for your contribution!

> John Cronin
John Cronin Aug. 3, 2026, 10:52 a.m. UTC | #4
Hi Jacopo,

On Mon, Aug 03, 2026 at 09:15:55AM +0200, Jacopo Mondi wrote:
> Thanks, I've applied the patches with this.
>
> Make sure to use git-send-email next time ;)

Great — thank you for applying them, and for the rewording of the
comments / commit messages. All of that looks better than what I had.

Agreed on git-send-email for the next series; I'll get SMTP set up so
we are not stuck with MUA wrapping again.

> Are you interested in making this a tool in utils/ and writing some
> lines in Documentation/guides ?

Yes. I have prepared a follow-up series:

  [PATCH 0/2] CameraSensorHelper measurement tool and guide
  [PATCH 1/2] utils: Add measure-analogue-gain helper
  [PATCH 2/2] Documentation: Add Camera Sensor Helper guide

Because Gmail still mangles format-patch for git am on this machine,
the apply-ready patches are here (raw files, verified with git am):

  https://gist.github.com/johncronin3/ad3e934e90b9920f1135d160252992bd

  curl -fsSL https://gist.githubusercontent.com/johncronin3/ad3e934e90b9920f1135d160252992bd/raw/0001-utils-Add-measure-analogue-gain-helper.patch
| git am
  curl -fsSL https://gist.githubusercontent.com/johncronin3/ad3e934e90b9920f1135d160252992bd/raw/0002-Documentation-Add-Camera-Sensor-Helper-guide.patch
| git am

The tool is sensor-agnostic (width/height/stride/bit-depth/sensor name
flags). It installs as libcamera-measure-analogue-gain. The guide covers
helper + properties placement, the measurement procedure, and points at
the utility. Happy to rework naming, install path, or docs structure if
you prefer something different.

Earlier imx471 measurement example/results remain at:
  https://gist.github.com/johncronin3/15d9eacbf64f91ecc600fe583686325f

Thanks again for the review and for merging the helper,
John Cronin