[v3,1/2] libcamera: sensor: camera_sensor_properties: Add Samsung S5K5E8
diff mbox series

Message ID 20261201112304.3425319-2-huynhtuankiet33@gmail.com
State New
Headers show
Series
  • libcamera: Add Samsung S5K5E8 sensor properties and helper
Related show

Commit Message

Tuan Kiet Huynh Dec. 1, 2026, 11:23 a.m. UTC
Add static sensor properties for the Samsung S5K5E8 5MP CMOS image
sensor (1.12 um pixel pitch, test pattern modes 0..4 including PN9,
and hardware-verified control delays on Xiaomi Redmi Note 4X where
analogue gain takes effect 1 frame earlier than exposure and
vertical blanking).

The kernel driver for this sensor was submitted separately to
linux-media:
Link: https://lore.kernel.org/all/20261201110235.3327189-1-huynhtuankiet33@gmail.com/

Reflow only: the vblankDelay comment is re-wrapped to stay within
80 columns; no content change.

Signed-off-by: Tuan Kiet Huynh <huynhtuankiet33@gmail.com>
---
 .../sensor/camera_sensor_properties.cpp       | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

Comments

Kieran Bingham Dec. 1, 2026, 11:34 a.m. UTC | #1
Hi

Quoting Tuan Kiet Huynh (2026-12-01 11:23:02)
> Add static sensor properties for the Samsung S5K5E8 5MP CMOS image
> sensor (1.12 um pixel pitch, test pattern modes 0..4 including PN9,
> and hardware-verified control delays on Xiaomi Redmi Note 4X where
> analogue gain takes effect 1 frame earlier than exposure and
> vertical blanking).

How are these delays confirmed? How did you measure them ?

> 
> The kernel driver for this sensor was submitted separately to
> linux-media:
> Link: https://lore.kernel.org/all/20261201110235.3327189-1-huynhtuankiet33@gmail.com/
> 
> Reflow only: the vblankDelay comment is re-wrapped to stay within
> 80 columns; no content change.
> 
> Signed-off-by: Tuan Kiet Huynh <huynhtuankiet33@gmail.com>
> ---
>  .../sensor/camera_sensor_properties.cpp       | 36 +++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
> index fbe82d47..16f17b09 100644
> --- a/src/libcamera/sensor/camera_sensor_properties.cpp
> +++ b/src/libcamera/sensor/camera_sensor_properties.cpp
> @@ -611,6 +611,42 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
>                         },
>                         .sensorDelays = { },
>                 } },
> +               { "s5k5e8", {
> +                       .unitCellSize = { 1120, 1120 },
> +                       .testPatternModes = {
> +                               { controls::draft::TestPatternModeOff, 0 },
> +                               { controls::draft::TestPatternModeSolidColor, 1 },
> +                               { controls::draft::TestPatternModeColorBars, 2 },
> +                               { controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
> +                               { controls::draft::TestPatternModePn9, 4 },
> +                       },
> +                       /*
> +                        * Frame delays, counted from the S_CTRL that applies
> +                        * them. The S_CTRL is issued during frame N+1, after
> +                        * DQBUF(N). Measured on the Redmi Note 4X (3 trials
> +                        * each): the first frame showing the change is N+3
> +                        * for exposure (900 -> 1964 lines) and for vblank
> +                        * (24 -> 1968, frame period 33.5 -> 66.5 ms), and
> +                        * N+2 for gain (32 -> 128), so the delays are 2, 1
> +                        * and 2. hblankDelay is unmeasured and carried over
> +                        * as 2 from v2. The driver does expose HBLANK, but
> +                        * read-only (264 lines full mode, 1480 binned), and
> +                        * the RPi pipeline registers it in DelayedControls,
> +                        * so the delay is consumed there; it has no visible
> +                        * effect on mido's simple pipeline. vblankDelay must
> +                        * not be less than exposureDelay: DelayedControls
> +                        * writes a shorter-delay control a frame later, so
> +                        * the new exposure would be written while the old
> +                        * vblank still bounds it, and the V4L2 control core
> +                        * would clamp it to the old maximum.
> +                        */


Please re-read all of the above and replace it all with something more
human consumable.

Don't write anyhting that isn't directly relevant.

Don't write something product (Redmi) specific in sensor specific code.
Don't write something platfrom (RPi) specific in sensor specific code.

Don't add anything that isn't actually useful.


> +                       .sensorDelays = {
> +                               .exposureDelay = 2,
> +                               .gainDelay = 1,
> +                               .vblankDelay = 2,
> +                               .hblankDelay = 2
> +                       },
> +               } },
>                 { "vd55g1", {
>                         .unitCellSize = { 2160, 2160 },
>                         .testPatternModes = {
> -- 
> 2.43.0
>

Patch
diff mbox series

diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
index fbe82d47..16f17b09 100644
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -611,6 +611,42 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 			},
 			.sensorDelays = { },
 		} },
+		{ "s5k5e8", {
+			.unitCellSize = { 1120, 1120 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeSolidColor, 1 },
+				{ controls::draft::TestPatternModeColorBars, 2 },
+				{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
+				{ controls::draft::TestPatternModePn9, 4 },
+			},
+			/*
+			 * Frame delays, counted from the S_CTRL that applies
+			 * them. The S_CTRL is issued during frame N+1, after
+			 * DQBUF(N). Measured on the Redmi Note 4X (3 trials
+			 * each): the first frame showing the change is N+3
+			 * for exposure (900 -> 1964 lines) and for vblank
+			 * (24 -> 1968, frame period 33.5 -> 66.5 ms), and
+			 * N+2 for gain (32 -> 128), so the delays are 2, 1
+			 * and 2. hblankDelay is unmeasured and carried over
+			 * as 2 from v2. The driver does expose HBLANK, but
+			 * read-only (264 lines full mode, 1480 binned), and
+			 * the RPi pipeline registers it in DelayedControls,
+			 * so the delay is consumed there; it has no visible
+			 * effect on mido's simple pipeline. vblankDelay must
+			 * not be less than exposureDelay: DelayedControls
+			 * writes a shorter-delay control a frame later, so
+			 * the new exposure would be written while the old
+			 * vblank still bounds it, and the V4L2 control core
+			 * would clamp it to the old maximum.
+			 */
+			.sensorDelays = {
+				.exposureDelay = 2,
+				.gainDelay = 1,
+				.vblankDelay = 2,
+				.hblankDelay = 2
+			},
+		} },
 		{ "vd55g1", {
 			.unitCellSize = { 2160, 2160 },
 			.testPatternModes = {