Skip to contentSkip to conversation

media: Add Himax HM1092 mono NIR sensor driver

PATCH Superseded Ramshouriesh R 3 participants 8 messages Jul 2

Subsystems (2)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v2 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.

---
Changes in v2:
- hm1092: use pm_ptr() instead of pm_sleep_ptr() for the dev_pm_ops pointer. The ops come from DEFINE_RUNTIME_DEV_PM_OPS(), so gating them
on CONFIG_PM_SLEEP dropped runtime PM on a CONFIG_PM=y, PM_SLEEP=n
build.
- hm1092: free the control handler on the error paths in hm1092_init_controls(); the fwnode-parse and ctrl_hdlr->error returns leaked the handler.
- Link to v1: https://patch.msgid.link/[email protected]

To: Ramshouriesh R <[email protected]>
To: Mauro Carvalho Chehab <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
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                         | 790 +++++++++++++++++++++
 5 files changed, 916 insertions(+)

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

Best regards,

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

PATCH v2 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
#2 lore raw

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

Quoted 10 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.

---
 .../bindings/media/i2c/himax,hm1092.yaml           | 107 +++++++++++++++++++++
 1 file changed, 107 insertions(+)

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state in the patch changelog or cover letter why and what changed.
</form letter>

Best regards,
Krzysztof

#3 lore raw

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

Quoted 13 lines

This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Quoted 9 lines

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state in the patch changelog or cover letter why and what changed.

Best regards,
Krzysztof

I'm adding it in v3 along with changes suggested by sasiko bot. I didn't check my mail or lore earlier before sending v2

#4 lore raw

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

Quoted 19 lines · Ramshouriesh R
Quoted 19 lines

This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state in the patch changelog or cover letter why and what changed.

Quoted 6 lines
Quoted 3 lines

Best regards,
Krzysztof

I'm adding it in v3 along with changes suggested by sasiko bot. I didn't check my mail or lore earlier before sending v2

Then why should we check our mailboxes for emails? If you ignore our emails and then ask us to do the same work TWICE (!) then probably we should ignore your emails as well. Seems logical, no?

Best regards,
Krzysztof

#5 lore raw

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

I sincerely apologise for my ignorance.
This will not happen again

Best Regards,
Ramshouriesh

#6 lore raw

PATCH v2 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 | 790 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 809 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 +790 -0

790 lines not on this page · raw message

Signature · 1 line
2.53.0
#7 lore raw

Re: [PATCH v2 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: - [Medium] The driver incorrectly returns `-EPROBE_DEFER` when the static fwnode graph endpoint is missing.…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The driver incorrectly returns -EPROBE_DEFER when the static fwnode graph endpoint is missing.
- [Medium] The driver fails to initialize and clamp V4L2 colorimetry fields in hm1092_update_pad_format(). --

commit e540c6418febd9d4f99cda20bb83d2a99d4aaeeb
Author: Ramshouriesh R <[email protected]>
Subject: 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, typically used as the face-authentication IR camera on laptops.

Quoted 5 lines
drivers/media/i2c/hm1092.c new file +0 -0
new file mode 100644
index 0000000000000..d0e417c9e35df

[ ... ]

drivers/media/i2c/hm1092.c line 435

Quoted 7 lines
drivers/media/i2c/hm1092.c new file +7 -0
+static void hm1092_update_pad_format(struct v4l2_mbus_framefmt *fmt)
+{
+	fmt->width = hm1092_mode_560x360.width;
+	fmt->height = hm1092_mode_560x360.height;
+	fmt->code = MEDIA_BUS_FMT_Y10_1X10;
+	fmt->field = V4L2_FIELD_NONE;
+}

[Severity: Medium]
Does this code need to initialize and clamp the V4L2 colorimetry fields (colorspace, ycbcr_enc, quantization, and xfer_func)?

If these fields are not overwritten here, they seem to retain arbitrary user-supplied values when called from VIDIOC_SUBDEV_S_FMT, instead of enforcing the correct colorimetry for a monochrome raw sensor (e.g., V4L2_COLORSPACE_RAW).

[ ... ]

drivers/media/i2c/hm1092.c line 489

Quoted 6 lines
drivers/media/i2c/hm1092.c new file +6 -0
+static int hm1092_set_format(struct v4l2_subdev *sd,
+			     struct v4l2_subdev_state *state,
+			     struct v4l2_subdev_format *fmt)
+{
+	hm1092_update_pad_format(&fmt->format);
+	*v4l2_subdev_state_get_format(state, fmt->pad) = fmt->format;

[Severity: Medium]
Because the colorimetry fields aren't validated or sanitized in hm1092_update_pad_format(), can this allow arbitrary or invalid values from user-space to be copied verbatim into the active V4L2 state here?

This might potentially break V4L2 specification compliance and format negotiation.

Quoted 3 lines
drivers/media/i2c/hm1092.c new file +3 -0
+
+	return 0;
+}

[ ... ]

Quoted 4 lines
drivers/media/i2c/hm1092.c new file +4 -0
+static int hm1092_check_hwcfg(struct hm1092 *hm1092)
+{
+	struct v4l2_fwnode_endpoint bus_cfg = {
+		.bus_type = V4L2_MBUS_CSI2_DPHY,

drivers/media/i2c/hm1092.c line 571

Quoted 10 lines
drivers/media/i2c/hm1092.c new file +10 -0
+	};
+	struct device *dev = hm1092->dev;
+	struct fwnode_handle *ep, *fwnode = dev_fwnode(dev);
+	unsigned long link_freq_bitmap;
+	int ret;
+
+	ep = fwnode_graph_get_endpoint_by_id(fwnode, 0, 0, 0);
+	if (!ep)
+		return dev_err_probe(dev, -EPROBE_DEFER,
+				     "waiting for fwnode graph endpoint\n");

[Severity: Medium]
Should this return a permanent error like -EINVAL or -ENODEV instead of -EPROBE_DEFER?

The device's fwnode graph endpoint is a static hardware property provided by the firmware (Device Tree or ACPI). If fwnode_graph_get_endpoint_by_id() returns NULL, it indicates a permanent misconfiguration rather than a temporary state where a dependent resource is missing.

Returning -EPROBE_DEFER here could cause the driver core to continually retry probing in the deferred probe workqueue indefinitely, wasting resources rather than cleanly failing.

Quoted 3 lines
drivers/media/i2c/hm1092.c new file +3 -0
+
+	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
+	fwnode_handle_put(ep);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2