Skip to contentSkip to conversation

media: Add Himax HM1092 mono NIR sensor driver

PATCH Superseded Ramshouriesh R 3 participants 5 messages Jul 1

Subsystems (2)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover media: Add Himax HM1092 mono NIR sensor driver

This adds a V4L2 subdev driver and DT binding for the Himax HM1092, a 1 megapixel monochrome near-infrared image sensor. On laptops it sits behind the IR camera used for face unlock. It speaks a single MIPI CSI-2 data lane and outputs 10-bit RAW at 560x360.

The driver exposes that one native mode, a test pattern control and the standard fwnode properties (orientation, rotation). It has been tested on real hardware (an ASUS Zenbook A14): the sensor probes, streams, and the on-chip test pattern comes through the full CSI-2 pipeline.

The sensor driver and its binding are SoC-neutral, so they are sent on their own through the media tree. The board-level device tree and PHY work that wires this camera up on the ASUS Zenbook A14 will be sent as its own series.

---
Ramshouriesh R (2):
media: dt-bindings: Add Himax HM1092 NIR sensor
media: i2c: hm1092: add Himax HM1092 mono NIR sensor driver

 .../bindings/media/i2c/himax,hm1092.yaml           | 107 +++
 MAINTAINERS                                        |   7 +
 drivers/media/i2c/Kconfig                          |  11 +
 drivers/media/i2c/Makefile                         |   1 +
 drivers/media/i2c/hm1092.c                         | 783 +++++++++++++++++++++
 5 files changed, 909 insertions(+)

---
base-commit: be5c93fa674f0fc3c8f359c2143abce6bbb422e6
change-id: 20260618-hm1092-driver-a6f2aaddf201

Best regards,

Signature · 1 line
Ramshouriesh R <[email protected]>
#1 lore raw

PATCH 1/2 media: dt-bindings: Add Himax HM1092 NIR sensor

Add a dt-binding schema for the Himax HM1092, a 1 megapixel monochrome near-infrared CMOS image sensor used as the face-authentication IR camera on laptops. The sensor streams 10-bit RAW over a single MIPI CSI-2 data lane.

---
 .../bindings/media/i2c/himax,hm1092.yaml           | 107 +++++++++++++++++++++
 1 file changed, 107 insertions(+)
