libcamera: libipa: camera_sensor: Add Sony IMX214 sensor properties
diff mbox series

Message ID 20240905-imx214-v1-1-740caf6fb0a9@apitzsch.eu
State New
Headers show
Series
  • libcamera: libipa: camera_sensor: Add Sony IMX214 sensor properties
Related show

Commit Message

André Apitzsch Sept. 5, 2024, 8:47 p.m. UTC
Provide the Sony IMX214 camera sensor properties and registration with
libipa for the gain code helpers.

Signed-off-by: André Apitzsch <git@apitzsch.eu>
---
 src/ipa/libipa/camera_sensor_helper.cpp           | 13 +++++++++++++
 src/libcamera/sensor/camera_sensor_properties.cpp | 10 ++++++++++
 2 files changed, 23 insertions(+)


---
base-commit: f75b8dd26feaca86701704390dea18c71e2f0350
change-id: 20240905-imx214-796939bd453c

Best regards,

Comments

Kieran Bingham Sept. 6, 2024, 10:52 a.m. UTC | #1
Hi André,

Quoting André Apitzsch (2024-09-05 21:47:46)
> Provide the Sony IMX214 camera sensor properties and registration with
> libipa for the gain code helpers.

Thanks for your continued work on upstream on this! I see an interesting
series on the kernel for this too which looks great from a first glance.

> 
> Signed-off-by: André Apitzsch <git@apitzsch.eu>
> ---
>  src/ipa/libipa/camera_sensor_helper.cpp           | 13 +++++++++++++
>  src/libcamera/sensor/camera_sensor_properties.cpp | 10 ++++++++++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> index ffc7c1d7..f3289b1c 100644
> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> @@ -519,6 +519,19 @@ private:
>  };
>  REGISTER_CAMERA_SENSOR_HELPER("ar0521", CameraSensorHelperAr0521)
>  
> +class CameraSensorHelperImx214 : public CameraSensorHelper
> +{
> +public:
> +       CameraSensorHelperImx214()
> +       {
> +               /* From datasheet: 64 at 10bits. */
> +               blackLevel_ = 4096;

I can't quite determine from the datasheet if this is 0x40 at 10 bit or
0x40 at 8 bit. But I believe this is reasonable until we determine
otherwise.


> +               gainType_ = AnalogueGainLinear;

The datasheet states:

	Analog Gain 18dB (24dB)*
	Digital Gain 24dB

* When AD input is doubled for vertical analog addition-average mode, analog gain can be set up to 24dB.

I'm curious if that will need any special handling ... but I don't think
we need to worry about that yet. I presume it will be exposed by the
kernel adjusting the min/max values for the control.


> +               gainConstants_.linear = { 0, 512, -1, 512 };

And this matches the reference manual.


> +       }
> +};
> +REGISTER_CAMERA_SENSOR_HELPER("imx214", CameraSensorHelperImx214)
> +
>  class CameraSensorHelperImx219 : public CameraSensorHelper
>  {
>  public:
> diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
> index 4e5217ab..6d4136d0 100644
> --- a/src/libcamera/sensor/camera_sensor_properties.cpp
> +++ b/src/libcamera/sensor/camera_sensor_properties.cpp
> @@ -88,6 +88,16 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
>                                  */
>                         },
>                 } },
> +               { "imx214", {
> +                       .unitCellSize = { 1120, 1120 },

Ack

> +                       .testPatternModes = {
> +                               { controls::draft::TestPatternModeOff, 0 },
> +                               { controls::draft::TestPatternModeColorBars, 1 },
> +                               { controls::draft::TestPatternModeSolidColor, 2 },
> +                               { controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
> +                               { controls::draft::TestPatternModePn9, 4 },

This (unsurpisingly) appears to match your additions to the driver ;-)

Thank you!

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> +                       },
> +               } },
>                 { "imx219", {
>                         .unitCellSize = { 1120, 1120 },
>                         .testPatternModes = {
> 
> ---
> base-commit: f75b8dd26feaca86701704390dea18c71e2f0350
> change-id: 20240905-imx214-796939bd453c
> 
> Best regards,
> -- 
> André Apitzsch <git@apitzsch.eu>
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index ffc7c1d7..f3289b1c 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -519,6 +519,19 @@  private:
 };
 REGISTER_CAMERA_SENSOR_HELPER("ar0521", CameraSensorHelperAr0521)
 
+class CameraSensorHelperImx214 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperImx214()
+	{
+		/* From datasheet: 64 at 10bits. */
+		blackLevel_ = 4096;
+		gainType_ = AnalogueGainLinear;
+		gainConstants_.linear = { 0, 512, -1, 512 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("imx214", CameraSensorHelperImx214)
+
 class CameraSensorHelperImx219 : public CameraSensorHelper
 {
 public:
diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
index 4e5217ab..6d4136d0 100644
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -88,6 +88,16 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				 */
 			},
 		} },
+		{ "imx214", {
+			.unitCellSize = { 1120, 1120 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeColorBars, 1 },
+				{ controls::draft::TestPatternModeSolidColor, 2 },
+				{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
+				{ controls::draft::TestPatternModePn9, 4 },
+			},
+		} },
 		{ "imx219", {
 			.unitCellSize = { 1120, 1120 },
 			.testPatternModes = {