Skip to contentSkip to conversation

media: ivsc: csi: Add sensor node in bound callback

PATCH In review Arpith Alexander 3 participants 3 messages Nov 3 – Nov 10

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: ivsc: csi: Add sensor node in bound callback

The IPU6 ISYS creates sub-device nodes in its bound and complete callbacks. A sensor behind the IVSC is bound by the IVSC's own notifier, after the ISYS's bound callback has already run for the IVSC, and mei_csi_notify_bound() doesn't create a node. Unless another device binds to the ISYS afterwards, the sensor's node is therefore only created by the ISYS's complete callback, which runs once every sensor in the graph is bound.

Commit 4fdb0342f05e ("media: ipu-bridge: Add Himax HM1092 IR sensor") added the HM1092 to the ipu-bridge list. The HM1092 has no driver in mainline yet, so it never binds and the complete callback never runs. The OV02C10 behind the IVSC therefore never gets a sub-device node.

On a Dell XPS 13 9340, libcamera then fails with:

'ov02c10 3-0036': Failed to open V4L2 device '': No such file or directory No valid pipeline for sensor 'ov02c10 3-0036', skipping

Register the sub-device nodes in mei_csi_notify_bound() as well, so that the sensor's node is created as soon as it binds. If the complete callback runs later, v4l2_device_register_subdev_nodes() skips sub-devices that already have a node.

Commit 7456b40bc992 ("media: i2c: cvs: Add sensor node in bound callback") is the CVS equivalent of this IVSC fix.

Fixes 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule")

---
Tested on a Dell XPS 13 9340 (Meteor Lake IPU6, OV02C10 behind the IVSC) with v7.4-rc1. ipu-bridge connects both sensors ("Connected 2 cameras"), the HM1092 has no driver and doesn't bind, and the OV02C10 now gets its sub-device node. libcamera finds the camera and streams at 30 fps (cam -c 1 -C10). The camera last worked on v7.2.

The test kernel also had my two other v7.4-rc1 fixes for this laptop:
https://lore.kernel.org/linux-spi/[email protected]/
https://lore.kernel.org/linux-media/[email protected]/

Unlike a revert of commit 4fdb0342f05e, this keeps the HM1092 entry for the pending driver, and it also covers kernels built without that driver once it is merged.

 drivers/media/pci/intel/ivsc/mei_csi.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/media/pci/intel/ivsc/mei_csi.c +10 -5
index 005b1414a252..f9513cffaacd 100644
@@ -29,6 +29,7 @@
 #include <media/ipu-bridge.h>
 #include <media/v4l2-async.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
 #include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 
@@ -513,7 +514,7 @@ static int mei_csi_notify_bound(struct v4l2_async_notifier *notifier,
 				struct v4l2_async_connection *asd)
 {
 	struct mei_csi *csi = notifier_to_csi(notifier);
-	int pad;
+	int pad, ret;
 
 	pad = media_entity_get_fwnode_pad(&subdev->entity, asd->match.fwnode,
 					  MEDIA_PAD_FL_SOURCE);
@@ -522,10 +523,14 @@ static int mei_csi_notify_bound(struct v4l2_async_notifier *notifier,
 
 	csi->remote = &subdev->entity.pads[pad];
 
-	return media_create_pad_link(&subdev->entity, pad,
-				     &csi->subdev.entity, CSI_PAD_SINK,
-				     MEDIA_LNK_FL_ENABLED |
-				     MEDIA_LNK_FL_IMMUTABLE);
+	ret = media_create_pad_link(&subdev->entity, pad,
+				    &csi->subdev.entity, CSI_PAD_SINK,
+				    MEDIA_LNK_FL_ENABLED |
+				    MEDIA_LNK_FL_IMMUTABLE);
+	if (ret)
+		return ret;
+
+	return v4l2_device_register_subdev_nodes(subdev->v4l2_dev);
 }
 
 static void mei_csi_notify_unbind(struct v4l2_async_notifier *notifier,

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

Signature · 1 line
2.55.0
Tested-by on v1 1/1
#1 lore raw

Hi Arpith,

Same regression on a Dell XPS 16 9640 (BIOS 1.4.1, OV02C10 behind the IVSC, HIMX1092:00 in ACPI). I reported it before finding your patch:
https://lore.kernel.org/r/[email protected]/

I tested the same change (identical apart from the declaration of ret) on CachyOS 7.2.8, with modules built from kernel.org v7.2.8 sources:
- 7.2.8 plus only the HM1092 entry from 4fdb0342f05e: no sub-device node for the OV02C10, libcamera skips the sensor.
- Same plus this change: the node is created, libcamera and PipeWire find the camera, and "cam -c1 --capture=10" streams at 30 fps.
- This change without the HM1092 entry, so .complete() runs after the node already exists: still one node for the sensor, streams fine.
No kernel warnings in any of these.

Sakari, if you pick this up, could you also add

I used an AI assistant (Claude) to analyse the problem; the tests above ran on my machine.

Thanks,
Sergey

Reviewed-by on v1 1/1
#2 lore raw
In reply to Arpith Alexander

(Resending, my first copy had a broken Cc list.)

Sorry about this, the HM1092 ipu-bridge entry went in ahead of the driver. The change matches the CVS fix and looks right to me.

Sergey's VCM point probably still holds: a VCM instantiated by ipu-bridge only gets its node from .complete(). Sakari, if you'd rather not rely on per-bridge fixes until the hm1092 driver lands, I'm fine with reverting 4fdb0342f05e.

Jake