Documentation/devicetree/bindings/media/i2c/himax,hm1092.yaml new file +107 -0
new file mode 100644
index 000000000000..d324569836af
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/himax,hm1092.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Himax HM1092 Monochrome NIR Sensor
+
+maintainers:
+  - Ramshouriesh R <[email protected]>
+
+description:
+  The Himax HM1092 is a 1 megapixel monochrome near-infrared CMOS image
+  sensor with a MIPI CSI-2 interface, commonly used as the IR camera for
+  face authentication on laptops. It outputs 10-bit RAW over a single
+  MIPI CSI-2 data lane.
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    const: himax,hm1092
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  avdd-supply:
+    description: Analogue circuit voltage supply.
+
+  dovdd-supply:
+    description: I/O circuit voltage supply.
+
+  dvdd-supply:
+    description: Digital circuit voltage supply.
+
+  reset-gpios:
+    maxItems: 1
+    description: Active low GPIO connected to the XSHUTDOWN pad.
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          data-lanes:
+            maxItems: 1
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - avdd-supply
+  - dovdd-supply
+  - dvdd-supply
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@24 {
+            compatible = "himax,hm1092";
+            reg = <0x24>;
+
+            reset-gpios = <&tlmm 109 GPIO_ACTIVE_LOW>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&cam_ir_default>;
+
+            clocks = <&camcc 1>;
+            assigned-clocks = <&camcc 1>;
+            assigned-clock-rates = <24000000>;
+
+            orientation = <0>;
+
+            avdd-supply = <&vreg_l7m_2p9>;
+            dvdd-supply = <&vreg_l7m_2p9>;
+            dovdd-supply = <&vreg_l4m_1p8>;
+
+            port {
+                hm1092_ep: endpoint {
+                    data-lanes = <1>;
+                    link-frequencies = /bits/ 64 <400000000>;
+                    remote-endpoint = <&camss_csiphy0_inep>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.53.0
#3 lore raw

PATCH 2/2 media: i2c: hm1092: add Himax HM1092 mono NIR sensor driver

In reply to Ramshouriesh R

Add a V4L2 subdev driver for the Himax HM1092, a 1 megapixel monochrome near-infrared image sensor with a single-lane MIPI CSI-2 interface, typically used as the face-authentication IR camera on laptops.

The driver supports the sensor's native 560x360 10-bit mono mode, a test pattern control and the standard fwnode properties (orientation, rotation).

---
 MAINTAINERS                |   7 +
 drivers/media/i2c/Kconfig  |  11 +
 drivers/media/i2c/Makefile |   1 +
 drivers/media/i2c/hm1092.c | 783 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 802 insertions(+)
MAINTAINERS +7 -0
index 5e11dd741d9f..4d9a4991ca2b 100644
@@ -11652,6 +11652,13 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/misc/hisi_hikey_usb.c
 
+HIMAX HM1092 SENSOR DRIVER
+M:	Ramshouriesh R <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/i2c/himax,hm1092.yaml
+F:	drivers/media/i2c/hm1092.c
+
 HIMAX HX83112B TOUCHSCREEN SUPPORT
 M:	Job Noorman <[email protected]>
 L:	[email protected]
drivers/media/i2c/Kconfig +11 -0
index 5d173e0ecf42..f94621edbe1a 100644
@@ -137,6 +137,17 @@ config VIDEO_HI847
           To compile this driver as a module, choose M here: the
           module will be called hi847.
 
+config VIDEO_HM1092
+	tristate "Himax HM1092 sensor support"
+	select V4L2_CCI_I2C
+	help
+	  This is a Video4Linux2 sensor driver for the Himax HM1092
+	  monochrome near-infrared CMOS image sensor, used as the
+	  face-authentication IR camera on laptops.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called hm1092.
+
 config VIDEO_IMX111
 	tristate "Sony IMX111 sensor support"
 	select V4L2_CCI_I2C
drivers/media/i2c/Makefile +1 -0
index e45359efe0e4..6507c173d0fa 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_VIDEO_GC2145) += gc2145.o
 obj-$(CONFIG_VIDEO_HI556) += hi556.o
 obj-$(CONFIG_VIDEO_HI846) += hi846.o
 obj-$(CONFIG_VIDEO_HI847) += hi847.o
+obj-$(CONFIG_VIDEO_HM1092) += hm1092.o
 obj-$(CONFIG_VIDEO_I2C) += video-i2c.o
 obj-$(CONFIG_VIDEO_IMX111) += imx111.o
 obj-$(CONFIG_VIDEO_IMX208) += imx208.o
drivers/media/i2c/hm1092.c new file +783 -0

783 lines not on this page · raw message

Signature · 1 line
2.53.0
#4 lore raw

Re: [PATCH 2/2] media: i2c: hm1092: add Himax HM1092 mono NIR sensor driver

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The driver incorrectly uses `pm_sleep_ptr()` instead of `pm_ptr()` for the `dev_pm_ops` structure…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The driver incorrectly uses pm_sleep_ptr() instead of pm_ptr() for the dev_pm_ops structure pointer, silently breaking Runtime PM when CONFIG_PM_SLEEP is disabled.
- [Medium] V4L2 control handler memory and lock resources are leaked on initialization error paths in hm1092_init_controls().
--

commit 355cde57de68093fd9275a1bf61c01ff0eed341f
Author: Ramshouriesh R <[email protected]>

media: i2c: hm1092: add Himax HM1092 mono NIR sensor driver

Add a V4L2 subdev driver for the Himax HM1092, a 1 megapixel monochrome near-infrared image sensor with a single-lane MIPI CSI-2 interface.

Quoted 4 lines
drivers/media/i2c/hm1092.c new file +0 -0
new file mode 100644

[ ... ]

Quoted 9 lines
drivers/media/i2c/hm1092.c new file +9 -0
+static int hm1092_init_controls(struct hm1092 *hm1092)
+{
+	struct v4l2_ctrl_handler *ctrl_hdlr = &hm1092->ctrl_handler;
+	const struct hm1092_mode *mode = &hm1092_mode_560x360;
+	struct v4l2_fwnode_device_properties props;
+	s64 hblank, pixel_rate;
+	int ret;
+
+	v4l2_ctrl_handler_init(ctrl_hdlr, 6);

[ ... ]

drivers/media/i2c/hm1092.c line 410

Quoted 8 lines
drivers/media/i2c/hm1092.c new file +8 -0
+	v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &hm1092_ctrl_ops,
+				     V4L2_CID_TEST_PATTERN,
+				     ARRAY_SIZE(hm1092_test_pattern_menu) - 1,
+				     0, 0, hm1092_test_pattern_menu);
+
+	ret = v4l2_fwnode_device_parse(hm1092->dev, &props);
+	if (ret)
+		return ret;

[Severity: Medium]
Could this leak the control handler memory and lock resources if v4l2_fwnode_device_parse() fails?

When hm1092_probe() calls hm1092_init_controls() and it fails here, probe jumps straight to err_power_off, bypassing v4l2_ctrl_handler_free().

drivers/media/i2c/hm1092.c line 415

Quoted 5 lines
drivers/media/i2c/hm1092.c new file +5 -0
+
+	v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &hm1092_ctrl_ops, &props);
+
+	if (ctrl_hdlr->error)
+		return ctrl_hdlr->error;

[Severity: Medium]
Similarly, if control creation fails, does returning ctrl_hdlr->error directly leave the allocated control handler resources orphaned?

[ ... ]

drivers/media/i2c/hm1092.c line 773

Quoted 4 lines
drivers/media/i2c/hm1092.c new file +4 -0
+static struct i2c_driver hm1092_i2c_driver = {
+	.driver = {
+		.name = "hm1092",
+		.pm = pm_sleep_ptr(&hm1092_pm_ops),

[Severity: High]
Will this silently drop the Runtime PM callbacks when the kernel is compiled with CONFIG_PM=y but CONFIG_PM_SLEEP=n?

According to the power management subsystem guidelines, pm_sleep_ptr() should be used for individual sleep callbacks, while pm_ptr() should be used for the dev_pm_ops structure pointer. If pm_sleep_ptr() evaluates to NULL here, the sensor hardware might not power on during hm1092_enable_streams().

Quoted 5 lines
drivers/media/i2c/hm1092.c new file +5 -0
+		.of_match_table = hm1092_of_match,
+	},
+	.probe = hm1092_probe,
+	.remove = hm1092_remove,
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] media: dt-bindings: Add Himax HM1092 NIR sensor

In reply to Ramshouriesh R
Quoted 6 lines · Ramshouriesh R

Add a dt-binding schema for the Himax HM1092, a 1 megapixel monochrome near-infrared CMOS image sensor used as the face-authentication IR camera on laptops. The sensor streams 10-bit RAW over a single MIPI CSI-2 data lane.

pw-bot: not-applicable