libcamera: camera_sensor: Add Hynix Hi556 sensor properties and helper
diff mbox series

Message ID 20261018102700.32980-1-tobias.predel@gmail.com
State New
Headers show
Series
  • libcamera: camera_sensor: Add Hynix Hi556 sensor properties and helper
Related show

Commit Message

Tobias Predel Oct. 18, 2026, 10:27 a.m. UTC
Add camera sensor properties and a camera sensor helper for the Hynix
Hi556, a 5MP sensor used as the user-facing camera on IPU6 laptops such
as the HP Dragonfly 13.5 inch G4.

The unit cell size is 1.12um. The test pattern modes follow the order of
the menu exposed by the kernel driver, the same as for the Hi846.

The black level was measured on raw 10-bit frames as the intercept of a
linear fit of the mean pixel value against exposure time, at analogue
gain codes 0 and 64 (63.95 and 64.20 respectively), giving 64 at 10
bits.

The kernel driver exposes analogue gain codes 0 to 240 in steps of 1.
The gain is 1 + code / 16, giving 1x to 16x. This was verified on raw
frames of a static scene, with a gain code 0 reference frame captured
before and after each step to cancel out light changes: the measured
gain is within 1% of the model for codes 0 to 224, and 1.5% below it at
code 240.

Without the helper, the soft ISP falls back to the uncalibrated defaults
and cannot convert between gain codes and gain values.

Signed-off-by: Tobias Predel <tobias.predel@gmail.com>
Assisted-by: Claude:claude-opus-5-5
---

Notes:
    Tested on an HP Dragonfly 13.5 inch G4 (Hi556 on IPU6 ISYS, simple pipeline
    handler with the soft ISP); the runtime log confirms that the helper and the
    sensor properties are picked up.
    
    This patch was written with the help of an AI coding assistant (hence the
    Assisted-by trailer, following the Linux kernel's coding-assistants
    guidelines; checkstyle doesn't know that trailer key yet). I reviewed the
    code and ran the measurements on the hardware myself.

 src/ipa/libipa/camera_sensor_helper.cpp        | 13 +++++++++++++
 .../sensor/camera_sensor_properties.cpp        | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 359040ec7..87d72afa0 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -519,6 +519,19 @@  public:
 };
 REGISTER_CAMERA_SENSOR_HELPER("gc08a3", CameraSensorHelperGc08a3)
 
+class CameraSensorHelperHi556 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperHi556()
+	{
+		/* Measured: 64 at 10bits. */
+		blackLevel_ = 4096;
+		/* Analogue gain is 1 + code / 16, codes 0 to 240 (1x to 16x). */
+		gain_ = AnalogueGainLinear{ 1, 16, 0, 16 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("hi556", CameraSensorHelperHi556)
+
 class CameraSensorHelperHm1246 : public CameraSensorHelper
 {
 public:
diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
index 20cfd0bc1..203ffb382 100644
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -132,6 +132,24 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				.hblankDelay = 2
 			},
 		} },
+		{ "hi556", {
+			.unitCellSize = { 1120, 1120 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeSolidColor, 1 },
+				{ controls::draft::TestPatternModeColorBars, 2 },
+				{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
+				{ controls::draft::TestPatternModePn9, 4 },
+				/*
+				 * No corresponding test pattern mode for:
+				 * 5: "Gradient Horizontal"
+				 * 6: "Gradient Vertical"
+				 * 7: "Check Board"
+				 * 8: "Slant Pattern"
+				 */
+			},
+			.sensorDelays = { },
+		} },
 		{ "hi846", {
 			.unitCellSize = { 1120, 1120 },
 			.testPatternModes = {